microsoft / microsoft/DirectXShaderCompiler
[SPIR-V] Invalid debug data generated
@SteveUrquhart is already working on this.
Since Oct 14, 2025.
- Dominant language
- C++
- Stars
- 3.7k
- Forks
- 900
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 44
Description
Description
Recent version of the compiler produces nonsense debug data, making the NV driver crash when trying to debug a shader with RenderDoc.
Steps to Reproduce
Explanation from @baldurk who had a look at the crash and was nice enough to take the time to analyze the issue:
In the attached SPIR-V which is the shader you submitted originally in your first report that you reported from v1.37, taking this struct for example:
struct imSHybridDepthRepartion
{
float2 m_vNearFarZ;
uint m_nGridDimZ;
float2 m_vSplitSchemeData;
float m_fDepthBias;
float m_fFarOverNear;
// member functions
};
these are the declarations of it:
%57 = OpString "imSHybridDepthRepartion"
%63 = OpString "this"
; source
%1520 = OpExtInst %void %2 DebugSource %45
; uint
%1507 = OpExtInst %void %2 DebugTypeBasic %40 %uint_32 %uint_6 %uint_0
; float
%1521 = OpExtInst %void %2 DebugTypeBasic %46 %uint_32 %uint_3 %uint_0
; float2
%1522 = OpExtInst %void %2 DebugTypeVector %1521 %uint_2
; m_vNearFarZ
%1524 = OpExtInst %void %2 DebugTypeMember %47 %1522 %1520 %uint_371 %uint_9 %uint_0 %uint_64 %uint_3
; m_nGridDimZ
%1528 = OpExtInst %void %2 DebugTypeMember %48 %1507 %1520 %uint_372 %uint_7 %uint_64 %uint_32 %uint_3
; m_vSplitSchemeData
%1531 = OpExtInst %void %2 DebugTypeMember %49 %1522 %1520 %uint_373 %uint_9 %uint_96 %uint_64 %uint_3
; m_fDepthBias
%1534 = OpExtInst %void %2 DebugTypeMember %50 %1521 %1520 %uint_374 %uint_8 %uint_160 %uint_32 %uint_3
; m_fFarOverNear
%1538 = OpExtInst %void %2 DebugTypeMember %51 %1521 %1520 %uint_375 %uint_8 %uint_192 %uint_32 %uint_3
; imSHybridDepthRepartion with members as above (%1543 on are functions)
%1542 = OpExtInstWithForwardRefsKHR %void %2 DebugTypeComposite %57 %uint_1 %1520 %uint_369 %uint_8 %1516 %57 %uint_224 %uint_3 %1524 %1528 %1531 %1534 %1538 %1543 %1547 %1551 %1564 %1555 %1559
; instance of type imSHybridDepthRepartion, 'this' variable
%1577 = OpExtInst %void %2 DebugLocalVariable %63 %1542 %1520 %uint_440 %uint_2 %1564 %uint_288 %uint_1
And here are a couple of examples of garbage debug values:
; empty debug expression
%1472 = OpExtInst %void %2 DebugExpression
; access chain 1 identifies m_nGridDimZ, impossible to index into
%14870 = OpExtInst %void %2 DebugValue %1577 %12323 %1472 %int_1 %int_0 %int_0
; similarly impossible access chain
%14882 = OpExtInst %void %2 DebugValue %1577 %12043 %1472 %int_1 %int_0 %int_1 %int_0 %int_0
Actual Behavior
RenderDoc crash because of a crash in NV drivers (out-of-bound access)
Environment
- DXC version #50764bac3d4048144e9ada5f5a742c82cc97cc9a (31/07/2025)
- 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.
Assessment
This issue has not been assessed yet.