From 16842b2391bac018326c9a2ee8dd36122b8269ee Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 12 Jul 2019 08:20:25 -0500 Subject: anv: Properly compute image usage in CreateImageView With separate stencil usage, we can't just grab the usage from the image directly and have to consider the per-aspect usage instead. Fixes: 1be38f9178 "anv:Use VK_EXT_separate_stencil_usage to avoid..." Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_image.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/intel') diff --git a/src/intel/vulkan/anv_image.c b/src/intel/vulkan/anv_image.c index 4adefb979b7..36c43f26634 100644 --- a/src/intel/vulkan/anv_image.c +++ b/src/intel/vulkan/anv_image.c @@ -1539,11 +1539,18 @@ anv_CreateImageView(VkDevice _device, conv_format = conversion->format; } + VkImageUsageFlags image_usage = 0; + if (range->aspectMask & ~VK_IMAGE_ASPECT_STENCIL_BIT) + image_usage |= image->usage; + if (range->aspectMask & VK_IMAGE_ASPECT_STENCIL_BIT) + image_usage |= image->stencil_usage; + const VkImageViewUsageCreateInfo *usage_info = vk_find_struct_const(pCreateInfo, IMAGE_VIEW_USAGE_CREATE_INFO); - VkImageUsageFlags view_usage = usage_info ? usage_info->usage : image->usage; + VkImageUsageFlags view_usage = usage_info ? usage_info->usage : image_usage; + /* View usage should be a subset of image usage */ - assert((view_usage & ~image->usage) == 0); + assert((view_usage & ~image_usage) == 0); assert(view_usage & (VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | -- cgit v1.2.3