intel: assert that we do not overflow the batch buffer.
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 22 Feb 2010 09:53:36 +0000 (09:53 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 22 Feb 2010 09:55:41 +0000 (09:55 +0000)
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
src/mesa/drivers/dri/intel/intel_batchbuffer.c

index 9261f2ffd8b633670885fe1ce3b5632311848bac..4c99dcde23f93da739ad8abac62da881a02dcec2 100644 (file)
@@ -158,9 +158,10 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file,
    }
 
    /* Mark the end of the buffer. */
-   *(GLuint *) (batch->ptr) = MI_BATCH_BUFFER_END; /* noop */
+   *(GLuint *) (batch->ptr) = MI_BATCH_BUFFER_END;
    batch->ptr += 4;
    used = batch->ptr - batch->map;
+   assert (used <= batch->buf->size);
 
    /* Workaround for recursive batchbuffer flushing: If the window is
     * moved, we can get into a case where we try to flush during a