Mesa (master): i965: Reinstate max-index paranoia

Chris Wilson ickle at kemper.freedesktop.org
Tue Feb 22 11:47:52 UTC 2011


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

Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Tue Feb 22 11:19:32 2011 +0000

i965: Reinstate max-index paranoia

Don't trust the applications not to reference beyond the end of the
vertex buffers.

Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

---

 src/mesa/drivers/dri/i965/brw_draw_upload.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c
index 6ea877b..4520749 100644
--- a/src/mesa/drivers/dri/i965/brw_draw_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c
@@ -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;




More information about the mesa-commit mailing list