From 0d16228ae22fa2e1a00e62dc099eea08da7717fe Mon Sep 17 00:00:00 2001 From: jarcherNV Date: Fri, 6 Jun 2025 14:30:06 -0700 Subject: Add command line option for separate debug info (#7178) * Add command line option for separate debug info Add command line arg -separate-debug-info which, if provided, produces both a .spv and a .dbg.spv file. The .dbg.spv file contains full debug info and the .spv file has all debug info stripped out. Also add a DebugBuildIdentifier instruction to store a unique hash in both the output files, so they can be more easily matched together. A matching API is provided to allow using the Slang API to retrieve a base and debug SPIRV as well as the debug build identifier string. --- tests/spirv/separate-debug.slang | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/spirv/separate-debug.slang (limited to 'tests/spirv/separate-debug.slang') diff --git a/tests/spirv/separate-debug.slang b/tests/spirv/separate-debug.slang new file mode 100644 index 000000000..65b015acf --- /dev/null +++ b/tests/spirv/separate-debug.slang @@ -0,0 +1,31 @@ +//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage compute -g2 -emit-spirv-directly -separate-debug-info + +struct TestType +{ + float memberA; + float3 memberB; + RWStructuredBuffer memberC; + float getValue() + { + return memberA; + } +} +RWStructuredBuffer result; +void main() +{ + TestType t; + t.memberA = 1.0; + t.memberB = float3(1, 2, 3); + t.memberC = result; + var val = t.getValue(); + result[0] = val + t.memberB.x; +} + +// CHECK: DebugBuildIdentifier +// CHECK-NOT: OpExtInst %void {{.*}} DebugExpression +// CHECK-NOT: DebugTypeMember +// CHECK-NOT: DebugTypeComposite +// CHECK-NOT: DebugFunctionDefinition +// CHECK-NOT: DebugScope +// CHECK-NOT: DebugLine +// CHECK-NOT: DebugValue -- cgit v1.2.3