[Mesa-dev] [PATCH 1/2] vbo: set min_index = 0 so gallium can use the value directly

Marek Olšák maraeo at gmail.com
Wed Apr 26 09:35:37 UTC 2017


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

We could also remove index_bounds_valid and use max_index != ~0 instead.
Opinions on that are welcome.
---
 src/mesa/vbo/vbo_context.c    | 2 +-
 src/mesa/vbo/vbo_exec_array.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 7022fe9..384e405 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -161,21 +161,21 @@ vbo_draw_indirect_prims(struct gl_context *ctx,
    prim[draw_count - 1].end = 1;
    for (i = 0; i < draw_count; ++i, indirect_offset += stride) {
       prim[i].mode = mode;
       prim[i].indexed = !!ib;
       prim[i].indirect_offset = indirect_offset;
       prim[i].is_indirect = 1;
       prim[i].draw_id = i;
    }
 
    vbo->draw_prims(ctx, prim, draw_count,
-                   ib, false, ~0, ~0,
+                   ib, false, 0, ~0,
                    NULL, 0,
                    ctx->DrawIndirectBuffer);
 
    free(prim);
 }
 
 
 GLboolean _vbo_CreateContext( struct gl_context *ctx )
 {
    struct vbo_context *vbo = CALLOC_STRUCT(vbo_context);
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index aecfad0..15382ea 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -1315,21 +1315,21 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
          prim[i].base_instance = 0;
          prim[i].draw_id = i;
          prim[i].is_indirect = 0;
          if (basevertex != NULL)
             prim[i].basevertex = basevertex[i];
          else
             prim[i].basevertex = 0;
       }
 
       vbo->draw_prims(ctx, prim, primcount, &ib,
-                      false, ~0, ~0, NULL, 0, NULL);
+                      false, 0, ~0, NULL, 0, NULL);
    }
    else {
       /* render one prim at a time */
       for (i = 0; i < primcount; i++) {
          if (count[i] == 0)
             continue;
          ib.count = count[i];
          ib.index_size = vbo_sizeof_ib_type(type);
          ib.obj = ctx->Array.VAO->IndexBufferObj;
          ib.ptr = indices[i];
@@ -1344,21 +1344,21 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
          prim[0].indexed = 1;
          prim[0].num_instances = 1;
          prim[0].base_instance = 0;
          prim[0].draw_id = i;
          prim[0].is_indirect = 0;
          if (basevertex != NULL)
             prim[0].basevertex = basevertex[i];
          else
             prim[0].basevertex = 0;
 
-         vbo->draw_prims(ctx, prim, 1, &ib, false, ~0, ~0, NULL, 0, NULL);
+         vbo->draw_prims(ctx, prim, 1, &ib, false, 0, ~0, NULL, 0, NULL);
       }
    }
 
    free(prim);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
       _mesa_flush(ctx);
    }
 }
 
@@ -1436,21 +1436,21 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
    prim[0].end = 1;
    prim[0].mode = mode;
    prim[0].num_instances = numInstances;
    prim[0].base_instance = 0;
    prim[0].is_indirect = 0;
 
    /* Maybe we should do some primitive splitting for primitive restart
     * (like in DrawArrays), but we have no way to know how many vertices
     * will be rendered. */
 
-   vbo->draw_prims(ctx, prim, 1, NULL, GL_FALSE, ~0, ~0, obj, stream, NULL);
+   vbo->draw_prims(ctx, prim, 1, NULL, GL_FALSE, 0, ~0, obj, stream, NULL);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
       _mesa_flush(ctx);
    }
 }
 
 
 /**
  * Like DrawArrays, but take the count from a transform feedback object.
  * \param mode  GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
-- 
2.7.4



More information about the mesa-dev mailing list