From 620f1d1a7a0a7848f9beaf8013aa4fc692cce39e Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Thu, 25 Jan 2024 15:53:02 -0800 Subject: [PATCH] anv/sparse: properly reject sample counts we don't support Yes, I understand that this looks like the kind of check that the applications should be doing instead of us, but if we don't that, dEQP will have failures. If we claim support for any multi-sampled sparse feature, dEQP will try to create multi-sampled sparse images with all possible sample counts, including the ones supported by non-sparse but not supported by sparse (x8 and x16 on Tile64 platforms) and also the ones not supported at all, like x32 and x64. This change affects a number of dEQP tests, including: - dEQP-VK.api.info.sparse_image_format_properties2.2d.optimal.r32g32_sfloat Without this patch, and with sparse multi-sampling enabled, this would hit the following assertion: anv_sparse.c:866: anv_sparse_calc_image_format_properties: Assertion `is_standard || is_known_nonstandard_format' failed. Reviewed-by: Lionel Landwerlin Signed-off-by: Paulo Zanoni Part-of: --- src/intel/vulkan/anv_sparse.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c index bf9347e681e..6eee1c946b3 100644 --- a/src/intel/vulkan/anv_sparse.c +++ b/src/intel/vulkan/anv_sparse.c @@ -1188,8 +1188,16 @@ anv_sparse_image_check_support(struct anv_physical_device *pdevice, if (tiling == VK_IMAGE_TILING_LINEAR) return VK_ERROR_FORMAT_NOT_SUPPORTED; - /* TODO: not supported yet. */ - if (samples != VK_SAMPLE_COUNT_1_BIT) + if ((samples & VK_SAMPLE_COUNT_2_BIT && + !pdevice->vk.supported_features.sparseResidency2Samples) || + (samples & VK_SAMPLE_COUNT_4_BIT && + !pdevice->vk.supported_features.sparseResidency4Samples) || + (samples & VK_SAMPLE_COUNT_8_BIT && + !pdevice->vk.supported_features.sparseResidency8Samples) || + (samples & VK_SAMPLE_COUNT_16_BIT && + !pdevice->vk.supported_features.sparseResidency16Samples) || + samples & VK_SAMPLE_COUNT_32_BIT || + samples & VK_SAMPLE_COUNT_64_BIT) return VK_ERROR_FEATURE_NOT_PRESENT; /* While the Vulkan spec allows us to support depth/stencil sparse images