vbo: Test for VBO_SAVE_PRIM_WEAK in _mesa_prim::mode is false.
[mesa.git] / src / mesa / vbo / vbo_private.h
index 1f3d31f577a8491e5a60264a38469fe7e2a8450c..86f6b41b793e9f66e4d8f9213ec101db942a8b42 100644 (file)
@@ -35,7 +35,6 @@
 #include "vbo/vbo_attrib.h"
 #include "vbo/vbo_exec.h"
 #include "vbo/vbo_save.h"
-#include "main/mtypes.h"
 #include "main/varray.h"
 
 
@@ -44,25 +43,13 @@ struct _mesa_prim;
 
 
 struct vbo_context {
-   struct gl_vertex_array currval[VBO_ATTRIB_MAX];
-   /* The array of inputs used for _DrawVAO draws. */
-   struct vbo_inputs draw_arrays;
+   struct gl_vertex_buffer_binding binding;
+   struct gl_array_attributes current[VBO_ATTRIB_MAX];
 
    struct gl_vertex_array_object *VAO;
 
    struct vbo_exec_context exec;
    struct vbo_save_context save;
-
-   /* Callback into the driver.  This must always succeed, the driver
-    * 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;
 };
 
 
@@ -73,6 +60,13 @@ vbo_context(struct gl_context *ctx)
 }
 
 
+static inline const struct vbo_context *
+vbo_context_const(const struct gl_context *ctx)
+{
+   return ctx->vbo_context;
+}
+
+
 /**
  * Array to apply the fixed function material aliasing map to
  * an attribute value used in vbo processing inputs to an attribute
@@ -110,8 +104,8 @@ vbo_attrtype_to_double_flag(GLenum format)
    case GL_FLOAT:
    case GL_INT:
    case GL_UNSIGNED_INT:
-   case GL_UNSIGNED_INT64_ARB:
       return GL_FALSE;
+   case GL_UNSIGNED_INT64_ARB:
    case GL_DOUBLE:
       return GL_TRUE;
    default:
@@ -220,9 +214,17 @@ _vbo_set_attrib_format(struct gl_context *ctx,
 {
    const GLboolean integer = vbo_attrtype_to_integer_flag(type);
    const GLboolean doubles = vbo_attrtype_to_double_flag(type);
+
+   if (doubles)
+      size /= 2;
    _mesa_update_array_format(ctx, vao, attr, size, type, GL_RGBA,
                              GL_FALSE, integer, doubles, offset);
-   /* Ptr for userspace arrays */
+   /* Ptr for userspace arrays.
+    * For updating the pointer we would need to add the vao->NewArrays flag
+    * to the VAO. But but that is done already unconditionally in
+    * _mesa_update_array_format called above.
+    */
+   assert((vao->NewArrays | ~vao->_Enabled) & VERT_BIT(attr));
    vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset);
 }