From e23b3c84f6cf38b60b3e0a900f943ab671e400fa Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Thu, 30 Oct 2025 14:49:07 -0300 Subject: [PATCH] tests/hlsl: Test clip distance semantic indexes above the 0-1 range. --- tests/hlsl/clip-cull-distance.shader_test | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/hlsl/clip-cull-distance.shader_test b/tests/hlsl/clip-cull-distance.shader_test index 6387e0567..98985a278 100644 --- a/tests/hlsl/clip-cull-distance.shader_test +++ b/tests/hlsl/clip-cull-distance.shader_test @@ -185,6 +185,56 @@ probe rtv 0 (480, 120) f32(0.0, 0.0, 0.0, 1.0) probe rtv 0 (480, 240) f32(0.0, 0.0, 0.0, 1.0) probe rtv 0 (480, 360) f32(0.0, 0.0, 0.0, 1.0) +[vertex shader fail(sm<6)] +struct vertex_data +{ + float4 position : SV_POSITION; // o0.xyzw + float3 clipA : SV_CLIPDISTANCE2; // o1.xyz + float2 clipB : SV_CLIPDISTANCE1; // o2.xy + float cull : SV_CULLDISTANCE; // o1.w + float clipC : SV_CLIPDISTANCE0; // o2.z +}; + +void main(float4 position : POSITION, out vertex_data vertex) +{ + vertex.position = position; + vertex.clipA = float3(10, 20, 30); + vertex.clipB = float2(40, 50); + vertex.cull = 1.0; + vertex.clipC = -position.x; // Removes all pixels on the right side of the render target. +} + +[pixel shader fail(sm<6)] +struct vertex_data +{ + float4 position : SV_POSITION; // v0.xyzw + float3 clipA : SV_CLIPDISTANCE2; // v1.xyz + float2 clipB : SV_CLIPDISTANCE1; // v2.xy + float cull : SV_CULLDISTANCE; // v1.w + float clipC : SV_CLIPDISTANCE0; // v2.z +}; + +float4 main(struct vertex_data vertex) : SV_Target +{ + return float4(vertex.clipA.z, vertex.clipB.y, vertex.cull, round(10000 * vertex.clipC)); +} + +[test] +clear rtv 0 0.0 0.0 0.0 1.0 +todo draw triangle list 27 +probe rtv 0 (160, 120) f32(30.0, 50.0, 1.0, 4984) +probe rtv 0 (160, 240) f32(30.0, 50.0, 1.0, 4984) +probe rtv 0 (160, 360) f32(30.0, 50.0, 1.0, 4984) +probe rtv 0 (319, 120) f32(30.0, 50.0, 1.0, 16) +probe rtv 0 (319, 240) f32(30.0, 50.0, 1.0, 16) +probe rtv 0 (319, 360) f32(30.0, 50.0, 1.0, 16) +probe rtv 0 (320, 120) f32(0.0, 0.0, 0.0, 1.0) +probe rtv 0 (320, 240) f32(0.0, 0.0, 0.0, 1.0) +probe rtv 0 (320, 360) f32(0.0, 0.0, 0.0, 1.0) +probe rtv 0 (480, 120) f32(0.0, 0.0, 0.0, 1.0) +probe rtv 0 (480, 240) f32(0.0, 0.0, 0.0, 1.0) +probe rtv 0 (480, 360) f32(0.0, 0.0, 0.0, 1.0) + [require] shader model >= 4.0