[Mesa-dev] [PATCH v3 6/8] ReadPixels: handle signed/unsigned integer clamping
Ian Romanick
idr at freedesktop.org
Mon Jul 23 13:53:33 PDT 2012
On 07/23/2012 09:59 AM, Jordan Justen wrote:
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
> src/mesa/main/readpix.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
> index 784aaad..4fa816f 100644
> --- a/src/mesa/main/readpix.c
> +++ b/src/mesa/main/readpix.c
> @@ -321,6 +321,8 @@ slow_read_rgba_pixels( struct gl_context *ctx,
> void *rgba;
> GLubyte *dst, *map;
> int dstStride, stride, j;
> + GLboolean is_integer = _mesa_is_enum_format_integer(format);
> + GLboolean is_unsiged_integer = _mesa_is_format_unsigned(rbFormat);
Same typo as patch 2/8.
>
> dstStride = _mesa_image_row_stride(packing, width, format, type);
> dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
> @@ -338,12 +340,17 @@ slow_read_rgba_pixels( struct gl_context *ctx,
> goto done;
>
> for (j = 0; j < height; j++) {
> - if (_mesa_is_enum_format_integer(format)) {
> + if (is_integer) {
> _mesa_unpack_uint_rgba_row(rbFormat, width, map, (GLuint (*)[4]) rgba);
> _mesa_rebase_rgba_uint(width, (GLuint (*)[4]) rgba,
> rb->_BaseFormat);
> - _mesa_pack_rgba_span_from_uints(ctx, width, (GLuint (*)[4]) rgba, format,
> - type, dst);
> + if (is_unsiged_integer) {
> + _mesa_pack_rgba_span_from_uints(ctx, width, (GLuint (*)[4]) rgba, format,
> + type, dst);
> + } else {
> + _mesa_pack_rgba_span_from_ints(ctx, width, (GLint (*)[4]) rgba, format,
> + type, dst);
> + }
> } else {
> _mesa_unpack_rgba_row(rbFormat, width, map, (GLfloat (*)[4]) rgba);
> _mesa_rebase_rgba_float(width, (GLfloat (*)[4]) rgba,
>
More information about the mesa-dev
mailing list