Module: Mesa
Branch: radeon-rewrite
Commit: 316598b96f07a38752c0c0f534feb025ee2a3235
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=316598b96f07a38752c0c0f534feb025ee2a3235

Author: Jerome Glisse <jgli...@redhat.com>
Date:   Wed Jun 10 14:59:33 2009 +0200

r300: make sure indexed rendering doesn't try to use more than the num of 
vertices

When with memory manager we need to make sure the GPU won't try to access
beyond vertex buffer size, do so by enforcing that the maximun index is the
last vertex of the buffer.

---

 src/mesa/drivers/dri/r300/r300_render.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/r300_render.c 
b/src/mesa/drivers/dri/r300/r300_render.c
index dfbd79a..c2c532a 100644
--- a/src/mesa/drivers/dri/r300/r300_render.c
+++ b/src/mesa/drivers/dri/r300/r300_render.c
@@ -351,6 +351,7 @@ static void r300FireAOS(r300ContextPtr rmesa, int 
vertex_count, int type)
 void r300RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim)
 {
        r300ContextPtr rmesa = R300_CONTEXT(ctx);
+       BATCH_LOCALS(&rmesa->radeon);
        int type, num_verts;
 
        type = r300PrimitiveType(rmesa, prim);
@@ -384,6 +385,12 @@ void r300RunRenderPrimitive(GLcontext * ctx, int start, 
int end, int prim)
                 */
                r300EmitElts(ctx, num_verts);
                r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start);
+               if (rmesa->radeon.radeonScreen->kernel_mm) {
+                       BEGIN_BATCH_NO_AUTOSTATE(2);
+                       OUT_BATCH_REGSEQ(R300_VAP_VF_MAX_VTX_INDX, 1);
+                       OUT_BATCH(num_verts);
+                       END_BATCH();
+               }
                r300FireEB(rmesa, num_verts, type);
        } else {
                r300EmitAOS(rmesa, rmesa->radeon.tcl.aos_count, start);

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to