aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/drivers/common/meta.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-06-14 08:12:46 +0200
committermarha <marha@users.sourceforge.net>2011-06-14 08:12:46 +0200
commit4d74e36f359d22b50302c82a922b79ac24dd3e23 (patch)
treefb8a1645c35cdbe7ac484fbd240c0c9993750b7c /mesalib/src/mesa/drivers/common/meta.c
parentf4babb3a422e27cd33fba36f7a21eb67b7dee25d (diff)
downloadvcxsrv-4d74e36f359d22b50302c82a922b79ac24dd3e23.tar.gz
vcxsrv-4d74e36f359d22b50302c82a922b79ac24dd3e23.tar.bz2
vcxsrv-4d74e36f359d22b50302c82a922b79ac24dd3e23.zip
libxcb mesa xkeyboard-config git update 14 June 2011
Diffstat (limited to 'mesalib/src/mesa/drivers/common/meta.c')
-rw-r--r--mesalib/src/mesa/drivers/common/meta.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c
index 979926a7e..0e58aeca3 100644
--- a/mesalib/src/mesa/drivers/common/meta.c
+++ b/mesalib/src/mesa/drivers/common/meta.c
@@ -2691,12 +2691,26 @@ copy_tex_image(struct gl_context *ctx, GLuint dims, GLenum target, GLint level,
GLenum format, type;
GLint bpp;
void *buf;
+ struct gl_renderbuffer *read_rb = ctx->ReadBuffer->_ColorReadBuffer;
texObj = _mesa_get_current_tex_object(ctx, target);
texImage = _mesa_get_tex_image(ctx, texObj, target, level);
/* Choose format/type for temporary image buffer */
format = _mesa_base_tex_format(ctx, internalFormat);
+
+ if (format == GL_LUMINANCE &&
+ _mesa_get_format_base_format(read_rb->Format) != GL_LUMINANCE) {
+ /* The glReadPixels() path will convert RGB to luminance by
+ * summing R+G+B. glCopyTexImage() is supposed to behave as
+ * glCopyPixels, which doesn't do that change, and instead
+ * leaves it up to glTexImage which converts RGB to luminance by
+ * just taking the R channel. To avoid glReadPixels() trashing
+ * our data, use RGBA for our temporary image.
+ */
+ format = GL_RGBA;
+ }
+
type = get_temp_image_type(ctx, format);
bpp = _mesa_bytes_per_pixel(format, type);
if (bpp <= 0) {