mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-27 04:11:05 +00:00
Handle naming forward pointer types better in SPIR-V disassembly
This commit is contained in:
@@ -323,8 +323,16 @@ std::string Reflector::Disassemble(const std::string &entryPoint) const
|
||||
case Op::TypeSampler:
|
||||
case Op::TypeSampledImage:
|
||||
case Op::TypeFunction:
|
||||
case Op::TypeRuntimeArray:
|
||||
case Op::TypeRuntimeArray: continue;
|
||||
|
||||
case Op::TypeForwardPointer:
|
||||
{
|
||||
OpTypeForwardPointer decoded(it);
|
||||
|
||||
ret += ToStr(decoded.storageClass) + " " + declName(decoded.pointerType, Id()) + ";\n";
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// structs we print out
|
||||
case Op::TypeStruct:
|
||||
|
||||
@@ -534,10 +534,6 @@ void Reflector::PostParse()
|
||||
{
|
||||
type.name = StringFormat::Fmt("struct%u", type.id);
|
||||
}
|
||||
else if(type.type == DataType::PointerType)
|
||||
{
|
||||
type.name = StringFormat::Fmt("%s*", dataTypes[type.InnerType()].name.c_str());
|
||||
}
|
||||
else if(type.type == DataType::ArrayType)
|
||||
{
|
||||
// prefer the name
|
||||
@@ -615,6 +611,14 @@ void Reflector::PostParse()
|
||||
}
|
||||
}
|
||||
|
||||
// do default names for pointer types in a second pass, because they can point forward at structs
|
||||
// with higher IDs
|
||||
for(auto it = dataTypes.begin(); it != dataTypes.end(); ++it)
|
||||
{
|
||||
if(it->second.type == DataType::PointerType && it->second.name.empty())
|
||||
it->second.name = StringFormat::Fmt("%s*", dataTypes[it->second.InnerType()].name.c_str());
|
||||
}
|
||||
|
||||
for(const MemberName &mem : memberNames)
|
||||
dataTypes[mem.id].children[mem.member].name = mem.name;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user