From c724778cb3cf91c548b91f750e5c10f12a0eb986 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 1 Apr 2024 14:22:34 +0100 Subject: [PATCH] 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. --- renderdoc/driver/shaders/spirv/spirv_reflect.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp index 19b2bda92..5aa8cfc6b 100644 --- a/renderdoc/driver/shaders/spirv/spirv_reflect.cpp +++ b/renderdoc/driver/shaders/spirv/spirv_reflect.cpp @@ -661,13 +661,14 @@ void Reflector::RegisterOp(Iter it) if(dbg.inst == ShaderDbg::Source) { rdcstr name = strings[dbg.arg(0)]; - if(name.empty()) - name = "unnamed_shader"; rdcstr source = dbg.params.size() > 1 ? strings[dbg.arg(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}); }