[Mesa-dev] [PATCH V3 07/13] mesa: add is_indirect to _mesa_prim

Chris Forbes chrisf at ijw.co.nz
Sat Nov 9 01:12:00 PST 2013


V3: Add missing cases

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
---
 src/mesa/vbo/vbo.h            | 3 ++-
 src/mesa/vbo/vbo_exec_api.c   | 1 +
 src/mesa/vbo/vbo_exec_array.c | 9 +++++++++
 src/mesa/vbo/vbo_save_api.c   | 2 ++
 4 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index e1914c8..f58fa0b 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -46,7 +46,8 @@ struct _mesa_prim {
    GLuint end:1;
    GLuint weak:1;
    GLuint no_current_update:1;
-   GLuint pad:19;
+   GLuint is_indirect:1;
+   GLuint pad:18;
 
    GLuint start;
    GLuint count;
diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c
index 600398c..c84d97f 100644
--- a/src/mesa/vbo/vbo_exec_api.c
+++ b/src/mesa/vbo/vbo_exec_api.c
@@ -702,6 +702,7 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode )
    exec->vtx.prim[i].count = 0;
    exec->vtx.prim[i].num_instances = 1;
    exec->vtx.prim[i].base_instance = 0;
+   exec->vtx.prim[i].is_indirect = 0;
 
    ctx->Driver.CurrentExecPrimitive = mode;
 
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 1c6b8b3..3ca489f 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -611,6 +611,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
    prim[0].mode = mode;
    prim[0].num_instances = numInstances;
    prim[0].base_instance = baseInstance;
+   prim[0].is_indirect = 0;
 
    /* Implement the primitive restart index */
    if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
@@ -965,6 +966,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
    prim[0].start = 0;
    prim[0].count = count;
    prim[0].indexed = 1;
+   prim[0].is_indirect = 0;
    prim[0].basevertex = basevertex;
    prim[0].num_instances = numInstances;
    prim[0].base_instance = baseInstance;
@@ -1368,6 +1370,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
 	 prim[i].indexed = 1;
          prim[i].num_instances = 1;
          prim[i].base_instance = 0;
+         prim[i].is_indirect = 0;
 	 if (basevertex != NULL)
 	    prim[i].basevertex = basevertex[i];
 	 else
@@ -1397,6 +1400,7 @@ 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].is_indirect = 0;
 	 if (basevertex != NULL)
 	    prim[0].basevertex = basevertex[i];
 	 else
@@ -1483,6 +1487,7 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
    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
@@ -1578,6 +1583,7 @@ vbo_validated_drawarraysindirect(struct gl_context *ctx,
    prim[0].begin = 1;
    prim[0].end = 1;
    prim[0].mode = mode;
+   prim[0].is_indirect = 1;
    prim[0].indirect_offset = (GLsizeiptr)indirect;
 
    /* NOTE: We do NOT want to handle primitive restart here, nor perform any
@@ -1623,6 +1629,7 @@ vbo_validated_multidrawarraysindirect(struct gl_context *ctx,
    for (i = 0; i < primcount; ++i, offset += stride) {
       prim[i].mode = mode;
       prim[i].indirect_offset = offset;
+      prim[i].is_indirect = 1;
    }
 
    check_buffers_are_unmapped(exec->array.inputs);
@@ -1660,6 +1667,7 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx,
    prim[0].mode = mode;
    prim[0].indexed = 1;
    prim[0].indirect_offset = (GLsizeiptr)indirect;
+   prim[0].is_indirect = 1;
 
    check_buffers_are_unmapped(exec->array.inputs);
    vbo->draw_prims(ctx, prim, 1,
@@ -1708,6 +1716,7 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx,
       prim[i].mode = mode;
       prim[i].indexed = 1;
       prim[i].indirect_offset = offset;
+      prim[i].is_indirect = 1;
    }
 
    check_buffers_are_unmapped(exec->array.inputs);
diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 411c006..d16405e 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -531,6 +531,7 @@ _save_wrap_buffers(struct gl_context *ctx)
    save->prim[0].count = 0;
    save->prim[0].num_instances = 1;
    save->prim[0].base_instance = 0;
+   save->prim[0].is_indirect = 0;
    save->prim_count = 1;
 }
 
@@ -986,6 +987,7 @@ vbo_save_NotifyBegin(struct gl_context *ctx, GLenum mode)
    save->prim[i].count = 0;
    save->prim[i].num_instances = 1;
    save->prim[i].base_instance = 0;
+   save->prim[i].is_indirect = 0;
 
    if (save->out_of_memory) {
       _mesa_install_save_vtxfmt(ctx, &save->vtxfmt_noop);
-- 
1.8.4.2



More information about the mesa-dev mailing list