[Mesa-dev] [PATCH 11/78] i965/vec4: Add auxiliary func to build a writemask from a component size
Jason Ekstrand
jason at jlekstrand.net
Mon Jun 29 16:52:28 PDT 2015
On Fri, Jun 26, 2015 at 1:06 AM, Eduardo Lima Mitev <elima at igalia.com> wrote:
> New method brw_writemask_for_size() will return a writemask with the first 'size'
> components activated.
>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89580
> ---
> src/mesa/drivers/dri/i965/brw_reg.h | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
> index c8b1341..83fe488 100644
> --- a/src/mesa/drivers/dri/i965/brw_reg.h
> +++ b/src/mesa/drivers/dri/i965/brw_reg.h
> @@ -950,6 +950,15 @@ brw_set_writemask(struct brw_reg reg, unsigned mask)
> return reg;
> }
>
> +static inline unsigned
> +brw_writemask_for_size(unsigned n)
> +{
> + unsigned writemask = 0;
> + for (unsigned i = 0; i < n; i++)
> + writemask |= 1 << i;
> + return writemask;
You don't need the loop; you can just do "return (1 << n) - 1;"
> +}
> +
> static inline struct brw_reg
> negate(struct brw_reg reg)
> {
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list