meta: Don't save or restore the renderbuffer binding
[mesa.git] / src / mesa / vbo / vbo_context.h
index 1e85335c1070d9e1e8c297bfd88cd4f8a2cca8a1..11f9b17c7c436278e4a25233fe9a6dd0f2841231 100644 (file)
@@ -76,6 +76,12 @@ struct vbo_context {
     * is responsible for initiating any fallback actions required:
     */
    vbo_draw_func draw_prims;
+
+   /* Optional callback for indirect draws. This allows multidraws to not be
+    * broken up, as well as for the actual count to be passed in as a separate
+    * indirect parameter.
+    */
+   vbo_indirect_draw_func draw_indirect_prims;
 };
 
 
@@ -205,8 +211,15 @@ 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));
+   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.
+    */
+   n--;
+   return n;
 }