aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_cb_texture.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-10-15 16:50:35 +0200
committermarha <marha@users.sourceforge.net>2012-10-15 16:50:35 +0200
commit54db46582aba2252d544fa3956522f9ef06b49cb (patch)
treee3692fa2c3864c2bd13089d80bbaccb86b5d4825 /mesalib/src/mesa/state_tracker/st_cb_texture.c
parent8223fb176264123c86c0d3eb845973d00fd62cc2 (diff)
downloadvcxsrv-54db46582aba2252d544fa3956522f9ef06b49cb.tar.gz
vcxsrv-54db46582aba2252d544fa3956522f9ef06b49cb.tar.bz2
vcxsrv-54db46582aba2252d544fa3956522f9ef06b49cb.zip
xserver mesa pixman git update 15 oct 2012
xserver: a69429a17bf4630f6e26f61630a1c2b287202627 pixman: d5f2f39319fc358cccda60abe0bc927bd27131c1 mesa: 4004620d34a580c8fdb965d9b640e97453fc8b28
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_cb_texture.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_cb_texture.c63
1 files changed, 28 insertions, 35 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_cb_texture.c b/mesalib/src/mesa/state_tracker/st_cb_texture.c
index 473ff3a94..5bf3dc699 100644
--- a/mesalib/src/mesa/state_tracker/st_cb_texture.c
+++ b/mesalib/src/mesa/state_tracker/st_cb_texture.c
@@ -578,9 +578,10 @@ decompress_with_blit(struct gl_context * ctx,
const GLuint width = texImage->Width;
const GLuint height = texImage->Height;
struct pipe_resource *dst_texture;
- struct pipe_transfer *tex_xfer;
struct pipe_blit_info blit;
unsigned bind = (PIPE_BIND_RENDER_TARGET | PIPE_BIND_TRANSFER_READ);
+ struct pipe_transfer *tex_xfer;
+ ubyte *map;
/* create temp / dest surface */
if (!util_create_rgba_texture(pipe, width, height, bind,
@@ -610,21 +611,22 @@ decompress_with_blit(struct gl_context * ctx,
/* blit/render/decompress */
st->pipe->blit(st->pipe, &blit);
- /* map the dst_surface so we can read from it */
- tex_xfer = pipe_get_transfer(pipe,
- dst_texture, 0, 0,
- PIPE_TRANSFER_READ,
- 0, 0, width, height);
-
pixels = _mesa_map_pbo_dest(ctx, &ctx->Pack, pixels);
+ map = pipe_transfer_map(pipe, dst_texture, 0, 0,
+ PIPE_TRANSFER_READ,
+ 0, 0, width, height, &tex_xfer);
+ if (!map) {
+ goto end;
+ }
+
/* copy/pack data into user buffer */
if (_mesa_format_matches_format_and_type(stImage->base.TexFormat,
format, type,
ctx->Pack.SwapBytes)) {
/* memcpy */
const uint bytesPerRow = width * util_format_get_blocksize(stImage->pt->format);
- ubyte *map = pipe_transfer_map(pipe, tex_xfer);
+ /* map the dst_surface so we can read from it */
GLuint row;
for (row = 0; row < height; row++) {
GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width,
@@ -655,7 +657,7 @@ decompress_with_blit(struct gl_context * ctx,
debug_printf("%s: fallback format translation\n", __FUNCTION__);
/* get float[4] rgba row from surface */
- pipe_get_tile_rgba_format(pipe, tex_xfer, 0, row, width, 1,
+ pipe_get_tile_rgba_format(tex_xfer, map, 0, row, width, 1,
pformat, rgba);
_mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, format,
@@ -666,10 +668,10 @@ decompress_with_blit(struct gl_context * ctx,
}
end:
- _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
-
- pipe->transfer_destroy(pipe, tex_xfer);
+ if (map)
+ pipe_transfer_unmap(pipe, tex_xfer);
+ _mesa_unmap_pbo_dest(ctx, &ctx->Pack);
pipe_resource_reference(&dst_texture, NULL);
}
@@ -720,6 +722,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
struct pipe_transfer *src_trans;
GLvoid *texDest;
enum pipe_transfer_usage transfer_usage;
+ void *map;
if (ST_DEBUG & DEBUG_FALLBACK)
debug_printf("%s: fallback processing\n", __FUNCTION__);
@@ -728,13 +731,13 @@ fallback_copy_texsubimage(struct gl_context *ctx,
srcY = strb->Base.Height - srcY - height;
}
- src_trans = pipe_get_transfer(pipe,
- strb->texture,
- strb->rtt_level,
- strb->rtt_face + strb->rtt_slice,
- PIPE_TRANSFER_READ,
- srcX, srcY,
- width, height);
+ map = pipe_transfer_map(pipe,
+ strb->texture,
+ strb->rtt_level,
+ strb->rtt_face + strb->rtt_slice,
+ PIPE_TRANSFER_READ,
+ srcX, srcY,
+ width, height, &src_trans);
if ((baseFormat == GL_DEPTH_COMPONENT ||
baseFormat == GL_DEPTH_STENCIL) &&
@@ -769,11 +772,12 @@ fallback_copy_texsubimage(struct gl_context *ctx,
if (data) {
/* To avoid a large temp memory allocation, do copy row by row */
for (row = 0; row < height; row++, srcY += yStep) {
- pipe_get_tile_z(pipe, src_trans, 0, srcY, width, 1, data);
+ pipe_get_tile_z(src_trans, map, 0, srcY, width, 1, data);
if (scaleOrBias) {
_mesa_scale_and_bias_depth_uint(ctx, width, data);
}
- pipe_put_tile_z(pipe, stImage->transfer, 0, row, width, 1, data);
+ pipe_put_tile_z(stImage->transfer, texDest, 0, row, width, 1,
+ data);
}
}
else {
@@ -801,7 +805,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
/* XXX this usually involves a lot of int/float conversion.
* try to avoid that someday.
*/
- pipe_get_tile_rgba_format(pipe, src_trans, 0, 0, width, height,
+ pipe_get_tile_rgba_format(src_trans, map, 0, 0, width, height,
util_format_linear(strb->texture->format),
tempSrc);
@@ -828,7 +832,7 @@ fallback_copy_texsubimage(struct gl_context *ctx,
}
st_texture_image_unmap(st, stImage);
- pipe->transfer_destroy(pipe, src_trans);
+ pipe->transfer_unmap(pipe, src_trans);
}
@@ -915,8 +919,7 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
{
struct st_texture_image *stImage = st_texture_image(texImage);
const GLenum texBaseFormat = texImage->_BaseFormat;
- struct gl_framebuffer *fb = ctx->ReadBuffer;
- struct st_renderbuffer *strb;
+ struct st_renderbuffer *strb = st_renderbuffer(rb);
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
struct pipe_screen *screen = pipe->screen;
@@ -933,16 +936,6 @@ st_CopyTexSubImage(struct gl_context *ctx, GLuint dims,
*/
if (0) st_validate_state(st);
- /* determine if copying depth or color data */
- if (texBaseFormat == GL_DEPTH_COMPONENT ||
- texBaseFormat == GL_DEPTH_STENCIL) {
- strb = st_renderbuffer(fb->Attachment[BUFFER_DEPTH].Renderbuffer);
- }
- else {
- /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */
- strb = st_renderbuffer(fb->_ColorReadBuffer);
- }
-
if (!strb || !strb->surface || !stImage->pt) {
debug_printf("%s: null strb or stImage\n", __FUNCTION__);
return;