diff options
author | Jason Ekstrand <[email protected]> | 2014-09-02 15:30:41 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2014-09-03 12:27:19 -0700 |
commit | 11ee9a4d99fd68be4c09341225e7faeff70d1b9b (patch) | |
tree | 3e51e4b5fdd42c45f3f86a451416cebaf2ab6f93 /src/mesa | |
parent | 499acf6e4a758be74dc5813a8c174da4360e046d (diff) |
i965/copy_image: Divide the x offsets by block width when using the blitter
Signed-off-by: Jason Ekstrand <[email protected]>
Cc: "10.3" <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82804
Tested-by: Tapani Pälli <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_copy_image.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_copy_image.c b/src/mesa/drivers/dri/i965/intel_copy_image.c index 8bda2dd594c..341220cff88 100644 --- a/src/mesa/drivers/dri/i965/intel_copy_image.c +++ b/src/mesa/drivers/dri/i965/intel_copy_image.c @@ -40,6 +40,7 @@ copy_image_with_blitter(struct brw_context *brw, int src_width, int src_height) { GLuint bw, bh; + uint32_t src_image_x, src_image_y, dst_image_x, dst_image_y; int cpp; /* The blitter doesn't understand multisampling at all. */ @@ -70,6 +71,9 @@ copy_image_with_blitter(struct brw_context *brw, return false; } + intel_miptree_get_image_offset(src_mt, src_level, src_z, + &src_image_x, &src_image_y); + if (_mesa_is_format_compressed(src_mt->format)) { _mesa_get_format_block_size(src_mt->format, &bw, &bh); @@ -83,10 +87,21 @@ copy_image_with_blitter(struct brw_context *brw, src_width /= (int)bw; src_height /= (int)bh; + /* Inside of the miptree, the x offsets are stored in pixels while + * the y offsets are stored in blocks. We need to scale just the x + * offset. + */ + src_image_x /= bw; + cpp = _mesa_get_format_bytes(src_mt->format); } else { cpp = src_mt->cpp; } + src_x += src_image_x; + src_y += src_image_y; + + intel_miptree_get_image_offset(dst_mt, dst_level, dst_z, + &dst_image_x, &dst_image_y); if (_mesa_is_format_compressed(dst_mt->format)) { _mesa_get_format_block_size(dst_mt->format, &bw, &bh); @@ -96,17 +111,13 @@ copy_image_with_blitter(struct brw_context *brw, dst_x /= (int)bw; dst_y /= (int)bh; - } - uint32_t src_image_x, src_image_y; - intel_miptree_get_image_offset(src_mt, src_level, src_z, - &src_image_x, &src_image_y); - src_x += src_image_x; - src_y += src_image_y; - - uint32_t dst_image_x, dst_image_y; - intel_miptree_get_image_offset(dst_mt, dst_level, dst_z, - &dst_image_x, &dst_image_y); + /* Inside of the miptree, the x offsets are stored in pixels while + * the y offsets are stored in blocks. We need to scale just the x + * offset. + */ + dst_image_x /= bw; + } dst_x += dst_image_x; dst_y += dst_image_y; |