diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 27 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 44 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 1 |
4 files changed, 27 insertions, 46 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); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 18b0032ae84..51fd434dc4f 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -361,30 +361,6 @@ enabled_filter(const 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); - } -} - - -/** * Helper function called by the other DrawArrays() functions below. * This is where we handle primitive restart for drawing non-indexed * arrays. If primitive restart is enabled, it typically means @@ -400,8 +376,6 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, if (skip_validated_draw(ctx)) return; - vbo_bind_arrays(ctx); - /* OpenGL 4.5 says that primitive restart is ignored with non-indexed * draws. */ @@ -818,8 +792,6 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, if (skip_draw_elements(ctx, count, indices)) return; - vbo_bind_arrays(ctx); - ib.count = count; ib.index_size = sizeof_ib_type(type); ib.obj = ctx->Array.VAO->IndexBufferObj; @@ -1251,8 +1223,6 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, return; } - vbo_bind_arrays(ctx); - min_index_ptr = (uintptr_t) indices[0]; max_index_ptr = 0; for (i = 0; i < primcount; i++) { @@ -1458,8 +1428,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, if (skip_validated_draw(ctx)) return; - vbo_bind_arrays(ctx); - /* init most fields to zero */ memset(&prim, 0, sizeof(prim)); prim.begin = 1; @@ -1557,8 +1525,6 @@ static void vbo_validated_drawarraysindirect(struct gl_context *ctx, GLenum mode, const GLvoid *indirect) { - vbo_bind_arrays(ctx); - ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, (GLsizeiptr) indirect, 1 /* draw_count */ , 16 /* stride */ , @@ -1580,8 +1546,6 @@ vbo_validated_multidrawarraysindirect(struct gl_context *ctx, if (primcount == 0) return; - vbo_bind_arrays(ctx); - ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset, primcount, stride, NULL, 0, NULL); @@ -1597,8 +1561,6 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx, { struct _mesa_index_buffer ib; - vbo_bind_arrays(ctx); - ib.count = 0; /* unknown */ ib.index_size = sizeof_ib_type(type); ib.obj = ctx->Array.VAO->IndexBufferObj; @@ -1626,8 +1588,6 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx, if (primcount == 0) return; - vbo_bind_arrays(ctx); - /* NOTE: IndexBufferObj is guaranteed to be a VBO. */ ib.count = 0; /* unknown */ @@ -1798,8 +1758,6 @@ vbo_validated_multidrawarraysindirectcount(struct gl_context *ctx, if (maxdrawcount == 0) return; - vbo_bind_arrays(ctx); - ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset, maxdrawcount, stride, @@ -1824,8 +1782,6 @@ vbo_validated_multidrawelementsindirectcount(struct gl_context *ctx, if (maxdrawcount == 0) return; - vbo_bind_arrays(ctx); - /* NOTE: IndexBufferObj is guaranteed to be a VBO. */ ib.count = 0; /* unknown */ diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 628720b1d04..1ed9d5eac0c 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -238,7 +238,6 @@ vbo_exec_bind_arrays(struct gl_context *ctx) /* The exec VAO is not immutable, so we need to set manually */ ctx->NewDriverState |= ctx->DriverFlags.NewArray; - _mesa_set_drawing_arrays(ctx, vbo->draw_arrays.inputs); /* Finally update the inputs array */ _vbo_update_inputs(ctx, &vbo->draw_arrays); } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 280e16cb811..ed3b50434f1 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -208,7 +208,6 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) /* Finally update the inputs array */ _vbo_update_inputs(ctx, &vbo->draw_arrays); - _mesa_set_drawing_arrays(ctx, vbo->draw_arrays.inputs); assert(ctx->NewState == 0); |