[PATCH vkd3d 07/12] vkd3d-shader/hlsl: Support matrix indexing.
Matteo Bruni
matteo.mystral at gmail.com
Wed Apr 20 16:04:26 CDT 2022
On Wed, Apr 20, 2022 at 8:28 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>
> On 4/18/22 01:34, Giovanni Mascellani wrote:
> > Signed-off-by: Giovanni Mascellani <gmascellani at codeweavers.com>
> > ---
> > libs/vkd3d-shader/hlsl.y | 87 +++++++++++++++++++++++++-
> > tests/hlsl-matrix-indexing.shader_test | 8 +--
> > 2 files changed, 88 insertions(+), 7 deletions(-)
> >
> > diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> > index 291f8392..b6a8e496 100644
> > --- a/libs/vkd3d-shader/hlsl.y
> > +++ b/libs/vkd3d-shader/hlsl.y
> > + var = hlsl_new_synthetic_var(ctx, name, ret_type, *loc);
> > + if (!var)
> > + return false;
> > +
> > + for (i = 0; i < mat_type->dimx; ++i)
> > + {
> > + struct hlsl_ir_node *offset;
> > + struct hlsl_ir_store *store;
> > + struct hlsl_ir_load *value;
> > + struct hlsl_ir_constant *c;
> > +
> > + if (!(c = hlsl_new_uint_constant(ctx, i, loc)))
> > + return false;
> > + list_add_tail(instrs, &c->node.entry);
> > +
> > + if (!(offset = compute_matrix_offset(ctx, instrs, mat_type, &c->node, index, loc)))
> > + return false;
>
> The signature of this function feels awkward to me. Could we fold the
> subsequent add_load() call into it, and call it something like
> add_matrix_scalar_load() instead? Note also that it'd be useful for
> matrix swizzles in that case, since I think we want to stop generating
> HLSL_IR_SWIZZLE instructions for those.
Yes, we do.
More information about the wine-devel
mailing list