microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] fatal error: generated SPIR-V is invalid: NonSemantic.Shader.DebugInfo.100 DebugTypeMember: operand Column End (171) is larger then Line 475 column length of 23 found in the DebugSource text
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Can't compile shader to SPIR-V target with debug information
Steps to Reproduce
dxc.exe shader_ref.txt -E mainvert -T vs_6_0 -spirv -fspv-target-env=vulkan1.1 -Wall -Wno-unused-const-variable -D imBINDLESS=1 -fspv-extension=SPV_EXT_descriptor_indexing -fspv-extension=SPV_KHR_non_semantic_info -fspv-debug=vulkan-with-source
ends up with the following error:
fatal error: generated SPIR-V is invalid: NonSemantic.Shader.DebugInfo.100 DebugTypeMember: operand Column End (171) is larger then Line 475 column length of 23 found in the DebugSource text
%210 = OpExtInst %void %1 DebugTypeMember %24 %164 %167 %uint_475 %uint_171 %uint_0 %uint_128 %uint_3
Another similar issue:
dxc.exe def_forward.txt -E mainfrag -T ps_6_0 -spirv -fspv-target-env=vulkan1.1 -Wall -Wno-unused-const-variable -D imBINDLESS=1 -fspv-extension=SPV_EXT_descriptor_indexing -fspv-extension=SPV_KHR_non_semantic_info -fspv-debug=vulkan-with-source
ends up with the following error:
fatal error: generated SPIR-V is invalid: NonSemantic.Shader.DebugInfo.100 DebugLocalVariable: operand Column End (58) is larger then Line 7798 column length of 32 found in the DebugSource text
%1505 = OpExtInst %void %2 DebugLocalVariable %163 %1023 %990 %uint_7798 %uint_58 %1372 %uint_4 %uint_6
Weirdly, the same source with some #line directives compiled successfully (not sure the produced SPIR-V is correct however):
dxc.exe def_forward_line.txt -E mainfrag -T ps_6_0 -spirv -fspv-target-env=vulkan1.1 -Wall -Wno-unused-const-variable -D imBINDLESS=1 -fspv-extension=SPV_EXT_descriptor_indexing -fspv-extension=SPV_KHR_non_semantic_info -fspv-debug=vulkan-with-source
Actual Behavior
Compiler emits an error:
fatal error: generated SPIR-V is invalid: NonSemantic.Shader.DebugInfo.100 DebugTypeMember: operand Column End (171) is larger then Line 475 column length of 23 found in the DebugSource text
%210 = OpExtInst %void %1 DebugTypeMember %24 %164 %167 %uint_475 %uint_171 %uint_0 %uint_128 %uint_3
Environment
- DXC version I compiled latest head from master (78d7aba5d3b21de3854b1f0f7d4e0615abf067cc) but it also occurs with the latest official releases (v1.10.2605.24)
- Host Operating System Windows 11
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the reported dxc.exe commands with shader_ref.txt, def_forward.txt, and def_forward_line.txt, focusing on -spirv and -fspv-debug=vulkan-with-source. Trace the SPIR-V debug information generation that produces DebugTypeMember and DebugLocalVariable locations, then verify that the generated module passes validation for both reproductions without the column-length errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100