Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion include/vsg/vk/Device.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ namespace vsg
class WindowTraits;
class MemoryBufferPools;
class DescriptorPools;
class TransferTask;

struct QueueSetting
{
Expand Down Expand Up @@ -87,10 +88,11 @@ namespace vsg
/// return the amount of memory available in deviceMemoryBufferPools and allocatable on device
VkDeviceSize availableMemory(bool includeMemoryPools = true) const;

// provide observer_ptr to memory buffer and descriptor pools so that these can be accessed when required
// provide observer_ptr to memory buffer, descriptor pools and transferTask so that these can be accessed when required
observer_ptr<MemoryBufferPools> deviceMemoryBufferPools;
observer_ptr<MemoryBufferPools> stagingMemoryBufferPools;
observer_ptr<DescriptorPools> descriptorPools;
observer_ptr<TransferTask> transferTask;

protected:
virtual ~Device();
Expand Down
2 changes: 2 additions & 0 deletions src/vsg/app/RecordAndSubmitTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ RecordAndSubmitTask::RecordAndSubmitTask(Device* in_device, uint32_t numBuffers)

earlyTransferConsumerCompletedSemaphore = Semaphore::create(in_device);
lateTransferConsumerCompletedSemaphore = Semaphore::create(in_device);

if (!device->transferTask) device->transferTask = transferTask;
}

void RecordAndSubmitTask::advance()
Expand Down
17 changes: 12 additions & 5 deletions src/vsg/state/BufferInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,19 @@ void BufferInfo::copyDataToBuffer(uint32_t deviceID)
{
if ((dm->getMemoryPropertyFlags() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) == 0)
{
warn("BufferInfo::copyDataToBuffer() cannot copy data. DeviceMemory does not support direct memory mapping.");
if (auto transferTask = dm->getDevice()->transferTask.ref_ptr())
{
transferTask->assign(BufferInfoList{ref_ptr<BufferInfo>(this)});
}
else
{
warn("BufferInfo::copyDataToBuffer() cannot copy data. DeviceMemory does not support direct memory mapping.");

// you can use dynamic data updates provided by vsg::TransferTask or alternatively, you can implement the following steps:
// 1. allocate staging buffer
// 2. copy to staging buffer
// 3. transfer from staging buffer to device local buffer - use CopyAndReleaseBuffer
// you can use dynamic data updates provided by vsg::TransferTask or alternatively, you can implement the following steps:
// 1. allocate staging buffer
// 2. copy to staging buffer
// 3. transfer from staging buffer to device local buffer - use CopyAndReleaseBuffer
}
return;
}

Expand Down
Loading