Generate consistent names for unnamed shader I/O signatures

This commit is contained in:
baldurk
2020-06-05 14:32:54 +01:00
parent 8ff6251d98
commit 7dda3770e4
2 changed files with 12 additions and 2 deletions
@@ -542,6 +542,8 @@ ShaderDebugTrace *Debugger::BeginDebug(DebugAPIWrapper *apiWrapper, const Shader
else if(decorations[v.id].flags & Decorations::HasLocation)
sourceName =
StringFormat::Fmt("_%s%u", isInput ? "input" : "output", decorations[v.id].location);
else
sourceName = StringFormat::Fmt("_sig%u", v.id.value());
}
const DataType &type = dataTypes[v.type];
@@ -769,9 +769,17 @@ void Reflector::MakeReflection(const GraphicsAPI sourceAPI, const ShaderStage st
if(name.empty() && baseType.type == DataType::StructType)
name = baseType.name;
// otherwise fall back to naming after the ID
// otherwise fall back to naming after the builtin or location
if(name.empty())
name = StringFormat::Fmt("sig%u", global.id.value());
{
if(decorations[global.id].flags & Decorations::HasBuiltIn)
name = StringFormat::Fmt("_%s", ToStr(decorations[global.id].builtIn).c_str());
else if(decorations[global.id].flags & Decorations::HasLocation)
name = StringFormat::Fmt("_%s%u", isInput ? "input" : "output",
decorations[global.id].location);
else
name = StringFormat::Fmt("_sig%u", global.id.value());
}
const bool used = usedIds.find(global.id) != usedIds.end();