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

Kenneth Graunke kenneth at whitecape.org
Wed Jul 20 19:14:11 UTC 2016


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,
or equivalently, that (result & WRITEMASK_XYZW) == result.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160720/3e4533ec/attachment.sig>


More information about the mesa-dev mailing list