aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_texture.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_texture.c70
1 files changed, 11 insertions, 59 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_texture.c b/mesalib/src/mesa/state_tracker/st_texture.c
index 3670683b5..d6dbf8d6c 100644
--- a/mesalib/src/mesa/state_tracker/st_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_texture.c
@@ -230,7 +230,6 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
{
struct st_texture_object *stObj =
st_texture_object(stImage->base.TexObject);
- struct pipe_context *pipe = st->pipe;
GLuint level;
DBG("%s \n", __FUNCTION__);
@@ -243,14 +242,9 @@ st_texture_image_map(struct st_context *st, struct st_texture_image *stImage,
else
level = stImage->base.Level;
- stImage->transfer = pipe_get_transfer(st->pipe, stImage->pt, level,
- stImage->base.Face + zoffset,
- usage, x, y, w, h);
-
- if (stImage->transfer)
- return pipe_transfer_map(pipe, stImage->transfer);
- else
- return NULL;
+ return pipe_transfer_map(st->pipe, stImage->pt, level,
+ stImage->base.Face + zoffset,
+ usage, x, y, w, h, &stImage->transfer);
}
@@ -263,43 +257,10 @@ st_texture_image_unmap(struct st_context *st,
DBG("%s\n", __FUNCTION__);
pipe_transfer_unmap(pipe, stImage->transfer);
-
- pipe->transfer_destroy(pipe, stImage->transfer);
stImage->transfer = NULL;
}
-
-/**
- * Upload data to a rectangular sub-region. Lots of choices how to do this:
- *
- * - memcpy by span to current destination
- * - upload data as new buffer and blit
- *
- * Currently always memcpy.
- */
-static void
-st_surface_data(struct pipe_context *pipe,
- struct pipe_transfer *dst,
- unsigned dstx, unsigned dsty,
- const void *src, unsigned src_stride,
- unsigned srcx, unsigned srcy, unsigned width, unsigned height)
-{
- void *map = pipe_transfer_map(pipe, dst);
-
- assert(dst->resource);
- util_copy_rect(map,
- dst->resource->format,
- dst->stride,
- dstx, dsty,
- width, height,
- src, src_stride,
- srcx, srcy);
-
- pipe_transfer_unmap(pipe, dst);
-}
-
-
/* Upload data for a particular image.
*/
void
@@ -313,7 +274,6 @@ st_texture_image_data(struct st_context *st,
struct pipe_context *pipe = st->pipe;
GLuint i;
const GLubyte *srcUB = src;
- struct pipe_transfer *dst_transfer;
GLuint layers;
if (dst->target == PIPE_TEXTURE_1D_ARRAY ||
@@ -325,20 +285,14 @@ st_texture_image_data(struct st_context *st,
DBG("%s\n", __FUNCTION__);
for (i = 0; i < layers; i++) {
- dst_transfer = pipe_get_transfer(st->pipe, dst, level, face + i,
- PIPE_TRANSFER_WRITE, 0, 0,
- u_minify(dst->width0, level),
- u_minify(dst->height0, level));
-
- st_surface_data(pipe, dst_transfer,
- 0, 0, /* dstx, dsty */
- srcUB,
- src_row_stride,
- 0, 0, /* source x, y */
- u_minify(dst->width0, level),
- u_minify(dst->height0, level)); /* width, height */
+ struct pipe_box box;
+ u_box_2d_zslice(0, 0, face + i,
+ u_minify(dst->width0, level),
+ u_minify(dst->height0, level),
+ &box);
- pipe->transfer_destroy(pipe, dst_transfer);
+ pipe->transfer_inline_write(pipe, dst, level, PIPE_TRANSFER_WRITE,
+ &box, srcUB, src_row_stride, 0);
srcUB += src_image_stride;
}
@@ -362,13 +316,11 @@ print_center_pixel(struct pipe_context *pipe, struct pipe_resource *src)
region.height = 1;
region.depth = 1;
- xfer = pipe->get_transfer(pipe, src, 0, PIPE_TRANSFER_READ, &region);
- map = pipe->transfer_map(pipe, xfer);
+ map = pipe->transfer_map(pipe, src, 0, PIPE_TRANSFER_READ, &region, &xfer);
printf("center pixel: %d %d %d %d\n", map[0], map[1], map[2], map[3]);
pipe->transfer_unmap(pipe, xfer);
- pipe->transfer_destroy(pipe, xfer);
}