From e9ff88469e4e3d45b2cdf09df016ecc2199af2d0 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 7 Mar 2022 19:55:40 -0600 Subject: [PATCH] tests: Split hlsl-operations into individual test units. Partly to make the tests easier to navigate, and partly to allow marking some tests as SM4+. Signed-off-by: Zebediah Figura Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- Makefile.am | 12 +- tests/arithmetic-float.shader_test | 25 ++ tests/arithmetic-int.shader_test | 25 ++ tests/arithmetic-uint.shader_test | 25 ++ tests/bitwise.shader_test | 129 ++++++++++ tests/hlsl-operations.shader_test | 367 ----------------------------- tests/logic-operations.shader_test | 158 +++++++++++++ 7 files changed, 372 insertions(+), 369 deletions(-) create mode 100644 tests/arithmetic-float.shader_test create mode 100644 tests/arithmetic-int.shader_test create mode 100644 tests/arithmetic-uint.shader_test create mode 100644 tests/bitwise.shader_test delete mode 100644 tests/hlsl-operations.shader_test create mode 100644 tests/logic-operations.shader_test diff --git a/Makefile.am b/Makefile.am index d4402910..79aacfcd 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,10 @@ vkd3d_cross_tests = \ vkd3d_shader_tests = \ tests/abs.shader_test \ + tests/arithmetic-float.shader_test \ + tests/arithmetic-int.shader_test \ + tests/arithmetic-uint.shader_test \ + tests/bitwise.shader_test \ tests/cast-to-float.shader_test \ tests/cast-to-half.shader_test \ tests/cast-to-int.shader_test \ @@ -85,7 +89,6 @@ vkd3d_shader_tests = \ tests/hlsl-nested-arrays.shader_test \ tests/hlsl-numeric-constructor-truncation.shader_test \ tests/hlsl-numeric-types.shader_test \ - tests/hlsl-operations.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ tests/hlsl-shape.shader_test \ @@ -97,6 +100,7 @@ vkd3d_shader_tests = \ tests/hlsl-struct-semantics.shader_test \ tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \ + tests/logic-operations.shader_test \ tests/math.shader_test \ tests/pow.shader_test \ tests/preproc-if.shader_test \ @@ -309,6 +313,10 @@ tests_vkd3d_api_LDADD = libvkd3d.la @VULKAN_LIBS@ tests_vkd3d_shader_api_LDADD = libvkd3d-shader.la SHADER_TEST_LOG_COMPILER = tests/shader_runner XFAIL_TESTS = \ + tests/arithmetic-float.shader_test \ + tests/arithmetic-int.shader_test \ + tests/arithmetic-uint.shader_test \ + tests/bitwise.shader_test \ tests/cast-to-float.shader_test \ tests/cast-to-half.shader_test \ tests/cast-to-int.shader_test \ @@ -334,7 +342,6 @@ XFAIL_TESTS = \ tests/hlsl-nested-arrays.shader_test \ tests/hlsl-numeric-constructor-truncation.shader_test \ tests/hlsl-numeric-types.shader_test \ - tests/hlsl-operations.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ tests/hlsl-shape.shader_test \ @@ -342,6 +349,7 @@ XFAIL_TESTS = \ tests/hlsl-storage-qualifiers.shader_test \ tests/hlsl-vector-indexing.shader_test \ tests/hlsl-vector-indexing-uniform.shader_test \ + tests/logic-operations.shader_test \ tests/max.shader_test \ tests/sampler-offset.shader_test \ tests/trigonometry.shader_test diff --git a/tests/arithmetic-float.shader_test b/tests/arithmetic-float.shader_test new file mode 100644 index 00000000..dcda1bcf --- /dev/null +++ b/tests/arithmetic-float.shader_test @@ -0,0 +1,25 @@ +[pixel shader] +float4 main() : SV_TARGET +{ + float x = 5.0; + float y = 15.0; + + return float4(x + y, x - y, x * y, x / y); +} + +[test] +draw quad +probe all rgba (20.0, -10.0, 75.0, 0.33333333) + +[pixel shader] +float4 main() : SV_TARGET +{ + float x = 5.0; + float y = 15.0; + + return float4(x % y, +x, -x, y / x); +} + +[test] +draw quad +probe all rgba (5.0, 5.0, -5.0, 3.0) diff --git a/tests/arithmetic-int.shader_test b/tests/arithmetic-int.shader_test new file mode 100644 index 00000000..959f9403 --- /dev/null +++ b/tests/arithmetic-int.shader_test @@ -0,0 +1,25 @@ +[pixel shader] +float4 main() : SV_TARGET +{ + int x = 5; + int y = 15; + + return float4(x + y, x - y, x * y, x / y); +} + +[test] +draw quad +probe all rgba (20.0, -10.0, 75.0, 0.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int x = 5; + int y = 15; + + return float4(x % y, +x, -x, y / x); +} + +[test] +draw quad +probe all rgba (5.0, 5.0, -5.0, 3.0) diff --git a/tests/arithmetic-uint.shader_test b/tests/arithmetic-uint.shader_test new file mode 100644 index 00000000..d73947f9 --- /dev/null +++ b/tests/arithmetic-uint.shader_test @@ -0,0 +1,25 @@ +[pixel shader] +float4 main() : SV_TARGET +{ + uint x = 5; + uint y = 15; + + return float4(x + y, x - y, x * y, x / y); +} + +[test] +draw quad +probe all rgba (20.0, 4294967296.0, 75.0, 0.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint x = 5; + uint y = 15; + + return float4(x % y, +x, -x, y / x); +} + +[test] +draw quad +probe all rgba (5.0, 5.0, 4294967296.0, 3.0) diff --git a/tests/bitwise.shader_test b/tests/bitwise.shader_test new file mode 100644 index 00000000..679cf9cd --- /dev/null +++ b/tests/bitwise.shader_test @@ -0,0 +1,129 @@ +[pixel shader] +float4 main() : SV_TARGET +{ + int x = 5; + int y = 15; + + return float4(x >> y, y >> x, x << y, y << x); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 163840.0, 480.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int x = 5; + int y = 15; + + return float4(x & y, x | y, x ^ y, ~x); +} + +[test] +draw quad +probe all rgba (5.0, 15.0, 10.0, -6.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int zero = 0; + int one = 1; + + return float4(zero & zero, zero & one, one & zero, one & one); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int zero = 0; + int one = 1; + + return float4(zero | zero, zero | one, one | zero, one | one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int zero = 0; + int one = 1; + + return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 0.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint x = 5; + uint y = 15; + + return float4(x >> y, y >> x, x << y, y << x); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 163840.0, 480.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint x = 5; + uint y = 15; + + return float4(x & y, x | y, x ^ y, ~x); +} + +[test] +draw quad +probe all rgba (5.0, 15.0, 10.0, 4294967296.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint zero = 0; + uint one = 1; + + return float4(zero & zero, zero & one, one & zero, one & one); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint zero = 0; + uint one = 1; + + return float4(zero | zero, zero | one, one | zero, one | one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint zero = 0; + uint one = 1; + + return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 0.0) diff --git a/tests/hlsl-operations.shader_test b/tests/hlsl-operations.shader_test deleted file mode 100644 index 09846b18..00000000 --- a/tests/hlsl-operations.shader_test +++ /dev/null @@ -1,367 +0,0 @@ - -[pixel shader] -float4 main() : SV_TARGET -{ - float x = 5.0; - float y = 15.0; - - return float4(x + y, x - y, x * y, x / y); -} - -[test] -draw quad -probe all rgba (20.0, -10.0, 75.0, 0.33333333) - -[pixel shader] -float4 main() : SV_TARGET -{ - float x = 5.0; - float y = 15.0; - - return float4(x % y, +x, -x, y / x); -} - -[test] -draw quad -probe all rgba (5.0, 5.0, -5.0, 3.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - float x = 5.0; - float y = 15.0; - - return float4(x == y, x != y, x < y, x <= y); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - float x = 5.0; - float y = 15.0; - float zero = 0.0; - - return float4(x > y, x >= y, !x, !zero); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - float zero = 0.0; - float one = 1.0; - - return float4(zero && zero, zero && one, one && zero, one && one); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - float zero = 0.0; - float one = 1.0; - - return float4(zero || zero, zero || one, one || zero, one || one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int x = 5; - int y = 15; - - return float4(x + y, x - y, x * y, x / y); -} - -[test] -draw quad -probe all rgba (20.0, -10.0, 75.0, 0.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int x = 5; - int y = 15; - - return float4(x % y, +x, -x, y / x); -} - -[test] -draw quad -probe all rgba (5.0, 5.0, -5.0, 3.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int x = 5; - int y = 15; - - return float4(x == y, x != y, x < y, x <= y); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int x = 5; - int y = 15; - int zero = 0; - - return float4(x > y, x >= y, !x, !zero); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int x = 5; - int y = 15; - - return float4(x >> y, y >> x, x << y, y << x); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 163840.0, 480.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int x = 5; - int y = 15; - - return float4(x & y, x | y, x ^ y, ~x); -} - -[test] -draw quad -probe all rgba (5.0, 15.0, 10.0, -6.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int zero = 0; - int one = 1; - - return float4(zero && zero, zero && one, one && zero, one && one); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int zero = 0; - int one = 1; - - return float4(zero || zero, zero || one, one || zero, one || one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int zero = 0; - int one = 1; - - return float4(zero & zero, zero & one, one & zero, one & one); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int zero = 0; - int one = 1; - - return float4(zero | zero, zero | one, one | zero, one | one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - int zero = 0; - int one = 1; - - return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 0.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint x = 5; - uint y = 15; - - return float4(x + y, x - y, x * y, x / y); -} - -[test] -draw quad -probe all rgba (20.0, 4294967296.0, 75.0, 0.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint x = 5; - uint y = 15; - - return float4(x % y, +x, -x, y / x); -} - -[test] -draw quad -probe all rgba (5.0, 5.0, 4294967296.0, 3.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint x = 5; - uint y = 15; - - return float4(x == y, x != y, x < y, x <= y); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint x = 5; - uint y = 15; - uint zero = 0; - - return float4(x > y, x >= y, !x, !zero); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint x = 5; - uint y = 15; - - return float4(x >> y, y >> x, x << y, y << x); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 163840.0, 480.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint x = 5; - uint y = 15; - - return float4(x & y, x | y, x ^ y, ~x); -} - -[test] -draw quad -probe all rgba (5.0, 15.0, 10.0, 4294967296.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint zero = 0; - uint one = 1; - - return float4(zero && zero, zero && one, one && zero, one && one); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint zero = 0; - uint one = 1; - - return float4(zero || zero, zero || one, one || zero, one || one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint zero = 0; - uint one = 1; - - return float4(zero & zero, zero & one, one & zero, one & one); -} - -[test] -draw quad -probe all rgba (0.0, 0.0, 0.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint zero = 0; - uint one = 1; - - return float4(zero | zero, zero | one, one | zero, one | one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 1.0) - -[pixel shader] -float4 main() : SV_TARGET -{ - uint zero = 0; - uint one = 1; - - return float4(zero ^ zero, zero ^ one, one ^ zero, one ^ one); -} - -[test] -draw quad -probe all rgba (0.0, 1.0, 1.0, 0.0) diff --git a/tests/logic-operations.shader_test b/tests/logic-operations.shader_test new file mode 100644 index 00000000..360ca03b --- /dev/null +++ b/tests/logic-operations.shader_test @@ -0,0 +1,158 @@ +[pixel shader] +float4 main() : SV_TARGET +{ + float x = 5.0; + float y = 15.0; + + return float4(x == y, x != y, x < y, x <= y); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + float x = 5.0; + float y = 15.0; + float zero = 0.0; + + return float4(x > y, x >= y, !x, !zero); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + float zero = 0.0; + float one = 1.0; + + return float4(zero && zero, zero && one, one && zero, one && one); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + float zero = 0.0; + float one = 1.0; + + return float4(zero || zero, zero || one, one || zero, one || one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int x = 5; + int y = 15; + + return float4(x == y, x != y, x < y, x <= y); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int x = 5; + int y = 15; + int zero = 0; + + return float4(x > y, x >= y, !x, !zero); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int zero = 0; + int one = 1; + + return float4(zero && zero, zero && one, one && zero, one && one); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + int zero = 0; + int one = 1; + + return float4(zero || zero, zero || one, one || zero, one || one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint x = 5; + uint y = 15; + + return float4(x == y, x != y, x < y, x <= y); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint x = 5; + uint y = 15; + uint zero = 0; + + return float4(x > y, x >= y, !x, !zero); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint zero = 0; + uint one = 1; + + return float4(zero && zero, zero && one, one && zero, one && one); +} + +[test] +draw quad +probe all rgba (0.0, 0.0, 0.0, 1.0) + +[pixel shader] +float4 main() : SV_TARGET +{ + uint zero = 0; + uint one = 1; + + return float4(zero || zero, zero || one, one || zero, one || one); +} + +[test] +draw quad +probe all rgba (0.0, 1.0, 1.0, 1.0)