diff options
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.h | 1 | ||||
-rw-r--r-- | src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c | 9 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_rasterpos.c | 5 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw.c | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw.h | 2 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_draw_feedback.c | 2 | ||||
-rw-r--r-- | src/mesa/tnl/t_draw.c | 3 | ||||
-rw-r--r-- | src/mesa/tnl/tnl.h | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo.h | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_context.h | 15 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 12 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_draw.c | 3 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_rebase.c | 8 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_save_draw.c | 3 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split_copy.c | 9 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_split_inplace.c | 9 |
18 files changed, 61 insertions, 31 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index da37b181f6e..813f7c8e570 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -531,7 +531,6 @@ retry: } void brw_draw_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -540,6 +539,7 @@ void brw_draw_prims( struct gl_context *ctx, GLuint max_index, struct gl_transform_feedback_object *tfb_vertcount ) { + const struct gl_client_array **arrays = ctx->Array._DrawArrays; bool retval; if (!_mesa_check_conditional_render(ctx)) diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index b91041932e1..2cc4cb38379 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -35,7 +35,6 @@ struct brw_context; void brw_draw_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, diff --git a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c index 62fee2e1e27..a9a56e78f2d 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c @@ -216,7 +216,7 @@ get_max_client_stride(struct gl_context *ctx, const struct gl_client_array **arr } static void -TAG(vbo_render_prims)(struct gl_context *ctx, const struct gl_client_array **arrays, +TAG(vbo_render_prims)(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -448,7 +448,6 @@ vbo_draw_imm(struct gl_context *ctx, const struct gl_client_array **arrays, static void TAG(vbo_render_prims)(struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -456,6 +455,7 @@ TAG(vbo_render_prims)(struct gl_context *ctx, struct gl_transform_feedback_object *tfb_vertcount) { struct nouveau_render_state *render = to_render_state(ctx); + const struct gl_client_array **arrays = ctx->Array._DrawArrays; if (!index_bounds_valid) vbo_get_minmax_indices(ctx, prims, ib, &min_index, &max_index, @@ -484,7 +484,6 @@ TAG(vbo_render_prims)(struct gl_context *ctx, static void TAG(vbo_check_render_prims)(struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, GLboolean index_bounds_valid, @@ -496,12 +495,12 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx, nouveau_validate_framebuffer(ctx); if (nctx->fallback == HWTNL) - TAG(vbo_render_prims)(ctx, arrays, prims, nr_prims, ib, + TAG(vbo_render_prims)(ctx, prims, nr_prims, ib, index_bounds_valid, min_index, max_index, tfb_vertcount); if (nctx->fallback == SWTNL) - _tnl_vbo_draw_prims(ctx, arrays, prims, nr_prims, ib, + _tnl_vbo_draw_prims(ctx, prims, nr_prims, ib, index_bounds_valid, min_index, max_index, tfb_vertcount); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 2b709ded683..9f1a2263f54 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1636,6 +1636,11 @@ struct gl_array_attrib /* GL_ARB_vertex_buffer_object */ struct gl_buffer_object *ArrayBufferObj; + + /** + * Vertex arrays as consumed by a driver. + * The array pointer is set up only by the VBO module. */ + const struct gl_client_array **_DrawArrays; /**< 0..VERT_ATTRIB_MAX-1 */ }; diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 2c21dc9a776..7fef031f013 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -225,6 +225,7 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) struct st_context *st = st_context(ctx); struct draw_context *draw = st->draw; struct rastpos_stage *rs; + const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays; if (st->rastpos_stage) { /* get rastpos stage info */ @@ -251,8 +252,10 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4]) rs->array[0].Ptr = (GLubyte *) v; /* draw the point */ - st_feedback_draw_vbo(ctx, rs->arrays, &rs->prim, 1, NULL, GL_TRUE, 0, 1, + ctx->Array._DrawArrays = rs->arrays; + st_feedback_draw_vbo(ctx, &rs->prim, 1, NULL, GL_TRUE, 0, 1, NULL); + ctx->Array._DrawArrays = saved_arrays; /* restore draw's rasterization stage depending on rendermode */ if (ctx->RenderMode == GL_FEEDBACK) { diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index edab76bf567..01ba09d6567 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -966,7 +966,6 @@ st_validate_varrays(struct gl_context *ctx, */ void st_draw_vbo(struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -979,6 +978,7 @@ st_draw_vbo(struct gl_context *ctx, struct pipe_context *pipe = st->pipe; struct pipe_index_buffer ibuffer; struct pipe_draw_info info; + const struct gl_client_array **arrays = ctx->Array._DrawArrays; unsigned i, num_instances = 1; unsigned max_index_plus_base; GLboolean new_array = diff --git a/src/mesa/state_tracker/st_draw.h b/src/mesa/state_tracker/st_draw.h index 47bdb11f81c..c608051eba1 100644 --- a/src/mesa/state_tracker/st_draw.h +++ b/src/mesa/state_tracker/st_draw.h @@ -49,7 +49,6 @@ void st_destroy_draw( struct st_context *st ); extern void st_draw_vbo(struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -60,7 +59,6 @@ st_draw_vbo(struct gl_context *ctx, extern void st_feedback_draw_vbo(struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index a559b733ac2..257618aa992 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -91,7 +91,6 @@ set_feedback_vertex_format(struct gl_context *ctx) */ void st_feedback_draw_vbo(struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -110,6 +109,7 @@ st_feedback_draw_vbo(struct gl_context *ctx, struct pipe_index_buffer ibuffer; struct pipe_transfer *vb_transfer[PIPE_MAX_ATTRIBS]; struct pipe_transfer *ib_transfer = NULL; + const struct gl_client_array **arrays = ctx->Array._DrawArrays; GLuint attr, i; const GLubyte *low_addr = NULL; const void *mapped_indices = NULL; diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 17042cf8f37..6a3c9662e96 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -408,7 +408,6 @@ static void unmap_vbos( struct gl_context *ctx, void _tnl_vbo_draw_prims(struct gl_context *ctx, - const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, @@ -417,6 +416,8 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx, GLuint max_index, struct gl_transform_feedback_object *tfb_vertcount) { + const struct gl_client_array **arrays = ctx->Array._DrawArrays; + if (!index_bounds_valid) vbo_get_minmax_indices(ctx, prim, ib, &min_index, &max_index, nr_prims); diff --git a/src/mesa/tnl/tnl.h b/src/mesa/tnl/tnl.h index 434bd7fcd95..f6b70e3236f 100644 --- a/src/mesa/tnl/tnl.h +++ b/src/mesa/tnl/tnl.h @@ -86,7 +86,6 @@ _tnl_draw_prims( struct gl_context *ctx, void _tnl_vbo_draw_prims( struct gl_context *ctx, - const struct gl_client_array *arrays[], const struct _mesa_prim *prim, GLuint nr_prims, const struct _mesa_index_buffer *ib, diff --git a/src/mesa/vbo/vbo.h b/src/mesa/vbo/vbo.h index 2d01d9823cc..3cff8987e78 100644 --- a/src/mesa/vbo/vbo.h +++ b/src/mesa/vbo/vbo.h @@ -72,7 +72,6 @@ void _vbo_InvalidateState( struct gl_context *ctx, GLuint new_state ); typedef void (*vbo_draw_func)( struct gl_context *ctx, - const struct gl_client_array **arrays, const struct _mesa_prim *prims, GLuint nr_prims, const struct _mesa_index_buffer *ib, diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h index a6397ba2f8f..93c48cd029b 100644 --- a/src/mesa/vbo/vbo_context.h +++ b/src/mesa/vbo/vbo_context.h @@ -131,6 +131,21 @@ vbo_draw_method(struct vbo_context *vbo, enum draw_method method) { if (vbo->last_draw_method != method) { struct gl_context *ctx = vbo->exec.ctx; + + switch (method) { + case DRAW_ARRAYS: + ctx->Array._DrawArrays = vbo->exec.array.inputs; + break; + case DRAW_BEGIN_END: + ctx->Array._DrawArrays = vbo->exec.vtx.inputs; + break; + case DRAW_DISPLAY_LIST: + ctx->Array._DrawArrays = vbo->save.inputs; + break; + default: + ASSERT(0); + } + ctx->Driver.UpdateState(ctx, _NEW_ARRAY); vbo->last_draw_method = method; } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 6c8a32e6452..d39324d12bc 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -600,7 +600,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, if (primCount > 0) { /* draw one or two prims */ check_buffers_are_unmapped(exec->array.inputs); - vbo->draw_prims(ctx, exec->array.inputs, prim, primCount, NULL, + vbo->draw_prims(ctx, prim, primCount, NULL, GL_TRUE, start, start + count - 1, NULL); } } @@ -610,7 +610,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start, prim[0].count = count; check_buffers_are_unmapped(exec->array.inputs); - vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL, + vbo->draw_prims(ctx, prim, 1, NULL, GL_TRUE, start, start + count - 1, NULL); } @@ -801,7 +801,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode, */ check_buffers_are_unmapped(exec->array.inputs); - vbo->draw_prims( ctx, exec->array.inputs, prim, 1, &ib, + vbo->draw_prims( ctx, prim, 1, &ib, index_bounds_valid, start, end, NULL ); } @@ -1096,7 +1096,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, } check_buffers_are_unmapped(exec->array.inputs); - vbo->draw_prims(ctx, exec->array.inputs, prim, primcount, &ib, + vbo->draw_prims(ctx, prim, primcount, &ib, GL_FALSE, ~0, ~0, NULL); } else { /* render one prim at a time */ @@ -1121,7 +1121,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode, prim[0].basevertex = 0; check_buffers_are_unmapped(exec->array.inputs); - vbo->draw_prims(ctx, exec->array.inputs, prim, 1, &ib, + vbo->draw_prims(ctx, prim, 1, &ib, GL_FALSE, ~0, ~0, NULL); } } @@ -1199,7 +1199,7 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode, * will be rendered. */ check_buffers_are_unmapped(exec->array.inputs); - vbo->draw_prims(ctx, exec->array.inputs, prim, 1, NULL, + vbo->draw_prims(ctx, prim, 1, NULL, GL_TRUE, 0, 0, obj); } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index da5ca695eaf..6e8bb15d1e2 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -407,8 +407,7 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean keepUnmapped) exec->vtx.vert_count); vbo_context(ctx)->draw_prims( ctx, - exec->vtx.inputs, - exec->vtx.prim, + exec->vtx.prim, exec->vtx.prim_count, NULL, GL_TRUE, diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index 597a8f46994..9a98ef7d449 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -129,6 +129,7 @@ void vbo_rebase_prims( struct gl_context *ctx, struct _mesa_index_buffer tmp_ib; struct _mesa_prim *tmp_prims = NULL; + const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays; void *tmp_indices = NULL; GLuint i; @@ -226,15 +227,18 @@ void vbo_rebase_prims( struct gl_context *ctx, /* Re-issue the draw call. */ + ctx->Array._DrawArrays = tmp_array_pointers; + draw( ctx, - tmp_array_pointers, - prim, + prim, nr_prims, ib, GL_TRUE, 0, max_index - min_index, NULL ); + + ctx->Array._DrawArrays = saved_arrays; if (tmp_indices) free(tmp_indices); diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 47564d340eb..bb5961549ef 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -312,8 +312,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data) if (node->count > 0) { vbo_context(ctx)->draw_prims(ctx, - save->inputs, - node->prim, + node->prim, node->prim_count, NULL, GL_TRUE, diff --git a/src/mesa/vbo/vbo_split_copy.c b/src/mesa/vbo/vbo_split_copy.c index b53293c3120..9665c4fcd2f 100644 --- a/src/mesa/vbo/vbo_split_copy.c +++ b/src/mesa/vbo/vbo_split_copy.c @@ -171,6 +171,8 @@ dump_draw_info(struct gl_context *ctx, static void flush( struct copy_context *copy ) { + struct gl_context *ctx = copy->ctx; + const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays; GLuint i; /* Set some counters: @@ -189,8 +191,9 @@ flush( struct copy_context *copy ) (void) dump_draw_info; #endif - copy->draw( copy->ctx, - copy->dstarray_ptr, + ctx->Array._DrawArrays = copy->dstarray_ptr; + + copy->draw( ctx, copy->dstprim, copy->dstprim_nr, ©->dstib, @@ -199,6 +202,8 @@ flush( struct copy_context *copy ) copy->dstbuf_nr - 1, NULL ); + ctx->Array._DrawArrays = saved_arrays; + /* Reset all pointers: */ copy->dstprim_nr = 0; diff --git a/src/mesa/vbo/vbo_split_inplace.c b/src/mesa/vbo/vbo_split_inplace.c index 9e596f66891..7c2cc3ece5a 100644 --- a/src/mesa/vbo/vbo_split_inplace.c +++ b/src/mesa/vbo/vbo_split_inplace.c @@ -62,6 +62,8 @@ struct split_context { static void flush_vertex( struct split_context *split ) { + struct gl_context *ctx = split->ctx; + const struct gl_client_array **saved_arrays = ctx->Array._DrawArrays; struct _mesa_index_buffer ib; GLuint i; @@ -82,8 +84,9 @@ static void flush_vertex( struct split_context *split ) assert(split->max_index >= split->min_index); - split->draw(split->ctx, - split->array, + ctx->Array._DrawArrays = split->array; + + split->draw(ctx, split->dstprim, split->dstprim_nr, split->ib ? &ib : NULL, @@ -92,6 +95,8 @@ static void flush_vertex( struct split_context *split ) split->max_index, NULL); + ctx->Array._DrawArrays = saved_arrays; + split->dstprim_nr = 0; split->min_index = ~0; split->max_index = 0; |