Mesa (master): draw: Cap max vertices instead of failing assert.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Feb 11 16:48:40 UTC 2009


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

Author: José Fonseca <jfonseca at vmware.com>
Date:   Wed Feb 11 16:35:12 2009 +0000

draw: Cap max vertices instead of failing assert.

---

 src/gallium/auxiliary/draw/draw_pipe_vbuf.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
index 5ead25e..9153bc2 100644
--- a/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
+++ b/src/gallium/auxiliary/draw/draw_pipe_vbuf.c
@@ -394,13 +394,14 @@ vbuf_alloc_vertices( struct vbuf_stage *vbuf )
    /* even number */
    vbuf->max_vertices = vbuf->max_vertices & ~1;
 
+   if(vbuf->max_vertices >= UNDEFINED_VERTEX_ID)
+      vbuf->max_vertices = UNDEFINED_VERTEX_ID - 1;
+
    /* Must always succeed -- driver gives us a
     * 'max_vertex_buffer_bytes' which it guarantees it can allocate,
     * and it will flush itself if necessary to do so.  If this does
     * fail, we are basically without usable hardware.
     */
-   assert(vbuf->max_vertices < UNDEFINED_VERTEX_ID);
-
    vbuf->vertices = (uint *) vbuf->render->allocate_vertices(vbuf->render,
 							     (ushort) vbuf->vertex_size,
 							     (ushort) vbuf->max_vertices);




More information about the mesa-commit mailing list