[PATCH vkd3d 05/12] vkd3d-shader/hlsl: Support vector indexing.

Matteo Bruni matteo.mystral at gmail.com
Wed Apr 20 15:55:45 CDT 2022


On Wed, Apr 20, 2022 at 7:57 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               | 14 ++++++++++----
> >   tests/hlsl-vector-indexing.shader_test |  4 ++--
> >   2 files changed, 12 insertions(+), 6 deletions(-)
> >
> > diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
> > index fd808648..291f8392 100644
> > --- a/libs/vkd3d-shader/hlsl.y
> > +++ b/libs/vkd3d-shader/hlsl.y
> > @@ -592,13 +592,21 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
> >       if (expr_type->type == HLSL_CLASS_ARRAY)
> >       {
> >           data_type = expr_type->e.array.type;
> > +        if (!(c = hlsl_new_uint_constant(ctx, hlsl_type_get_array_element_reg_size(data_type), &loc)))
> > +            return false;
> >       }
> > -    else if (expr_type->type == HLSL_CLASS_MATRIX || expr_type->type == HLSL_CLASS_VECTOR)
> > +    else if (expr_type->type == HLSL_CLASS_MATRIX)
> >       {
> >           /* This needs to be lowered now, while we still have type information. */
> > -        FIXME("Index of matrix or vector type.\n");
> > +        FIXME("Index of matrix type.\n");
> >           return false;
> >       }
> > +    else if (expr_type->type == HLSL_CLASS_VECTOR)
> > +    {
> > +        data_type = hlsl_get_scalar_type(ctx, expr_type->base_type);
> > +        if (!(c = hlsl_new_uint_constant(ctx, 1, &loc)))
> > +            return false;
>
> Why not just bring the constant + mul into the ARRAY path?

I had basically the same comment (I was thinking about moving the c =
hlsl_new_uint_constant() thing below into common code instead) but
then I went "eh, whatever".

It would still be nice to follow up on that at some point though.



More information about the wine-devel mailing list