i965: Reinstate max-index paranoia
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 22 Feb 2011 11:19:32 +0000 (11:19 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 22 Feb 2011 11:24:45 +0000 (11:24 +0000)
Don't trust the applications not to reference beyond the end of the
vertex buffers.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/i965/brw_draw_upload.c

index 6ea877bfbc4c4114579f17e1591d121d7a32503f..452074961dab6869ae418e4a2129a6ccea1044c1 100644 (file)
@@ -550,7 +550,7 @@ static void brw_emit_vertices(struct brw_context *brw)
         if (intel->gen >= 5) {
            OUT_RELOC(buffer->bo, I915_GEM_DOMAIN_VERTEX, 0, buffer->bo->size - 1);
         } else
-           OUT_BATCH(0);
+           OUT_BATCH(buffer->bo->size / buffer->stride);
         OUT_BATCH(0); /* Instance data step rate */
 
         brw->vb.current_buffers[i].handle = buffer->bo->handle;