summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/texgetimage.c
diff options
context:
space:
mode:
authorAnuj Phogat <anuj.phogat@gmail.com>2012-01-24 20:06:27 -0800
committerAnuj Phogat <anuj.phogat@gmail.com>2012-01-27 13:22:52 -0800
commit5665b5cc31da70e833f80e7a17bfa034d2f7ba44 (patch)
treeff63d42568ea86f847c7679986ebf3b4ba2805ed /src/mesa/main/texgetimage.c
parent5f65598cc79eccd38bf7f95ab167ed62e575daf2 (diff)
downloadexternal_mesa3d-5665b5cc31da70e833f80e7a17bfa034d2f7ba44.zip
external_mesa3d-5665b5cc31da70e833f80e7a17bfa034d2f7ba44.tar.gz
external_mesa3d-5665b5cc31da70e833f80e7a17bfa034d2f7ba44.tar.bz2
mesa: set clamp bit in glGetTexImage for GL_UNSIGNED_NORMALIZED
Color clamping should be enabled in glGetTexImage if texture dataType is GL_UNSIGNED_NORMALIZED and format is GL_LUMINANCE or GL_LUMINANCE_ALPHA Fixes 2 Intel oglconform test cases: pxconv-gettex and pxtrans-gettex https://bugs.freedesktop.org/show_bug.cgi?id=40864 NOTE: This is a candidate for the 8.0 branch Signed-off-by: Anuj Phogat <anuj.phogat@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com>
Diffstat (limited to 'src/mesa/main/texgetimage.c')
-rw-r--r--src/mesa/main/texgetimage.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 818deb8..42495c8 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -462,6 +462,15 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
transferOps |= IMAGE_CLAMP_BIT;
}
}
+ /* This applies to RGB, RGBA textures. if the format is either LUMINANCE
+ * or LUMINANCE ALPHA, luminance (L) is computed as L=R+G+B .we need to
+ * clamp the sum to [0,1].
+ */
+ else if ((format == GL_LUMINANCE ||
+ format == GL_LUMINANCE_ALPHA) &&
+ dataType == GL_UNSIGNED_NORMALIZED) {
+ transferOps |= IMAGE_CLAMP_BIT;
+ }
if (_mesa_is_format_compressed(texImage->TexFormat)) {
get_tex_rgba_compressed(ctx, dimensions, format, type,