From: Dave Airlie <[email protected]>

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 <[email protected]>
---
 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

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to