meta: Don't save or restore the renderbuffer binding
[mesa.git] / src / mesa / vbo / vbo_context.h
index 6099b56e66139fd1434031303f09f5fbf6fef21b..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;
 };
 
 
@@ -146,9 +152,26 @@ vbo_attrtype_to_integer_flag(GLenum format)
 {
    switch (format) {
    case GL_FLOAT:
+   case GL_DOUBLE:
+      return GL_FALSE;
+   case GL_INT:
+   case GL_UNSIGNED_INT:
+      return GL_TRUE;
+   default:
+      assert(0);
       return GL_FALSE;
+   }
+}
+
+static inline GLboolean
+vbo_attrtype_to_double_flag(GLenum format)
+{
+   switch (format) {
+   case GL_FLOAT:
    case GL_INT:
    case GL_UNSIGNED_INT:
+      return GL_FALSE;
+   case GL_DOUBLE:
       return GL_TRUE;
    default:
       assert(0);
@@ -179,6 +202,27 @@ vbo_get_default_vals_as_union(GLenum format)
    }
 }
 
+
+/**
+ * Compute the max number of vertices which can be stored in
+ * a vertex buffer, given the current vertex size, and the amount
+ * of space already used.
+ */
+static inline unsigned
+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));
+   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;
+}
+
+
 #ifdef __cplusplus
 } // extern "C"
 #endif