[Mesa-dev] [PATCH 3/3] nouveau: force luminance clear colors to have the same g/b values as r

Francisco Jerez currojerez at riseup.net
Tue Aug 12 23:45:26 PDT 2014


Ilia Mirkin <imirkin at alum.mit.edu> writes:

> Fixes the LUMINANCE_ALPHA formats of fbo-clear-formats piglit test.
>
> Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
> ---
>
> Not sure about this one. Perhaps we should just nuke LUMINANCE_ALPHA support?
> Or we should fix the texturing so that only the R component is read back out?
> Not sure how to do that though.
>
>  src/mesa/drivers/dri/nouveau/nouveau_driver.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.c b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> index b0afb69..7148a11 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.c
> @@ -114,8 +114,15 @@ nouveau_clear(struct gl_context *ctx, GLbitfield buffers)
>  			fb->Attachment[i].Renderbuffer)->surface;
>  
>  		if (buf & BUFFER_BITS_COLOR) {
> +			float color[4];
> +
> +			memcpy(color, ctx->Color.ClearColor.f, sizeof(color));
> +			if (fb->Attachment[i].Renderbuffer->_BaseFormat ==
> +			    GL_LUMINANCE_ALPHA)
> +				color[1] = color[2] = color[0];
> +
>  			mask = pack_rgba_i(s->format, ctx->Color.ColorMask[0]);
> -			value = pack_rgba_clamp_f(s->format, ctx->Color.ClearColor.f);
> +			value = pack_rgba_clamp_f(s->format, color);
>  

This solution looks OK to me, but how about implementing it as a
pack_la_f(float l, float a) utility function which would be used instead
of pack_rgba_* for LA buffers?

>  			if (mask)
>  				context_drv(ctx)->surface_fill(
> -- 
> 1.8.5.5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140813/a0f8442c/attachment.sig>


More information about the mesa-dev mailing list