From 141b86ac7091200421dbae8063ebf99f4a493365 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Wed, 18 Dec 2024 13:59:20 +0000 Subject: [PATCH] Update the UI debug state after all lanes have executed and skipped nops This keeps UI nextInstruction in sync with m_ActiveGlobalInstructionIdx --- renderdoc/driver/shaders/dxil/dxil_debug.cpp | 22 ++++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_debug.cpp b/renderdoc/driver/shaders/dxil/dxil_debug.cpp index 075cbf6de..72bd8df95 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debug.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debug.cpp @@ -5285,9 +5285,6 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper, RDCASSERTEQUAL(m_ActiveGlobalInstructionIdx, m_GlobalInstructionIdx); if(m_State) { - if(!m_Ended) - m_State->nextInstruction = m_GlobalInstructionIdx + 1; - m_State->flags = ShaderEvents::NoEvent; m_State->changes.clear(); @@ -5320,9 +5317,6 @@ void ThreadState::StepNext(ShaderDebugState *state, DebugAPIWrapper *apiWrapper, } ExecuteInstruction(apiWrapper, workgroups); - if(m_State && m_Ended) - --m_State->nextInstruction; - m_State = NULL; } @@ -7947,6 +7941,8 @@ rdcarray Debugger::ContinueDebug(DebugAPIWrapper *apiWrapper) CalcActiveMask(activeMask); // step all active members of the workgroup + ShaderDebugState state; + bool hasDebugState = false; for(size_t lane = 0; lane < m_Workgroups.size(); lane++) { if(activeMask[lane]) @@ -7961,13 +7957,9 @@ rdcarray Debugger::ContinueDebug(DebugAPIWrapper *apiWrapper) if(lane == m_ActiveLaneIndex) { - ShaderDebugState state; - + hasDebugState = true; state.stepIndex = m_Steps; thread.StepNext(&state, apiWrapper, m_Workgroups); - thread.FillCallstack(state); - - ret.push_back(std::move(state)); m_Steps++; } else @@ -7981,6 +7973,14 @@ rdcarray Debugger::ContinueDebug(DebugAPIWrapper *apiWrapper) if(activeMask[lane]) m_Workgroups[lane].StepOverNopInstructions(); } + // Update UI state after the execute and step over nops to make sure state.nextInstruction is in sync + if(hasDebugState) + { + ThreadState &thread = m_Workgroups[m_ActiveLaneIndex]; + state.nextInstruction = thread.m_ActiveGlobalInstructionIdx; + thread.FillCallstack(state); + ret.push_back(std::move(state)); + } } return ret; }