diff options
author | Marek Olšák <[email protected]> | 2013-01-15 19:04:13 +0100 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2013-01-21 15:42:28 +0100 |
commit | bfb405ceee3843ab7fa9ec03919939ff69e2a373 (patch) | |
tree | ef8e43184a3b5b7a2fa093c66c9e33a8ffe3a270 /src/gallium/drivers/radeonsi/r600_texture.c | |
parent | f0ffbbc9fff190f014709bb5c5067bf5faae181e (diff) |
radeonsi: Assorted depth/stencil changes ported from r600g.
[ Squashed port of the following r600g commits: - Michel Dänzer ]
commit c1e8c845ea9c6f843cc5bba5974668c007799bbc
Author: Marek Olšák <[email protected]>
Date: Sat Jul 7 19:10:00 2012 +0200
r600g: inline r600_hw_copy_region
commit 4891c5dc64ccd8cf2bf8a8550ae23e1a61806a7d
Author: Marek Olšák <[email protected]>
Date: Mon Jun 25 22:53:21 2012 +0200
r600g: inline r600_blit_push_depth and use resource_copy_region
We are going to have a separate resource for depth texturing and transfers
and this is just a transfer thing.
commit da98bb6fc105e1a2f688a1713ca9e50f0ac8fbed
Author: Marek Olšák <[email protected]>
Date: Mon Jun 25 12:45:32 2012 +0200
r600g: split flushed depth texture creation and flushing
Signed-off-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/r600_texture.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/r600_texture.c | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/src/gallium/drivers/radeonsi/r600_texture.c b/src/gallium/drivers/radeonsi/r600_texture.c index 4c6ca6eb3a7..4c107b26bea 100644 --- a/src/gallium/drivers/radeonsi/r600_texture.c +++ b/src/gallium/drivers/radeonsi/r600_texture.c @@ -281,7 +281,6 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; struct pipe_resource resource; struct r600_transfer *trans; - int r; boolean use_staging_texture = FALSE; struct radeon_winsys_cs_handle *buf; enum pipe_format format = texture->format; @@ -329,8 +328,8 @@ static void *si_texture_transfer_map(struct pipe_context *ctx, */ /* XXX: when discard is true, no need to read back from depth texture */ - r = r600_texture_depth_flush(ctx, texture, FALSE); - if (r < 0) { + r600_texture_depth_flush(ctx, texture); + if (!rtex->flushed_depth_texture) { R600_ERR("failed to create temporary texture to hold untiled copy\n"); pipe_resource_reference(&trans->transfer.resource, NULL); FREE(trans); @@ -438,8 +437,19 @@ static void si_texture_transfer_unmap(struct pipe_context *ctx, } if (rtex->depth && !rtex->is_flushing_texture) { - if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtex->flushed_depth_texture) - r600_blit_push_depth(ctx, rtex); + if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtex->flushed_depth_texture) { + struct pipe_box sbox; + + sbox.x = sbox.y = sbox.z = 0; + sbox.width = texture->width0; + sbox.height = texture->height0; + /* XXX that might be wrong */ + sbox.depth = 1; + + ctx->resource_copy_region(ctx, texture, 0, 0, 0, 0, + &rtex->flushed_depth_texture->resource.b.b, 0, + &sbox); + } } pipe_resource_reference(&transfer->resource, NULL); @@ -617,14 +627,14 @@ struct pipe_resource *si_texture_from_handle(struct pipe_screen *screen, stride, 0, buf, FALSE, &surface); } -int r600_texture_depth_flush(struct pipe_context *ctx, - struct pipe_resource *texture, boolean just_create) +void r600_init_flushed_depth_texture(struct pipe_context *ctx, + struct pipe_resource *texture) { struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; struct pipe_resource resource; if (rtex->flushed_depth_texture) - goto out; + return; /* it's ready */ resource.target = texture->target; resource.format = texture->format; @@ -641,18 +651,25 @@ int r600_texture_depth_flush(struct pipe_context *ctx, rtex->flushed_depth_texture = (struct r600_resource_texture *)ctx->screen->resource_create(ctx->screen, &resource); if (rtex->flushed_depth_texture == NULL) { R600_ERR("failed to create temporary texture to hold untiled copy\n"); - return -ENOMEM; + return; } ((struct r600_resource_texture *)rtex->flushed_depth_texture)->is_flushing_texture = TRUE; -out: - if (just_create) - return 0; +} + +void r600_texture_depth_flush(struct pipe_context *ctx, + struct pipe_resource *texture) +{ + struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture; + + r600_init_flushed_depth_texture(ctx, texture); + + if (!rtex->flushed_depth_texture) + return; /* error */ /* XXX: only do this if the depth texture has actually changed: */ si_blit_uncompress_depth(ctx, rtex); - return 0; } void si_init_surface_functions(struct r600_context *r600) |