r300: split vbo rendering with big drawarray case
authorJerome Glisse <jglisse@redhat.com>
Mon, 17 Aug 2009 10:46:34 +0000 (12:46 +0200)
committerJerome Glisse <jglisse@redhat.com>
Mon, 17 Aug 2009 10:50:27 +0000 (12:50 +0200)
Split vbo rendering when the number of elements requested
by drawarrays is bigger than 65536.

src/mesa/drivers/dri/r300/r300_render.c

index 369c3edcd094efa18ae7095151b6f43928bcb67b..45330cda3c11ad36effcff43e498ac747c403b9e 100644 (file)
@@ -394,12 +394,23 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
                }
 
        } else {
-               if (num_verts > 65535) {
-                       WARN_ONCE("Fixme: can't handle more then 65535 vertices");
+               GLuint first, incr, offset = 0;
+
+               if (!split_prim_inplace(prim & PRIM_MODE_MASK, &first, &incr) &&
+                       num_verts > 65500) {
+                       WARN_ONCE("Fixme: can't handle spliting prim %d\n", prim);
                        return;
                }
-               r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start);
-               r300FireAOS(rmesa, num_verts, type);
+               r300_emit_scissor(rmesa->radeon.glCtx);
+               while (num_verts > 0) {
+                       int nr;
+                       nr = MIN2(num_verts, 65535);
+                       nr -= (nr - first) % incr;
+                       r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start + offset);
+                       r300FireAOS(rmesa, nr, type);
+                       num_verts -= nr;
+                       offset += nr;
+               }
        }
        COMMIT_BATCH();
 }