aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2024-01-25 16:00:09 -0800
committerMarge Bot <emma+marge@anholt.net>2024-05-15 08:00:15 +0000
commit6d748f5b2c7541ffbc45e55e36d16a7154e4bb14 (patch)
tree75467a237ecdc3756ace7c3aea5d5b521dbf7a03
parent620f1d1a7a0a7848f9beaf8013aa4fc692cce39e (diff)
downloadmesa3d-6d748f5b2c7541ffbc45e55e36d16a7154e4bb14.tar.gz
anv/sparse: reject all sample flags that non-sparse doesn't support
We call anv_get_image_format_properties() from anv_GetPhysicalDeviceSparseImageFormatProperties2() because we want to reject all images that we don't support for the non-sparse case. That function does not take sample counts as its input, it outputs a list of possible sample counts. In this patch we check the sample counts it outputs: if what the user is querying isn't even supported by non-sparse, reject it right away. That saves us from having to code in anv_sparse_image_check_support() cases that are coded elsewhere. Examples include: 1D images and compressed formats. This change affects a number of dEQP tests, including: - dEQP-VK.api.info.sparse_image_format_properties2.1d.optimal.r4g4b4a4_unorm_pack16 - dEQP-VK.api.info.sparse_image_format_properties2.2d.optimal.bc2_srgb_block Without this patch, and with sparse multi-sampling enabled, this would hit the following assertion: anv_formats.c:1903: anv_GetPhysicalDeviceSparseImageFormatProperties2: Assertion `false' failed. 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/27306>
-rw-r--r--src/intel/vulkan/anv_formats.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c
index 3dd9e6599a6..ebd76667e5f 100644
--- a/src/intel/vulkan/anv_formats.c
+++ b/src/intel/vulkan/anv_formats.c
@@ -1840,6 +1840,10 @@ void anv_GetPhysicalDeviceSparseImageFormatProperties2(
&img_info, &img_props) != VK_SUCCESS)
return;
+ if ((pFormatInfo->samples &
+ img_props.imageFormatProperties.sampleCounts) == 0)
+ return;
+
if (anv_sparse_image_check_support(physical_device,
VK_IMAGE_CREATE_SPARSE_BINDING_BIT |
VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT,