Skip to content

Commit

Permalink
DXIL Debugger treat global variables as always in scope
Browse files Browse the repository at this point in the history
  • Loading branch information
Zorro666 committed Dec 10, 2024
1 parent 9e0e25a commit 8f75a16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions renderdoc/driver/shaders/dxil/dxil_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,7 @@ void ThreadState::InitialiseHelper(const ThreadState &activeState)
m_Variables = activeState.m_Variables;
m_Assigned = activeState.m_Assigned;
m_Live = activeState.m_Live;
m_IsGlobal = activeState.m_IsGlobal;
}

bool ThreadState::Finished() const
Expand Down Expand Up @@ -1597,6 +1598,8 @@ void ThreadState::EnterFunction(const Function *function, const rdcarray<Value *

// start with just globals
m_Live = m_Debugger.GetLiveGlobals();
m_IsGlobal = m_Live;

m_Block = 0;
m_PreviousBlock = ~0U;
m_PhiVariables.clear();
Expand Down Expand Up @@ -4264,6 +4267,9 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
// The fake output variable is always in scope
if(id == m_Output.id)
continue;
// Global are always in scope
if(m_IsGlobal[id])
continue;

auto itRange = m_FunctionInfo->maxExecPointPerId.find(id);
RDCASSERT(itRange != m_FunctionInfo->maxExecPointPerId.end());
Expand Down
2 changes: 2 additions & 0 deletions renderdoc/driver/shaders/dxil/dxil_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,8 @@ struct ThreadState
std::map<Id, ShaderVariable> m_PhiVariables;
// Live variables at the current scope
rdcarray<bool> m_Live;
// Globals variables at the current scope
rdcarray<bool> m_IsGlobal;
// If the variable has been assigned a value
rdcarray<bool> m_Assigned;
// Annotated handle properties
Expand Down

0 comments on commit 8f75a16

Please sign in to comment.