anv/meta: Fix hardcoded format size in anv_CmdCopy*
authorChad Versace <chad.versace@intel.com>
Thu, 7 Jan 2016 21:46:20 +0000 (13:46 -0800)
committerChad Versace <chad.versace@intel.com>
Thu, 7 Jan 2016 21:56:58 +0000 (13:56 -0800)
When looping through VkBufferImageCopy regions, for each region we
incremented the offset into the VkBuffer assuming the format size was 4.

Fixes CTS tests dEQP-VK.pipeline.image.view_type.cube_array.3d.* on
Skylake.

src/vulkan/anv_meta.c

index e351db0872880af8f2c805dbfc9b70d9ffc37d43..b61cda793d576396d6bfc1e56bac690fc60744fc 100644 (file)
@@ -1234,9 +1234,9 @@ void anv_CmdCopyBufferToImage(
           * increment the offset directly in the image effectively
           * re-binding it to different backing memory.
           */
-         /* XXX: Insert a real CPP */
          src_image->offset += src_image->extent.width *
-                              src_image->extent.height * 4;
+                              src_image->extent.height *
+                              src_image->format->isl_layout->bs;
       }
 
       anv_DestroyImage(vk_device, anv_image_to_handle(src_image),
@@ -1336,9 +1336,9 @@ void anv_CmdCopyImageToBuffer(
           * increment the offset directly in the image effectively
           * re-binding it to different backing memory.
           */
-         /* XXX: Insert a real CPP */
          dest_image->offset += dest_image->extent.width *
-                               dest_image->extent.height * 4;
+                               dest_image->extent.height *
+                               src_image->format->isl_layout->bs;
       }
 
       anv_DestroyImage(vk_device, anv_image_to_handle(dest_image),