summaryrefslogtreecommitdiff
path: root/src/mesa/vbo/vbo_exec_array.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-01-29 08:38:21 -0700
committerBrian Paul <brianp@vmware.com>2010-01-29 08:38:21 -0700
commit5ce9183c1c535d924a79c2b6b280c6a2648cec19 (patch)
tree348159e4fc78879fa139a065d153010dfb4656be /src/mesa/vbo/vbo_exec_array.c
parenta38859569dca1d8b139c4c451499bf6e328379e9 (diff)
vbo: fix missing state validation bugs
Commit 2708ddfb06a36d8568e2aa130bf1f7d551fcd309 caused a few regressions. We need to check/validate state after calling bind_arrays() because it might set the _NEW_ARRAYS flag if the varying VP inputs change. The symptom of this problem was some attribute arrays being ignored (or interpreted as constant-valued) in glDrawRangeElements or glMultiDrawElements. A follow-on patch will add some additional asserts to try to catch this kind of thing in the future. (cherry picked from commit 3cba779e16935f7c3a0bfd8af48bd5e015068e96)
Diffstat (limited to 'src/mesa/vbo/vbo_exec_array.c')
-rw-r--r--src/mesa/vbo/vbo_exec_array.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c
index 392da43c5e..88502f3d35 100644
--- a/src/mesa/vbo/vbo_exec_array.c
+++ b/src/mesa/vbo/vbo_exec_array.c
@@ -443,6 +443,13 @@ recalculate_input_bindings(GLcontext *ctx)
}
+/**
+ * Examine the enabled vertex arrays to set the exec->array.inputs[] values.
+ * These will point to the arrays to actually use for drawing. Some will
+ * be user-provided arrays, other will be zero-stride const-valued arrays.
+ * Note that this might set the _NEW_ARRAY dirty flag so state validation
+ * must be done after this call.
+ */
static void
bind_arrays(GLcontext *ctx)
{
@@ -484,9 +491,6 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count)
FLUSH_CURRENT( ctx, 0 );
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
if (!_mesa_valid_to_render(ctx, "glDrawArrays")) {
return;
}
@@ -600,18 +604,16 @@ vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode,
FLUSH_CURRENT( ctx, 0 );
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
if (!_mesa_valid_to_render(ctx, "glDraw[Range]Elements")) {
return;
}
+ bind_arrays( ctx );
+
+ /* check for dirty state again */
if (ctx->NewState)
_mesa_update_state( ctx );
- bind_arrays( ctx );
-
ib.count = count;
ib.type = type;
ib.obj = ctx->Array.ElementArrayBufferObj;
@@ -848,16 +850,10 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
FLUSH_CURRENT( ctx, 0 );
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
if (!_mesa_valid_to_render(ctx, "glMultiDrawElements")) {
return;
}
- if (ctx->NewState)
- _mesa_update_state( ctx );
-
prim = _mesa_calloc(primcount * sizeof(*prim));
if (prim == NULL) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glMultiDrawElements");
@@ -869,6 +865,10 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode,
*/
bind_arrays( ctx );
+ /* check for dirty state again */
+ if (ctx->NewState)
+ _mesa_update_state( ctx );
+
switch (type) {
case GL_UNSIGNED_INT:
index_type_size = 4;