From 434fe47b68fec9af487d4a34684c8418fd61b7f7 Mon Sep 17 00:00:00 2001 From: baldurk Date: Thu, 17 Nov 2016 11:17:00 +0100 Subject: [PATCH] Tweak D3D12 pass events to ensure render targets are the same --- renderdoc/driver/d3d12/d3d12_replay.cpp | 26 +++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/renderdoc/driver/d3d12/d3d12_replay.cpp b/renderdoc/driver/d3d12/d3d12_replay.cpp index ca40fde95..133efe431 100644 --- a/renderdoc/driver/d3d12/d3d12_replay.cpp +++ b/renderdoc/driver/d3d12/d3d12_replay.cpp @@ -1242,37 +1242,39 @@ vector D3D12Replay::GetPassEvents(uint32_t eventID) if(!draw) return passEvents; - // for vulkan a pass == a renderpass, if we're not inside a - // renderpass then there are no pass events. + // for D3D12 a pass == everything writing to the same RTs in a command list. const FetchDrawcall *start = draw; while(start) { - // if we've come to the beginning of a pass, break out of the loop, we've + // if we've come to the beginning of a list, break out of the loop, we've // found the start. - // Note that vkCmdNextSubPass has both Begin and End flags set, so it will - // break out here before we hit the terminating case looking for eDraw_EndPass if(start->flags & eDraw_BeginPass) break; - // if we come to the END of a pass, since we were iterating backwards that - // means we started outside of a pass, so return empty set. - // Note that vkCmdNextSubPass has both Begin and End flags set, so it will - // break out above before we hit this terminating case + // if we come to the END of a list, since we were iterating backwards that + // means we started outside of a list, so return empty set. if(start->flags & eDraw_EndPass) return passEvents; - // if we've come to the start of the log we were outside of a render pass + // if we've come to the start of the log we were outside of a list // to start with if(start->previous == 0) return passEvents; // step back - start = m_pDevice->GetDrawcall((uint32_t)start->previous); + const FetchDrawcall *prev = m_pDevice->GetDrawcall((uint32_t)start->previous); // something went wrong, start->previous was non-zero but we didn't // get a draw. Abort - if(!start) + if(!prev) return passEvents; + + // if the outputs changed, we're done + if(memcmp(start->outputs, prev->outputs, sizeof(start->outputs)) || + start->depthOut != prev->depthOut) + break; + + start = prev; } // store all the draw eventIDs up to the one specified at the start