summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/vbo/vbo_context.h')
-rw-r--r--src/mesa/vbo/vbo_context.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/vbo/vbo_context.h b/src/mesa/vbo/vbo_context.h
index 1e85335c107..e6b9d890d5f 100644
--- a/src/mesa/vbo/vbo_context.h
+++ b/src/mesa/vbo/vbo_context.h
@@ -205,8 +205,14 @@ vbo_get_default_vals_as_union(GLenum format)
static inline unsigned
vbo_compute_max_verts(const struct vbo_exec_context *exec)
{
- return (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
- (exec->vtx.vertex_size * sizeof(GLfloat));
+ unsigned n = (VBO_VERT_BUFFER_SIZE - exec->vtx.buffer_used) /
+ (exec->vtx.vertex_size * sizeof(GLfloat));
+ assert(n > 0);
+ /* Subtract one so we're always sure to have room for an extra
+ * vertex for GL_LINE_LOOP -> GL_LINE_STRIP conversion.
+ */
+ n--;
+ return n;
}