From: Chad Versace Date: Mon, 25 Jan 2016 17:14:03 +0000 (-0800) Subject: anv/meta: Add func anv_meta_get_iview_layer() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8cc1e59d61a71cb6444fc849a9f2d3dd4803d2ae;p=mesa.git anv/meta: Add func anv_meta_get_iview_layer() 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. --- diff --git a/src/vulkan/anv_meta.c b/src/vulkan/anv_meta.c index 4fd61476635..2c70e6708ea 100644 --- a/src/vulkan/anv_meta.c +++ b/src/vulkan/anv_meta.c @@ -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; diff --git a/src/vulkan/anv_meta.h b/src/vulkan/anv_meta.h index 31d344a4cbe..47c6d335438 100644 --- a/src/vulkan/anv_meta.h +++ b/src/vulkan/anv_meta.h @@ -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