From e6a9381f78605072cab52447fce35eaa98c1e75c Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 26 Feb 2007 11:37:37 -0700 Subject: Do proper framebuffer refcounting in _mesa_make_current(). Also, added DeletePending field to gl_framebuffer used when a window has been deleted, but there still may be rendering contexts attached to the gl_framebuffer object. --- src/mesa/main/mtypes.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/mesa/main/mtypes.h') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e8f0f45d39..422d176c25 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2243,6 +2243,7 @@ struct gl_framebuffer _glthread_Mutex Mutex; /**< for thread safety */ GLuint Name; /* if zero, this is a window system framebuffer */ GLint RefCount; + GLboolean DeletePending; GLvisual Visual; /**< The framebuffer's visual. Immutable if this is a window system buffer. -- cgit v1.2.3 From f9f79c8d770e696249bd98c68b563f887562c974 Mon Sep 17 00:00:00 2001 From: Brian Date: Fri, 9 Mar 2007 09:08:41 -0700 Subject: New IMAGE_RED_TO_LUMINANCE flag passed to _mesa_pack_rgba_span_float() to fix glGetTexImage(GL_LUMINANCE) bug #10232. --- src/mesa/main/image.c | 19 ++++++++++++++----- src/mesa/main/mtypes.h | 1 + src/mesa/main/texstore.c | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) (limited to 'src/mesa/main/mtypes.h') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index fc8e1f0f57..eb91ebb611 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -1182,15 +1182,24 @@ _mesa_pack_rgba_span_float(GLcontext *ctx, GLuint n, GLfloat rgba[][4], if (dstFormat == GL_LUMINANCE || dstFormat == GL_LUMINANCE_ALPHA) { /* compute luminance values */ - if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) { + if (transferOps & IMAGE_RED_TO_LUMINANCE) { + /* Luminance = Red (glGetTexImage) */ for (i = 0; i < n; i++) { - GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; - luminance[i] = CLAMP(sum, 0.0F, 1.0F); + luminance[i] = rgba[i][RCOMP]; } } else { - for (i = 0; i < n; i++) { - luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + /* Luminance = Red + Green + Blue (glReadPixels) */ + if (dstType != GL_FLOAT || ctx->Color.ClampReadColor == GL_TRUE) { + for (i = 0; i < n; i++) { + GLfloat sum = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + luminance[i] = CLAMP(sum, 0.0F, 1.0F); + } + } + else { + for (i = 0; i < n; i++) { + luminance[i] = rgba[i][RCOMP] + rgba[i][GCOMP] + rgba[i][BCOMP]; + } } } } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 422d176c25..7caa1f8d7f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2540,6 +2540,7 @@ struct matrix_stack #define IMAGE_HISTOGRAM_BIT 0x200 #define IMAGE_MIN_MAX_BIT 0x400 #define IMAGE_CLAMP_BIT 0x800 /* extra */ +#define IMAGE_RED_TO_LUMINANCE 0x1000 /** Pixel Transfer ops up to convolution */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 87f8fa7a0d..994fb16730 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3611,7 +3611,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format, type, dest, - &ctx->Pack, 0x0 /*image xfer ops*/); + &ctx->Pack, IMAGE_RED_TO_LUMINANCE); } /* format */ } /* row */ } /* img */ -- cgit v1.2.3