Skip to content

Commit 554e746

Browse files
committed
Emit error message instead of crashing for missing SSA variables
Make GetLiveVariable() behave similarly to GetPhiVariable()
1 parent 8e733a7 commit 554e746

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

renderdoc/driver/shaders/dxil/dxil_debug.cpp

+25-7
Original file line numberDiff line numberDiff line change
@@ -5666,19 +5666,37 @@ bool ThreadState::GetShaderVariableHelper(const DXIL::Value *dxilValue, DXIL::Op
56665666

56675667
bool ThreadState::IsVariableAssigned(const Id id) const
56685668
{
5669-
RDCASSERT(id < m_Assigned.size());
5670-
return m_Assigned[id];
5669+
if(id < m_Assigned.size())
5670+
{
5671+
return m_Assigned[id];
5672+
}
5673+
else
5674+
{
5675+
RDCERR("Variable Id %d is not in assigned list", id);
5676+
return false;
5677+
}
56715678
}
56725679

56735680
bool ThreadState::GetLiveVariable(const Id &id, Operation op, DXOp dxOpCode, ShaderVariable &var) const
56745681
{
5675-
RDCASSERT(id < m_Live.size());
5676-
RDCASSERT(m_Live[id]);
5682+
if(id < m_Live.size())
5683+
{
5684+
RDCASSERT(m_Live[id]);
5685+
}
5686+
else
5687+
{
5688+
RDCERR("Unknown Live Variable Id %d", id);
5689+
}
56775690
RDCASSERT(IsVariableAssigned(id));
5691+
56785692
auto it = m_Variables.find(id);
5679-
RDCASSERT(it != m_Variables.end());
5680-
var = it->second;
5681-
return GetVariableHelper(op, dxOpCode, var);
5693+
if(it != m_Variables.end())
5694+
{
5695+
var = it->second;
5696+
return GetVariableHelper(op, dxOpCode, var);
5697+
}
5698+
RDCERR("Unknown Variable %d", id);
5699+
return false;
56825700
}
56835701

56845702
bool ThreadState::GetPhiVariable(const Id &id, Operation op, DXOp dxOpCode, ShaderVariable &var) const

0 commit comments

Comments
 (0)