[Mesa-dev] [PATCH 04/11] i965/vec4/nir: vec4 also need to remap vs attributes

Juan A. Suarez Romero jasuarez at igalia.com
Wed Jan 11 09:23:17 UTC 2017


On Tue, 2017-01-10 at 20:52 -0800, Matt Turner wrote:
> On 01/09, Juan A. Suarez Romero wrote:
> > From: Alejandro Piñeiro <apinheiro at igalia.com>
> > 
> > Doubles need extra space, so we would need to do a remapping for vec4
> > too in order to take that into account. We reuse the already
> > existing remap_vs_attrs, but passing is_scalar, so they could
> > remap accordingly.
> > 
> > Signed-off-by: Alejandro Piñeiro <apinheiro at igalia.com>
> > Signed-off-by: Juan A. Suarez Romero <jasuarez at igalia.com>
> > ---
> > src/mesa/drivers/dri/i965/brw_nir.c | 30 ++++++++++++++++++++----------
> > 1 file changed, 20 insertions(+), 10 deletions(-)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_nir.c b/src/mesa/drivers/dri/i965/brw_nir.c
> > index 2d2fce2..b491cdb 100644
> > --- a/src/mesa/drivers/dri/i965/brw_nir.c
> > +++ b/src/mesa/drivers/dri/i965/brw_nir.c
> > @@ -95,9 +95,19 @@ add_const_offset_to_base(nir_shader *nir, nir_variable_mode mode)
> >    }
> > }
> > 
> > +struct remap_vs_attrs_params {
> > +   shader_info *nir_info;
> > +   bool is_scalar;
> > +};
> > +
> > static bool
> > -remap_vs_attrs(nir_block *block, shader_info *nir_info)
> > +remap_vs_attrs(nir_block *block, void *closure)
> > {
> > +   struct remap_vs_attrs_params *params =
> > +      (struct remap_vs_attrs_params *) closure;
> > +   shader_info *nir_info = params->nir_info;
> > +   bool is_scalar = params->is_scalar;
> > +
> >    nir_foreach_instr(instr, block) {
> >       if (instr->type != nir_instr_type_intrinsic)
> >          continue;
> > @@ -113,7 +123,7 @@ remap_vs_attrs(nir_block *block, shader_info *nir_info)
> >          int attr = intrin->const_index[0];
> >          int slot = _mesa_bitcount_64(nir_info->inputs_read &
> >                                       BITFIELD64_MASK(attr));
> > -         intrin->const_index[0] = 4 * slot;
> > +         intrin->const_index[0] = is_scalar ? 4 * slot : slot;
> >       }
> >    }
> >    return true;
> > @@ -257,6 +267,9 @@ brw_nir_lower_vs_inputs(nir_shader *nir,
> >                         bool use_legacy_snorm_formula,
> >                         const uint8_t *vs_attrib_wa_flags)
> > {
> > +   struct remap_vs_attrs_params params = { .nir_info = nir->info,
> > +                                           .is_scalar = is_scalar };
> 
> Please write this as
> 
> 	
>    struct remap_vs_attrs_params params = {
>       .nir_info = nir->info,
>       .is_scalar = is_scalar
>    };


Sure!

	J.A.


More information about the mesa-dev mailing list