mesa/draw: drop the multi draw with indices fallback.
authorDave Airlie <airlied@redhat.com>
Mon, 20 Dec 2021 01:21:33 +0000 (11:21 +1000)
committerMarge Bot <emma+marge@anholt.net>
Thu, 23 Dec 2021 19:06:56 +0000 (19:06 +0000)
Gallium drivers don't need this.

v2: drop some more code

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14261>

src/mesa/main/draw.c
src/mesa/main/mtypes.h
src/mesa/state_tracker/st_extensions.c

index 71b72dc..e291f69 100644 (file)
@@ -981,48 +981,40 @@ _mesa_draw_gallium_fallback(struct gl_context *ctx,
    ib.index_size_shift = util_logbase2(index_size);
 
    /* Single draw or a fallback for user indices. */
-   if (num_draws == 1 ||
-       (info->index_size && info->has_user_indices &&
-        !ctx->Const.MultiDrawWithUserIndices)) {
-      for (unsigned i = 0; i < num_draws; i++) {
-         if (!draws[i].count)
-            continue;
+   if (num_draws == 1) {
+      if (!draws[0].count)
+         return;
 
-         if (index_size) {
-            ib.count = draws[i].count;
-
-            if (info->has_user_indices) {
-               ib.obj = NULL;
-               /* User indices require start to be added here if
-                * Const.MultiDrawWithUserIndices is false.
-                */
-               ib.ptr = (const char*)info->index.user +
-                        draws[i].start * index_size;
-            } else {
-               ib.obj = info->index.gl_bo;
-               ib.ptr = NULL;
-            }
-         }
+      if (index_size) {
+         ib.count = draws[0].count;
 
-         struct _mesa_prim prim;
-         prim.mode = info->mode;
-         prim.begin = 1;
-         prim.end = 1;
-         prim.start = index_size && info->has_user_indices ? 0 : draws[i].start;
-         prim.count = draws[i].count;
-         prim.basevertex = index_size ? draws[i].index_bias : 0;
-         prim.draw_id = drawid_offset + (info->increment_draw_id ? i : 0);
-
-         if (!index_size) {
-            min_index = draws[i].start;
-            max_index = draws[i].start + draws[i].count - 1;
+         if (info->has_user_indices) {
+            ib.obj = NULL;
+            ib.ptr = (const char*)info->index.user;
+         } else {
+            ib.obj = info->index.gl_bo;
+            ib.ptr = NULL;
          }
+      }
+
+      struct _mesa_prim prim;
+      prim.mode = info->mode;
+      prim.begin = 1;
+      prim.end = 1;
+      prim.start = draws[0].start;
+      prim.count = draws[0].count;
+      prim.basevertex = index_size ? draws[0].index_bias : 0;
+      prim.draw_id = drawid_offset;
 
-         st_feedback_draw_vbo(ctx, &prim, 1, index_size ? &ib : NULL,
-                              index_bounds_valid, info->primitive_restart,
-                              info->restart_index, min_index, max_index,
-                              info->instance_count, info->start_instance);
+      if (!index_size) {
+         min_index = draws[0].start;
+         max_index = draws[0].start + draws[0].count - 1;
       }
+
+      st_feedback_draw_vbo(ctx, &prim, 1, index_size ? &ib : NULL,
+                           index_bounds_valid, info->primitive_restart,
+                           info->restart_index, min_index, max_index,
+                           info->instance_count, info->start_instance);
       return;
    }
 
index 91b38d9..579d1be 100644 (file)
@@ -4295,9 +4295,6 @@ struct gl_constants
    /** Whether the vertex buffer offset is a signed 32-bit integer. */
    bool VertexBufferOffsetIsInt32;
 
-   /** Whether the driver can handle MultiDrawElements with non-VBO indices. */
-   bool MultiDrawWithUserIndices;
-
    /** Whether out-of-order draw (Begin/End) optimizations are allowed. */
    bool AllowDrawOutOfOrder;
 
index 04f5310..aa5fe92 100644 (file)
@@ -633,7 +633,6 @@ void st_init_limits(struct pipe_screen *screen,
    c->VertexBufferOffsetIsInt32 =
       screen->get_param(screen, PIPE_CAP_SIGNED_VERTEX_BUFFER_OFFSET);
 
-   c->MultiDrawWithUserIndices = true;
    c->AllowDynamicVAOFastPath =
          screen->get_param(screen, PIPE_CAP_ALLOW_DYNAMIC_VAO_FASTPATH);