From: Giovanni Mascellani Subject: Re: [PATCH vkd3d v2 07/10] vkd3d-shader/hlsl: Support complex numeric initializers. Message-Id: <6c03d4ad-bd31-54f6-5a3c-7ee97e7ed10d@codeweavers.com> Date: Fri, 14 Jan 2022 09:26:57 +0100 In-Reply-To: References: <20220110193318.267854-7-fcasas@codeweavers.com> Hi, Il 13/01/22 19:57, Zebediah Figura (she/her) ha scritto: > This suggests to me that what we should probably do is actually > "flatten" the initializer beforehand. That is, generate load and swizzle > instructions such that every initializer argument is a scalar. E.g. the > above would become {1, 2, u.x, u.y, u.z, u.w, 3, 4}. This generates a > lot of unnecessary scalar ops, but I think we want a vectorization pass > anyway. Fully agreed. Initially I thought this could arrive later, but I'm convincing myself that if we (meaning, in this case, Francisco :-P ) bite the bullet and immediately write the flattening, it becomes easier to check the rest and we have cleaner code. As I already said, there are cases that are treated a bit differently, like "float3 x = float4(1, 2, 3, 4)", in which it is sensible to fall back to a simple assignment. Giovanni.