Module: Mesa
Branch: main
Commit: 819b94176ad1fa8c6c0fe366a4919ae58af0a83a
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=819b94176ad1fa8c6c0fe366a4919ae58af0a83a

Author: Paulo Zanoni <[email protected]>
Date:   Thu Nov 30 16:43:07 2023 -0800

anv/sparse: check if the non-sparse version is supported first

During vkGetPhysicalDeviceSparseImageFormatProperties(), check first
if the non-sparse version of the image is supported, and return in
case it's not.

On TGL, if we don't do that, we may hit the following assertion:
  deqp-vk: ../../src/intel/isl/isl.c:2584: isl_surf_init_s: Assertion 
`!(info->usage & ISL_SURF_USAGE_CPB_BIT) || 
dev->info->has_coarse_pixel_primitive_and_cb' failed.

My TGL doesn't has_coarse_pixel_primitive_and_cb.

Fixes the following on TGL:
  dEQP-VK.api.maintenance5.flags.sparse_image_format_props
  dEQP-VK.api.maintenance5.flags.sparse_image_format_props2

Reviewed-by: Lionel Landwerlin <[email protected]>
Signed-off-by: Paulo Zanoni <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26454>

---

 src/intel/vulkan/anv_formats.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index a402b062004..8d652e0c8f8 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -1828,6 +1828,22 @@ void anv_GetPhysicalDeviceSparseImageFormatProperties2(
    vk_foreach_struct_const(ext, pFormatInfo->pNext)
       anv_debug_ignored_stype(ext->sType);
 
+   /* Check if the image is supported at all (regardless of being Sparse). */
+   const VkPhysicalDeviceImageFormatInfo2 img_info = {
+      .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2,
+      .pNext = NULL,
+      .format = pFormatInfo->format,
+      .type = pFormatInfo->type,
+      .tiling = pFormatInfo->tiling,
+      .usage = pFormatInfo->usage,
+      .flags = VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
+               VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT,
+   };
+   VkImageFormatProperties img_props;
+   if (anv_get_image_format_properties(physical_device, &img_info,
+                                       &img_props, NULL, false) != VK_SUCCESS)
+      return;
+
    if (anv_sparse_image_check_support(physical_device,
                                       VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
                                       VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT,

Reply via email to