anv/sparse: fix block_size_B when the image is multi-sampled

This is all that's needed to make anv_sparse_bind_image_memory() work
with multi-sampled images.

The assert() we just added would have been really helpful when
debugging this.

All the dEQP tests with "sparse" in their names are passing *even*
without this patch. Real-world applications show very clear visual
corruption for sparse MSAA images bound through non-opaque binds since
only a fraction of the the actual image ends up being bound.

Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27306>
This commit is contained in:
Paulo Zanoni
2024-01-24 16:42:06 -08:00
committed by Marge Bot
parent 6d748f5b2c
commit e69c7cd149
+4 -1
View File
@@ -1079,7 +1079,10 @@ anv_sparse_bind_image_memory(struct anv_queue *queue,
* either 4k or 64k depending on the tiling format. */
const uint64_t block_size_B = block_shape_el.width * (layout->bpb / 8) *
block_shape_el.height *
block_shape_el.depth;
block_shape_el.depth *
image->vk.samples;
assert(block_size_B == (64 * 1024) || block_size_B == 4096);
/* How many blocks are necessary to form a whole line on this image? */
const uint32_t blocks_per_line = surf->row_pitch_B / (layout->bpb / 8) /
block_shape_el.width;