anv/meta: Calculate mip offset for compressed texture
authorNanley Chery <nanley.g.chery@intel.com>
Wed, 27 Jan 2016 02:10:12 +0000 (18:10 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 27 Jan 2016 23:12:42 +0000 (15:12 -0800)
This value will be used in a later commit.

src/vulkan/anv_meta.c

index 65f07eb4bce542f3a531a361f7084a0d2db9f400..0b0adfc224f67a60a2e9c29a09eca77baab46154 100644 (file)
@@ -1328,6 +1328,22 @@ void anv_CmdCopyBufferToImage(
             },
             cmd_buffer);
 
+         uint32_t img_x = 0;
+         uint32_t img_y = 0;
+         uint32_t img_o = 0;
+         if (isl_format_is_compressed(dest_image->format->surface_format))
+            isl_surf_get_image_intratile_offset_el(&cmd_buffer->device->isl_dev,
+                                                   &dest_image->color_surface.isl,
+                                                   pRegions[r].imageSubresource.mipLevel,
+                                                   pRegions[r].imageSubresource.baseArrayLayer + slice_array,
+                                                   pRegions[r].imageOffset.z + slice_3d,
+                                                   &img_o, &img_x, &img_y);
+
+         VkOffset3D dest_offset_el = meta_region_offset_el(dest_image, & pRegions[r].imageOffset);
+         dest_offset_el.x += img_x;
+         dest_offset_el.y += img_y;
+         dest_offset_el.z = 0;
+
          struct anv_image_view dest_iview;
          anv_image_view_init(&dest_iview, cmd_buffer->device,
             &(VkImageViewCreateInfo) {
@@ -1346,9 +1362,6 @@ void anv_CmdCopyBufferToImage(
             },
             cmd_buffer);
 
-         VkOffset3D dest_offset_el = meta_region_offset_el(dest_image,
-                                                      &pRegions[r].imageOffset);
-         dest_offset_el.z = 0;
          const VkExtent3D img_extent_el = meta_region_extent_el(dest_image->vk_format,
                                                       &pRegions[r].imageExtent);