mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 22:38:05 +02:00
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 <kenneth@whitecape.org>
This commit is contained in:
parent
e34c9edcda
commit
11a90af1ef
1 changed files with 13 additions and 6 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue