From 8b4f0f348adcfd7293e372130805632d479a41da Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Wed, 18 Dec 2024 00:13:22 -0600 Subject: [PATCH] tests: Adjust arithmetic-float.shader_test to pass with 1.x. Pixel shader 1.x constants must be between -1 and 1, or they will be clamped, even constants defined in the shader. Also mark 1.x-specific features if any. --- tests/hlsl/arithmetic-float.shader_test | 35 +++++++++++-------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/tests/hlsl/arithmetic-float.shader_test b/tests/hlsl/arithmetic-float.shader_test index 866eb607..3a708d48 100644 --- a/tests/hlsl/arithmetic-float.shader_test +++ b/tests/hlsl/arithmetic-float.shader_test @@ -1,41 +1,41 @@ [pixel shader] float4 main() : SV_TARGET { - float x = 5.0; - float y = 15.0; + float x = 0.05; + float y = 0.15; return float4(x + y, x - y, x * y, x / y); } [test] draw quad -probe (0, 0) rgba (20.0, -10.0, 75.0, 0.33333333) +probe (0, 0) rgba (0.20, -0.10, 0.0075, 0.33333333) 1 [pixel shader] float4 main() : SV_TARGET { - float x = 5.0; - float y = 15.0; + float x = 0.05; + float y = 0.15; - return float4(x % y, +x, -x, y / x); + return float4(x % y, +x, -x, y % x); } [test] draw quad -probe (0, 0) rgba (5.0, 5.0, -5.0, 3.0) +probe (0, 0) rgba (0.05, 0.05, -0.05, 0.0) 1 [pixel shader] float4 main() : SV_TARGET { - float x = 42; - float y = 5; + float x = 0.42; + float y = 0.05; return float4(x % y, -x % y, x % -y, -x % -y); } [test] draw quad -probe (0, 0) rgba (2.0, -2.0, 2.0, -2.0) 16 +probe (0, 0) rgba (0.02, -0.02, 0.02, -0.02) 16 [pixel shader] float4 main() : SV_TARGET @@ -53,21 +53,17 @@ probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) [pixel shader] float4 main() : sv_target { - float4 x = {5.0, -42.1, 4.0, 45.0}; - float4 y = {15.0, -5.0, 4.1, 5.0}; + float4 x = {0.5, -4.21, 0.4, 45.0}; + float4 y = {1.5, -0.5, 0.41, 5.0}; return x % y; } [test] draw quad -probe (0, 0) rgba (5.0, -2.1, 4.0, 0.0) 6 +probe (0, 0) rgba (0.5, -0.21, 0.4, 0.0) 6 -[require] -% Infinities are not allowed in SM1 -shader model >= 4.0 - -[pixel shader] +[pixel shader fail(sm>=2&sm<4)] float4 main() : SV_TARGET { float x = 1; @@ -78,4 +74,5 @@ float4 main() : SV_TARGET [test] draw quad -probe (0, 0) rgba (1e99, 1e99, 1e99, 1e99) +if(sm<2) probe (0, 0) rgba (0, 0, 0, 0) +if(sm>=4) probe (0, 0) rgba (1e99, 1e99, 1e99, 1e99)