From 1c7deb7df77d7f1cae9a8f859d50ef703a578413 Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Tue, 7 Jan 2025 17:40:23 +0000 Subject: [PATCH] Extend handling in GetFunctionScopeName() Now supports passing in: DISubprogram DILexicalBlock In addition to existing support for: DILocalVariable DIGlobalVariable --- renderdoc/driver/shaders/dxil/dxil_debuginfo.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/renderdoc/driver/shaders/dxil/dxil_debuginfo.cpp b/renderdoc/driver/shaders/dxil/dxil_debuginfo.cpp index b16b2bdbe..468d10f4c 100644 --- a/renderdoc/driver/shaders/dxil/dxil_debuginfo.cpp +++ b/renderdoc/driver/shaders/dxil/dxil_debuginfo.cpp @@ -415,11 +415,19 @@ rdcstr Program::GetDebugVarName(const DIBase *d) const rdcstr Program::GetFunctionScopeName(const DIBase *d) const { + if(d->type == DIBase::Subprogram) + { + const rdcstr *name = d->As()->name; + return name ? *name : ""; + } + const Metadata *scope = NULL; if(d->type == DIBase::LocalVariable) scope = d->As()->scope; - if(d->type == DIBase::GlobalVariable) + else if(d->type == DIBase::GlobalVariable) scope = d->As()->scope; + else if(d->type == DIBase::LexicalBlock) + scope = d->As()->scope; while(scope && scope->dwarf) {