diff options
author | Mathias Fröhlich <[email protected]> | 2018-03-16 06:34:35 +0100 |
---|---|---|
committer | Mathias Fröhlich <[email protected]> | 2018-03-22 04:58:52 +0100 |
commit | c4c56ff303e39f55e7940b33e8afeafa80b26280 (patch) | |
tree | abcf9d3364258333e08d80ad2ef94601c64bfe33 /src/mesa/vbo/vbo_context.c | |
parent | 6307d1be0a746bf30efe6d9c057ef5bad75ba183 (diff) |
vbo: Move vbo_bind_arrays into a dd_driver_functions draw callback.
Factor out that common call into the almost single place.
Remove the _mesa_set_drawing_arrays call from vbo_{exec,save}_draw code
paths as the function is now called through vbo_bind_arrays.
Prepare updating the list of struct gl_vertex_array entries via
calling _vbo_update_inputs for being pushed into those drivers that
finally work on that long list of gl_vertex_array pointers.
Reviewed-by: Brian Paul <[email protected]>
Signed-off-by: Mathias Fröhlich <[email protected]>
Diffstat (limited to 'src/mesa/vbo/vbo_context.c')
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index bef2b47fdff..28f494839e3 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -309,6 +309,31 @@ vbo_set_indirect_draw_func(struct gl_context *ctx, } +/** + * 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 + * be user-provided arrays, other will be zero-stride const-valued arrays. + */ +static void +vbo_bind_arrays(struct gl_context *ctx) +{ + struct vbo_context *vbo = vbo_context(ctx); + struct vbo_exec_context *exec = &vbo->exec; + + _mesa_set_drawing_arrays(ctx, vbo->draw_arrays.inputs); + + if (exec->array.recalculate_inputs) { + /* Finally update the inputs array */ + _vbo_update_inputs(ctx, &vbo->draw_arrays); + ctx->NewDriverState |= ctx->DriverFlags.NewArray; + exec->array.recalculate_inputs = GL_FALSE; + } + + assert(ctx->NewState == 0); + assert(ctx->Array._DrawVAO->NewArrays == 0); +} + + void _vbo_draw(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -317,6 +342,7 @@ _vbo_draw(struct gl_context *ctx, const struct _mesa_prim *prims, unsigned tfb_stream, struct gl_buffer_object *indirect) { struct vbo_context *vbo = vbo_context(ctx); + vbo_bind_arrays(ctx); vbo->draw_prims(ctx, prims, nr_prims, ib, index_bounds_valid, min_index, max_index, tfb_vertcount, tfb_stream, indirect); } @@ -332,6 +358,7 @@ _vbo_draw_indirect(struct gl_context *ctx, GLuint mode, 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); |