From 90accaef67b4182b4df83b37749ec71b3e56e77e Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 20 May 2022 14:48:10 +0100 Subject: [PATCH] Add usage from trailing events in command buffers on D3D12. Closes #2589 --- renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp index d5c1bc8bc..95732193f 100644 --- a/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp +++ b/renderdoc/driver/d3d12/d3d12_command_queue_wrap.cpp @@ -582,6 +582,7 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se // only primary command lists can be submitted m_Cmd.m_Partial[D3D12CommandData::Primary].cmdListExecs[cmd].push_back(m_Cmd.m_RootEventID); + // pull in any remaining events on the command buffer that weren't added to an action for(size_t e = 0; e < cmdListInfo.curEvents.size(); e++) { APIEvent apievent = cmdListInfo.curEvents[e]; @@ -595,6 +596,13 @@ bool WrappedID3D12CommandQueue::Serialise_ExecuteCommandLists(SerialiserType &se m_Cmd.m_RootEventID += cmdListInfo.eventCount; m_Cmd.m_RootActionID += cmdListInfo.actionCount; + for(auto it = cmdListInfo.resourceUsage.begin(); it != cmdListInfo.resourceUsage.end(); ++it) + { + EventUsage u = it->second; + u.eventId += m_Cmd.m_RootEventID - cmdListInfo.curEvents.count(); + m_Cmd.m_ResourceUses[it->first].push_back(u); + } + { action.customName = StringFormat::Fmt("=> %s[%u]: Close(%s)", basename.c_str(), c, ToStr(cmd).c_str());