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 <funfunc...@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, or equivalently, that (result & WRITEMASK_XYZW) == result.
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev