aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/vbo')
-rw-r--r--src/mesa/vbo/vbo_exec.c4
-rw-r--r--src/mesa/vbo/vbo_exec.h1
-rw-r--r--src/mesa/vbo/vbo_exec_array.c59
3 files changed, 25 insertions, 39 deletions
diff --git a/src/mesa/vbo/vbo_exec.c b/src/mesa/vbo/vbo_exec.c
index 05c3ec1ae9d..fd5e0f8911b 100644
--- a/src/mesa/vbo/vbo_exec.c
+++ b/src/mesa/vbo/vbo_exec.c
@@ -85,6 +85,10 @@ void vbo_exec_invalidate_state( struct gl_context *ctx, GLuint new_state )
{
struct vbo_exec_context *exec = &vbo_context(ctx)->exec;
+ if (new_state & (_NEW_PROGRAM|_NEW_ARRAY)) {
+ exec->array.recalculate_inputs = GL_TRUE;
+ }
+
if (new_state & (_NEW_PROGRAM|_NEW_EVAL))
exec->eval.recalculate_maps = 1;
diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h
index f6ede99cd75..5cdf5ced912 100644
--- a/src/mesa/vbo/vbo_exec.h
+++ b/src/mesa/vbo/vbo_exec.h
@@ -141,6 +141,7 @@ struct vbo_exec_context
* programs:
*/
const struct gl_client_array *inputs[VERT_ATTRIB_MAX];
+ GLboolean recalculate_inputs;
} array;
/* Which flags to set in vbo_exec_BeginVertices() */
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index b0a4261e764..d9003c243b1 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -529,12 +529,25 @@ recalculate_input_bindings(struct gl_context *ctx)
void
vbo_bind_arrays(struct gl_context *ctx)
{
- if (!ctx->Array.RebindArrays) {
- return;
- }
+ struct vbo_context *vbo = vbo_context(ctx);
+ struct vbo_exec_context *exec = &vbo->exec;
+
+ vbo_draw_method(exec, DRAW_ARRAYS);
- recalculate_input_bindings(ctx);
- ctx->Array.RebindArrays = GL_FALSE;
+ if (exec->array.recalculate_inputs) {
+ recalculate_input_bindings(ctx);
+
+ /* Again... because we may have changed the bitmask of per-vertex varying
+ * attributes. If we regenerate the fixed-function vertex program now
+ * we may be able to prune down the number of vertex attributes which we
+ * need in the shader.
+ */
+ if (ctx->NewState) {
+ _mesa_update_state(ctx);
+ }
+
+ exec->array.recalculate_inputs = GL_FALSE;
+ }
}
@@ -554,16 +567,6 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
vbo_bind_arrays(ctx);
- vbo_draw_method(exec, DRAW_ARRAYS);
-
- /* Again... because we may have changed the bitmask of per-vertex varying
- * attributes. If we regenerate the fixed-function vertex program now
- * we may be able to prune down the number of vertex attributes which we
- * need in the shader.
- */
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
/* init most fields to zero */
memset(prim, 0, sizeof(prim));
prim[0].begin = 1;
@@ -771,13 +774,7 @@ vbo_validated_drawrangeelements(struct gl_context *ctx, GLenum mode,
return;
}
- vbo_bind_arrays( ctx );
-
- vbo_draw_method(exec, DRAW_ARRAYS);
-
- /* check for dirty state again */
- if (ctx->NewState)
- _mesa_update_state( ctx );
+ vbo_bind_arrays(ctx);
ib.count = count;
ib.type = type;
@@ -1063,15 +1060,7 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
return;
}
- /* Decide if we can do this all as one set of primitives sharing the
- * same index buffer, or if we have to reset the index pointer per
- * primitive.
- */
- vbo_bind_arrays( ctx );
-
- /* check for dirty state again */
- if (ctx->NewState)
- _mesa_update_state( ctx );
+ vbo_bind_arrays(ctx);
min_index_ptr = (uintptr_t)indices[0];
max_index_ptr = 0;
@@ -1217,14 +1206,6 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
vbo_bind_arrays(ctx);
- /* Again... because we may have changed the bitmask of per-vertex varying
- * attributes. If we regenerate the fixed-function vertex program now
- * we may be able to prune down the number of vertex attributes which we
- * need in the shader.
- */
- if (ctx->NewState)
- _mesa_update_state(ctx);
-
/* init most fields to zero */
memset(prim, 0, sizeof(prim));
prim[0].begin = 1;