@@ -4100,9 +4100,26 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
4100
4100
Id ptrId = GetArgumentId (0 );
4101
4101
if (ptrId == DXILDebug::INVALID_ID)
4102
4102
break ;
4103
- RDCASSERT (m_Memory.m_AllocPointers .count (ptrId) == 1 );
4103
+
4104
+ auto itPtr = m_Memory.m_AllocPointers .find (ptrId);
4105
+ RDCASSERT (itPtr != m_Memory.m_AllocPointers .end ());
4106
+
4107
+ const MemoryTracking::AllocPointer &ptr = itPtr->second ;
4108
+ Id baseMemoryId = ptr.baseMemoryId ;
4109
+
4110
+ auto itAlloc = m_Memory.m_Allocs .find (baseMemoryId);
4111
+ RDCASSERT (itAlloc != m_Memory.m_Allocs .end ());
4112
+ const MemoryTracking::Alloc &alloc = itAlloc->second ;
4104
4113
ShaderVariable arg;
4105
- RDCASSERT (GetShaderVariable (inst.args [0 ], opCode, dxOpCode, arg));
4114
+ if (alloc.global )
4115
+ {
4116
+ RDCASSERT (IsVariableAssigned (baseMemoryId));
4117
+ arg = m_Variables[baseMemoryId];
4118
+ }
4119
+ else
4120
+ {
4121
+ RDCASSERT (GetShaderVariable (inst.args [0 ], opCode, dxOpCode, arg));
4122
+ }
4106
4123
result.value = arg.value ;
4107
4124
break ;
4108
4125
}
@@ -5098,7 +5115,7 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
5098
5115
RDCASSERT (baseMemoryBackingPtr);
5099
5116
RDCASSERTNOTEQUAL (baseMemoryId, DXILDebug::INVALID_ID);
5100
5117
5101
- RDCASSERTEQUAL (resultId, DXILDebug::INVALID_ID);
5118
+ RDCASSERTNOTEQUAL (resultId, DXILDebug::INVALID_ID);
5102
5119
RDCASSERT (IsVariableAssigned (baseMemoryId));
5103
5120
const ShaderVariable a = m_Variables[baseMemoryId];
5104
5121
@@ -5107,7 +5124,7 @@ bool ThreadState::ExecuteInstruction(DebugAPIWrapper *apiWrapper,
5107
5124
RDCASSERT (GetShaderVariable (inst.args [newValueArgIdx], opCode, dxOpCode, b));
5108
5125
const uint32_t c = 0 ;
5109
5126
5110
- ShaderVariable res;
5127
+ ShaderVariable res = a ;
5111
5128
5112
5129
if (opCode == Operation::AtomicExchange)
5113
5130
{
@@ -5417,8 +5434,13 @@ bool ThreadState::GetShaderVariableHelper(const DXIL::Value *dxilValue, DXIL::Op
5417
5434
}
5418
5435
else if (const GlobalVar *gv = cast<GlobalVar>(dxilValue))
5419
5436
{
5420
- var.value .u64v [0 ] = gv->initialiser ->getU64 ();
5421
- return true ;
5437
+ if (gv->initialiser )
5438
+ {
5439
+ var.value .u64v [0 ] = gv->initialiser ->getU64 ();
5440
+ return true ;
5441
+ }
5442
+ RDCERR (" Unhandled DXIL GlobalVar no initialiser" );
5443
+ return false ;
5422
5444
}
5423
5445
5424
5446
if (const Instruction *inst = cast<Instruction>(dxilValue))
@@ -6246,7 +6268,6 @@ const TypeData &Debugger::AddDebugType(const DXIL::Metadata *typeMD)
6246
6268
{
6247
6269
case DW_ATE_boolean:
6248
6270
{
6249
- RDCASSERTEQUAL (sizeInBits, 8 );
6250
6271
typeData.type = VarType ::Bool;
6251
6272
break ;
6252
6273
}
0 commit comments