Giovanni Mascellani : tests: Test matrix multiplication.

Alexandre Julliard julliard at winehq.org
Mon Feb 14 15:40:56 CST 2022


Module: vkd3d
Branch: master
Commit: 6426161feac0e30b347a0d7e678df878b4a8bde7
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=6426161feac0e30b347a0d7e678df878b4a8bde7

Author: Giovanni Mascellani <gmascellani at codeweavers.com>
Date:   Fri Feb 11 21:04:04 2022 +0100

tests: Test matrix multiplication.

Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Francisco Casas <fcasas at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 Makefile.am                |   2 +
 tests/hlsl-mul.shader_test | 290 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 292 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 7a7bd6a..687b624 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -79,6 +79,7 @@ vkd3d_shader_tests = \
 	tests/hlsl-invalid.shader_test \
 	tests/hlsl-majority-pragma.shader_test \
 	tests/hlsl-majority-typedef.shader_test \
+	tests/hlsl-mul.shader_test \
 	tests/hlsl-nested-arrays.shader_test \
 	tests/hlsl-numeric-constructor-truncation.shader_test \
 	tests/hlsl-numeric-types.shader_test \
@@ -319,6 +320,7 @@ XFAIL_TESTS = \
 	tests/hlsl-intrinsic-override.shader_test \
 	tests/hlsl-majority-pragma.shader_test \
 	tests/hlsl-majority-typedef.shader_test \
+	tests/hlsl-mul.shader_test \
 	tests/hlsl-nested-arrays.shader_test \
 	tests/hlsl-numeric-constructor-truncation.shader_test \
 	tests/hlsl-numeric-types.shader_test \
diff --git a/tests/hlsl-mul.shader_test b/tests/hlsl-mul.shader_test
new file mode 100644
index 0000000..7b45318
--- /dev/null
+++ b/tests/hlsl-mul.shader_test
@@ -0,0 +1,290 @@
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float4 y = float4(1.0, 2.0, 3.0, 4.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (30.0, 70.0, 110.0, 150.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4 x = float4(1.0, 2.0, 3.0, 4.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (90.0, 100.0, 110.0, 120.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float3 y = float3(1.0, 2.0, 3.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (14.0, 38.0, 62.0, 86.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float3 x = float3(1.0, 2.0, 3.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (38.0, 44.0, 50.0, 56.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float3x3 x = float3x3(1.0, 2.0, 3.0,
+                          4.0, 5.0, 6.0,
+                          7.0, 8.0, 9.0);
+    float4 y = float4(1.0, 2.0, 3.0, 4.0);
+
+    return float4(mul(x, y), 0.0);
+}
+
+[test]
+draw quad
+probe all rgba (14.0, 32.0, 50.0, 0.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4 x = float4(1.0, 2.0, 3.0, 4.0);
+    float3x3 y = float3x3(1.0, 2.0, 3.0,
+                          4.0, 5.0, 6.0,
+                          7.0, 8.0, 9.0);
+
+    return float4(mul(x, y), 0.0);
+}
+
+[test]
+draw quad
+probe all rgba (30.0, 36.0, 42.0, 0.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float x = 10.0;
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y)[1];
+}
+
+[test]
+draw quad
+probe all rgba (50.0, 60.0, 70.0, 80.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float y = 10.0;
+
+    return mul(x, y)[1];
+}
+
+[test]
+draw quad
+probe all rgba (50.0, 60.0, 70.0, 80.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float1 x = float1(10.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (10.0, 20.0, 30.0, 40.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float1 y = float1(10.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (10.0, 50.0, 90.0, 130.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float1x1 x = float1x1(10.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (10.0, 20.0, 30.0, 40.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float1x1 y = float1x1(10.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (10.0, 50.0, 90.0, 130.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float1x4 x = float1x4(1.0, 2.0, 3.0, 4.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (90.0, 100.0, 110.0, 120.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float1x4 y = float1x4(1.0, 2.0, 3.0, 4.0);
+
+    return mul(x, y)[1];
+}
+
+[test]
+draw quad
+probe all rgba (5.0, 10.0, 15.0, 20.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x1 x = float4x1(1.0, 2.0, 3.0, 4.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y)[1];
+}
+
+[test]
+draw quad
+probe all rgba (2.0, 4.0, 6.0, 8.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float4x1 y = float4x1(1.0, 2.0, 3.0, 4.0);
+
+    return mul(x, y);
+}
+
+[test]
+draw quad
+probe all rgba (30.0, 70.0, 110.0, 150.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float3x3 x = float3x3(1.0, 2.0, 3.0,
+                          4.0, 5.0, 6.0,
+                          7.0, 8.0, 9.0);
+    float4x4 y = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+
+    return mul(x, y)[1];
+}
+
+[test]
+draw quad
+probe all rgba (83.0, 98.0, 113.0, 128.0)
+
+[pixel shader]
+float4 main(float4 pos : sv_position) : sv_target
+{
+    float4x4 x = float4x4(1.0, 2.0, 3.0, 4.0,
+                          5.0, 6.0, 7.0, 8.0,
+                          9.0, 10.0, 11.0, 12.0,
+                          13.0, 14.0, 15.0, 16.0);
+    float3x3 y = float3x3(1.0, 2.0, 3.0,
+                          4.0, 5.0, 6.0,
+                          7.0, 8.0, 9.0);
+
+    return float4(mul(x, y)[1], 0.0);
+}
+
+[test]
+draw quad
+probe all rgba (78.0, 96.0, 114.0, 0.0)




More information about the wine-cvs mailing list