[Mesa-dev] [PATCH] mesa/readpix: don't clamp SNORM readings.

Dave Airlie airlied at gmail.com
Tue May 10 03:36:51 UTC 2016


From: Dave Airlie <airlied at redhat.com>

The clamping code always clamps to 0..1, which for SNORM is
incorrect. Just don't clamp at all in this case.

This fixes a number of SNORM cases in:
GL33-CTS.texture_size_promotion.functional

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/mesa/main/readpix.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index 1cb06c7..ac4f8b2 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -119,6 +119,10 @@ _mesa_get_readpixels_transfer_ops(const struct gl_context *ctx,
       }
    }
 
+   /* don't clamp signed normalized as they have a different range */
+   if (_mesa_get_format_datatype(texFormat) == GL_SIGNED_NORMALIZED)
+      transferOps &= ~IMAGE_CLAMP_BIT;
+
    /* If the format is unsigned normalized, we can ignore clamping
     * because the values are already in the range [0,1] so it won't
     * have any effect anyway.
-- 
2.5.5



More information about the mesa-dev mailing list