commit 94a88a48e1a7f80caa8355bcc3f39e208d4d2ba9 Author: Maxim Levitsky Date: Wed Aug 15 04:13:45 2012 +0300 Revert "mesa,vbo: properly detect when vertex arrays need to be recalculated" This reverts commit 784dd51198433e5c299da4a7742c68d21d68d1c1. diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index b019266..20cd495 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -578,6 +578,10 @@ _mesa_update_state_locked( struct gl_context *ctx ) */ new_state = ctx->NewState | new_prog_state; ctx->NewState = 0; + + if (!ctx->Array.RebindArrays) + ctx->Array.RebindArrays = (new_state & (_NEW_ARRAY | _NEW_PROGRAM)) != 0; + ctx->Driver.UpdateState(ctx, new_state); ctx->Array.NewState = 0; if (!ctx->Array.RebindArrays) diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 766fcb7..f6ede99 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -188,8 +188,7 @@ static inline void vbo_draw_method(struct vbo_exec_context *exec, enum draw_method method) { if (exec->last_draw_method != method) { - struct gl_context *ctx = exec->ctx; - ctx->Driver.UpdateState(ctx, _NEW_ARRAY); + exec->ctx->NewState |= _NEW_ARRAY; exec->last_draw_method = method; } } diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index c6b36df..cacfb1d 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -438,6 +438,14 @@ recalculate_input_bindings(struct gl_context *ctx) inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i]; const_inputs |= VERT_BIT_GENERIC(i); } + + /* There is no need to make _NEW_ARRAY dirty here for the TnL program, + * because it already takes care of invalidating the state necessary + * to revalidate vertex arrays. Not marking the state as dirty also + * improves performance (quite significantly in some apps). + */ + if (!ctx->VertexProgram._MaintainTnlProgram) + ctx->NewState |= _NEW_ARRAY; break; case VP_NV: @@ -464,6 +472,8 @@ recalculate_input_bindings(struct gl_context *ctx) inputs[VERT_ATTRIB_GENERIC(i)] = &vbo->currval[VBO_ATTRIB_GENERIC0+i]; const_inputs |= VERT_BIT_GENERIC(i); } + + ctx->NewState |= _NEW_ARRAY; break; case VP_ARB: @@ -502,11 +512,11 @@ recalculate_input_bindings(struct gl_context *ctx) } inputs[VERT_ATTRIB_GENERIC0] = inputs[0]; + ctx->NewState |= _NEW_ARRAY; break; } _mesa_set_varying_vp_inputs( ctx, VERT_BIT_ALL & (~const_inputs) ); - ctx->Driver.UpdateState(ctx, _NEW_ARRAY); } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index c9e64e7..07fb5a2 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -253,11 +253,11 @@ vbo_exec_bind_arrays( struct gl_context *ctx ) arrays[attr]._MaxElement = count; /* ??? */ varying_inputs |= VERT_BIT(attr); + ctx->NewState |= _NEW_ARRAY; } } _mesa_set_varying_vp_inputs( ctx, varying_inputs ); - ctx->Driver.UpdateState(ctx, _NEW_ARRAY); } diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index 88a9a7e..57186de 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -209,11 +209,11 @@ static void vbo_bind_vertex_list(struct gl_context *ctx, buffer_offset += node_attrsz[src] * sizeof(GLfloat); varying_inputs |= VERT_BIT(attr); + ctx->NewState |= _NEW_ARRAY; } } _mesa_set_varying_vp_inputs( ctx, varying_inputs ); - ctx->Driver.UpdateState(ctx, _NEW_ARRAY); }