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>
(cherry picked from commit 68d6cdfbc5)
This commit is contained in:
Faith Ekstrand 2024-07-22 11:35:57 -05:00 committed by Eric Engestrom
parent a3aed210bd
commit 43d3468267
2 changed files with 7 additions and 2 deletions

View file

@ -594,7 +594,7 @@
"description": "nvk: Reject sparse images on Maxwell A and earlier",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "d2177f47649bb39d8afd84eca95deabe63c447fb",
"notes": null

View file

@ -348,6 +348,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
@ -360,7 +365,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;