i965: flush batch buffer when getting the maximum. This makes
authorXiang, Haihao <haihao.xiang@intel.com>
Tue, 28 Aug 2007 15:35:52 +0000 (11:35 -0400)
committerXiang, Haihao <haihao.xiang@intel.com>
Tue, 28 Aug 2007 15:35:52 +0000 (11:35 -0400)
some 3D programs such as pymol work well.

src/mesa/drivers/dri/i965/brw_draw.c

index 0c64d7e756dca93369bb14ce211ae6ffcb142e61..5ca9b2f549a276191960dc661b3a04d4e4cba569 100644 (file)
@@ -331,6 +331,7 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
       else {
         /* Otherwise, explicitly do the cliprects at this point:
          */
+          GLuint nprims = 0;
         for (j = 0; j < brw->intel.numClipRects; j++) {
            brw_emit_cliprect(brw, &brw->intel.pClipRects[j]);
 
@@ -338,6 +339,11 @@ static GLboolean brw_try_draw_prims( GLcontext *ctx,
             */
            for (i = 0; i < nr_prims; i++) {
               brw_emit_prim(brw, &prim[i]);   
+
+          if (++nprims == VBO_MAX_PRIM) {
+              intel_batchbuffer_flush(brw->intel.batch);
+              nprims = 0;
+          }
            }
         }
       }