Skip to content

Add NonSemantic.Shader.DebugInfo.100 options for Nvidia Nsight and/or RenderDoc source debugging - #1589

Open
DannyArends wants to merge 2 commits into
google:mainfrom
DannyArends:main
Open

Add NonSemantic.Shader.DebugInfo.100 options for Nvidia Nsight and/or RenderDoc source debugging#1589
DannyArends wants to merge 2 commits into
google:mainfrom
DannyArends:main

Conversation

@DannyArends

@DannyArends DannyArends commented Aug 1, 2026

Copy link
Copy Markdown

What

Adds two compile options that make shaderc emit NonSemantic.Shader.DebugInfo.100, equivalent to glslang's -gV / -gVS:

  • shaderc_compile_options_set_generate_nonsemantic_debug_info, equivalent to -gV
  • shaderc_compile_options_set_generate_nonsemantic_debug_source, equivalent to -gVS

Additionally, I have wired up matching CompileOptions::SetGenerateNonSemanticDebugInfo() / SetGenerateNonSemanticDebugSource() in the C++ wrapper.

Why

set_generate_debug_info only emits OpLine/OpSource (glslang -g). Tools like NVIDIA Nsight Graphics need NonSemantic.Shader.DebugInfo.100 for function- and call-site-level source correlation (Flame Graph, Top-Down/Bottom-Up Calls). shaderc had no way to request it (see #1391), so callers had to drop to glslang or dxc directly. The pull requests makes these new flag independent from generate_debug_info so plain -g stays available as a fallback for shaders that fail to compile withNonSemantic info enabled.

Usage: a Nsight-ready build

    shaderc_compile_options_t options = shaderc_compile_options_initialize();
    shaderc_compile_options_set_generate_debug_info(options);               // -g:   OpLine/OpSource
    shaderc_compile_options_set_generate_nonsemantic_debug_source(options); // -gVS: NonSemantic + source
    shaderc_compile_options_set_optimization_level(options, shaderc_optimization_level_zero);

-g provides the line table, -gVS provides the call graph; Nsight uses both. Optimization must stay at zero. The size/performance passes can mangle or strip NonSemantic info even with the strip-guards in place.

Notes

  • Build against glslang >= 15.0.0; earlier versions point every DebugFunction at the same file, corrupting name/line correlation.
  • Some shaders fail to compile with NonSemantic enabled; since the new flags are independent of -g, this is now a non-issue since builds need to opt in.

Add generate_nonsemantic_debug_info_ / _source_ to libshaderc_util's
Compiler, wired to glslang SpvOptions::emitNonSemanticShaderDebugInfo
and emitNonSemanticShaderDebugSource (equivalent to glslang -gV/-gVS).
Kept independent from generate_debug_info_ so plain -g stays available
as a fallback for shaders that fail to compile with NonSemantic info.

Enables function- and call-site-level source correlation in Nsight
Graphics (Flame Graph, Top-Down/Bottom-Up Calls), which the existing
-g-only path does not provide.

Extract the strip-pass unqueue loop into UnstripDebugInfoPasses() and
guard SetOptimizationLevel against stripping when either debug mode is on.
Wire SetGenerateNonSemanticDebugInfo / SetGenerateNonSemanticDebugSource
from libshaderc_util::Compiler up through the public API:
shaderc_compile_options_set_generate_nonsemantic_debug_{info,source} in
the C API, plus the matching CompileOptions methods in shaderc.hpp.

Mirrors the existing set_generate_debug_info plumbing. Lets callers
request glslang -gV/-gVS output (NonSemantic.Shader.DebugInfo.100) for
Nsight Graphics call-site correlation without dropping to internal headers.
@google-cla

google-cla Bot commented Aug 1, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@DannyArends

Copy link
Copy Markdown
Author

Update: I have signed the CLA, let me know if anything else is needed from my side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant