mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-28 01:16:31 +00:00
Store command buffer page set in baked commands. Closes #2039
* If we keep the page set in the command buffer and destroy it on reset, we'll free the pages behind the baked chunks that we stored. If a capture records and resets a command buffer multiple times within a capture we need to store multiple baked command buffers. * So instead we give the baked commands ownership of those pages and reset them when the baked commands record is destroyed (either because the command buffer has been reset as it was before - or if we hold onto a reference during capture then after the capture is done).
This commit is contained in:
@@ -1011,6 +1011,12 @@ struct ImageState;
|
||||
|
||||
struct CmdBufferRecordingInfo
|
||||
{
|
||||
~CmdBufferRecordingInfo()
|
||||
{
|
||||
if(alloc)
|
||||
alloc->ResetPageSet(pageSet);
|
||||
}
|
||||
|
||||
VkDevice device;
|
||||
VkCommandBufferAllocateInfo allocInfo;
|
||||
|
||||
|
||||
@@ -1020,8 +1020,6 @@ VkResult WrappedVulkan::vkBeginCommandBuffer(VkCommandBuffer commandBuffer,
|
||||
if(record->bakedCommands)
|
||||
record->bakedCommands->Delete(GetResourceManager());
|
||||
|
||||
record->cmdInfo->alloc->ResetPageSet(record->cmdInfo->pageSet);
|
||||
|
||||
record->bakedCommands = GetResourceManager()->AddResourceRecord(ResourceIDGen::GetNewUniqueID());
|
||||
record->bakedCommands->DisableChunkLocking();
|
||||
record->bakedCommands->InternalResource = true;
|
||||
@@ -1242,7 +1240,7 @@ VkResult WrappedVulkan::vkEndCommandBuffer(VkCommandBuffer commandBuffer)
|
||||
|
||||
// if we can't reset command buffers there's no need to claim a set of pages
|
||||
if(record->pool->cmdPoolInfo->allowCmdBufReset)
|
||||
record->cmdInfo->pageSet = record->cmdInfo->alloc->GetPageSet();
|
||||
record->bakedCommands->cmdInfo->pageSet = record->cmdInfo->alloc->GetPageSet();
|
||||
|
||||
record->Bake();
|
||||
}
|
||||
@@ -1272,8 +1270,6 @@ VkResult WrappedVulkan::vkResetCommandBuffer(VkCommandBuffer commandBuffer,
|
||||
if(record->bakedCommands)
|
||||
record->bakedCommands->Delete(GetResourceManager());
|
||||
|
||||
record->cmdInfo->alloc->ResetPageSet(record->cmdInfo->pageSet);
|
||||
|
||||
record->bakedCommands = NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user