i965/copy_image: Use the correct texture level
authorJason Ekstrand <jason.ekstrand@intel.com>
Mon, 1 Sep 2014 11:38:28 +0000 (04:38 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 3 Sep 2014 19:27:19 +0000 (12:27 -0700)
Previously, we were using the source images level for both source and
destination.  Also, we weren't taking the MinLevel from a potential texture
view into account.  This commit fixes both problems.

Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com>
Cc: "10.3" <mesa-stable@lists.freedesktop.org>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82804
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/intel_copy_image.c

index 4e177c7505ff7becd4f1509f2d665ee17722a72e..935f91cfbd966ca93560194d0c714d0a6507ed48 100644 (file)
@@ -243,9 +243,11 @@ intel_copy_image_sub_data(struct gl_context *ctx,
    intel_miptree_all_slices_resolve_depth(brw, intel_dst_image->mt);
    intel_miptree_resolve_color(brw, intel_dst_image->mt);
 
-   if (copy_image_with_blitter(brw, intel_src_image->mt, src_image->Level,
+   unsigned src_level = src_image->Level + src_image->TexObject->MinLevel;
+   unsigned dst_level = dst_image->Level + dst_image->TexObject->MinLevel;
+   if (copy_image_with_blitter(brw, intel_src_image->mt, src_level,
                                src_x, src_y, src_z,
-                               intel_dst_image->mt, src_image->Level,
+                               intel_dst_image->mt, dst_level,
                                dst_x, dst_y, dst_z,
                                src_width, src_height))
       return;
@@ -253,9 +255,9 @@ intel_copy_image_sub_data(struct gl_context *ctx,
    /* This is a worst-case scenario software fallback that maps the two
     * textures and does a memcpy between them.
     */
-   copy_image_with_memcpy(brw, intel_src_image->mt, src_image->Level,
+   copy_image_with_memcpy(brw, intel_src_image->mt, src_level,
                           src_x, src_y, src_z,
-                          intel_dst_image->mt, src_image->Level,
+                          intel_dst_image->mt, dst_level,
                           dst_x, dst_y, dst_z,
                           src_width, src_height);
 }