diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index 3024d6ac7..73746afc0 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -1655,6 +1655,36 @@ bool IsNopInstruction(const Instruction &inst) return false; } +bool ThreadState::JumpToBlock(const Block *target) +{ + m_PreviousBlock = m_Block; + m_PhiVariables.clear(); + auto it = m_FunctionInfo->phiReferencedIdsPerBlock.find(m_PreviousBlock); + if(it != m_FunctionInfo->phiReferencedIdsPerBlock.end()) + { + const FunctionInfo::ReferencedIds &phiIds = it->second; + for(Id id : phiIds) + m_PhiVariables[id] = m_Variables[id]; + } + + RDCASSERT(target); + uint32_t blockId = target->id; + if(blockId < m_FunctionInfo->function->blocks.size()) + { + m_Block = blockId; + m_FunctionInstructionIdx = m_FunctionInfo->function->blocks[m_Block]->startInstructionIdx; + } + else + { + return false; + } + + uint32_t nextInstruction = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx; + if(m_State && !m_Ended) + m_State->nextInstruction = nextInstruction; + return true; +} + bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper, const rdcarray &workgroup, const rdcarray &activeMask) @@ -4113,16 +4143,6 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper, } case Operation::Branch: { - m_PreviousBlock = m_Block; - m_PhiVariables.clear(); - auto it = m_FunctionInfo->phiReferencedIdsPerBlock.find(m_PreviousBlock); - if(it != m_FunctionInfo->phiReferencedIdsPerBlock.end()) - { - const FunctionInfo::ReferencedIds &phiIds = it->second; - for(Id id : phiIds) - m_PhiVariables[id] = m_Variables[id]; - } - // Branch