Treat entry point variables consistently with other functions

This commit is contained in:
baldurk
2020-05-05 18:59:49 +01:00
parent a9a821081a
commit 18decf78b2
3 changed files with 31 additions and 14 deletions
@@ -474,6 +474,15 @@ void ThreadState::SkipIgnoredInstructions()
}
}
void ThreadState::EnterEntryPoint(ShaderDebugState *state)
{
m_State = state;
EnterFunction({});
m_State = NULL;
}
void ThreadState::StepNext(ShaderDebugState *state, const rdcarray<ThreadState> &workgroup)
{
m_State = state;
+2 -1
View File
@@ -176,7 +176,7 @@ struct ThreadState
ThreadState(uint32_t workgroupIdx, Debugger &debug, const GlobalState &globalState);
~ThreadState();
void EnterFunction(const rdcarray<Id> &arguments);
void EnterEntryPoint(ShaderDebugState *state);
void StepNext(ShaderDebugState *state, const rdcarray<ThreadState> &workgroup);
enum DerivDir
@@ -238,6 +238,7 @@ struct ThreadState
void WritePointerValue(Id pointer, const ShaderVariable &val);
private:
void EnterFunction(const rdcarray<Id> &arguments);
void SetDst(Id id, const ShaderVariable &val);
void ProcessScopeChange(const rdcarray<Id> &oldLive, const rdcarray<Id> &newLive);
void JumpToLabel(Id target);
@@ -1020,24 +1020,31 @@ rdcarray<ShaderDebugState> Debugger::ContinueDebug()
// initialise the first ShaderDebugState if we haven't stepped yet
if(steps == 0)
{
// we should be sitting at the entry point function prologue, step forward into the first block
// and past any function-local variable declarations
for(ThreadState &thread : workgroup)
thread.EnterFunction({});
ShaderDebugState initial;
initial.nextInstruction = active.nextInstruction;
// we should be sitting at the entry point function prologue, step forward into the first block
// and past any function-local variable declarations
for(size_t lane = 0; lane < workgroup.size(); lane++)
{
ThreadState &thread = workgroup[lane];
for(const Id &v : active.live)
if(lane == activeLaneIndex)
{
thread.EnterEntryPoint(&initial);
thread.FillCallstack(initial);
initial.nextInstruction = thread.nextInstruction;
initial.sourceVars = thread.sourceVars;
}
else
{
thread.EnterEntryPoint(NULL);
}
}
// globals won't be filled out by entering the entry point, ensure their change is registered.
for(const Id &v : liveGlobals)
initial.changes.push_back({ShaderVariable(), GetPointerValue(active.ids[v])});
initial.sourceVars = active.sourceVars;
initial.stepIndex = steps;
active.FillCallstack(initial);
ret.push_back(initial);
steps++;