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 <lionel.g.landwerlin@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26454>
This commit is contained in:
Paulo Zanoni 2023-11-30 16:43:07 -08:00 committed by Marge Bot
parent 181aa83027
commit 819b94176a

View file

@ -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,