[Mesa-dev] [PATCH 3/4] st/mesa: ignore primitive restart if FixedIndex is enabled in DrawArraysIndirect

Marek Olšák maraeo at gmail.com
Sun Jan 4 13:44:19 PST 2015


From: Marek Olšák <marek.olsak at amd.com>

>From GL 4.4 Core profile:

  If both PRIMITIVE_RESTART and PRIMITIVE_RESTART_FIXED_INDEX are
  enabled, the index value determined by PRIMITIVE_RESTART_FIXED_INDEX is
  used. If PRIMITIVE_RESTART_FIXED_INDEX is enabled, primitive restart is not
  performed for array elements transferred by any drawing command not taking a
  type parameter, including all of the *Draw* commands other than *DrawEle-
  ments*.

If only I had a driver where primitive restart works with DrawArraysIndirect.
I can't test this, sorry.
---
 src/mesa/state_tracker/st_draw.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c
index b6ccdd7..9e5a5a9 100644
--- a/src/mesa/state_tracker/st_draw.c
+++ b/src/mesa/state_tracker/st_draw.c
@@ -248,9 +248,15 @@ st_draw_vbo(struct gl_context *ctx,
    if (indirect) {
       info.indirect = st_buffer_object(indirect)->buffer;
 
-      /* Primitive restart is not handled by the VBO module in this case. */
-      info.primitive_restart = ctx->Array._PrimitiveRestart;
-      info.restart_index = ctx->Array.RestartIndex;
+      /* Primitive restart for DrawArrays is not handled by the VBO module
+       * in this case.
+       *
+       * If PrimitiveRestartFixedIndex is enabled, primitive_restart must
+       * be disabled for DrawArrays. DrawElements is handled above. */
+      if (!ib && !ctx->Array.PrimitiveRestartFixedIndex) {
+         info.primitive_restart = ctx->Array.PrimitiveRestart;
+         info.restart_index = ctx->Array.RestartIndex;
+      }
    }
 
    /* do actual drawing */
-- 
2.1.0



More information about the mesa-dev mailing list