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 <lionel.g.landwerlin@intel.com>
This commit is contained in:
Jason Ekstrand
2019-07-12 08:20:25 -05:00
parent b393b2ce95
commit 16842b2391
+9 -2
View File
@@ -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 |