mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 01:50:38 +00:00
Added assert for Op::ControlBarrier that the workgroup is converged
New helper method ThreadState::WorkgroupIsDiverged()
This commit is contained in:
@@ -739,6 +739,26 @@ void ThreadState::EnterEntryPoint(ShaderDebugState *state)
|
||||
EnterFunction({});
|
||||
|
||||
m_State = NULL;
|
||||
currentInstruction = nextInstruction;
|
||||
}
|
||||
|
||||
bool ThreadState::WorkgroupIsDiverged(const rdcarray<ThreadState> &workgroup)
|
||||
{
|
||||
uint32_t instr0 = ~0U;
|
||||
for(size_t i = 0; i < workgroup.size(); i++)
|
||||
{
|
||||
if(workgroup[i].Finished())
|
||||
continue;
|
||||
if(instr0 == ~0U)
|
||||
{
|
||||
instr0 = workgroup[i].currentInstruction;
|
||||
continue;
|
||||
}
|
||||
// not executing the same instruction
|
||||
if(workgroup[i].currentInstruction != instr0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState> &workgroup,
|
||||
@@ -3741,11 +3761,16 @@ void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
case Op::MemoryBarrier:
|
||||
case Op::ControlBarrier:
|
||||
{
|
||||
// do nothing for now
|
||||
break;
|
||||
}
|
||||
case Op::ControlBarrier:
|
||||
{
|
||||
// For thread barriers the threads must be converged
|
||||
RDCASSERT(!WorkgroupIsDiverged(workgroup));
|
||||
break;
|
||||
}
|
||||
case Op::Label:
|
||||
case Op::SelectionMerge:
|
||||
case Op::LoopMerge:
|
||||
|
||||
@@ -202,6 +202,7 @@ struct ThreadState
|
||||
|
||||
bool Finished() const;
|
||||
|
||||
uint32_t currentInstruction;
|
||||
uint32_t nextInstruction;
|
||||
|
||||
const GlobalState &global;
|
||||
@@ -269,6 +270,8 @@ private:
|
||||
void SkipIgnoredInstructions();
|
||||
void SetConvergencePoint(Id block);
|
||||
|
||||
static bool WorkgroupIsDiverged(const rdcarray<ThreadState> &workgroup);
|
||||
|
||||
ShaderDebugState *m_State = NULL;
|
||||
};
|
||||
|
||||
|
||||
@@ -2728,6 +2728,11 @@ rdcarray<ShaderDebugState> Debugger::ContinueDebug()
|
||||
if(thread.diverged)
|
||||
++countDivergedThreads;
|
||||
}
|
||||
for(size_t lane = 0; lane < workgroup.size(); lane++)
|
||||
{
|
||||
if(activeMask[lane])
|
||||
workgroup[lane].currentInstruction = workgroup[lane].nextInstruction;
|
||||
}
|
||||
if(countConvergePointThreads)
|
||||
{
|
||||
// all the active threads should have a convergence point if any have one
|
||||
|
||||
Reference in New Issue
Block a user