Mesa (master): r600g: optimize uploading depth textures

Marek Olšák mareko at kemper.freedesktop.org
Tue Jul 17 22:38:42 UTC 2012


Module: Mesa
Branch: master
Commit: 43e226b6efb77db2247741cc2057d9625a2cfa05
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=43e226b6efb77db2247741cc2057d9625a2cfa05

Author: Marek Olšák <maraeo at gmail.com>
Date:   Wed Jul 18 00:32:50 2012 +0200

r600g: optimize uploading depth textures

Make it only copy the portion of a depth texture being uploaded and
not the whole 2D layer.

There is also a little code cleanup.

---

 src/gallium/drivers/r600/r600_texture.c |   16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_texture.c b/src/gallium/drivers/r600/r600_texture.c
index 3a5a912..4cf9cb8 100644
--- a/src/gallium/drivers/r600/r600_texture.c
+++ b/src/gallium/drivers/r600/r600_texture.c
@@ -906,19 +906,13 @@ void r600_texture_transfer_destroy(struct pipe_context *ctx,
 	struct pipe_resource *texture = transfer->resource;
 	struct r600_resource_texture *rtex = (struct r600_resource_texture*)texture;
 
-	if (rtex->is_depth) {
-		if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtransfer->staging) {
-			struct pipe_box sbox;
-
-			u_box_origin_2d(texture->width0, texture->height0, &sbox);
-
+	if ((transfer->usage & PIPE_TRANSFER_WRITE) && rtransfer->staging) {
+		if (rtex->is_depth) {
 			ctx->resource_copy_region(ctx, texture, transfer->level,
-						  0, 0, transfer->box.z,
+						  transfer->box.x, transfer->box.y, transfer->box.z,
 						  &rtransfer->staging->b.b, transfer->level,
-						  &sbox);
-		}
-	} else if (rtransfer->staging) {
-		if (transfer->usage & PIPE_TRANSFER_WRITE) {
+						  &transfer->box);
+		} else {
 			r600_copy_from_staging_texture(ctx, rtransfer);
 		}
 	}




More information about the mesa-commit mailing list