From c952c1f109960a50aebf5a6d6bf3cf1e005e0729 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 17 Aug 2009 12:46:34 +0200 Subject: [PATCH] r300: split vbo rendering with big drawarray case Split vbo rendering when the number of elements requested by drawarrays is bigger than 65536. --- src/mesa/drivers/dri/r300/r300_render.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 369c3edcd09..45330cda3c1 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -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(); } -- 2.30.2