[Mesa-dev] [PATCH 02/23] pack: adjust clamping for int=>ubyte conversion

Jordan Justen jordan.l.justen at intel.com
Fri Jan 4 18:41:25 PST 2013


gles3conform expects than when converting from a signed
int to an unsigned byte, the output will be clamped at a
max of 0x7f. This impacts conversion from
int16_t => uint8_t and int32_t => uint8_t.

Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/pack.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c
index 4f0caa7..9e74b1e 100644
--- a/src/mesa/main/pack.c
+++ b/src/mesa/main/pack.c
@@ -885,7 +885,7 @@ _mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][
 #undef FN_NAME
 
 #define DST_TYPE GLubyte
-#define SRC_CONVERT(x) MAX2(x, 0)
+#define SRC_CONVERT(x) CLAMP(x, 0, 0x7f)
 #define FN_NAME pack_ubyte_from_int_rgba
 #include "pack_tmp.h"
 #undef DST_TYPE
-- 
1.7.10.4



More information about the mesa-dev mailing list