Rationalise DXIL debugger instruction indexes

Use m_ActiveGlobalInstructionIdx instead of m_GlobalInstructionIdx
Removed m_GlobalInstructionIdx
This commit is contained in:
Jake Turner
2025-01-08 12:17:43 +00:00
parent a98d0a403f
commit 4b35fbcc96
2 changed files with 8 additions and 13 deletions
+7 -10
View File
@@ -1656,7 +1656,7 @@ ThreadState::ThreadState(uint32_t workgroupIndex, Debugger &debugger,
m_WorkgroupIndex = workgroupIndex;
m_FunctionInfo = NULL;
m_FunctionInstructionIdx = 0;
m_GlobalInstructionIdx = 0;
m_ActiveGlobalInstructionIdx = 0;
m_Killed = false;
m_Ended = false;
m_Callstack.clear();
@@ -1747,7 +1747,7 @@ void ThreadState::EnterFunction(const Function *function, const rdcarray<Value *
m_PreviousBlock = ~0U;
m_PhiVariables.clear();
m_GlobalInstructionIdx = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
m_ActiveGlobalInstructionIdx = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
m_Callstack.push_back(frame);
ShaderDebugState *state = m_State;
@@ -4144,14 +4144,13 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
{
m_Block = blockId;
m_FunctionInstructionIdx = m_FunctionInfo->function->blocks[m_Block]->startInstructionIdx;
m_GlobalInstructionIdx = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
}
else
{
RDCERR("Unknown branch target %u '%s'", m_Block, GetArgumentName(targetArg).c_str());
}
if(m_State && !m_Ended)
m_State->nextInstruction = m_GlobalInstructionIdx;
m_State->nextInstruction = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
break;
}
case Operation::Phi:
@@ -5228,7 +5227,6 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
{
m_Block = blockId;
m_FunctionInstructionIdx = m_FunctionInfo->function->blocks[m_Block]->startInstructionIdx;
m_GlobalInstructionIdx = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
}
else
{
@@ -5458,12 +5456,12 @@ void ThreadState::StepOverNopInstructions()
return;
do
{
m_GlobalInstructionIdx = m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
RDCASSERT(m_FunctionInstructionIdx < m_FunctionInfo->function->instructions.size());
const Instruction *inst = m_FunctionInfo->function->instructions[m_FunctionInstructionIdx];
if(!IsNopInstruction(*inst))
{
m_ActiveGlobalInstructionIdx = m_GlobalInstructionIdx;
m_ActiveGlobalInstructionIdx =
m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx;
return;
}
@@ -5476,9 +5474,8 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper,
{
m_State = state;
RDCASSERTEQUAL(m_GlobalInstructionIdx,
RDCASSERTEQUAL(m_ActiveGlobalInstructionIdx,
m_FunctionInfo->globalInstructionOffset + m_FunctionInstructionIdx);
RDCASSERTEQUAL(m_ActiveGlobalInstructionIdx, m_GlobalInstructionIdx);
if(m_State)
{
m_State->flags = ShaderEvents::NoEvent;
@@ -8378,7 +8375,7 @@ rdcarray<ShaderDebugState> Debugger::ContinueDebug(DebugAPIWrapper *apiWrapper)
{
thread.EnterEntryPoint(m_EntryPointFunction, &initial);
thread.FillCallstack(initial);
initial.nextInstruction = thread.m_GlobalInstructionIdx;
initial.nextInstruction = thread.m_ActiveGlobalInstructionIdx;
}
else
{
+1 -3
View File
@@ -326,9 +326,7 @@ struct ThreadState
// The current and previous function basic block index
uint32_t m_Block = ~0U;
uint32_t m_PreviousBlock = ~0U;
// A global logical instruction index (bit like a PC) not the instruction index within a function
uint32_t m_GlobalInstructionIdx = ~0U;
// The PC of the active instruction that was or will be executed on the current simulation step
// The global PC of the active instruction that was or will be executed on the current simulation step
uint32_t m_ActiveGlobalInstructionIdx = ~0U;
// SSA Ids guaranteed to be greater than 0 and less than this value