[Mesa-dev] [PATCH 06/15] i965: add helper for creating packing writemask

Timothy Arceri timothy.arceri at collabora.com
Thu Jul 21 00:17:19 UTC 2016


On Wed, 2016-07-20 at 12:14 -0700, Kenneth Graunke wrote:
> On Tuesday, July 19, 2016 4:33:18 PM PDT Timothy Arceri wrote:
> > For example where n=3 first_component=1 this will give us
> > 0xE (WRITEMASK_YZW).
> > 
> > Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>
> > ---
> >  src/mesa/drivers/dri/i965/brw_reg.h | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/src/mesa/drivers/dri/i965/brw_reg.h
> > b/src/mesa/drivers/dri/i965/brw_reg.h
> > index 7eab7b5..abd63e4 100644
> > --- a/src/mesa/drivers/dri/i965/brw_reg.h
> > +++ b/src/mesa/drivers/dri/i965/brw_reg.h
> > @@ -972,6 +972,12 @@ brw_writemask_for_size(unsigned n)
> >     return (1 << n) - 1;
> >  }
> >  
> > +static inline unsigned
> > +brw_writemask_for_component_packing(unsigned n, unsigned
> > first_component)
> > +{
> > +   return (((1 << n) - 1) << first_component);
> > +}
> > +
> >  static inline struct brw_reg
> >  negate(struct brw_reg reg)
> >  {
> > 
> 
> It would be nice to include an assert that first_component + n < 4,

I think it needs to be <= I've added this change to my branch [1]. Note
that this values comes directly from the qualifier so this should have
already been validated in the front-end but I guess this doesn't hurt.

All the patches now have reviews did you want me to hold off pushing
these?

[1] https://github.com/tarceri/Mesa_arrays_of_arrays/compare/master...c
omponent_packing_gen6+_v2


> or equivalently, that (result & WRITEMASK_XYZW) == result.
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list