Fixes for loose events on secondary command buffers

- Don't modify the command buffer loose events because the the command buffer might be executed multiple times
This commit is contained in:
Jake Turner
2026-04-21 10:24:49 +01:00
parent 93fc846cb2
commit 7da9fd2c11
@@ -5547,6 +5547,15 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(SerialiserType &ser, VkComman
parentCmdBufInfo.resourceUsage.back().second.eventId += parentCmdBufInfo.curEventID;
}
// pull in any remaining events on the command buffer that weren't added to an action
for(const APIEvent &event : cmdBufInfo.curEvents)
{
APIEvent apievent(event);
apievent.eventId += parentCmdBufInfo.curEventID;
parentCmdBufInfo.curEvents.push_back(apievent);
}
// Record execution of the secondary command buffer in the parent's CommandBufferNode
// Only primary command buffers can be submitted
CommandBufferExecuteInfo execInfo;
@@ -5560,18 +5569,6 @@ bool WrappedVulkan::Serialise_vkCmdExecuteCommands(SerialiserType &ser, VkComman
parentCmdBufInfo.curEventID += cmdBufInfo.eventCount;
parentCmdBufInfo.actionCount += cmdBufInfo.actionCount;
// pull in any remaining events on the command buffer that weren't added to an action
uint32_t i = 0;
for(APIEvent &apievent : cmdBufInfo.curEvents)
{
apievent.eventId = parentCmdBufInfo.curEventID - cmdBufInfo.curEvents.count() + i;
parentCmdBufInfo.curEvents.push_back(apievent);
i++;
}
cmdBufInfo.curEvents.clear();
marker.customName = StringFormat::Fmt(
"=> vkCmdExecuteCommands()[%u]: vkEndCommandBuffer(%s)", c, ToStr(cmd).c_str());
marker.flags =