From e69c7cd1496a10fe31b53666f9ab64614dfa9e15 Mon Sep 17 00:00:00 2001 From: Paulo Zanoni Date: Wed, 24 Jan 2024 16:42:06 -0800 Subject: [PATCH] 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 Signed-off-by: Paulo Zanoni Part-of: --- src/intel/vulkan/anv_sparse.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c index 6eee1c946b3..66e1de969a2 100644 --- a/src/intel/vulkan/anv_sparse.c +++ b/src/intel/vulkan/anv_sparse.c @@ -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;