From: Matteo Bruni Subject: Re: [PATCH vkd3d 3/5] tests: Test matrix multiplication. Message-Id: Date: Thu, 2 Sep 2021 22:08:57 +0200 In-Reply-To: <20210831144023.66911-3-gmascellani@codeweavers.com> References: <20210831144023.66911-1-gmascellani@codeweavers.com> <20210831144023.66911-3-gmascellani@codeweavers.com> On Tue, Aug 31, 2021 at 4:40 PM Giovanni Mascellani wrote: > > Signed-off-by: Giovanni Mascellani > --- > Makefile.am | 2 + > tests/hlsl-mul.shader_test | 78 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 80 insertions(+) > create mode 100644 tests/hlsl-mul.shader_test > > diff --git a/Makefile.am b/Makefile.am > index 8dbbefc7..f9d232e2 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -62,6 +62,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-return-implicit-conversion.shader_test \ > tests/hlsl-return-void.shader_test \ > @@ -271,6 +272,7 @@ XFAIL_TESTS = \ > tests/hlsl-duplicate-modifiers.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-return-implicit-conversion.shader_test \ > tests/hlsl-return-void.shader_test \ > diff --git a/tests/hlsl-mul.shader_test b/tests/hlsl-mul.shader_test > new file mode 100644 > index 00000000..4d5af691 > --- /dev/null > +++ b/tests/hlsl-mul.shader_test > @@ -0,0 +1,78 @@ > +[pixel shader] > +float4 main(float4 pos : sv_position) : sv_target > +{ > + float x = 10.0; > + float1 v1 = float1(10.0); > + float3 v3 = float3(1.0, 2.0, 3.0); > + float4 v4 = float4(1.0, 2.0, 3.0, 4.0); > + float1x1 m11 = float1x1(10.0); > + float1x4 m14 = float1x4(1.0, 2.0, 3.0, 4.0); > + float4x1 m41 = float4x1(1.0, 2.0, 3.0, 4.0); > + float3x3 m33 = float3x3(1.0, 2.0, 3.0, > + 4.0, 5.0, 6.0, > + 7.0, 8.0, 9.0); > + float4x4 m44 = 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); > + > + if (pos.x == 0.5) > + return mul(m44, v4); > + if (pos.x == 1.5) > + return mul(v4, m44); > + if (pos.x == 2.5) > + return mul(m44, v3); > + if (pos.x == 3.5) > + return mul(v3, m44); > + if (pos.x == 4.5) > + return float4(mul(m33, v4), 0.0); > + if (pos.x == 5.5) > + return float4(mul(v4, m33), 0.0); > + if (pos.x == 6.5) > + return mul(x, m44)[1]; > + if (pos.x == 7.5) > + return mul(m44, x)[1]; > + if (pos.x == 8.5) > + return mul(v1, m44); > + if (pos.x == 9.5) > + return mul(m44, v1); More differences between scalar and vector1. Nice catch.