On 05/13/2012 08:00 AM, Jordan Justen wrote:
When PrimitiveRestartInSoftware is set, the VBO module will handle
primitive restart scenarios before calling the vbo->draw_prims
drawing function.
Signed-off-by: Jordan Justen<jordan.l.jus...@intel.com>
---
src/mesa/vbo/vbo_exec_array.c | 35 +++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index cc94e76..df81981 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -542,6 +542,29 @@ vbo_bind_arrays(struct gl_context *ctx)
}
+static void vbo_handle_primitive_restart(struct gl_context *ctx,
+ const struct _mesa_prim *prim,
+ GLuint nr_prims,
+ const struct _mesa_index_buffer *ib,
+ GLboolean index_bounds_valid,
+ GLuint min_index,
+ GLuint max_index)
Minor nit, but I'd reformat this to match other functions:
static void
vbo_handle_primitive_restart(struct gl_context *ctx,
const struct _mesa_prim *prim,
...
This lets one do "grep ^function" to easily find a function
definition/declaration.
Also, I'd put a short comment on the function explaining what it does.
+{
+ struct vbo_context *vbo = vbo_context(ctx);
+
+ if ((ib != NULL)&&
+ ctx->Const.PrimitiveRestartInSoftware&&
+ ctx->Array.PrimitiveRestart) {
+ /* Handle primitive restart in software */
+ vbo_sw_primitive_restart(ctx, prim, nr_prims, ib);
+ } else {
+ /* Call driver directly for draw_prims */
+ vbo->draw_prims(ctx, prim, nr_prims, ib,
+ index_bounds_valid, min_index, max_index, NULL);
+ }
+}
+
+
/**
* Helper function called by the other DrawArrays() functions below.
* This is where we handle primitive restart for drawing non-indexed
@@ -801,8 +824,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx,
GLenum mode,
*/
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims( ctx, prim, 1,&ib,
- index_bounds_valid, start, end, NULL );
+ vbo_handle_primitive_restart(ctx, prim, 1,&ib,
+ index_bounds_valid, start, end);
}
@@ -1096,8 +1119,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx,
GLenum mode,
}
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, prim, primcount,&ib,
- GL_FALSE, ~0, ~0, NULL);
+ vbo_handle_primitive_restart(ctx, prim, primcount,&ib,
+ GL_FALSE, ~0, ~0);
} else {
/* render one prim at a time */
for (i = 0; i< primcount; i++) {
@@ -1121,8 +1144,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx,
GLenum mode,
prim[0].basevertex = 0;
check_buffers_are_unmapped(exec->array.inputs);
- vbo->draw_prims(ctx, prim, 1,&ib,
- GL_FALSE, ~0, ~0, NULL);
+ vbo_handle_primitive_restart(ctx, prim, 1,&ib,
+ GL_FALSE, ~0, ~0);
}
}
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev