mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-27 12:21:11 +00:00
DXIL Disassembly and Debug sanitise global variable names
Using newly added DXIL::SanisiseName() Current implementation converts '.' -> '_'
This commit is contained in:
@@ -1737,6 +1737,8 @@ bool IsLLVMDebugCall(const Instruction &inst);
|
||||
|
||||
bool isUndef(const Value *v);
|
||||
|
||||
void SanitiseName(rdcstr &name);
|
||||
|
||||
}; // namespace DXIL
|
||||
|
||||
DECLARE_REFLECTION_ENUM(DXIL::Attribute);
|
||||
|
||||
@@ -5755,7 +5755,9 @@ ShaderDebugTrace *Debugger::BeginDebug(uint32_t eventId, const DXBC::DXBCContain
|
||||
continue;
|
||||
|
||||
GlobalVariable globalVar;
|
||||
globalVar.var.name = DXBC::BasicDemangle(gv->name);
|
||||
rdcstr n = DXBC::BasicDemangle(gv->name);
|
||||
DXIL::SanitiseName(n);
|
||||
globalVar.var.name = n;
|
||||
globalVar.id = gv->ssaId;
|
||||
state.AllocateMemoryForType(gv->type, globalVar.id, globalVar.var);
|
||||
|
||||
|
||||
@@ -163,6 +163,16 @@ bool DXIL::FindSigParameter(const rdcarray<SigParameter> &inputSig,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Replace '.' -> '_'
|
||||
void DXIL::SanitiseName(rdcstr &name)
|
||||
{
|
||||
for(size_t c = 0; c < name.size(); ++c)
|
||||
{
|
||||
if(name[c] == '.')
|
||||
name[c] = '_';
|
||||
}
|
||||
}
|
||||
|
||||
static const char *shaderNames[] = {
|
||||
"Pixel", "Vertex", "Geometry", "Hull", "Domain",
|
||||
"Compute", "Library", "RayGeneration", "Intersection", "AnyHit",
|
||||
@@ -1576,7 +1586,10 @@ rdcstr Program::DisassembleGlobalVars(int &instructionLine) const
|
||||
|
||||
rdcstr n = g.name;
|
||||
if(!m_DXCStyle)
|
||||
{
|
||||
n = DXBC::BasicDemangle(g.name);
|
||||
DXIL::SanitiseName(n);
|
||||
}
|
||||
ret += StringFormat::Fmt("@%s = ", escapeStringIfNeeded(n).c_str());
|
||||
switch(g.flags & GlobalFlags::LinkageMask)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user