From e40b191943527c67ee208495e47fe3497d654903 Mon Sep 17 00:00:00 2001 From: Elizabeth Figura Date: Wed, 18 Dec 2024 00:21:35 -0600 Subject: [PATCH] tests: Adjust arithmetic-int.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-int.shader_test | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/tests/hlsl/arithmetic-int.shader_test b/tests/hlsl/arithmetic-int.shader_test index 3d1b7420..e9e247e3 100644 --- a/tests/hlsl/arithmetic-int.shader_test +++ b/tests/hlsl/arithmetic-int.shader_test @@ -4,12 +4,12 @@ float4 main() : SV_TARGET int x = 5; int y = 15; - return float4(x + y, x - y, x * y, x / y); + return float4(x + y, x - y, x * y, x / y) / 100.0; } [test] draw quad -probe (0, 0) rgba (20.0, -10.0, 75.0, 0.0) +probe (0, 0) rgba (0.20, -0.10, 0.75, 0.0) 1 [pixel shader] float4 main() : SV_TARGET @@ -17,12 +17,12 @@ float4 main() : SV_TARGET int x = 5; int y = 15; - return float4(x % y, +x, -x, y / x); + return float4(x % y, +x, -x, y / x) / 10.0; } [test] draw quad -probe (0, 0) rgba (5.0, 5.0, -5.0, 3.0) +probe (0, 0) rgba (0.5, 0.5, -0.5, 0.3) [pixel shader] float4 main() : SV_TARGET @@ -30,12 +30,12 @@ float4 main() : SV_TARGET int x = 42; int y = 5; - return float4(x / y, -x / y, x / -y, -x / -y); + return float4(x / y, -x / y, x / -y, -x / -y) / 10.0; } [test] draw quad -probe (0, 0) rgba (8.0, -8.0, -8.0, 8.0) +probe (0, 0) rgba (0.8, -0.8, -0.8, 0.8) [pixel shader] float4 main() : SV_TARGET @@ -43,12 +43,12 @@ float4 main() : SV_TARGET int x = 42; int y = 5; - return float4(x % y, -x % y, x % -y, -x % -y); + return float4(x % y, -x % y, x % -y, -x % -y) / 10.0; } [test] draw quad -probe (0, 0) rgba (2.0, -2.0, 2.0, -2.0) +probe (0, 0) rgba (0.2, -0.2, 0.2, -0.2) [pixel shader] float4 main() : SV_TARGET @@ -56,12 +56,12 @@ float4 main() : SV_TARGET int x = 45; int y = 5; - return float4(x / y, -x / y, x / -y, -x / -y); + return float4(x / y, -x / y, x / -y, -x / -y) / 10.0; } [test] draw quad -probe (0, 0) rgba (9.0, -9.0, -9.0, 9.0) +probe (0, 0) rgba (0.9, -0.9, -0.9, 0.9) 1 [pixel shader] float4 main() : SV_TARGET @@ -76,8 +76,7 @@ float4 main() : SV_TARGET draw quad probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) -[pixel shader fail(sm<6)] -// On SM1 this gives hr 0x88760b59. +[pixel shader fail(sm>=2&sm<6)] float4 main() : SV_TARGET { int x = 1; @@ -90,8 +89,8 @@ float4 main() : SV_TARGET draw quad probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) -[pixel shader fail(sm<6)] -// On SM1 this gives hr 0x88760b59. +% Allowed regardless of shader model on 31 and below +[pixel shader fail(sm>=2&sm<6)] float4 main() : SV_TARGET { int x = 1; @@ -106,7 +105,8 @@ probe (0, 0) rgba (0.0, 0.0, 0.0, 0.0) [require] -shader model >= 4.0 +% Skip 1.x because of clamping. +shader model >= 2.0 [pixel shader] float4 main() : SV_TARGET @@ -119,7 +119,8 @@ float4 main() : SV_TARGET [test] draw quad -if(sm<6) probe (0,0) rgba (-2147483648.0, -2147483648.0, -2147483648.0, -2147483648.0) +if(sm<4) todo probe (0,0) rgba ( 2147483648.0, 2147483648.0, 2147483648.0, 2147483648.0) +if(sm>=4&sm<6) probe (0,0) rgba (-2147483648.0, -2147483648.0, -2147483648.0, -2147483648.0) if(sm>=6) probe (0,0) rgba (0.0, 0.0, 0.0, 0.0)