[Mesa-dev] [PATCH 14/23] anv/image: Use aspects for computing full usage

Nanley Chery nanleychery at gmail.com
Tue May 17 00:52:48 UTC 2016


On Mon, May 16, 2016 at 12:08:19PM -0700, Jason Ekstrand wrote:
> ---
>  src/intel/vulkan/anv_image.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c
> index 704ca9f..792645d 100644
> --- a/src/intel/vulkan/anv_image.c
> +++ b/src/intel/vulkan/anv_image.c
> @@ -161,7 +161,7 @@ make_surface(const struct anv_device *dev,
>   */
>  static VkImageUsageFlags
>  anv_image_get_full_usage(const VkImageCreateInfo *info,
> -                         const struct anv_format *format)
> +                         VkImageAspectFlags aspects)

It seems like VkImageCreateInfo *info is the only needed parameter here.
With that you can use vk_format_is_depth_or_stencil(info->format) to
handle the depth/stencil case in this function.

With that changed,
Reviewed-by: Nanley Chery <nanley.g.chery at intel.com>


>  {
>     VkImageUsageFlags usage = info->usage;
>  
> @@ -183,7 +183,7 @@ anv_image_get_full_usage(const VkImageCreateInfo *info,
>         */
>        usage |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
>  
> -      if (anv_format_is_depth_or_stencil(format)) {
> +      if (aspects & (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
>           /* vkCmdClearDepthStencilImage() only requires that
>            * VK_IMAGE_USAGE_TRANSFER_SRC_BIT be set. In particular, it does
>            * not require VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT. Meta
> @@ -206,7 +206,6 @@ anv_image_create(VkDevice _device,
>     ANV_FROM_HANDLE(anv_device, device, _device);
>     const VkImageCreateInfo *pCreateInfo = create_info->vk_info;
>     struct anv_image *image = NULL;
> -   const struct anv_format *format = anv_format_for_vk_format(pCreateInfo->format);
>     VkResult r;
>  
>     assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO);
> @@ -231,7 +230,7 @@ anv_image_create(VkDevice _device,
>     image->levels = pCreateInfo->mipLevels;
>     image->array_size = pCreateInfo->arrayLayers;
>     image->samples = pCreateInfo->samples;
> -   image->usage = anv_image_get_full_usage(pCreateInfo, format);
> +   image->usage = anv_image_get_full_usage(pCreateInfo, image->aspects);
>     image->tiling = pCreateInfo->tiling;
>  
>     uint32_t b;
> -- 
> 2.5.0.400.gff86faf
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list