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

Ilia Mirkin imirkin at alum.mit.edu
Sun Aug 10 21:38:03 PDT 2014


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);
 
 			if (mask)
 				context_drv(ctx)->surface_fill(
-- 
1.8.5.5



More information about the mesa-dev mailing list