[Mesa-dev] [PATCH 1/5] mesa: change ctx->Color.ColorMask into a 32-bit bitmask

Eric Anholt eric at anholt.net
Sun Feb 4 00:28:58 UTC 2018


Marek Olšák <maraeo at gmail.com> writes:

> From: Marek Olšák <marek.olsak at amd.com>
>
> 4 bits per draw buffer, 8 draw buffers in total --> 32 bits.
>
> This is easier to work with.

> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> index 998e751..018f65a 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> @@ -125,21 +125,27 @@ nouveau_clear(struct gl_context *ctx, GLbitfield buffers)
>  		if (buf & BUFFER_BITS_COLOR) {
>  			const float *color = ctx->Color.ClearColor.f;
>  
>  			if (fb->Attachment[i].Renderbuffer->_BaseFormat ==
>  			    GL_LUMINANCE_ALPHA)
>  				value = pack_la_clamp_f(
>  						s->format, color[0], color[3]);
>  			else
>  				value = pack_rgba_clamp_f(s->format, color);
>  
> -			mask = pack_rgba_i(s->format, ctx->Color.ColorMask[0]);
> +			const uint8_t colormask[4] = {
> +				GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 0) ? 0xf : 0,
> +				GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 1) ? 0xf : 0,
> +				GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 2) ? 0xf : 0,
> +				GET_COLORMASK_BIT(ctx->Color.ColorMask, 0, 3) ? 0xf : 0,
> +			};

I think you meant 0xff instead of 0xf.

With this and Roland's other suggestion, the patch is:

Reviewed-by: Eric Anholt <eric at anholt.net>

(and now my plane is boarding)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180203/1488e0b8/attachment.sig>


More information about the mesa-dev mailing list