[PATCH vkd3d v2 07/10] vkd3d-shader/hlsl: Support complex numeric initializers.
Giovanni Mascellani
gmascellani at codeweavers.com
Wed Jan 12 10:35:26 CST 2022
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.
More information about the wine-devel
mailing list