diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-09-02 12:51:12 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-02 12:51:12 -0700 |
| commit | 21693abbd0579107e3c03d1e5090b2653722b5de (patch) | |
| tree | d533198d4ae4096543e31f39b8f2765d4b431522 /tests/spirv | |
| parent | b46f46c5e8603fdafca258028227adf25f95807f (diff) | |
Emit DebugInfo for the legalized entry point parameters (#7703)
This commit is to emit the debug-info for the entry point parameters.
Two things are implemented/fixed in this PR:
- We were not emitting the `DebugVar` and `DebugValue` at the IR
lowering level when the type of the entry point parameter is `ConstRef`.
This commit handles the `ConstRef` case in a same way that the other
types are handled so that `DebugVar` and `DebugValues` are properly
emitted at the IR lowering level.
- Two types for Geometry shaders were incorrectly treated as not valid
types for the DebugInfo. They are `InputPatch` and `OutputPatch`. This
commit handles them as valid types for DebugInfo.
Diffstat (limited to 'tests/spirv')
| -rw-r--r-- | tests/spirv/debug-value-dynamic-index.slang | 3 | ||||
| -rw-r--r-- | tests/spirv/debug-variable-scope.slang | 41 | ||||
| -rw-r--r-- | tests/spirv/tessellation.slang | 11 |
3 files changed, 45 insertions, 10 deletions
diff --git a/tests/spirv/debug-value-dynamic-index.slang b/tests/spirv/debug-value-dynamic-index.slang index 8b4f6b43e..0d25ef545 100644 --- a/tests/spirv/debug-value-dynamic-index.slang +++ b/tests/spirv/debug-value-dynamic-index.slang @@ -1,5 +1,4 @@ -// This will be re-enabled when github #7693 is resolved -//DISABLE_TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage compute -g2 -emit-spirv-directly +//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage compute -g2 -emit-spirv-directly struct TestType { diff --git a/tests/spirv/debug-variable-scope.slang b/tests/spirv/debug-variable-scope.slang index 946c1a08b..03871f1f0 100644 --- a/tests/spirv/debug-variable-scope.slang +++ b/tests/spirv/debug-variable-scope.slang @@ -6,18 +6,47 @@ SamplerState testSampler : register(s0); struct PSIn { float4 pos : SV_Position; + float4 color : COLOR; }; float4 main(PSIn input) : SV_TARGET { - uint4 testPos = input.pos; + uint4 testPos = (uint4)input.pos; float bias = -1.0; float2 tc = testPos.xy / 32.0; - float4 colVal = testTex.SampleBias(testSampler, tc, bias); + float4 colVal = testTex.SampleBias(testSampler, tc, bias) + input.color; return float4(colVal.xyz, 1.0); } -// CHECK: %[[COMPILATION_UNIT_ID:[0-9]+]] = OpExtInst %void {{.*}} DebugCompilationUnit -// CHECK: %[[FUNC_ID:[0-9]+]] = OpExtInst %void {{.*}} DebugFunction %{{[0-9]+}} -// CHECK: DebugLocalVariable %{{[0-9]+}} %{{[0-9]+}} %{{[0-9]+}} %{{.*}} %{{.*}} %[[FUNC_ID]] -// CHECK: DebugGlobalVariable %{{[0-9]+}} %{{[0-9]+}} %{{[0-9]+}} %{{.*}} %{{.*}} %[[COMPILATION_UNIT_ID]] +// Make sure "pos" and "color" is reported as member variables +// CHECK-DAG: %[[StrPos:[0-9]+]] = OpString "pos" +// CHECK-DAG: %[[StrColor:[0-9]+]] = OpString "color" +// CHECK-DAG: DebugTypeMember %[[StrPos]] +// CHECK-DAG: DebugTypeMember %[[StrColor]] + +// Global variables should be reported as DebugGlobalVariable +// CHECK-DAG: %[[COMPILATION_UNIT_ID:[0-9]+]] = OpExtInst %void {{.*}} DebugCompilationUnit +// CHECK-DAG: DebugGlobalVariable %{{.+}} %[[COMPILATION_UNIT_ID]] %{{[0-9]+}} %testTex +// CHECK-DAG: DebugGlobalVariable %{{.+}} %[[COMPILATION_UNIT_ID]] %{{[0-9]+}} %testSampler + +// Entry point parameter is reported as DebugLocalVariable +// CHECK-DAG: %[[StrInput:[0-9]+]] = OpString "input" +// CHECK-DAG: %[[input:[A-Za-z_0-9]+]] = {{.*}} DebugLocalVariable %[[StrInput]] + +// Funciton local variable should be reported as DebugLocalVariable +// CHECK-DAG: %[[StrTestPos:[0-9]+]] = OpString "testPos" +// CHECK-DAG: DebugLocalVariable %[[StrTestPos]] + +// CHECK: %main = OpFunction %void None + +// "input.pos" is reported with DebugValue as a first member +// And its value comes from `gl_FragCoord` +// CHECK-DAG: DebugValue %[[input]] %[[input_pos:[0-9]+]] %{{[0-9]+}} %int_0 +// CHECK-DAG: OpStore %[[input_pos]] %[[gl_FragCoord_input_pos:[0-9]+]] +// CHECK-DAG: %[[gl_FragCoord_input_pos]] = OpLoad %v4float %gl_FragCoord + +// "input.color" is reported with DebugValue as a second member +// And its value comes from a global varying input +// CHECK-DAG: DebugValue %[[input]] %[[input_color:[0-9]+]] %{{[0-9]+}} %int_1 +// CHECK-DAG: OpStore %[[input_color]] %[[varying_color:[0-9]+]] +// CHECK-DAG: %[[varying_color]] = OpLoad %v4float %input_color diff --git a/tests/spirv/tessellation.slang b/tests/spirv/tessellation.slang index 9ac5860f9..67cbca07f 100644 --- a/tests/spirv/tessellation.slang +++ b/tests/spirv/tessellation.slang @@ -1,5 +1,7 @@ //TEST:SIMPLE(filecheck=HULL): -target spirv -stage hull -entry hullMain //TEST:SIMPLE(filecheck=DOMAIN): -target spirv -stage domain -entry domainMain +//TEST:SIMPLE(filecheck=DEBUGINFO): -target spirv -g2 -stage hull -entry hullMain +//TEST:SIMPLE(filecheck=DEBUGINFO): -target spirv -g2 -stage domain -entry domainMain // HULL-DAG: OpExecutionMode %hullMain SpacingEqual // HULL-DAG: OpExecutionMode %hullMain OutputVertices 4 @@ -19,6 +21,11 @@ // DOMAIN-DAG: OpExecutionMode %domainMain SpacingEqual // DOMAIN-DAG: OpExecutionMode %domainMain Quads +// Entry point params should be emitted as local-variable debug info +// DEBUGINFO: %[[patchStr:[0-9]+]] = OpString "patch" +// DEBUGINFO: %[[patchId:[a-zA-Z0-9_]+]] = {{.*}} DebugLocalVariable %[[patchStr]] +// DEBUGINFO: DebugValue %[[patchId]] + struct VS_OUT { float3 position : POSITION; @@ -61,7 +68,7 @@ HSC_OUT constants(InputPatch<VS_OUT, 4> patch) float3 p3 = patch[3].position; HSC_OUT o; - o.EdgeTessFactor[0] = dot(p0, p1); + o.EdgeTessFactor[0] = dot(p0, p1); o.EdgeTessFactor[1] = dot(p0, p3); o.EdgeTessFactor[2] = dot(p2, p3); o.EdgeTessFactor[3] = dot(p1, p2); @@ -86,7 +93,7 @@ DS_OUT domainMain( float3 p3 = patch[3].position; // Bilinear interpolation of the position in the quad - float3 interpolatedPosition = + float3 interpolatedPosition = p0 * (1 - uv.x) * (1 - uv.y) + p1 * uv.x * (1 - uv.y) + p3 * uv.x * uv.y |
