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

Author: Alyssa Rosenzweig <[email protected]>
Date:   Mon Apr 25 10:28:29 2022 -0400

panvk: Consider primitive restart in index buffer walks

Fixes:

dEQP-VK.pipeline.input_assembly.primitive_restart.index_type_uint32.line_strip

Signed-off-by: Alyssa Rosenzweig <[email protected]>
Reviewed-by: Boris Brezillon <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16140>

---

 src/panfrost/ci/deqp-panfrost-g52-vk.toml | 1 +
 src/panfrost/vulkan/panvk_vX_cmd_buffer.c | 8 +++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/ci/deqp-panfrost-g52-vk.toml 
b/src/panfrost/ci/deqp-panfrost-g52-vk.toml
index f135d8a71c0..6858f2460e6 100644
--- a/src/panfrost/ci/deqp-panfrost-g52-vk.toml
+++ b/src/panfrost/ci/deqp-panfrost-g52-vk.toml
@@ -21,6 +21,7 @@ include = [
     "dEQP-VK.glsl.derivate.*.linear.*",
     "dEQP-VK.glsl.derivate.*.uniform_*",
     "dEQP-VK.image.load_store.with_format.*",
+    "dEQP-VK.pipeline.input_assembly.*",
     
"dEQP-VK.pipeline.sampler.view_type.*.format.r*.address_modes.all_mode_clamp_to_border*",
     "dEQP-VK.ssbo.layout.single_basic_type.*",
 ]
diff --git a/src/panfrost/vulkan/panvk_vX_cmd_buffer.c 
b/src/panfrost/vulkan/panvk_vX_cmd_buffer.c
index 703a8a4cb2d..37f1606ce09 100644
--- a/src/panfrost/vulkan/panvk_vX_cmd_buffer.c
+++ b/src/panfrost/vulkan/panvk_vX_cmd_buffer.c
@@ -989,6 +989,7 @@ panvk_per_arch(CmdDraw)(VkCommandBuffer commandBuffer,
 static void
 panvk_index_minmax_search(struct panvk_cmd_buffer *cmdbuf,
                           uint32_t start, uint32_t count,
+                          bool restart,
                           uint32_t *min, uint32_t *max)
 {
    void *ptr = cmdbuf->state.ib.buffer->bo->ptr.cpu +
@@ -1013,6 +1014,7 @@ panvk_index_minmax_search(struct panvk_cmd_buffer *cmdbuf,
       uint ## sz ## _t *indices = ptr; \
       *min = UINT ## sz ## _MAX; \
       for (uint32_t i = 0; i < count; i++) { \
+         if (restart && indices[i + start] == UINT ## sz ##_MAX) continue; \
          *min = MIN2(indices[i + start], *min); \
          *max = MAX2(indices[i + start], *max); \
       } \
@@ -1041,7 +1043,11 @@ panvk_per_arch(CmdDrawIndexed)(VkCommandBuffer 
commandBuffer,
    if (instanceCount == 0 || indexCount == 0)
       return;
 
-   panvk_index_minmax_search(cmdbuf, firstIndex, indexCount,
+   const struct panvk_pipeline *pipeline =
+      panvk_cmd_get_pipeline(cmdbuf, GRAPHICS);
+   bool primitive_restart = pipeline->ia.primitive_restart;
+
+   panvk_index_minmax_search(cmdbuf, firstIndex, indexCount, primitive_restart,
                              &min_vertex, &max_vertex);
 
    unsigned vertex_range = max_vertex - min_vertex + 1;

Reply via email to