Give empty sources 'unnamed_shader' name after checking for empty name

* This means that truly empty sources with no name or source are still properly
  filtered out - which is how OpSource works. Sources that are empty but have a
  name (e.g. ones referenced by #line directives) will still be kept, and
  unnamed sources with contents will be kept and given the unnamed filename.
This commit is contained in:
baldurk
2024-04-01 14:22:34 +01:00
parent e43d6b4a26
commit c724778cb3
@@ -661,13 +661,14 @@ void Reflector::RegisterOp(Iter it)
if(dbg.inst == ShaderDbg::Source)
{
rdcstr name = strings[dbg.arg<Id>(0)];
if(name.empty())
name = "unnamed_shader";
rdcstr source = dbg.params.size() > 1 ? strings[dbg.arg<Id>(1)] : rdcstr();
// don't add empty source statements as actual files
if(!name.empty() || !source.empty())
{
if(name.empty())
name = "unnamed_shader";
debugSources[dbg.result] = sources.size();
sources.push_back({name, source});
}