Signed-off-by: Giovanni Mascellani gmascellani@codeweavers.com --- Makefile.am | 2 + tests/hlsl-shape.shader_test | 121 +++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 tests/hlsl-shape.shader_test
diff --git a/Makefile.am b/Makefile.am index 3de58991..8dbbefc7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,6 +65,7 @@ vkd3d_shader_tests = \ tests/hlsl-nested-arrays.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ + tests/hlsl-shape.shader_test \ tests/hlsl-static-initializer.shader_test \ tests/hlsl-storage-qualifiers.shader_test \ tests/hlsl-struct-assignment.shader_test \ @@ -273,6 +274,7 @@ XFAIL_TESTS = \ tests/hlsl-nested-arrays.shader_test \ tests/hlsl-return-implicit-conversion.shader_test \ tests/hlsl-return-void.shader_test \ + tests/hlsl-shape.shader_test \ tests/hlsl-static-initializer.shader_test \ tests/hlsl-storage-qualifiers.shader_test \ tests/hlsl-vector-indexing.shader_test \ diff --git a/tests/hlsl-shape.shader_test b/tests/hlsl-shape.shader_test new file mode 100644 index 00000000..0d488da4 --- /dev/null +++ b/tests/hlsl-shape.shader_test @@ -0,0 +1,121 @@ +[pixel shader] +float4 main(float4 pos : sv_position) : sv_target +{ + /* Scalar and scalar */ + float x = 1.0; + float y = 2.0; + if (pos.x == 0.5) + return float4(x + y, 0.0, 0.0, 0.0); + + /* Vector and vector */ + float1 v1 = float1(1.0); + float2 v2 = float2(2.0, 3.0); + float4 v4 = float4(4.0, 5.0, 6.0, 7.0); + if (pos.x == 10.5) + return float4(v1 + v2, 0.0, 0.0); + if (pos.x == 11.5) + return float4(v1 + v4); + if (pos.x == 12.5) + return float4(v2 + v4, 0.0, 0.0); + + /* Scalar and vector */ + if (pos.x == 20.5) + return float4(x + v1, v1 + x, 0.0, 0.0); + if (pos.x == 21.5) + return float4(v4 + x); + if (pos.x == 22.5) + return float4(x + v4); + + /* Matrix and matrix */ + float1x4 m14 = float1x4(1.0, 2.0, 3.0, 4.0); + float4x1 m41 = float4x1(5.0, 6.0, 7.0, 8.0); + float2x2 m22 = float2x2(9.0, 10.0, 11.0, 12.0); + float2x3 m23 = float2x3(13.0, 14.0, 15.0, + 16.0, 17.0, 18.0); + float4x4 m44 = float4x4(35.0, 36.0, 37.0, 38.0, + 39.0, 40.0, 41.0, 42.0, + 43.0, 44.0, 45.0, 46.0, + 47.0, 48.0, 49.0, 50.0); + if (pos.x == 30.5) + return float4(m22 + m23); + if (pos.x == 31.5) + return float4(m23 + m22); + if (pos.x == 32.5) + return float4(m14 + m44); + if (pos.x == 33.5) + return float4(m44 + m14); + if (pos.x == 34.5) + return float4(m41 + m44); + if (pos.x == 35.5) + return float4(m44 + m41); + if (pos.x == 36.5) + return float4((m44 + m23)[0], 0.0); + if (pos.x == 37.5) + return float4((m44 + m23)[1], 0.0); + + /* Matrix and vector */ + if (pos.x == 50.5) + return v4 + m14; + if (pos.x == 51.5) + return m14 + v4; + if (pos.x == 52.5) + return v4 + m41; + if (pos.x == 53.5) + return m41 + v4; + if (pos.x == 54.5) + return v4 + m22; + if (pos.x == 55.5) + return m22 + v4; + if (pos.x == 56.5) + return float4(v1 + m14); + if (pos.x == 57.5) + return float4(m14 + v1); + if (pos.x == 58.5) + return float4(v2 + m41, 0.0, 0.0); + if (pos.x == 59.5) + return float4(m41 + v2, 0.0, 0.0); + + /* Matrix and scalar */ + if (pos.x == 70.5) + return (x + m44)[0]; + if (pos.x == 71.5) + return (m44 + x)[1]; + + return float4(0.0, 0.0, 0.0, 0.0); +} + +[test] +draw quad +probe rgba (0, 0) (3.0, 0.0, 0.0, 0.0) + +probe rgba (10, 0) (3.0, 4.0, 0.0, 0.0) +probe rgba (11, 0) (5.0, 6.0, 7.0, 8.0) +probe rgba (12, 0) (6.0, 8.0, 0.0, 0.0) + +probe rgba (20, 0) (2.0, 2.0, 0.0, 0.0) +probe rgba (21, 0) (5.0, 6.0, 7.0, 8.0) +probe rgba (22, 0) (5.0, 6.0, 7.0, 8.0) + +probe rgba (30, 0) (22.0, 24.0, 27.0, 29.0) +probe rgba (31, 0) (22.0, 24.0, 27.0, 29.0) +probe rgba (32, 0) (36.0, 38.0, 40.0, 42.0) +probe rgba (33, 0) (36.0, 38.0, 40.0, 42.0) +probe rgba (34, 0) (40.0, 45.0, 50.0, 55.0) +probe rgba (35, 0) (40.0, 45.0, 50.0, 55.0) +probe rgba (36, 0) (48.0, 50.0, 52.0, 0.0) +probe rgba (37, 0) (55.0, 57.0, 59.0, 0.0) + +probe rgba (50, 0) (5.0, 7.0, 9.0, 11.0) +probe rgba (51, 0) (5.0, 7.0, 9.0, 11.0) +probe rgba (52, 0) (9.0, 11.0, 13.0, 15.0) +probe rgba (53, 0) (9.0, 11.0, 13.0, 15.0) +probe rgba (54, 0) (13.0, 15.0, 17.0, 19.0) +probe rgba (55, 0) (13.0, 15.0, 17.0, 19.0) +probe rgba (56, 0) (2.0, 3.0, 4.0, 5.0) +probe rgba (57, 0) (2.0, 3.0, 4.0, 5.0) +probe rgba (58, 0) (7.0, 9.0, 0.0, 0.0) +probe rgba (59, 0) (7.0, 9.0, 0.0, 0.0) + + +probe rgba (70, 0) (36.0, 37.0, 38.0, 39.0) +probe rgba (71, 0) (40.0, 41.0, 42.0, 43.0)