Module: Mesa
Branch: main
Commit: bf0f261c1eccce8bee373666fac25d61b8a5d551
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf0f261c1eccce8bee373666fac25d61b8a5d551

Author: Paulo Zanoni <[email protected]>
Date:   Thu Nov 30 17:42:07 2023 -0800

anv/sparse: document USAGE_2D_3D_COMPATIBLE as non-standard too

The standard block shapes (and by extension, the tiling formats they
require) are simply incompatible with getting a 2D view of a 3D image.
I couldn't find in the Vulkan spec anything related to what are the
expectations when trying to use both at the same time.

So here we "document" that this case is known non-standard. Please
notice that since we report residencyStandard3DBlockShape as true we
were actually supposed to support this case, but I can't see how this
would be possible, so set is_known_nonstandard_format to true so we
can avoid the assert() that comes right after.

Fixes the following when using Zink:
  KHR-GL46.sparse_texture_tests.SparseTextureAllocation

Also "moves forward" the following test on Zink, so it now hits a
different assertion:
  KHR-GL46.sparse_texture_tests.SparseTextureCommitment

Reviewed-by: Lionel Landwerlin <[email protected]>
Signed-off-by: Paulo Zanoni <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26454>

---

 src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt | 3 +--
 src/intel/vulkan/anv_sparse.c                      | 7 +++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt 
b/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt
index 1e1f856a0c0..8b8b34e3f26 100644
--- a/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt
+++ b/src/gallium/drivers/zink/ci/zink-anv-tgl-fails.txt
@@ -686,8 +686,7 @@ 
spec@arb_gpu_shader_fp64@execution@arb_gpu_shader_fp64-vs-getuniformdv,Crash
 
 spec@arb_fragment_layer_viewport@layer-no-gs,Fail
 
-# anv_sparse_calc_image_format_properties: Assertion `is_standard || 
is_known_nonstandard_format' failed
-KHR-GL46.sparse_texture_tests.SparseTextureAllocation,Crash
+# sparse_backing_alloc: Assertion `bo->u.sparse.num_backing_pages < 
DIV_ROUND_UP(bo->base.size, ZINK_SPARSE_BUFFER_PAGE_SIZE)' failed
 KHR-GL46.sparse_texture_tests.SparseTextureCommitment,Crash
 
 # Assertion `size % ZINK_SPARSE_BUFFER_PAGE_SIZE == 0 || offset + size == 
bo->base.size' failed.
diff --git a/src/intel/vulkan/anv_sparse.c b/src/intel/vulkan/anv_sparse.c
index 53002a7cdc2..180cf7e2c5d 100644
--- a/src/intel/vulkan/anv_sparse.c
+++ b/src/intel/vulkan/anv_sparse.c
@@ -812,6 +812,13 @@ anv_sparse_calc_image_format_properties(struct 
anv_physical_device *pdevice,
       if (pdevice->info.verx10 >= 125 && isl_format_is_yuv(surf->format))
          is_known_nonstandard_format = true;
 
+      /* The standard block shapes (and by extension, the tiling formats they
+       * require) are simply incompatible with getting a 2D view of a 3D
+       * image.
+       */
+      if (surf->usage & ISL_SURF_USAGE_2D_3D_COMPATIBLE_BIT)
+         is_known_nonstandard_format = true;
+
       is_standard = granularity.width == std_shape.width &&
                     granularity.height == std_shape.height &&
                     granularity.depth == std_shape.depth;

Reply via email to