unsigned bind = PIPE_BIND_TRANSFER_READ;
struct pipe_transfer *tex_xfer;
ubyte *map = NULL;
- bool window;
+ int dst_x, dst_y;
/* Validate state (to be sure we have up-to-date framebuffer surfaces)
* and flush the bitmap cache prior to reading. */
st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP,
width, height, format, src_format, dst_format);
if (dst) {
- window = false;
+ dst_x = x;
+ dst_y = y;
} else {
/* See if the texture format already matches the format and type,
* in which case the memcpy-based fast path will likely be used and
if (!dst)
goto fallback;
- window = true;
+ dst_x = 0;
+ dst_y = 0;
}
/* map resources */
pixels = _mesa_map_pbo_dest(ctx, pack, pixels);
map = pipe_transfer_map_3d(pipe, dst, 0, PIPE_TRANSFER_READ,
- 0, 0, 0, width, height, 1, &tex_xfer);
+ dst_x, dst_y, 0, width, height, 1, &tex_xfer);
if (!map) {
_mesa_unmap_pbo_dest(ctx, pack);
pipe_resource_reference(&dst, NULL);
goto fallback;
}
- if (!window)
- map += y * tex_xfer->stride + x * util_format_get_blocksize(dst_format);
-
/* memcpy data into a user buffer */
{
const uint bytesPerRow = width * util_format_get_blocksize(dst_format);