Skip to content

Commit 0028c65

Browse files
committed
DXIL debugging sets initial data for non-const global variables
1 parent aaefec8 commit 0028c65

File tree

1 file changed

+16
-19
lines changed

1 file changed

+16
-19
lines changed

renderdoc/driver/shaders/dxil/dxil_debug.cpp

+16-19
Original file line numberDiff line numberDiff line change
@@ -7750,28 +7750,25 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain
77507750
globalVar.var.name = n;
77517751
globalVar.id = gv->ssaId;
77527752
globalMemory.AllocateMemoryForType(gv->type, globalVar.id, true, globalVar.var);
7753-
if(gv->flags & GlobalFlags::IsConst)
7753+
if(gv->initialiser)
77547754
{
7755-
if(gv->initialiser)
7755+
const Constant *initialData = gv->initialiser;
7756+
if(!initialData->isNULL())
77567757
{
7757-
const Constant *initialData = gv->initialiser;
7758-
if(!initialData->isNULL())
7758+
RDCASSERT(ConvertDXILConstantToShaderVariable(initialData, globalVar.var));
7759+
// Write ShaderVariable data back to memory
7760+
auto itAlloc = globalMemory.m_Allocations.find(globalVar.id);
7761+
if(itAlloc != globalMemory.m_Allocations.end())
77597762
{
7760-
RDCASSERT(ConvertDXILConstantToShaderVariable(initialData, globalVar.var));
7761-
// Write ShaderVariable data back to memory
7762-
auto itAlloc = globalMemory.m_Allocations.find(globalVar.id);
7763-
if(itAlloc != globalMemory.m_Allocations.end())
7764-
{
7765-
const MemoryTracking::Allocation &allocation = itAlloc->second;
7766-
void *allocMemoryBackingPtr = allocation.backingMemory;
7767-
uint64_t allocSize = allocation.size;
7768-
state.UpdateBackingMemoryFromVariable(allocMemoryBackingPtr, allocSize, globalVar.var);
7769-
RDCASSERTEQUAL(allocSize, 0);
7770-
}
7771-
else
7772-
{
7773-
RDCERR("Unknown memory allocation for GlobalVariable Id %u", globalVar.id);
7774-
}
7763+
const MemoryTracking::Allocation &allocation = itAlloc->second;
7764+
void *allocMemoryBackingPtr = allocation.backingMemory;
7765+
uint64_t allocSize = allocation.size;
7766+
state.UpdateBackingMemoryFromVariable(allocMemoryBackingPtr, allocSize, globalVar.var);
7767+
RDCASSERTEQUAL(allocSize, 0);
7768+
}
7769+
else
7770+
{
7771+
RDCERR("Unknown memory allocation for GlobalVariable Id %u", globalVar.id);
77757772
}
77767773
}
77777774
}

0 commit comments

Comments
 (0)