Another fix
authorKeith Whitwell <keith@tungstengraphics.com>
Wed, 22 Nov 2006 13:53:21 +0000 (13:53 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Wed, 22 Nov 2006 13:53:21 +0000 (13:53 +0000)
src/mesa/main/api_arrayelt.c

index b3c33f2..49aa427 100644 (file)
@@ -1076,6 +1076,7 @@ static void check_vbo( AEcontext *actx,
       for (i = 0; i < actx->nr_vbos; i++)
         if (actx->vbo[i] == vbo)
            return;
+      assert(actx->nr_vbos < VERT_ATTRIB_MAX);
       actx->vbo[actx->nr_vbos++] = vbo;
    }
 }
@@ -1094,6 +1095,8 @@ static void _ae_update_state( GLcontext *ctx )
    AEattrib *at = actx->attribs;
    GLuint i;
 
+   actx->nr_vbos = 0;
+
    /* conventional vertex arrays */
   if (ctx->Array.ArrayObj->Index.Enabled) {
       aa->array = &ctx->Array.ArrayObj->Index;
@@ -1296,6 +1299,11 @@ void _ae_invalidate_state( GLcontext *ctx, GLuint new_state )
 {
    AEcontext *actx = AE_CONTEXT(ctx);
 
+   /* It is possible to raise a statechange between begin/end pairs as
+    * the glMaterial calls will raise _NEW_LIGHT eventually.  However,
+    * within a DrawArrays or DrawElements call (which cannot emit
+    * material data), it should never be possible.
+    */
    assert(!actx->mapped_vbos);
    actx->NewState |= new_state;
 }