[Mesa-dev] [PATCH] mesa: Don't clamp GetTexImage results post RGB->L if !ClampReadColor.

Eric Anholt eric at anholt.net
Sat Jun 18 17:43:16 PDT 2011


Fixes oglconform failure about our ARB_texture_float GetTexImage.
Note that clamping does not appear in the "Conversion to L" stage of
the GL 3.2 spec, and the next stage of "Final conversion" does
clamping according to CLAMP_READ_COLOR.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=36892
---
 src/mesa/main/texgetimage.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 26c2ff9..fa6535e 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -254,7 +254,15 @@ get_tex_rgba(struct gl_context *ctx, GLuint dimensions,
     * containing negative values to unsigned format.
     */
    if (format == GL_LUMINANCE || format == GL_LUMINANCE_ALPHA) {
-      transferOps |= IMAGE_CLAMP_BIT;
+      /* Apply ARB_color_buffer_float clamping control.  Note that we
+       * don't use _ClampReadColor because we care about the
+       * float-ness of the texture, not the fb.
+       */
+      if (ctx->Color.ClampReadColor == GL_TRUE ||
+	  (ctx->Color.ClampReadColor == GL_FIXED_ONLY &&
+	   _mesa_get_format_datatype(texImage->TexFormat) != GL_FLOAT)) {
+	 transferOps |= IMAGE_CLAMP_BIT;
+      }
    }
    else if (!type_with_negative_values(type) &&
             (dataType == GL_FLOAT ||
-- 
1.7.5.3



More information about the mesa-dev mailing list