From: Giovanni Mascellani Subject: Re: [PATCH vkd3d v2 07/10] vkd3d-shader/hlsl: Support complex numeric initializers. Message-Id: <7ddb2af1-3120-cafd-337f-1e414fc8a25b@codeweavers.com> Date: Wed, 12 Jan 2022 17:35:26 +0100 In-Reply-To: <20220110193318.267854-7-fcasas@codeweavers.com> References: <20220110193318.267854-7-fcasas@codeweavers.com> Hi, this patch causes a regression on this shader: --- float4 main() : SV_TARGET { float3 x = float4(71, 72, 73, 74); return float4(x, 74); } --- This is accepted by native compiler and is works before your patch, but is broken after. (see below) On 10/01/22 20:33, Francisco Casas wrote: > @@ -1495,23 +1541,27 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t > vkd3d_free(v); > continue; > } > - if (v->initializer.args_count > 1) > + > + if (type->type <= HLSL_CLASS_LAST_NUMERIC && size == 1) > { > - hlsl_fixme(ctx, &v->loc, "Complex initializer."); > - free_parse_initializer(&v->initializer); > - vkd3d_free(v); > - continue; > + struct hlsl_ir_load *load = hlsl_new_var_load(ctx, var, var->loc); > + > + list_add_tail(v->initializer.instrs, &load->node.entry); > + add_assignment(ctx, v->initializer.instrs, &load->node, ASSIGN_OP_ASSIGN, v->initializer.args[0]); > } 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. Also, consider adding something similar to my example above to the tests (in the spirit of "everything that was gotten wrong at least once is a good candidate for a test"). Thanks, Giovanni.