summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMathias Fröhlich <[email protected]>2018-03-25 19:16:54 +0200
committerMathias Fröhlich <[email protected]>2018-03-31 06:32:13 +0200
commit7f8db5ca471c1940b0be42f49d37c24af381979a (patch)
tree03938eda4c60e086c0edbcd5d3d03b1c3ac2898e /src/mesa
parent4db9d83a2dd5611776577bacdbdbf483b6bea937 (diff)
vbo: Remove vbo_indirect_draw_func.
Remove the vbo_indirect_draw_func vbo callback and make the default implementation use the drivers main draw callback function directly. This will be needed with the next changes when drivers without own main drivers DrawIndirect implementation get moved to the main drivers Draw method. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/vbo/vbo.h32
-rw-r--r--src/mesa/vbo/vbo_context.c94
-rw-r--r--src/mesa/vbo/vbo_private.h6
3 files changed, 30 insertions, 102 deletions
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h
index ef2bf9221a2..db136f94450 100644
--- a/src/mesa/vbo/vbo.h
+++ b/src/mesa/vbo/vbo.h
@@ -169,34 +169,6 @@ typedef void (*vbo_draw_func)(struct gl_context *ctx,
struct gl_buffer_object *indirect);
-/**
- * Draw a primitive, getting the vertex count, instance count, start
- * vertex, etc. from a buffer object.
- * \param mode GL_POINTS, GL_LINES, GL_TRIANGLE_STRIP, etc.
- * \param indirect_data buffer to get "DrawArrays/ElementsIndirectCommand" data
- * \param indirect_offset offset of first primitive in indrect_data buffer
- * \param draw_count number of primitives to draw
- * \param stride stride, in bytes, between "DrawArrays/ElementsIndirectCommand"
- * objects
- * \param indirect_draw_count_buffer if non-NULL specifies a buffer to get the
- * real draw_count value. Used for
- * GL_ARB_indirect_parameters.
- * \param indirect_draw_count_offset offset to the draw_count value in
- * indirect_draw_count_buffer
- * \param ib index buffer for indexed drawing, NULL otherwise.
- */
-typedef void (*vbo_indirect_draw_func)(
- struct gl_context *ctx,
- GLuint mode,
- struct gl_buffer_object *indirect_data,
- GLsizeiptr indirect_offset,
- unsigned draw_count,
- unsigned stride,
- struct gl_buffer_object *indirect_draw_count_buffer,
- GLsizeiptr indirect_draw_count_offset,
- const struct _mesa_index_buffer *ib);
-
-
/* Utility function to cope with various constraints on tnl modules or
@@ -262,10 +234,6 @@ void
vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func);
void
-vbo_set_indirect_draw_func(struct gl_context *ctx,
- vbo_indirect_draw_func func);
-
-void
vbo_sw_primitive_restart(struct gl_context *ctx,
const struct _mesa_prim *prim,
GLuint nr_prims,
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c
index 025d6d8de81..54cbab0c14f 100644
--- a/src/mesa/vbo/vbo_context.c
+++ b/src/mesa/vbo/vbo_context.c
@@ -141,55 +141,6 @@ init_mat_currval(struct gl_context *ctx)
}
-/**
- * Fallback for when a driver does not call vbo_set_indirect_draw_func().
- */
-static void
-vbo_draw_indirect_prims(struct gl_context *ctx,
- GLuint mode,
- struct gl_buffer_object *indirect_buffer,
- GLsizeiptr indirect_offset,
- unsigned draw_count,
- unsigned stride,
- struct gl_buffer_object *indirect_draw_count_buffer,
- GLsizeiptr indirect_draw_count_offset,
- const struct _mesa_index_buffer *ib)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- struct _mesa_prim *prim;
- GLsizei i;
-
- prim = calloc(draw_count, sizeof(*prim));
- if (prim == NULL) {
- _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sDraw%sIndirect%s",
- (draw_count > 1) ? "Multi" : "",
- ib ? "Elements" : "Arrays",
- indirect_buffer ? "CountARB" : "");
- return;
- }
-
- prim[0].begin = 1;
- 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;
- }
-
- /* This should always be true at this time */
- assert(indirect_buffer == ctx->DrawIndirectBuffer);
-
- vbo->draw_prims(ctx, prim, draw_count,
- ib, false, 0, ~0,
- NULL, 0,
- indirect_buffer);
-
- free(prim);
-}
-
-
void
_vbo_install_exec_vtxfmt(struct gl_context *ctx)
{
@@ -236,7 +187,6 @@ _vbo_CreateContext(struct gl_context *ctx)
init_generic_currval(ctx);
init_mat_currval(ctx);
_vbo_init_inputs(&vbo->draw_arrays);
- vbo_set_indirect_draw_func(ctx, vbo_draw_indirect_prims);
/* make sure all VBO_ATTRIB_ values can fit in an unsigned byte */
STATIC_ASSERT(VBO_ATTRIB_MAX <= 255);
@@ -292,15 +242,6 @@ vbo_set_draw_func(struct gl_context *ctx, vbo_draw_func func)
}
-void
-vbo_set_indirect_draw_func(struct gl_context *ctx,
- vbo_indirect_draw_func func)
-{
- struct vbo_context *vbo = vbo_context(ctx);
- vbo->draw_indirect_prims = func;
-}
-
-
/**
* Examine the enabled vertex arrays to set the exec->array.inputs[] values.
* These will point to the arrays to actually use for drawing. Some will
@@ -348,9 +289,34 @@ _vbo_draw_indirect(struct gl_context *ctx, GLuint mode,
GLsizeiptr indirect_draw_count_offset,
const struct _mesa_index_buffer *ib)
{
- struct vbo_context *vbo = vbo_context(ctx);
- vbo_bind_arrays(ctx);
- vbo->draw_indirect_prims(ctx, mode, indirect_data, indirect_offset,
- draw_count, stride, indirect_draw_count_buffer,
- indirect_draw_count_offset, ib);
+ struct _mesa_prim *prim;
+
+ prim = calloc(draw_count, sizeof(*prim));
+ if (prim == NULL) {
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "gl%sDraw%sIndirect%s",
+ (draw_count > 1) ? "Multi" : "",
+ ib ? "Elements" : "Arrays",
+ indirect_data ? "CountARB" : "");
+ return;
+ }
+
+ prim[0].begin = 1;
+ prim[draw_count - 1].end = 1;
+ for (unsigned 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;
+ }
+
+ /* This should always be true at this time */
+ assert(indirect_data == ctx->DrawIndirectBuffer);
+
+ ctx->Driver.Draw(ctx, prim, draw_count,
+ ib, false, 0, ~0,
+ NULL, 0,
+ indirect_data);
+
+ free(prim);
}
diff --git a/src/mesa/vbo/vbo_private.h b/src/mesa/vbo/vbo_private.h
index 112a4605c7b..90d8ed45704 100644
--- a/src/mesa/vbo/vbo_private.h
+++ b/src/mesa/vbo/vbo_private.h
@@ -58,12 +58,6 @@ struct vbo_context {
* is responsible for initiating any fallback actions required:
*/
vbo_draw_func draw_prims;
-
- /* Optional callback for indirect draws. This allows multidraws to not be
- * broken up, as well as for the actual count to be passed in as a separate
- * indirect parameter.
- */
- vbo_indirect_draw_func draw_indirect_prims;
};