diff options
author | Eric Anholt <[email protected]> | 2011-11-03 17:27:23 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2011-11-09 12:59:20 -0800 |
commit | 11a90af1ef6384b3ac7730d16db9a65b4a799466 (patch) | |
tree | 8ad6c5ec5e050a2dda56f85d9e637e50faf71d1f /src/mesa | |
parent | e34c9edcda9167c634fe8381bd039f1a65925d0a (diff) |
swrast: Add support for glReadPixels() to integer types.
With this change, i965 passes
GL_EXT_texture_integer/fbo_integer_precision_clear
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/swrast/s_readpix.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 50422dbd59f..54f42db0254 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -236,7 +236,10 @@ slow_read_rgba_pixels( struct gl_context *ctx, GLbitfield transferOps ) { struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - GLfloat rgba[MAX_WIDTH][4]; + union { + float f[MAX_WIDTH][4]; + unsigned int i[MAX_WIDTH][4]; + } rgba; GLubyte *dst, *map; int dstStride, stride, j; @@ -248,11 +251,15 @@ slow_read_rgba_pixels( struct gl_context *ctx, &map, &stride); for (j = 0; j < height; j++) { - _mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb->Format), - width, map, rgba); - _mesa_pack_rgba_span_float(ctx, width, rgba, format, type, dst, - packing, transferOps); - + if (_mesa_is_integer_format(format)) { + _mesa_unpack_int_rgba_row(rb->Format, width, map, rgba.i); + _mesa_pack_rgba_span_int(ctx, width, rgba.i, format, type, dst); + } else { + _mesa_unpack_rgba_row(_mesa_get_srgb_format_linear(rb->Format), + width, map, rgba.f); + _mesa_pack_rgba_span_float(ctx, width, rgba.f, format, type, dst, + packing, transferOps); + } dst += dstStride; map += stride; } |