From 5dc96ab8d66ba0107a70c24fa74d07ead1373abf Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Thu, 6 Nov 2025 15:00:16 -0300 Subject: [PATCH] tests/hlsl: Test which shader models allow FOG and PSIZE. --- Makefile.am | 1 + tests/hlsl/attrout-semantics.shader_test | 75 ++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 tests/hlsl/attrout-semantics.shader_test diff --git a/Makefile.am b/Makefile.am index 886a42db0..b54dfff2a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,6 +69,7 @@ vkd3d_shader_tests = \ tests/hlsl/asint.shader_test \ tests/hlsl/asuint.shader_test \ tests/hlsl/attributes.shader_test \ + tests/hlsl/attrout-semantics.shader_test \ tests/hlsl/barriers.shader_test \ tests/hlsl/bitwise-assignment.shader_test \ tests/hlsl/bitwise.shader_test \ diff --git a/tests/hlsl/attrout-semantics.shader_test b/tests/hlsl/attrout-semantics.shader_test new file mode 100644 index 000000000..91befd109 --- /dev/null +++ b/tests/hlsl/attrout-semantics.shader_test @@ -0,0 +1,75 @@ +[require] +compile shader model 2.0 +compile shader model 3.0 + +% This compiles since FOG is not referenced. +[pixel shader] +float4 main(float fog : FOG) : sv_target +{ + return 0; +} + +% This compiles since PSIZE is not referenced +[pixel shader] +float4 main(float psize : PSIZE) : sv_target +{ + return 0; +} + +[vertex shader] +void main(float4 pos : position, out float fog : fog, out float4 out_pos : sv_position) +{ + fog = 1.0; + out_pos = pos; +} + +[pixel shader] +float4 main() : sv_target +{ + return 1.0; +} + +[test] +draw quad +probe (0, 0) f32(1, 1, 1, 1) + +% FOG can be used as a pixel shader input in ps_3_0, but not ps_2_0. +% On ps_4_0 and above, it behaves as a regular semantic, without sysval. +[pixel shader fail(sm<3) todo(sm<3)] +float4 main(float fog : FOG) : sv_target +{ + return fog; +} + +[test] +draw quad +probe (0, 0) f32(1, 1, 1, 1) + +[vertex shader] +void main(float4 pos : position, out float psize : psize, out float4 out_pos : sv_position) +{ + psize = 1.0; + out_pos = pos; +} + +[pixel shader] +float4 main() : sv_target +{ + return 1.0; +} + +[test] +draw quad +probe (0, 0) f32(1, 1, 1, 1) + +% PSIZE cannot be used as a pixel shader input in ps_2_0 nor ps_3_0. +% On ps_4_0 and above, it behaves as a regular semantic, without sysval. +[pixel shader fail(sm<4) todo(sm<4)] +float4 main(float psize : PSIZE) : sv_target +{ + return psize; +} + +[test] +draw quad +probe (0, 0) f32(1, 1, 1, 1)