summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-01-28 13:04:16 -0700
committerBrian Paul <brianp@vmware.com>2010-01-29 08:24:36 -0700
commit3cba779e16935f7c3a0bfd8af48bd5e015068e96 (patch)
treeb01e355b04d13530a53b74066ee2464aba7bfa73
parent23eda89ec89e2bd5bc26077bd56e8d6b5d4040d4 (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.
-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 fdd6b0259e3..d08976ca298 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;