From 1ccdf7f4f47ab8ae0f18a66630fa715052c77d8f Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Sat, 27 Sep 2025 14:18:58 +0100 Subject: [PATCH] Op::ControlBarrier requires full lockstep when being simulated Lockstep before executing the instruction Lockstep after executing the instruction --- renderdoc/driver/shaders/spirv/spirv_debug.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_debug.cpp b/renderdoc/driver/shaders/spirv/spirv_debug.cpp index 919d30b9d..b0c695bfe 100644 --- a/renderdoc/driver/shaders/spirv/spirv_debug.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_debug.cpp @@ -5387,10 +5387,20 @@ bool ThreadState::CanRunAnotherStep() const if(IsPendingResultPending()) return false; + // current instructions that require full lockstep + ConstIter it = debugger.GetIterForInstruction(nextInstruction - 1); + OpDecoder opdata(it); + switch(opdata.op) + { + // no thread can continue until all threads execute the barrier + case Op::ControlBarrier: return false; + default: break; + } + // Next instructions that prevent running another step: // any instruction that requires threads in the tangle to be in lockstep - ConstIter it = debugger.GetIterForInstruction(nextInstruction); - OpDecoder opdata(it); + it = debugger.GetIterForInstruction(nextInstruction); + opdata = it; switch(opdata.op) { // thread barriers require threads in the tangle to be in lockstep