diff options
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r-- | src/mesa/vbo/vbo.h | 18 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_context.c | 29 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 39 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 11 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_primitive_restart.c | 14 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 9 |
6 files changed, 72 insertions, 48 deletions
diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index d6cf8e2afe5..42436e0fac9 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -215,6 +215,24 @@ struct split_limits void +_vbo_draw(struct gl_context *ctx, const struct _mesa_prim *prims, + GLuint nr_prims, const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + struct gl_transform_feedback_object *tfb_vertcount, + unsigned tfb_stream, struct gl_buffer_object *indirect); + + +void +_vbo_draw_indirect(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); + + +void vbo_split_prims(struct gl_context *ctx, const struct gl_vertex_array *arrays, const struct _mesa_prim *prim, diff --git a/src/mesa/vbo/vbo_context.c b/src/mesa/vbo/vbo_context.c index acb28d02938..bef2b47fdff 100644 --- a/src/mesa/vbo/vbo_context.c +++ b/src/mesa/vbo/vbo_context.c @@ -307,3 +307,32 @@ vbo_set_indirect_draw_func(struct gl_context *ctx, struct vbo_context *vbo = vbo_context(ctx); vbo->draw_indirect_prims = func; } + + +void +_vbo_draw(struct gl_context *ctx, const struct _mesa_prim *prims, + GLuint nr_prims, const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, GLuint min_index, GLuint max_index, + struct gl_transform_feedback_object *tfb_vertcount, + unsigned tfb_stream, struct gl_buffer_object *indirect) +{ + struct vbo_context *vbo = vbo_context(ctx); + vbo->draw_prims(ctx, prims, nr_prims, ib, index_bounds_valid, + min_index, max_index, tfb_vertcount, tfb_stream, indirect); +} + + +void +_vbo_draw_indirect(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) +{ + struct vbo_context *vbo = vbo_context(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 50299373365..18b0032ae84 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -395,7 +395,6 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, GLsizei count, GLuint numInstances, GLuint baseInstance, GLuint drawID) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_prim prim; if (skip_validated_draw(ctx)) @@ -417,8 +416,8 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, prim.start = start; prim.count = count; - vbo->draw_prims(ctx, &prim, 1, NULL, - GL_TRUE, start, start + count - 1, NULL, 0, NULL); + ctx->Driver.Draw(ctx, &prim, 1, NULL, + GL_TRUE, start, start + count - 1, NULL, 0, NULL); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) { _mesa_flush(ctx); @@ -808,7 +807,6 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, GLint basevertex, GLuint numInstances, GLuint baseInstance) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_index_buffer ib; struct _mesa_prim prim; @@ -872,8 +870,8 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, * for the latter case elsewhere. */ - vbo->draw_prims(ctx, &prim, 1, &ib, - index_bounds_valid, start, end, NULL, 0, NULL); + ctx->Driver.Draw(ctx, &prim, 1, &ib, + index_bounds_valid, start, end, NULL, 0, NULL); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) { _mesa_flush(ctx); @@ -1237,7 +1235,6 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, const GLvoid * const *indices, GLsizei primcount, const GLint *basevertex) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_index_buffer ib; struct _mesa_prim *prim; unsigned int index_type_size = sizeof_ib_type(type); @@ -1323,8 +1320,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, prim[i].basevertex = 0; } - vbo->draw_prims(ctx, prim, primcount, &ib, - false, 0, ~0, NULL, 0, NULL); + ctx->Driver.Draw(ctx, prim, primcount, &ib, + false, 0, ~0, NULL, 0, NULL); } else { /* render one prim at a time */ @@ -1353,7 +1350,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, else prim[0].basevertex = 0; - vbo->draw_prims(ctx, prim, 1, &ib, false, 0, ~0, NULL, 0, NULL); + ctx->Driver.Draw(ctx, prim, 1, &ib, false, 0, ~0, NULL, 0, NULL); } } @@ -1431,7 +1428,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, struct gl_transform_feedback_object *obj, GLuint stream, GLuint numInstances) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_prim prim; if (_mesa_is_no_error_enabled(ctx)) { @@ -1477,7 +1473,7 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, * (like in DrawArrays), but we have no way to know how many vertices * will be rendered. */ - vbo->draw_prims(ctx, &prim, 1, NULL, GL_FALSE, 0, ~0, obj, stream, NULL); + ctx->Driver.Draw(ctx, &prim, 1, NULL, GL_FALSE, 0, ~0, obj, stream, NULL); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) { _mesa_flush(ctx); @@ -1561,11 +1557,9 @@ static void vbo_validated_drawarraysindirect(struct gl_context *ctx, GLenum mode, const GLvoid *indirect) { - struct vbo_context *vbo = vbo_context(ctx); - vbo_bind_arrays(ctx); - vbo->draw_indirect_prims(ctx, mode, + ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, (GLsizeiptr) indirect, 1 /* draw_count */ , 16 /* stride */ , NULL, 0, NULL); @@ -1581,7 +1575,6 @@ vbo_validated_multidrawarraysindirect(struct gl_context *ctx, const GLvoid *indirect, GLsizei primcount, GLsizei stride) { - struct vbo_context *vbo = vbo_context(ctx); GLsizeiptr offset = (GLsizeiptr) indirect; if (primcount == 0) @@ -1589,7 +1582,7 @@ vbo_validated_multidrawarraysindirect(struct gl_context *ctx, vbo_bind_arrays(ctx); - vbo->draw_indirect_prims(ctx, mode, ctx->DrawIndirectBuffer, offset, + ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset, primcount, stride, NULL, 0, NULL); if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) @@ -1602,7 +1595,6 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx, GLenum mode, GLenum type, const GLvoid *indirect) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_index_buffer ib; vbo_bind_arrays(ctx); @@ -1612,7 +1604,7 @@ vbo_validated_drawelementsindirect(struct gl_context *ctx, ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = NULL; - vbo->draw_indirect_prims(ctx, mode, + ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, (GLsizeiptr) indirect, 1 /* draw_count */ , 20 /* stride */ , NULL, 0, &ib); @@ -1628,7 +1620,6 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx, const GLvoid *indirect, GLsizei primcount, GLsizei stride) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_index_buffer ib; GLsizeiptr offset = (GLsizeiptr) indirect; @@ -1644,7 +1635,7 @@ vbo_validated_multidrawelementsindirect(struct gl_context *ctx, ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = NULL; - vbo->draw_indirect_prims(ctx, mode, + ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset, primcount, stride, NULL, 0, &ib); @@ -1802,7 +1793,6 @@ vbo_validated_multidrawarraysindirectcount(struct gl_context *ctx, GLsizei maxdrawcount, GLsizei stride) { - struct vbo_context *vbo = vbo_context(ctx); GLsizeiptr offset = indirect; if (maxdrawcount == 0) @@ -1810,7 +1800,7 @@ vbo_validated_multidrawarraysindirectcount(struct gl_context *ctx, vbo_bind_arrays(ctx); - vbo->draw_indirect_prims(ctx, mode, + ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset, maxdrawcount, stride, ctx->ParameterBuffer, drawcount_offset, NULL); @@ -1828,7 +1818,6 @@ vbo_validated_multidrawelementsindirectcount(struct gl_context *ctx, GLsizei maxdrawcount, GLsizei stride) { - struct vbo_context *vbo = vbo_context(ctx); struct _mesa_index_buffer ib; GLsizeiptr offset = (GLsizeiptr) indirect; @@ -1844,7 +1833,7 @@ vbo_validated_multidrawelementsindirectcount(struct gl_context *ctx, ib.obj = ctx->Array.VAO->IndexBufferObj; ib.ptr = NULL; - vbo->draw_indirect_prims(ctx, mode, + ctx->Driver.DrawIndirect(ctx, mode, ctx->DrawIndirectBuffer, offset, maxdrawcount, stride, ctx->ParameterBuffer, drawcount_offset, &ib); diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index d02b33c8ee2..628720b1d04 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -398,14 +398,9 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean keepUnmapped) printf("%s %d %d\n", __func__, exec->vtx.prim_count, exec->vtx.vert_count); - vbo_context(ctx)->draw_prims(ctx, - exec->vtx.prim, - exec->vtx.prim_count, - NULL, - GL_TRUE, - 0, - exec->vtx.vert_count - 1, - NULL, 0, NULL); + ctx->Driver.Draw(ctx, exec->vtx.prim, exec->vtx.prim_count, + NULL, GL_TRUE, 0, exec->vtx.vert_count - 1, + NULL, 0, NULL); /* Get new storage -- unless asked not to. */ if (!keepUnmapped) diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c index 33ad37c5733..699b566dca2 100644 --- a/src/mesa/vbo/vbo_primitive_restart.c +++ b/src/mesa/vbo/vbo_primitive_restart.c @@ -177,8 +177,6 @@ vbo_sw_primitive_restart(struct gl_context *ctx, GLuint sub_end_index; GLuint restart_index = _mesa_primitive_restart_index(ctx, ib->index_size); struct _mesa_prim temp_prim; - struct vbo_context *vbo = vbo_context(ctx); - vbo_draw_func draw_prims_func = vbo->draw_prims; GLboolean map_ib = ib->obj->Name && !ib->obj->Mappings[MAP_INTERNAL].Pointer; void *ptr; @@ -249,13 +247,13 @@ vbo_sw_primitive_restart(struct gl_context *ctx, temp_prim.count = MIN2(sub_end_index, end_index) - temp_prim.start; if ((temp_prim.start == sub_prim->start) && (temp_prim.count == sub_prim->count)) { - draw_prims_func(ctx, &temp_prim, 1, ib, - GL_TRUE, sub_prim->min_index, sub_prim->max_index, - NULL, 0, NULL); + ctx->Driver.Draw(ctx, &temp_prim, 1, ib, GL_TRUE, + sub_prim->min_index, sub_prim->max_index, + NULL, 0, NULL); } else { - draw_prims_func(ctx, &temp_prim, 1, ib, - GL_FALSE, -1, -1, - NULL, 0, NULL); + ctx->Driver.Draw(ctx, &temp_prim, 1, ib, + GL_FALSE, -1, -1, + NULL, 0, NULL); } } if (sub_end_index >= end_index) { diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 69d28312d3f..280e16cb811 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -215,13 +215,8 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) if (node->vertex_count > 0) { GLuint min_index = _vbo_save_get_min_index(node); GLuint max_index = _vbo_save_get_max_index(node); - vbo->draw_prims(ctx, - node->prims, - node->prim_count, - NULL, - GL_TRUE, - min_index, max_index, - NULL, 0, NULL); + ctx->Driver.Draw(ctx, node->prims, node->prim_count, NULL, GL_TRUE, + min_index, max_index, NULL, 0, NULL); } } |