[Mesa-dev] [RFC PATCH v1 18/30] anv: Refactor anv_GetImageSubresourceLayout()

Lionel Landwerlin lionel.g.landwerlin at intel.com
Tue Nov 7 16:18:28 UTC 2017


Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

On 07/11/17 14:47, Chad Versace wrote:
> Its helper function, anv_surface_get_subresource_layout(), was not very
> helpful. So fold it into the main function.
> ---
>   src/intel/vulkan/anv_image.c | 32 +++++++++++---------------------
>   1 file changed, 11 insertions(+), 21 deletions(-)
>
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> index 34df2a348e0..ba932ba47c3 100644
> --- a/src/intel/vulkan/anv_image.c
> +++ b/src/intel/vulkan/anv_image.c
> @@ -677,12 +677,18 @@ VkResult anv_BindImageMemory2KHR(
>      return VK_SUCCESS;
>   }
>   
> -static void
> -anv_surface_get_subresource_layout(struct anv_image *image,
> -                                   struct anv_surface *surface,
> -                                   const VkImageSubresource *subresource,
> -                                   VkSubresourceLayout *layout)
> +void anv_GetImageSubresourceLayout(
> +    VkDevice                                    device,
> +    VkImage                                     _image,
> +    const VkImageSubresource*                   subresource,
> +    VkSubresourceLayout*                        layout)
>   {
> +   ANV_FROM_HANDLE(anv_image, image, _image);
> +   const struct anv_surface *surface =
> +      get_surface(image, subresource->aspectMask);
> +
> +   assert(__builtin_popcount(subresource->aspectMask) == 1);
> +
>      /* If we are on a non-zero mip level or array slice, we need to
>       * calculate a real offset.
>       */
> @@ -696,22 +702,6 @@ anv_surface_get_subresource_layout(struct anv_image *image,
>      layout->size = surface->isl.size;
>   }
>   
> -void anv_GetImageSubresourceLayout(
> -    VkDevice                                    device,
> -    VkImage                                     _image,
> -    const VkImageSubresource*                   pSubresource,
> -    VkSubresourceLayout*                        pLayout)
> -{
> -   ANV_FROM_HANDLE(anv_image, image, _image);
> -
> -   assert(__builtin_popcount(pSubresource->aspectMask) == 1);
> -
> -   anv_surface_get_subresource_layout(image,
> -                                      get_surface(image,
> -                                                  pSubresource->aspectMask),
> -                                      pSubresource, pLayout);
> -}
> -
>   /**
>    * This function determines the optimal buffer to use for a given
>    * VkImageLayout and other pieces of information needed to make that




More information about the mesa-dev mailing list