Add NonSemantic.Shader.DebugInfo.100 options for Nvidia Nsight and/or RenderDoc source debugging - #1589
Add NonSemantic.Shader.DebugInfo.100 options for Nvidia Nsight and/or RenderDoc source debugging#1589DannyArends wants to merge 8 commits into
Conversation
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.
|
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. |
|
Update: I have signed the CLA, let me know if anything else is needed from my side. |
| for (size_t i = 0; i < enabled_opt_passes_.size(); ++i) { | ||
| if (enabled_opt_passes_[i] == PassId::kStripDebugInfo) { | ||
| enabled_opt_passes_[i] = PassId::kNullPass; | ||
| void Compiler::UnstripDebugInfoPasses() { |
There was a problem hiding this comment.
The function name reads weirdly.
I'd prefer: RemoveStripDebugInfoPass.
Not a huge issue though.
dneto0
left a comment
There was a problem hiding this comment.
This change should also include a command-line option on glslc, and please at least one unit test for each option, and glslc-based tests.
|
Thanks for the review @dneto0. I've pushed changes addressing all points raised:
A minor note on the I ran ctest --output-on-failure and everything passes locally. |
What
Adds two compile options that make shaderc emit NonSemantic.Shader.DebugInfo.100, equivalent to glslang's -gV / -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
-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