mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-06 18:10:35 +00:00
Cache DXIL SSA ID Result names
The disassembly will populate the cache and the debugger will reuse the cache
This commit is contained in:
@@ -1729,7 +1729,7 @@ protected:
|
||||
const ResourceReference *GetResourceReference(const DXILDebug::Id handleId) const;
|
||||
rdcstr GetHandleAlias(const rdcstr &handleStr) const;
|
||||
static DXILDebug::Id GetResultSSAId(const DXIL::Instruction &inst);
|
||||
static void MakeResultId(const Instruction &inst, rdcstr &resultId);
|
||||
void MakeResultId(const Instruction &inst, rdcstr &resultId) const;
|
||||
rdcstr GetArgId(const Instruction &inst, uint32_t arg) const;
|
||||
rdcstr GetArgId(const Value *v) const;
|
||||
rdcstr GetArgumentName(const Value *v) const;
|
||||
@@ -1808,6 +1808,7 @@ protected:
|
||||
std::map<rdcstr, rdcstr> m_SsaAliases;
|
||||
std::map<rdcstr, uint32_t> m_ResourceAnnotateCounts;
|
||||
rdcarray<LocalSourceVariable> m_Locals;
|
||||
mutable std::map<DXILDebug::Id, rdcstr> m_ResultNames;
|
||||
|
||||
rdcarray<ResourceReference> m_ResourceReferences;
|
||||
rdcstr m_Disassembly;
|
||||
|
||||
@@ -2088,7 +2088,7 @@ bool ThreadState::ExecuteInstruction(const rdcarray<ThreadState> &workgroup,
|
||||
const Type *retType = inst.type;
|
||||
// Sensible defaults
|
||||
ShaderVariable result;
|
||||
Program::MakeResultId(inst, result.name);
|
||||
m_Program.MakeResultId(inst, result.name);
|
||||
result.rows = 1;
|
||||
result.columns = 1;
|
||||
result.type = ConvertDXILTypeToVarType(retType);
|
||||
|
||||
@@ -6246,12 +6246,26 @@ DXILDebug::Id Program::GetResultSSAId(const DXIL::Instruction &inst)
|
||||
return inst.slot;
|
||||
}
|
||||
|
||||
void Program::MakeResultId(const DXIL::Instruction &inst, rdcstr &resultId)
|
||||
void Program::MakeResultId(const DXIL::Instruction &inst, rdcstr &resultId) const
|
||||
{
|
||||
DXILDebug::Id id = inst.slot;
|
||||
if(id != ~0U)
|
||||
{
|
||||
auto it = m_ResultNames.find(id);
|
||||
if(it != m_ResultNames.end())
|
||||
{
|
||||
resultId = it->second;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(!inst.getName().empty())
|
||||
resultId = StringFormat::Fmt("%c%s", '_', escapeStringIfNeeded(inst.getName()).c_str());
|
||||
else if(inst.slot != ~0U)
|
||||
resultId = StringFormat::Fmt("%c%s", '_', ToStr(inst.slot).c_str());
|
||||
resultId = StringFormat::Fmt("_%s", escapeStringIfNeeded(inst.getName()).c_str());
|
||||
else if(id != ~0U)
|
||||
resultId = StringFormat::Fmt("_%s", ToStr(id).c_str());
|
||||
|
||||
if(id != ~0U)
|
||||
m_ResultNames[id] = resultId;
|
||||
}
|
||||
|
||||
rdcpair<int32_t, int32_t> Program::ParseDIExpressionMD(const Metadata *expressionMD) const
|
||||
@@ -6328,7 +6342,7 @@ SourceMappingInfo Program::ParseDbgOpDeclare(const DXIL::Instruction &inst) cons
|
||||
if(const Instruction *varInst = cast<Instruction>(value))
|
||||
{
|
||||
ret.dbgVarId = Program::GetResultSSAId(*varInst);
|
||||
Program::MakeResultId(*varInst, ret.dbgVarName);
|
||||
MakeResultId(*varInst, ret.dbgVarName);
|
||||
}
|
||||
else if(const GlobalVar *gv = cast<GlobalVar>(value))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user