summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerome Glisse <jglisse@redhat.com>2009-06-10 14:59:33 +0200
committerJerome Glisse <jglisse@redhat.com>2009-06-10 14:59:33 +0200
commit316598b96f07a38752c0c0f534feb025ee2a3235 (patch)
tree01e6ae81aa01ad946a7639fae0d4c6f47cba44d9
parent18b3cbcede292ce7b90b818b6abb064869072ff3 (diff)
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.
-rw-r--r--src/mesa/drivers/dri/r300/r300_render.c7
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 dfbd79a389..c2c532a9a8 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);