diff options
author | Zebediah Figura <zfigura@codeweavers.com> | 2022-04-14 02:54:12 +0300 |
---|---|---|
committer | Giovanni Mascellani <gmascellani@codeweavers.com> | 2022-07-26 15:48:55 +0300 |
commit | 74dcd5e9a2b5f295373b80569e4b1d06d6860d36 (patch) | |
tree | 9c691bca5a0262519c6021a6be4d0ee4de0fe755 | |
parent | 90071a06720142c2cce5f4fb9a43306e35b1909d (diff) |
[fixme] tests: Add tests for clamping and special values in float-to-int conversion.
FIXME: These are just broken at the moment. We need to probe non-float values.
-rw-r--r-- | tests/cast-to-int.shader_test | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/cast-to-int.shader_test b/tests/cast-to-int.shader_test index 4c5d0e2f..b46bf114 100644 --- a/tests/cast-to-int.shader_test +++ b/tests/cast-to-int.shader_test @@ -22,6 +22,7 @@ uniform 3 float -3.6 draw quad todo probe all rgba (0.5, 0.5, 0.5, 0.5) + [pixel shader] float4 main() : sv_target @@ -42,3 +43,55 @@ float4 main() : sv_target [test] draw quad probe all rgba (0.5, 0.5, 0.5, 0.5) + + +% Large values are clamped. + +[pixel shader] + +int4 main(uniform float2 u) : sv_target +{ + float2 f = float2(-3000000000.0, 3000000000.0); + + return int4(int2(u), int2(f)); +} + +[test] +uniform 0 float4 -3000000000.0 3000000000.0 0 0 +draw quad +todo probe all rgba (-2147483648.0, 2147483648.0, -2147483648.0, 2147483648.0) + + +% Infinity is also clamped. + +[pixel shader] + +int4 main(uniform float2 u) : sv_target +{ + float2 f = float2(1.0 / 0, -1.0 / 0); + + return int4(int2(u), int2(f)); +} + +[test] +uniform 0 float4 INF -INF 0 0 +draw quad +todo probe all rgba (2147483648.0, -2147483648.0, 2147483648.0, -2147483648.0) + + +% NaN is converted to zero. + +[pixel shader] + +int4 main(uniform float2 u) : sv_target +{ + float nan = 0 * (1.0 / 0); + float2 f = float2(nan, -nan); + + return int4(int2(u), int2(f)); +} + +[test] +uniform 0 float4 NaN -NaN 0 0 +draw quad +probe all rgba (0.0, 0.0, 0.0, 0.0) |