anv/image: Fix VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT
authorChad Versace <chadversary@chromium.org>
Mon, 17 Jul 2017 22:18:51 +0000 (15:18 -0700)
committerChad Versace <chadversary@chromium.org>
Wed, 19 Jul 2017 18:25:50 +0000 (11:25 -0700)
We incorrectly detected VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT.  We looked
for the bit in VkImageCreateInfo::usage, but it's actually in
VkImageCreateInfo::flags.

Found by assertion failures while enabling VK_ANDROID_native_buffer.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_image.c

index 149e1f20334dca213939224f6181518dd8b4828e..4f0057c9527392a2979f181e020d43ef4aa74e5c 100644 (file)
@@ -37,7 +37,8 @@
  * Exactly one bit must be set in \a aspect.
  */
 static isl_surf_usage_flags_t
-choose_isl_surf_usage(VkImageUsageFlags vk_usage,
+choose_isl_surf_usage(VkImageCreateFlags vk_create_flags,
+                      VkImageUsageFlags vk_usage,
                       VkImageAspectFlags aspect)
 {
    isl_surf_usage_flags_t isl_usage = 0;
@@ -51,7 +52,7 @@ choose_isl_surf_usage(VkImageUsageFlags vk_usage,
    if (vk_usage & VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT)
       isl_usage |= ISL_SURF_USAGE_RENDER_TARGET_BIT;
 
-   if (vk_usage & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
+   if (vk_create_flags & VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)
       isl_usage |= ISL_SURF_USAGE_CUBE_BIT;
 
    /* Even if we're only using it for transfer operations, clears to depth and
@@ -168,7 +169,7 @@ make_surface(const struct anv_device *dev,
       .samples = vk_info->samples,
       .min_alignment = 0,
       .row_pitch = anv_info->stride,
-      .usage = choose_isl_surf_usage(image->usage, aspect),
+      .usage = choose_isl_surf_usage(vk_info->flags, image->usage, aspect),
       .tiling_flags = tiling_flags);
 
    /* isl_surf_init() will fail only if provided invalid input. Invalid input