diff options
author | Jason Ekstrand <[email protected]> | 2019-07-12 08:20:25 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-07-12 16:13:48 +0000 |
commit | 16842b2391bac018326c9a2ee8dd36122b8269ee (patch) | |
tree | a66e594953d5f9df61c0f453bca880799a233d4c /src/intel | |
parent | b393b2ce95560f82623dad35757e5a65a8d3a582 (diff) |
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 <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r-- | src/intel/vulkan/anv_image.c | 11 |
1 files changed, 9 insertions, 2 deletions
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 | |