[Mesa-dev] [PATCH 1/7] panfrost: Implement primitive restart

Alyssa Rosenzweig alyssa.rosenzweig at collabora.com
Thu Jun 27 13:12:21 UTC 2019


For GLES3, just pass the flag through.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
---
 src/gallium/drivers/panfrost/pan_context.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 967d7116c24..26b9cdb4130 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -37,6 +37,7 @@
 #include "util/half_float.h"
 #include "util/u_helpers.h"
 #include "util/u_format.h"
+#include "util/u_prim_restart.h"
 #include "indices/u_primconvert.h"
 #include "tgsi/tgsi_parse.h"
 #include "util/u_math.h"
@@ -1625,6 +1626,15 @@ panfrost_draw_vbo(
 
         int mode = info->mode;
 
+        /* Fallback unsupported restart index */
+        unsigned primitive_index = (1 << (info->index_size * 8)) - 1;
+
+        if (info->primitive_restart && info->index_size
+                        && info->restart_index != primitive_index) {
+                util_draw_vbo_without_prim_restart(pipe, info);
+                return;
+        }
+
         /* Fallback for unsupported modes */
 
         if (!(ctx->draw_modes & (1 << mode))) {
@@ -1661,6 +1671,9 @@ panfrost_draw_vbo(
         if (panfrost_writes_point_size(ctx))
                 draw_flags |= MALI_DRAW_VARYING_SIZE;
 
+        if (info->primitive_restart)
+                draw_flags |= MALI_DRAW_PRIMITIVE_RESTART_FIXED_INDEX;
+
         /* For higher amounts of vertices (greater than what fits in a 16-bit
          * short), the other value is needed, otherwise there will be bizarre
          * rendering artefacts. It's not clear what these values mean yet. */
-- 
2.20.1



More information about the mesa-dev mailing list