vbo: remove dead code in vbo_can_merge_prims
[mesa.git] / src / mesa / vbo / vbo_private.h
index 90d8ed45704dbc06826b8cfabadc17783f9dcee0..c94215a20f556cf99cf98030702a85370553099d 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"
 
 
@@ -46,18 +45,11 @@ struct _mesa_prim;
 struct vbo_context {
    struct gl_vertex_buffer_binding binding;
    struct gl_array_attributes current[VBO_ATTRIB_MAX];
-   /* The array of inputs used for _DrawVAO draws. */
-   struct vbo_inputs draw_arrays;
 
    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;
 };
 
 
@@ -68,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
@@ -105,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:
@@ -116,6 +115,16 @@ vbo_attrtype_to_double_flag(GLenum format)
 }
 
 
+static inline void
+vbo_set_vertex_format(struct gl_vertex_format* vertex_format,
+                      GLubyte size, GLenum16 type)
+{
+   _mesa_set_vertex_format(vertex_format, size, type, GL_RGBA, GL_FALSE,
+                           vbo_attrtype_to_integer_flag(type),
+                           vbo_attrtype_to_double_flag(type));
+}
+
+
 /**
  * Return default component values for the given format.
  * The return type is an array of fi_types, because that's how we declare
@@ -126,6 +135,8 @@ vbo_get_default_vals_as_union(GLenum format)
 {
    static const GLfloat default_float[4] = { 0, 0, 0, 1 };
    static const GLint default_int[4] = { 0, 0, 0, 1 };
+   static const GLdouble default_double[4] = { 0, 0, 0, 1 };
+   static const uint64_t default_uint64[4] = { 0, 0, 0, 1 };
 
    switch (format) {
    case GL_FLOAT:
@@ -133,6 +144,10 @@ vbo_get_default_vals_as_union(GLenum format)
    case GL_INT:
    case GL_UNSIGNED_INT:
       return (fi_type *)default_int;
+   case GL_DOUBLE:
+      return (fi_type *)default_double;
+   case GL_UNSIGNED_INT64_ARB:
+      return (fi_type *)default_uint64;
    default:
       unreachable("Bad vertex format");
       return NULL;
@@ -215,9 +230,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);
 }