aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texstore.c
diff options
context:
space:
mode:
authorXiang, Haihao <[email protected]>2008-11-19 11:22:35 +0800
committerXiang, Haihao <[email protected]>2008-11-19 11:30:30 +0800
commit2f9ceb158afffe5ea390b909261988267e663e36 (patch)
treecd7ac67f37ccbe2ffff5d1de187e12883b191c97 /src/mesa/main/texstore.c
parent80d6379722a1249ce13db79a898d340644936f67 (diff)
mesa: clamp luminance if needed.
This fixes glReadPixels(GL_LUMINANCE, GL_FLOAT)/glGetTexImage(GL_LUMINANCE, GL_FLOAT) issue on fixed-point color buffers.
Diffstat (limited to 'src/mesa/main/texstore.c')
-rw-r--r--src/mesa/main/texstore.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index abeed3baa14..4b2b129468f 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -3719,6 +3719,14 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
/* general case: convert row to RGBA format */
GLfloat rgba[MAX_WIDTH][4];
GLint col;
+ GLbitfield transferOps = 0x0;
+
+ if (type == GL_FLOAT &&
+ ((ctx->Color.ClampReadColor == GL_TRUE) ||
+ (ctx->Color.ClampReadColor == GL_FIXED_ONLY_ARB &&
+ texImage->TexFormat->DataType != GL_FLOAT)))
+ transferOps |= IMAGE_CLAMP_BIT;
+
for (col = 0; col < width; col++) {
(*texImage->FetchTexelf)(texImage, col, row, img, rgba[col]);
if (texImage->TexFormat->BaseFormat == GL_ALPHA) {
@@ -3743,7 +3751,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, transferOps /*image xfer ops*/);
} /* format */
} /* row */
} /* img */