From c331152916fdb4f6bd195111638838c1f45d631a Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Thu, 19 Dec 2024 13:08:12 +0000 Subject: [PATCH] Extend scope lifetime to match how SSA IDs variables get extended If the scope is in a loop block, use the next uniform block instead --- renderdoc/driver/shaders/dxil/dxil_debug.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index 2844679faf..dd5df37217 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -7829,6 +7829,8 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain for(auto funcInfosIt = m_FunctionInfos.begin(); funcInfosIt != m_FunctionInfos.end(); ++funcInfosIt) { FunctionInfo &info = funcInfosIt->second; + const ControlFlow &controlFlow = info.controlFlow; + const rdcarray loopBlocks = controlFlow.GetLoopBlocks(); for(ScopedDebugData *scope : m_DebugInfo.scopedDebugDatas) { for(LocalMapping &localMapping : scope->localMappings) @@ -7841,7 +7843,13 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain scopeEndInst = RDCMIN(scopeEndInst, (uint32_t)info.instructionToBlock.size() - 1); const uint32_t scopeEndBlock = info.instructionToBlock[scopeEndInst]; ExecutionPoint scopeEnd(scopeEndBlock, scopeEndInst); - if(scopeEnd.IsAfter(current, info.controlFlow)) + if(loopBlocks.contains(scopeEnd.block)) + { + uint32_t nextUniformBlock = controlFlow.GetNextUniformBlock(scopeEnd.block); + scopeEnd.block = nextUniformBlock; + scopeEnd.instruction = info.function->blocks[nextUniformBlock]->startInstructionIdx + 1; + } + if(scopeEnd.IsAfter(current, controlFlow)) it->second = scopeEnd; } }