Add EID shift to loose events & uaage after IndirectDraw*Count

Apply to loose events i.e. Barriers and resource usage in the current command buffer info
Fixes incorrect event ID in UI and resource usage for non-Action events at the end of a command buffer which contained IndirectDraw*Count calls
This commit is contained in:
Jake Turner
2026-04-16 16:10:00 +01:00
parent e4a3fdce0f
commit a606bcda53
@@ -632,6 +632,7 @@ void WrappedVulkan::InsertActionsAndRefreshIDs(BakedCmdBufferInfo &cmdBufInfo)
localAnnotations = m_RootAnnotation->Duplicate();
size_t curAnnot = 0;
int32_t totalEIDShift = 0;
rdcarray<VulkanActionTreeNode> &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;
}