diff options
author | Marek Olšák <[email protected]> | 2012-04-23 18:20:56 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2012-05-08 15:57:51 +0200 |
commit | 50f7e75f9e945cfbb2ae868cc961a2205a0b6e73 (patch) | |
tree | d55b1c38416040b9df653df6327dbaa0e82866fc /src/mesa/state_tracker | |
parent | a7ac9c9c7dc7401ca6143d1e7476df5e3c2758b7 (diff) |
mesa: move gl_client_array*[] from vbo_draw_func into gl_context
In the future we'd like to treat vertex arrays as a state and
not as a parameter to the draw function. This is the first step
towards that goal. Part of the goal is to avoid array re-validation
for every draw call.
This commit adds:
const struct gl_client_array **gl_context::Array::_DrawArrays.
The pointer is changed in:
* vbo_draw_method
* vbo_rebase_prims - unused by gallium
* vbo_split_prims - unused by gallium
* st_RasterPos
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/state_tracker')
-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 |
4 files changed, 6 insertions, 5 deletions
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; |