diff --git a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp index c5ddca440..c6a9bc0e8 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_cmd_funcs.cpp @@ -517,9 +517,10 @@ VkResult WrappedVulkan::vkAllocateCommandBuffers(VkDevice device, } // a bit of a hack, we make a parallel resource record with the same lifetime as the command - // buffer and make it a parent, so it will hold onto our allocation chunk and not try to - // record it (and throw it away with baked commands that are unused), then it'll be pulled - // into the capture. + // buffer, so it will hold onto our allocation chunk & pool parent. + // It will be pulled into the capture explicitly, since the command buffer record itself is + // used directly for recording in-progress commands, and we can't pull that in since it + // might be partially recorded at the time of a submit of a previously baked list. VkResourceRecord *allocRecord = GetResourceManager()->AddResourceRecord(ResourceIDGen::GetNewUniqueID()); allocRecord->SpecialResource = true; @@ -529,7 +530,7 @@ VkResult WrappedVulkan::vkAllocateCommandBuffers(VkDevice device, record->bakedCommands = NULL; record->pool = GetRecord(pAllocateInfo->commandPool); - record->AddParent(record->pool); + allocRecord->AddParent(record->pool); { record->pool->LockChunks(); diff --git a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp index bdbeba4c8..9841bfc1b 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp @@ -652,8 +652,9 @@ VkResult WrappedVulkan::vkQueueSubmit(VkQueue queue, uint32_t submitCount, record->bakedCommands->AddResourceReferences(GetResourceManager()); record->bakedCommands->AddReferencedIDs(refdIDs); - // ref the parent command buffer by itself, this will pull in the cmd buffer pool - GetResourceManager()->MarkResourceFrameReferenced(record->GetResourceID(), eFrameRef_Read); + // ref the parent command buffer's alloc record, this will pull in the cmd buffer pool + GetResourceManager()->MarkResourceFrameReferenced( + record->cmdInfo->allocRecord->GetResourceID(), eFrameRef_Read); for(size_t sub = 0; sub < record->bakedCommands->cmdInfo->subcmds.size(); sub++) { @@ -661,7 +662,8 @@ VkResult WrappedVulkan::vkQueueSubmit(VkQueue queue, uint32_t submitCount, GetResourceManager()); record->bakedCommands->cmdInfo->subcmds[sub]->bakedCommands->AddReferencedIDs(refdIDs); GetResourceManager()->MarkResourceFrameReferenced( - record->bakedCommands->cmdInfo->subcmds[sub]->GetResourceID(), eFrameRef_Read); + record->bakedCommands->cmdInfo->subcmds[sub]->cmdInfo->allocRecord->GetResourceID(), + eFrameRef_Read); record->bakedCommands->cmdInfo->subcmds[sub]->bakedCommands->AddRef(); }