vbo: replace assertion with conditional in vbo_compute_max_verts()
authorBrian Paul <brianp@vmware.com>
Tue, 27 Oct 2015 19:50:10 +0000 (13:50 -0600)
committerBrian Paul <brianp@vmware.com>
Wed, 28 Oct 2015 17:03:27 +0000 (11:03 -0600)
With just the right sequence of per-vertex commands and state changes,
it's possible for this assertion to fail (such as with viewperf11's
lightwave-06-1 test).  Instead of asserting, return 0 so that the
caller knows the VBO is full and needs to be flushed.

Reviewed-by: Charmaine Lee <charmainel@vmware.com>
src/mesa/vbo/vbo_context.h

index e6b9d89..6293a8b 100644 (file)
@@ -207,7 +207,8 @@ vbo_compute_max_verts(const struct vbo_exec_context *exec)
 {
    unsigned n = (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
       (exec->vtx.vertex_size * sizeof(GLfloat));
-   assert(n > 0);
+   if (n == 0)
+      return 0;
    /* Subtract one so we're always sure to have room for an extra
     * vertex for GL_LINE_LOOP -> GL_LINE_STRIP conversion.
     */