aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_drawpixels.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_drawpixels.c64
1 files changed, 29 insertions, 35 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
index a8a01db96..4e2edd2e7 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -514,12 +514,10 @@ make_texture(struct st_context *st,
/* we'll do pixel transfer in a fragment shader */
ctx->_ImageTransferState = 0x0;
- transfer = pipe_get_transfer(st->pipe, pt, 0, 0,
- PIPE_TRANSFER_WRITE, 0, 0,
- width, height);
-
/* map texture transfer */
- dest = pipe_transfer_map(pipe, transfer);
+ dest = pipe_transfer_map(pipe, pt, 0, 0,
+ PIPE_TRANSFER_WRITE, 0, 0,
+ width, height, &transfer);
/* Put image into texture transfer.
@@ -538,7 +536,6 @@ make_texture(struct st_context *st,
/* unmap */
pipe_transfer_unmap(pipe, transfer);
- pipe->transfer_destroy(pipe, transfer);
assert(success);
@@ -863,12 +860,10 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
usage = PIPE_TRANSFER_WRITE;
}
- pt = pipe_get_transfer(pipe, strb->texture,
- strb->rtt_level, strb->rtt_face + strb->rtt_slice,
- usage, x, y,
- width, height);
-
- stmap = pipe_transfer_map(pipe, pt);
+ stmap = pipe_transfer_map(pipe, strb->texture,
+ strb->rtt_level, strb->rtt_face + strb->rtt_slice,
+ usage, x, y,
+ width, height, &pt);
pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels);
assert(pixels);
@@ -996,7 +991,6 @@ draw_stencil_pixels(struct gl_context *ctx, GLint x, GLint y,
/* unmap the stencil buffer */
pipe_transfer_unmap(pipe, pt);
- pipe->transfer_destroy(pipe, pt);
}
@@ -1247,18 +1241,16 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
dsty = rbDraw->Base.Height - dsty - height;
}
- ptDraw = pipe_get_transfer(pipe,
- rbDraw->texture,
- rbDraw->rtt_level,
- rbDraw->rtt_face + rbDraw->rtt_slice,
- usage, dstx, dsty,
- width, height);
-
- assert(util_format_get_blockwidth(ptDraw->resource->format) == 1);
- assert(util_format_get_blockheight(ptDraw->resource->format) == 1);
+ assert(util_format_get_blockwidth(rbDraw->texture->format) == 1);
+ assert(util_format_get_blockheight(rbDraw->texture->format) == 1);
/* map the stencil buffer */
- drawMap = pipe_transfer_map(pipe, ptDraw);
+ drawMap = pipe_transfer_map(pipe,
+ rbDraw->texture,
+ rbDraw->rtt_level,
+ rbDraw->rtt_face + rbDraw->rtt_slice,
+ usage, dstx, dsty,
+ width, height, &ptDraw);
/* draw */
/* XXX PixelZoom not handled yet */
@@ -1283,7 +1275,6 @@ copy_stencil_pixels(struct gl_context *ctx, GLint srcx, GLint srcy,
/* unmap the stencil buffer */
pipe_transfer_unmap(pipe, ptDraw);
- pipe->transfer_destroy(pipe, ptDraw);
}
@@ -1573,13 +1564,15 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
}
else {
/* CPU-based fallback/conversion */
- struct pipe_transfer *ptRead =
- pipe_get_transfer(st->pipe, rbRead->texture,
+ struct pipe_transfer *ptRead;
+ void *mapRead =
+ pipe_transfer_map(st->pipe, rbRead->texture,
rbRead->rtt_level,
rbRead->rtt_face + rbRead->rtt_slice,
PIPE_TRANSFER_READ,
- readX, readY, readW, readH);
+ readX, readY, readW, readH, &ptRead);
struct pipe_transfer *ptTex;
+ void *mapTex;
enum pipe_transfer_usage transfer_usage;
if (ST_DEBUG & DEBUG_FALLBACK)
@@ -1590,8 +1583,8 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
else
transfer_usage = PIPE_TRANSFER_WRITE;
- ptTex = pipe_get_transfer(st->pipe, pt, 0, 0, transfer_usage,
- 0, 0, width, height);
+ mapTex = pipe_transfer_map(st->pipe, pt, 0, 0, transfer_usage,
+ 0, 0, width, height, &ptTex);
/* copy image from ptRead surface to ptTex surface */
if (type == GL_COLOR) {
@@ -1600,23 +1593,24 @@ st_CopyPixels(struct gl_context *ctx, GLint srcx, GLint srcy,
enum pipe_format readFormat, drawFormat;
readFormat = util_format_linear(rbRead->texture->format);
drawFormat = util_format_linear(pt->format);
- pipe_get_tile_rgba_format(pipe, ptRead, 0, 0, readW, readH,
+ pipe_get_tile_rgba_format(ptRead, mapRead, 0, 0, readW, readH,
readFormat, buf);
- pipe_put_tile_rgba_format(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
+ pipe_put_tile_rgba_format(ptTex, mapTex, pack.SkipPixels,
+ pack.SkipRows,
readW, readH, drawFormat, buf);
free(buf);
}
else {
/* GL_DEPTH */
GLuint *buf = malloc(width * height * sizeof(GLuint));
- pipe_get_tile_z(pipe, ptRead, 0, 0, readW, readH, buf);
- pipe_put_tile_z(pipe, ptTex, pack.SkipPixels, pack.SkipRows,
+ pipe_get_tile_z(ptRead, mapRead, 0, 0, readW, readH, buf);
+ pipe_put_tile_z(ptTex, mapTex, pack.SkipPixels, pack.SkipRows,
readW, readH, buf);
free(buf);
}
- pipe->transfer_destroy(pipe, ptRead);
- pipe->transfer_destroy(pipe, ptTex);
+ pipe->transfer_unmap(pipe, ptRead);
+ pipe->transfer_unmap(pipe, ptTex);
}
/* OK, the texture 'pt' contains the src image/pixels. Now draw a