From: "Francisco Casas" Subject: Re: [PATCH vkd3d v2 07/10] vkd3d-shader/hlsl: Support complex numeric initializers. Message-Id: <46c051e79b7a419cbb77ba2ac6b005c3@codeweavers.com> Date: Wed, 12 Jan 2022 17:15:14 +0000 In-Reply-To: References: <20220110193318.267854-7-fcasas@codeweavers.com> <7ddb2af1-3120-cafd-337f-1e414fc8a25b@codeweavers.com> January 12, 2022 1:48 PM, "Giovanni Mascellani" wrote: > Hi again, > > On 12/01/22 17:35, Giovanni Mascellani wrote: > >> In other words, it seems that here you have to test for > "v->initializer.args_count == 1", not >> "size == 1". But do your own > research. > > Actually, I noticed that this shader does not compile on native: > > --- > float4 main() : SV_TARGET > { > float3 x = {float4(71, 72, 73, 74)}; > return float4(x, 74); > } > --- > > (the only difference with my previous email is the pair of braces around the initializer) > > So it seems that the condition you want to discriminate on is whether the initializer is specified > as a list (in which case you have to fully unpack and match in order) or as a single object (in > which case you treat it as an assignment). I guess, at least. > No, I think that the original purpose of doing an assignment when "v->initializer.args_count == 1" is to cover the cases for when numeric variables are initialized with a single numerical constant. For instance, this shader: --- float4 main() : sv_target { float3 aa = 3; float4 bb = {aa.x, aa.y, aa.z, 4.0}; return bb; } --- Retrieves (3.0, 3.0, 3.0, 4.0) with the native compiler. If I am not mistaken, initializers like float4(1 ,2 ,3 ,4) are treated the same as {1, 2, 3, 4} in the code. Still, I will add these tests in v3.