i965: Don't try to continue space before the start of a VBO.
authorEric Anholt <eric@anholt.net>
Sat, 11 Jun 2011 03:19:01 +0000 (20:19 -0700)
committerEric Anholt <eric@anholt.net>
Sat, 18 Jun 2011 22:20:36 +0000 (15:20 -0700)
This loop is trying to see if all the buffers to be uploaded happen to
be the same increment from the start of the 3DSTATE_VERTEX_BUFFERS
currently loaded in the hardware.  However, we might be at a smaller
offset than the previous set of VERTEX_BUFFERS, so we can't reuse
because that packet made the first entry be its starting offset (you
can't access outside the given bounds).

Fixes piglit ARB_vertex_buffer_object/elements-negative-offset.

src/mesa/drivers/dri/i965/brw_draw_upload.c

index 13d3aa7841c0e571c665cc96cbe676ca8e058677..32a1d297479f9646b2c02cf4fb2ba1109fd43671 100644 (file)
@@ -500,6 +500,8 @@ static void brw_prepare_vertices(struct brw_context *brw)
            break;
 
         d = brw->vb.buffers[i].offset - brw->vb.current_buffers[i].offset;
+        if (d < 0)
+           break;
         if (i == 0)
            delta = d / brw->vb.current_buffers[i].stride;
         if (delta * brw->vb.current_buffers[i].stride != d)