[Mesa-dev] [PATCH v2 08/12] mesa GetTexImage: handle signed/unsigned integer clamping
Jordan Justen
jordan.l.justen at intel.com
Wed Jul 11 14:58:54 PDT 2012
Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
---
src/mesa/main/texgetimage.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c
index 5d2f4da..06d4464 100644
--- a/src/mesa/main/texgetimage.c
+++ b/src/mesa/main/texgetimage.c
@@ -306,6 +306,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
GLfloat (*rgba)[4];
GLuint (*rgba_uint)[4];
GLboolean is_integer = _mesa_is_format_integer_color(texImage->TexFormat);
+ GLboolean is_unsiged_integer = _mesa_is_format_unsigned(texImage->TexFormat);
/* Allocate buffer for one row of texels */
rgba = (GLfloat (*)[4]) malloc(4 * width * sizeof(GLfloat));
@@ -361,8 +362,15 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions,
_mesa_unpack_uint_rgba_row(texFormat, width, src, rgba_uint);
if (rebaseFormat)
_mesa_rebase_rgba_uint(width, rgba_uint, rebaseFormat);
- _mesa_pack_rgba_span_from_uints(ctx, width, rgba_uint,
- format, type, dest);
+ if (is_unsiged_integer) {
+ _mesa_pack_rgba_span_from_uints(ctx, width,
+ (GLuint (*)[4]) rgba_uint,
+ format, type, dest);
+ } else {
+ _mesa_pack_rgba_span_from_ints(ctx, width,
+ (GLint (*)[4]) rgba_uint,
+ format, type, dest);
+ }
} else {
_mesa_unpack_rgba_row(texFormat, width, src, rgba);
if (rebaseFormat)
--
1.7.9.5
More information about the mesa-dev
mailing list