Mesa (master): mesa: clamp colors to [0,1] for glGetTexImage() when format is GL_LUMINANCE
Brian Paul
brianp at kemper.freedesktop.org
Fri Apr 3 23:30:45 UTC 2009
Module: Mesa
Branch: master
Commit: 35d88e1ac2cd34d5cc62f521654d79f5b24fcdf8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=35d88e1ac2cd34d5cc62f521654d79f5b24fcdf8
Author: Brian Paul <brianp at vmware.com>
Date: Fri Apr 3 17:10:31 2009 -0600
mesa: clamp colors to [0,1] for glGetTexImage() when format is GL_LUMINANCE
For luminance, we add R+G+B and it seems we should always clamp in case.
---
src/mesa/main/texstore.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c
index c65b9a9..28e9d5c 100644
--- a/src/mesa/main/texstore.c
+++ b/src/mesa/main/texstore.c
@@ -4115,9 +4115,11 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level,
* Looks like we need clamp though when going from format
* containing negative values to unsigned format.
*/
- if (!type_with_negative_values(type) &&
- (texImage->TexFormat->DataType == GL_FLOAT ||
- texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED))
+ if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA)
+ transferOps |= IMAGE_CLAMP_BIT;
+ else if (!type_with_negative_values(type) &&
+ (texImage->TexFormat->DataType == GL_FLOAT ||
+ texImage->TexFormat->DataType == GL_SIGNED_NORMALIZED))
transferOps |= IMAGE_CLAMP_BIT;
for (col = 0; col < width; col++) {
@@ -4144,7 +4146,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, transferOps, GL_TRUE);
+ &ctx->Pack, transferOps, GL_FALSE);
} /* format */
} /* row */
} /* img */
More information about the mesa-commit
mailing list