From: Matteo Bruni Subject: Re: [PATCH 1/5] d3dcompiler: Emit constructors as sequences of stores to a synthetic variable. Message-Id: Date: Mon, 8 Jun 2020 16:06:30 +0200 In-Reply-To: <20200605221933.1861389-1-zfigura@codeweavers.com> References: <20200605221933.1861389-1-zfigura@codeweavers.com> On Sat, Jun 6, 2020 at 12:20 AM Zebediah Figura wrote: > > @@ -2415,41 +2414,60 @@ postfix_expr: primary_expr > } > $$ = append_binop($1, $3, &load->node); > } > - /* "var_modifiers" doesn't make sense in this case, but it's needed > - in the grammar to avoid shift/reduce conflicts. */ BTW there are 3 of those comments in hlsl.y, all different from each other... Good job me. > + if ($2->type == HLSL_CLASS_MATRIX) > + FIXME("Matrix constructors are not supported yet.\n"); > + > + sprintf(name, "", counter++); > + if (!(var = new_synthetic_var(name, $2, get_location(&@2)))) > + YYABORT; > + for (i = 0; i < $4.args_count; ++i) > + { > + const struct hlsl_type *arg_type = $4.args[i]->data_type; > + unsigned int component_count = arg_type->dimx * arg_type->dimy; > + > + if (!(assignment = new_assignment(var, NULL, $4.args[i], > + ((1 << component_count) - 1) << writemask_offset, $4.args[i]->loc))) > + YYABORT; > + writemask_offset += component_count; Isn't this wrong for structs or arrays? FWIW it seems it would be more easily extensible to matrix and other types if you generate a "full" assignment with a swizzle on the lhs and then delegate fixing it up to make_assignment() rather than directly computing the writemask here.