fixes for andree's drawarrays problems
authorKeith Whitwell <keith@tungstengraphics.com>
Fri, 19 Nov 1999 00:03:27 +0000 (00:03 +0000)
committerKeith Whitwell <keith@tungstengraphics.com>
Fri, 19 Nov 1999 00:03:27 +0000 (00:03 +0000)
src/mesa/main/varray.c

index be7fc8798fc5af5d12e269f8f81c5e2268207542..3c1bf6eef374f15e15f19966ca797dde14aaec90 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: varray.c,v 1.16 1999/11/18 23:56:04 brianp Exp $ */
+/* $Id: varray.c,v 1.17 1999/11/19 00:03:27 keithw Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -505,14 +505,23 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
        * rendering to keep it turned on.
        */
       relock = ctx->CompileCVAFlag;
-      ctx->CompileCVAFlag = 0;
 
-      if (!elt->pipeline_valid || relock)
+      if (relock) {
+        ctx->CompileCVAFlag = 0;
+        elt->pipeline_valid = 0;
+      }
+
+      if (!elt->pipeline_valid)
         gl_build_immediate_pipeline( ctx );
 
       required = elt->inputs;
       fallback = (elt->inputs & ~ctx->Array.Summary);
 
+      /* The translate function doesn't do anything about size.  It
+       * just ensures that type and stride come out right.
+       */
+      IM->v.Obj.size = ctx->Array.Vertex.Size;
+
       if (required & VERT_RGBA) 
       {
         Color = &ctx->Array.Color;
@@ -587,8 +596,6 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
       VB->Material = IM->Material;
       VB->BoundsPtr = 0;
 
-      IM->v.Obj.size = ctx->Array.Vertex.Size;  /* added by Andree Borrmann */
-
       while (remaining > 0) {
          GLint vbspace = VB_MAX - VB_START;
         GLuint count, n;
@@ -675,7 +682,6 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
          /* Transform and render.
          */
          gl_run_pipeline( VB );
-         gl_flush_vb( ctx, "DrawArrays" );  /* added by Andree Borrmann */
         gl_reset_vb( VB );
 
         ctx->Array.Flag[count] = ctx->Array.Flags;
@@ -685,7 +691,12 @@ _mesa_DrawArrays(GLenum mode, GLint start, GLsizei count)
          remaining -= n;
       }
 
-      ctx->CompileCVAFlag = relock;
+      gl_reset_input( ctx );
+
+      if (relock) {
+        ctx->CompileCVAFlag = relock;
+        elt->pipeline_valid = 0;
+      }
    }
    else if (ctx->Array.Vertex.Enabled) 
    {