From 4f7c1172960ead0465670594821ea46575f37dc9 Mon Sep 17 00:00:00 2001 From: Francisco Casas Date: Tue, 14 Jan 2025 20:54:19 -0300 Subject: [PATCH] tests: Test casting negative floats to int. Turns out we are not doing this correctly in SM1, because the rounding should be to the number that is closer to zero and lower_casts_to_int() doesn't do that. A vertex shader test is added since in SM1 they must rely on the SLT operation instead of the CMP operation. --- tests/hlsl/cast-to-int.shader_test | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/tests/hlsl/cast-to-int.shader_test b/tests/hlsl/cast-to-int.shader_test index c982968b..604ea263 100644 --- a/tests/hlsl/cast-to-int.shader_test +++ b/tests/hlsl/cast-to-int.shader_test @@ -9,9 +9,30 @@ float4 main() : sv_target } [test] -uniform 0 float4 10.3 11.5 12.8 13.1 +uniform 0 float4 10.3 -11.6 12.8 13.1 draw quad -probe (0, 0) rgba (10, 11, 12, 0) +todo(sm<4) probe (0, 0) rgba(10, -11, 12, 0) + + +[vertex shader] +uniform float4 f; + +void main(float4 pos : position, out float4 t1 : TEXCOORD1, out float4 out_pos : sv_position) +{ + out_pos = pos; + t1 = (int4)f; +} + +[pixel shader] +float4 main(float4 t1 : TEXCOORD1) : sv_target +{ + return t1; +} + +[test] +uniform 0 float4 -0.4 -0.7 -12.8 14.8 +draw quad +todo(sm<4) probe (0, 0) rgba(0, 0, -12, 14) [pixel shader todo(sm<4)]