From: Jordan Justen Date: Tue, 10 Jul 2012 17:41:46 +0000 (-0700) Subject: mesa pack: handle packed integer formats with clamping X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f7333b6345deb1c0322079039544bc322ca1dad9;p=mesa.git mesa pack: handle packed integer formats with clamping Signed-off-by: Jordan Justen Reviewed-by: Brian Paul --- diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index 8ea5853897f..7aebd45ea2b 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -516,11 +516,24 @@ get_type_min_max(GLenum type, GLfloat *min, GLfloat *max) #undef SRC_TYPE +static void +_pack_rgba_span_from_uints_problem(struct gl_context *ctx, + GLenum dstFormat, GLenum dstType) +{ + _mesa_problem(ctx, + "Unsupported type (%s) / format (%s) " + "in _mesa_pack_rgba_span_from_uints", + _mesa_lookup_enum_by_nr(dstType), + _mesa_lookup_enum_by_nr(dstFormat)); +} + void _mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][4], GLenum dstFormat, GLenum dstType, GLvoid *dstAddr) { + GLuint i; + switch(dstType) { case GL_UNSIGNED_INT: pack_uint_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); @@ -540,12 +553,304 @@ _mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][ case GL_BYTE: pack_byte_from_uint_rgba(ctx, dstAddr, dstFormat, rgba, n); break; - + case GL_UNSIGNED_BYTE_3_3_2: + if ((dstFormat == GL_RGB) || (dstFormat == GL_RGB_INTEGER)) { + GLubyte *dst = (GLubyte *) dstAddr; + for (i=0;i