Mesa (master): r600g: fix source box in r600_resource_copy_region

Dave Airlie airlied at kemper.freedesktop.org
Sat Jun 18 06:11:35 UTC 2011


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

Author: Vadim Girlin <vadimgirlin at gmail.com>
Date:   Fri Jun 17 23:01:59 2011 +0400

r600g: fix source box in r600_resource_copy_region

Source box needs to be adjusted for blitting from compressed formats.

fixes https://bugs.freedesktop.org/show_bug.cgi?id=35434

Signed-off-by: Vadim Girlin <vadimgirlin at gmail.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/r600/r600_blit.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_blit.c b/src/gallium/drivers/r600/r600_blit.c
index 043c875..e858ea2 100644
--- a/src/gallium/drivers/r600/r600_blit.c
+++ b/src/gallium/drivers/r600/r600_blit.c
@@ -294,6 +294,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
 {
 	struct r600_resource_texture *rsrc = (struct r600_resource_texture*)src;
 	struct texture_orig_info orig_info[2];
+	struct pipe_box sbox, *psbox;
 	boolean restore_orig[2];
 
 	/* Fallback for buffers. */
@@ -311,7 +312,15 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
 	if (util_format_is_compressed(src->format)) {
 		r600_compressed_to_blittable(src, src_level, &orig_info[0]);
 		restore_orig[0] = TRUE;
-	}
+		sbox.x = util_format_get_nblocksx(orig_info[0].format, src_box->x);
+		sbox.y = util_format_get_nblocksy(orig_info[0].format, src_box->y);
+		sbox.z = src_box->z;
+		sbox.width = util_format_get_nblocksx(orig_info[0].format, src_box->width);
+		sbox.height = util_format_get_nblocksy(orig_info[0].format, src_box->height);
+		sbox.depth = src_box->depth;
+		psbox=&sbox;
+	} else
+		psbox=src_box;
 
 	if (util_format_is_compressed(dst->format)) {
 		r600_compressed_to_blittable(dst, dst_level, &orig_info[1]);
@@ -322,7 +331,7 @@ static void r600_resource_copy_region(struct pipe_context *ctx,
 	}
 
 	r600_hw_copy_region(ctx, dst, dst_level, dstx, dsty, dstz,
-			    src, src_level, src_box);
+			    src, src_level, psbox);
 
 	if (restore_orig[0])
 		r600_reset_blittable_to_compressed(src, src_level, &orig_info[0]);




More information about the mesa-commit mailing list