Giovanni Mascellani (@giomasce) commented about libs/vkd3d-shader/hlsl.y:
- if (!(one = hlsl_new_float_constant(ctx, 1.0f, loc)))
return false;
- list_add_tail(params->instrs, &one->node.entry);
- if (!(zero = hlsl_new_float_constant(ctx, 0.0f, loc)))
return false;
- list_add_tail(params->instrs, &zero->node.entry);
- mul = &one->node;
- for (i = 0; i < arg_type->dimx; ++i)
- {
for (j = 0; j < arg_type->dimy; ++j)
{
if (!(load = add_load_component(ctx, params->instrs, arg, j * arg->data_type->dimx + i, loc)))
return false;
That's not wrong, but you could just iterate on a single index ranging from zero to `hlsl_type_component_count(arg_type)`.