From: "Zebediah Figura (she/her)" Subject: Re: [PATCH vkd3d 2/5] tests: Test the shape of the sum of two numeric values. Message-Id: Date: Tue, 31 Aug 2021 12:32:16 -0500 In-Reply-To: <20210831144023.66911-2-gmascellani@codeweavers.com> References: <20210831144023.66911-1-gmascellani@codeweavers.com> <20210831144023.66911-2-gmascellani@codeweavers.com> On 8/31/21 9:40 AM, Giovanni Mascellani wrote: > 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 I'm not a huge fan of this name; it's not immediately clear to me what it means :-( Maybe "hlsl-expression-dimensions"? > @@ -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); > +} This doesn't compile with native for ps_2_0 either (see my comment on 5/5). Part of this is because it uses SV_Position, which is kind of my fault too as I've been using that. We should probably find a way to change that to texcoords instead. With that hacked out of the way, it breaks because of the following error: Z:\home\hazel\test.hlsl(83,38): error X5608: Compiled shader code uses too many arithmetic instruction slots (83). Max. allowed by the target (ps_2_0) is 64. Consider increasing optimization level to reduce instruction count. (Increasing optimization level does nothing, of course.)