diff --git a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp index be43f3b9c..2949d85cc 100644 --- a/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp +++ b/renderdoc/driver/vulkan/wrappers/vk_queue_funcs.cpp @@ -632,6 +632,7 @@ void WrappedVulkan::InsertActionsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) localAnnotations = m_RootAnnotation->Duplicate(); size_t curAnnot = 0; + int32_t totalEIDShift = 0; rdcarray &cmdBufNodes = cmdBufInfo.action->children; @@ -711,6 +712,7 @@ void WrappedVulkan::InsertActionsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) // this can be negative if indirectCount is 0 int32_t eidShift = indirectCount - 1; + totalEIDShift += eidShift; // we reserved one event and action for the indirect count based action. // if we ended up with a different number eidShift will be non-zero, so we need to adjust @@ -942,6 +944,15 @@ void WrappedVulkan::InsertActionsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo) GetActionStack().pop_back(); } + if(totalEIDShift != 0) + { + // Move the loose events and resource usage by the total EID shift + for(auto it = cmdBufInfo.curEvents.begin(); it != cmdBufInfo.curEvents.end(); ++it) + it->eventId += totalEIDShift; + for(auto it = cmdBufInfo.resourceUsage.begin(); it != cmdBufInfo.resourceUsage.end(); ++it) + it->second.eventId += totalEIDShift; + } + delete localAnnotations; }