From 46000cecc32104702fcb0de5a842d11b18c41c6b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Thu, 18 Jun 2009 13:20:32 +1000 Subject: r300: use vbo_split_prims to split up large vertex buffers. This lets ut2004 avoid hitting the elt warning. --- src/mesa/drivers/dri/r300/r300_draw.c | 9 +++++++++ src/mesa/drivers/dri/r300/r300_render.c | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index cc5650fb7c8..92bb0ee3385 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -452,12 +452,21 @@ static void r300DrawPrims(GLcontext *ctx, GLuint min_index, GLuint max_index) { + struct split_limits limits; GLboolean retval; + limits.max_verts = 65535; + limits.max_indices = 65535; + limits.max_vb_size = 1024*1024; + if (min_index) { vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims ); return; } + if ((ib && ib->count > 65536)) { + vbo_split_prims (ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims, &limits); + return; + } /* Make an attempt at drawing */ retval = r300TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 1356305a212..bf50b062f6c 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -243,7 +243,6 @@ static void r300EmitAOS(r300ContextPtr rmesa, GLuint nr, GLuint offset) fprintf(stderr, "%s: nr=%d, ofs=0x%08x\n", __FUNCTION__, nr, offset); - if (!rmesa->radeon.radeonScreen->kernel_mm) { BEGIN_BATCH(sz+2+(nr * 2)); OUT_BATCH_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, sz - 1); @@ -384,7 +383,8 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) * arrays. *sigh* */ r300EmitElts(ctx, num_verts); - r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start); + /* don't pass start if we are split up */ + r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, 0); if (rmesa->radeon.radeonScreen->kernel_mm) { BEGIN_BATCH_NO_AUTOSTATE(2); OUT_BATCH_REGSEQ(R300_VAP_VF_MAX_VTX_INDX, 1); -- cgit v1.2.3