From: Carl Worth Date: Mon, 21 Jan 2013 20:16:27 +0000 (-0800) Subject: ReadPixels: Force ALPHA to 1 while rebasing RGBA values for GL_RGB format X-Git-Tag: mesa-9.1-rc1~189 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=570ed2be7d776211e1ca2a7a4c44ee6a1d141714;p=platform%2Fupstream%2Fmesa.git ReadPixels: Force ALPHA to 1 while rebasing RGBA values for GL_RGB format When performing a ReadPixels operation, we may be reading from a buffer that stores alpha values, but that is actually representing a buffer with no alpha channel. In this case, while rebasing the values, touch up all alpha values read to 1.0. This commit fixes the following piglit (sub) tests: ARB_texture_float/fbo-colormask-formats GL_RBG16F_ARB EXT_texture_snorm/fbo-colormask-formats GL_RGB16_SNORM GL_RGB8_SNORM GL_RGB_SNORM It likely improves the results of other tests as well, but a PASS remains elusive due to additional bugs. Reviewed-by: Brian Paul Reviewed-by: Anuj Phogat --- diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index d6a97b3..e00ae63 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -6022,6 +6022,11 @@ _mesa_rebase_rgba_float(GLuint n, GLfloat rgba[][4], GLenum baseFormat) rgba[i][BCOMP] = 0.0F; } break; + case GL_RGB: + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = 1.0F; + } + break; default: /* no-op */ ; @@ -6060,6 +6065,11 @@ _mesa_rebase_rgba_uint(GLuint n, GLuint rgba[][4], GLenum baseFormat) rgba[i][BCOMP] = 0; } break; + case GL_RGB: + for (i = 0; i < n; i++) { + rgba[i][ACOMP] = 1; + } + break; default: /* no-op */ ;