Skip to content

Commit b348d24

Browse files
authored
[SPIR-V] Add -fspv-debug=vulkan-with-source to usage and README (#4811)
-fspv-debug=vulkan will be kept for testing purposes but will not be documented in usage or README (for now).
1 parent 2f6da0f commit b348d24

4 files changed

Lines changed: 12 additions & 6 deletions

File tree

docs/SPIR-V.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,10 +580,15 @@ information, you can use ``-fspv-debug=``. It accepts:
580580
* ``line``: for emitting line information (turns on ``source`` implicitly)
581581
* ``tool``: for emitting DXC Git commit hash and command-line options
582582

583-
``-fspv-debug=`` overrules ``-Zi``. And you can provide multiple instances of
584-
``-fspv-debug=``. For example, you can use ``-fspv-debug=file -fspv-debug=tool``
585-
to turn on emitting file path and DXC information; source code and line
586-
information will not be emitted.
583+
These ``-fspv-debug=`` options overrule ``-Zi``. And you can provide multiple
584+
instances of ``-fspv-debug=``. For example, you can use ``-fspv-debug=file
585+
-fspv-debug=tool`` to turn on emitting file path and DXC information; source
586+
code and line information will not be emitted.
587+
588+
If you want to generate `NonSemantic.Shader.DebugInfo.100 <http://htmlpreview.github.io/?https://github.com/KhronosGroup/SPIRV-Registry/blob/main/nonsemantic/NonSemantic.Shader.DebugInfo.100.html>`_ extended instructions, you can use
589+
``-fspv-debug=vulkan-with-source``. These instructions support source-level
590+
shader debugging with tools such as RenderDoc, even if the SPIR-V is optimized.
591+
This option overrules the other ``-fspv-debug`` options above.
587592

588593
Reflection
589594
----------

include/dxc/Support/HLSLOptions.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def fspv_use_legacy_buffer_matrix_order: Flag<["-"], "fspv-use-legacy-buffer-mat
354354
def fspv_reflect: Flag<["-"], "fspv-reflect">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
355355
HelpText<"Emit additional SPIR-V instructions to aid reflection">;
356356
def fspv_debug_EQ : Joined<["-"], "fspv-debug=">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
357-
HelpText<"Specify whitelist of debug info category (file -> source -> line, tool)">;
357+
HelpText<"Specify whitelist of debug info category (file -> source -> line, tool, vulkan-with-source)">;
358358
def fspv_extension_EQ : Joined<["-"], "fspv-extension=">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,
359359
HelpText<"Specify SPIR-V extension permitted to use">;
360360
def fspv_target_env_EQ : Joined<["-"], "fspv-target-env=">, Group<spirv_Group>, Flags<[CoreOption, DriverOption]>,

lib/DxcSupport/HLSLOptions.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ int ReadDxcOpts(const OptTable *optionTable, unsigned flagsToInclude,
10751075
opts.SpirvOptions.debugInfoLine = true;
10761076
opts.SpirvOptions.debugInfoRich = true;
10771077
} else if (v == "vulkan") {
1078+
// For test purposes only
10781079
opts.SpirvOptions.debugInfoFile = true;
10791080
opts.SpirvOptions.debugInfoSource = false;
10801081
opts.SpirvOptions.debugInfoLine = true;

tools/clang/lib/SPIRV/SpirvEmitter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ SpirvEmitter::SpirvEmitter(CompilerInstance &ci)
707707
richDebugInfo->scopeStack.back());
708708
}
709709

710-
if (spirvOptions.debugInfoTool &&
710+
if (spirvOptions.debugInfoTool && !spirvOptions.debugInfoVulkan &&
711711
featureManager.isTargetEnvVulkan1p1OrAbove()) {
712712
// Emit OpModuleProcessed to indicate the commit information.
713713
std::string commitHash =

0 commit comments

Comments
 (0)