anv/sparse: fix reporting of VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT

This calculation was wrong for both compressed formats and
multi-sampled images. As a result, we misreported the image as having
a single miptail.

No Vulkan or GL CTS tests were tripping on this bug. I found this
while looking for tile size calculations after fixing a similar bug
elsewhere in the code.

The calculation should now match what we have in
anv_sparse_bind_image_memory(), which is widely tested.

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/29337>
This commit is contained in:
Paulo Zanoni 2024-05-16 14:39:39 -07:00 committed by Marge Bot
parent 789b53c523
commit 6a6d449a1d

View file

@ -931,8 +931,12 @@ anv_sparse_calc_image_format_properties(struct anv_physical_device *pdevice,
assert(is_standard || is_known_nonstandard_format);
assert(!(is_standard && is_known_nonstandard_format));
uint32_t block_size = granularity.width * granularity.height *
granularity.depth * Bpb;
VkExtent3D block_shape_el = vk_extent3d_px_to_el(granularity, isl_layout);
uint32_t block_size = block_shape_el.width * Bpb *
block_shape_el.height *
block_shape_el.depth * vk_samples;
assert(block_size == 64 * 1024 || block_size == 4096);
bool wrong_block_size = block_size != ANV_SPARSE_BLOCK_SIZE;
return (VkSparseImageFormatProperties) {