diff options
Diffstat (limited to 'src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_texture.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 304dc91677e..97bba8b7da5 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -175,6 +175,10 @@ st_FreeTextureImageBuffer(struct gl_context *ctx, _mesa_align_free(stImage->TexData); stImage->TexData = NULL; + + free(stImage->transfer); + stImage->transfer = NULL; + stImage->num_transfers = 0; } @@ -190,6 +194,7 @@ st_MapTextureImage(struct gl_context *ctx, struct st_texture_image *stImage = st_texture_image(texImage); unsigned pipeMode; GLubyte *map; + struct pipe_transfer *transfer; pipeMode = 0x0; if (mode & GL_MAP_READ_BIT) @@ -199,10 +204,11 @@ st_MapTextureImage(struct gl_context *ctx, if (mode & GL_MAP_INVALIDATE_RANGE_BIT) pipeMode |= PIPE_TRANSFER_DISCARD_RANGE; - map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1); + map = st_texture_image_map(st, stImage, pipeMode, x, y, slice, w, h, 1, + &transfer); if (map) { *mapOut = map; - *rowStrideOut = stImage->transfer->stride; + *rowStrideOut = transfer->stride; } else { *mapOut = NULL; @@ -219,7 +225,7 @@ st_UnmapTextureImage(struct gl_context *ctx, { struct st_context *st = st_context(ctx); struct st_texture_image *stImage = st_texture_image(texImage); - st_texture_image_unmap(st, stImage); + st_texture_image_unmap(st, stImage, slice); } @@ -1144,6 +1150,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, unsigned dst_width = width; unsigned dst_height = height; unsigned dst_depth = 1; + struct pipe_transfer *transfer; if (ST_DEBUG & DEBUG_FALLBACK) debug_printf("%s: fallback processing\n", __FUNCTION__); @@ -1169,7 +1176,8 @@ fallback_copy_texsubimage(struct gl_context *ctx, texDest = st_texture_image_map(st, stImage, transfer_usage, destX, destY, slice, - dst_width, dst_height, dst_depth); + dst_width, dst_height, dst_depth, + &transfer); if (baseFormat == GL_DEPTH_COMPONENT || baseFormat == GL_DEPTH_STENCIL) { @@ -1199,13 +1207,11 @@ fallback_copy_texsubimage(struct gl_context *ctx, } if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) { - pipe_put_tile_z(stImage->transfer, - texDest + row*stImage->transfer->layer_stride, + pipe_put_tile_z(transfer, texDest + row*transfer->layer_stride, 0, 0, width, 1, data); } else { - pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1, - data); + pipe_put_tile_z(transfer, texDest, 0, row, width, 1, data); } } } @@ -1231,10 +1237,10 @@ fallback_copy_texsubimage(struct gl_context *ctx, } if (stImage->pt->target == PIPE_TEXTURE_1D_ARRAY) { - dstRowStride = stImage->transfer->layer_stride; + dstRowStride = transfer->layer_stride; } else { - dstRowStride = stImage->transfer->stride; + dstRowStride = transfer->stride; } /* get float/RGBA image from framebuffer */ @@ -1267,7 +1273,7 @@ fallback_copy_texsubimage(struct gl_context *ctx, free(tempSrc); } - st_texture_image_unmap(st, stImage); + st_texture_image_unmap(st, stImage, slice); pipe->transfer_unmap(pipe, src_trans); } |