Mesa (master): r300: fix vertex limits

Maciej Cencora osiris at kemper.freedesktop.org
Sun Jul 5 13:25:54 UTC 2009


Module: Mesa
Branch: master
Commit: 6fff62ee3fdbfe7d8ba15d3ad001f9afd120c307
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6fff62ee3fdbfe7d8ba15d3ad001f9afd120c307

Author: Maciej Cencora <m.cencora at gmail.com>
Date:   Mon Jun 29 19:50:39 2009 +0200

r300: fix vertex limits

- don't limit vertex count if we are using indices
- max indices count is 65535 not 65536
- remove some comments that don't apply anymore
- remove unreachable code

---

 src/mesa/drivers/dri/r300/r300_draw.c   |   10 ++++++----
 src/mesa/drivers/dri/r300/r300_render.c |   19 +------------------
 2 files changed, 7 insertions(+), 22 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c
index 92bb0ee..20fe8db 100644
--- a/src/mesa/drivers/dri/r300/r300_draw.c
+++ b/src/mesa/drivers/dri/r300/r300_draw.c
@@ -442,8 +442,6 @@ static GLboolean r300TryDrawPrims(GLcontext *ctx,
 	return GL_TRUE;
 }
 
-/* TODO: rebase if number of indices in any of primitives is > 8192 for 32bit indices or 16384 for 16bit indices */
-
 static void r300DrawPrims(GLcontext *ctx,
 			 const struct gl_client_array *arrays[],
 			 const struct _mesa_prim *prim,
@@ -455,7 +453,11 @@ static void r300DrawPrims(GLcontext *ctx,
 	struct split_limits limits;
 	GLboolean retval;
 
-	limits.max_verts = 65535;
+	if (ib)
+		limits.max_verts = 0xffffffff;
+	else
+		limits.max_verts = 65535;
+
 	limits.max_indices = 65535;
 	limits.max_vb_size = 1024*1024;
 
@@ -463,7 +465,7 @@ static void r300DrawPrims(GLcontext *ctx,
 		vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims );
 		return;
 	}
-	if ((ib && ib->count > 65536)) {
+	if ((ib && ib->count > 65535)) {
 		vbo_split_prims (ctx, arrays, prim, nr_prims, ib, min_index, max_index, r300DrawPrims, &limits);
 		return;
 	}
diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c
index bf50b06..36c5ca7 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -359,31 +359,14 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
 	if (type < 0 || num_verts <= 0)
 		return;
 
-	/* Make space for at least 64 dwords.
+	/* Make space for at least 128 dwords.
 	 * This is supposed to ensure that we can get all rendering
 	 * commands into a single command buffer.
 	 */
 	rcommonEnsureCmdBufSpace(&rmesa->radeon, 128, __FUNCTION__);
 
 	if (rmesa->ind_buf.ptr) {
-		if (num_verts > 65535) {
-			/* not implemented yet */
-			WARN_ONCE("Too many elts\n");
-			return;
-		}
-		/* Note: The following is incorrect, but it's the best I can do
-		 * without a major refactoring of how DMA memory is handled.
-		 * The problem: Ensuring that both vertex arrays *and* index
-		 * arrays are at the right position, and then ensuring that
-		 * the LOAD_VBPNTR, DRAW_INDX and INDX_BUFFER packets are emitted
-		 * at once.
-		 *
-		 * So why is the following incorrect? Well, it seems like
-		 * allocating the index array might actually evict the vertex
-		 * arrays. *sigh*
-		 */
 		r300EmitElts(ctx, num_verts);
-		/* 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);




More information about the mesa-commit mailing list