nvk: Reject sparse images on Maxwell A and earlier

Even though we don't advertise the sparseResidency feature, a bunch of
CTS tests just call GetPhysicalDeviceImageFormatProperties2() with
SPARSE_RESIDENCY_BIT and see if that fails.

Fixes: d2177f4764 ("nvk: Don't advertise sparse residency on Maxwell A")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30303>
This commit is contained in:
Faith Ekstrand 2024-07-22 11:35:57 -05:00 committed by Marge Bot
parent 49b433d5e7
commit 68d6cdfbc5

View file

@ -349,6 +349,11 @@ nvk_GetPhysicalDeviceImageFormatProperties2(
if (ycbcr_info && pImageFormatInfo->type != VK_IMAGE_TYPE_2D)
return VK_ERROR_FORMAT_NOT_SUPPORTED;
/* Maxwell B and earlier don't support sparse residency */
if ((pImageFormatInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) &&
pdev->info.cls_eng3d < MAXWELL_B)
return VK_ERROR_FORMAT_NOT_SUPPORTED;
/* From the Vulkan 1.3.279 spec:
*
* VUID-VkImageCreateInfo-tiling-04121
@ -361,7 +366,7 @@ nvk_GetPhysicalDeviceImageFormatProperties2(
* "If imageType is VK_IMAGE_TYPE_1D, flags must not contain
* VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT"
*/
if (pImageFormatInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT &&
if ((pImageFormatInfo->flags & VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT) &&
(pImageFormatInfo->type == VK_IMAGE_TYPE_1D ||
pImageFormatInfo->tiling == VK_IMAGE_TILING_LINEAR))
return VK_ERROR_FORMAT_NOT_SUPPORTED;