anv/meta: Add func anv_meta_get_iview_layer()
authorChad Versace <chad.versace@intel.com>
Mon, 25 Jan 2016 17:14:03 +0000 (09:14 -0800)
committerChad Versace <chad.versace@intel.com>
Thu, 28 Jan 2016 00:52:30 +0000 (16:52 -0800)
This function is just meta_blit_get_dest_view_base_array_slice(), but
moved to the shared header anv_meta.h.

Will be needed by anv_meta_resolve.c.

src/vulkan/anv_meta.c
src/vulkan/anv_meta.h

index 4fd61476635f13dcacdbf5820bfe21a79a0a5c17..2c70e6708ea97a0628c11fee1a3435288cbdbaca 100644 (file)
@@ -169,10 +169,14 @@ anv_meta_get_view_type(const struct anv_image *image)
    }
 }
 
-static uint32_t
-meta_blit_get_dest_view_base_array_slice(const struct anv_image *dest_image,
-                                         const VkImageSubresourceLayers *dest_subresource,
-                                         const VkOffset3D *dest_offset)
+/**
+ * When creating a destination VkImageView, this function provides the needed
+ * VkImageViewCreateInfo::subresourceRange::baseArrayLayer.
+ */
+uint32_t
+anv_meta_get_iview_layer(const struct anv_image *dest_image,
+                         const VkImageSubresourceLayers *dest_subresource,
+                         const VkOffset3D *dest_offset)
 {
    switch (dest_image->type) {
    case VK_IMAGE_TYPE_1D:
@@ -1078,9 +1082,8 @@ void anv_CmdCopyImage(
       }
 
       const uint32_t dest_base_array_slice =
-         meta_blit_get_dest_view_base_array_slice(dest_image,
-                                                  &pRegions[r].dstSubresource,
-                                                  &pRegions[r].dstOffset);
+         anv_meta_get_iview_layer(dest_image, &pRegions[r].dstSubresource,
+                                  &pRegions[r].dstOffset);
 
       for (unsigned slice = 0; slice < num_slices; slice++) {
          VkOffset3D src_offset = pRegions[r].srcOffset;
@@ -1186,9 +1189,8 @@ void anv_CmdBlitImage(
       };
 
       const uint32_t dest_array_slice =
-         meta_blit_get_dest_view_base_array_slice(dest_image,
-                                                  &pRegions[r].dstSubresource,
-                                                  &pRegions[r].dstOffsets[0]);
+         anv_meta_get_iview_layer(dest_image, &pRegions[r].dstSubresource,
+                                  &pRegions[r].dstOffsets[0]);
 
       if (pRegions[r].srcSubresource.layerCount > 1)
          anv_finishme("FINISHME: copy multiple array layers");
@@ -1304,9 +1306,8 @@ void anv_CmdCopyBufferToImage(
                                &pRegions[r]);
 
       const uint32_t dest_base_array_slice =
-         meta_blit_get_dest_view_base_array_slice(dest_image,
-                                                  &pRegions[r].imageSubresource,
-                                                  &pRegions[r].imageOffset);
+         anv_meta_get_iview_layer(dest_image, &pRegions[r].imageSubresource,
+                                  &pRegions[r].imageOffset);
 
       unsigned num_slices_3d = pRegions[r].imageExtent.depth;
       unsigned num_slices_array = pRegions[r].imageSubresource.layerCount;
index 31d344a4cbe1d3611e44eabb54836ddb7bc2fe8d..47c6d3354383eb0efab82986e892c55b3609a477 100644 (file)
@@ -59,6 +59,11 @@ anv_meta_restore(const struct anv_meta_saved_state *state,
 VkImageViewType
 anv_meta_get_view_type(const struct anv_image *image);
 
+uint32_t
+anv_meta_get_iview_layer(const struct anv_image *dest_image,
+                         const VkImageSubresourceLayers *dest_subresource,
+                         const VkOffset3D *dest_offset);
+
 #ifdef __cplusplus
 }
 #endif