Skip to content

Commit

Permalink
Extend scope lifetime to match how SSA IDs variables get extended
Browse files Browse the repository at this point in the history
If the scope is in a loop block, use the next uniform block instead
  • Loading branch information
Zorro666 committed Dec 19, 2024
1 parent b7ffeb8 commit c331152
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion renderdoc/driver/shaders/dxil/dxil_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t> loopBlocks = controlFlow.GetLoopBlocks();
for(ScopedDebugData *scope : m_DebugInfo.scopedDebugDatas)
{
for(LocalMapping &localMapping : scope->localMappings)
Expand All @@ -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;
}
}
Expand Down

0 comments on commit c331152

Please sign in to comment.