Add variable debug variables when we have debug info

* We don't want to wait until the first store to do this, since the source
  variables are added at the appropriate scope - even before the first store.
This commit is contained in:
baldurk
2022-02-04 16:45:15 +00:00
parent 2f0be387c4
commit 309a2aaded
2 changed files with 8 additions and 2 deletions
@@ -184,9 +184,14 @@ void ThreadState::EnterFunction(const rdcarray<Id> &arguments)
frame->locals.resize(numVars);
// don't add source vars for variables, we'll add it on the first store
ShaderDebugState *state = m_State;
m_State = NULL;
// don't add variables if we don't have debug info, we'll add it on the first store to reduce
// noise on unoptimised shaders with lots of variables and no scope information. However if we
// have debug info we'll add the variable immediately because the source variable will only be
// added at the correct scope and we want to display that before it's stored to.
if(!debugger.HasDebugInfo())
m_State = NULL;
size_t i = 0;
// handle any variable declarations
@@ -289,6 +289,7 @@ public:
const DataType &GetTypeForId(Id ssaId);
const Decorations &GetDecorations(Id typeId);
bool IsDebugExtInstSet(Id id) const;
bool HasDebugInfo() const { return m_DebugInfo.valid; }
rdcstr GetRawName(Id id) const;
rdcstr GetHumanName(Id id);
void AddSourceVars(rdcarray<SourceVariableMapping> &sourceVars, const ShaderVariable &var, Id id);