vbo: remove dead code in vbo_can_merge_prims
[mesa.git] / src / mesa / vbo / vbo_private.h
index b69f836aa0b210fc3c598e22c76c491c724b9015..c94215a20f556cf99cf98030702a85370553099d 100644 (file)
@@ -104,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:
@@ -115,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
@@ -125,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:
@@ -132,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;
@@ -214,6 +230,9 @@ _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.
@@ -221,7 +240,7 @@ _vbo_set_attrib_format(struct gl_context *ctx,
     * 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));
+   assert((vao->NewArrays | ~vao->Enabled) & VERT_BIT(attr));
    vao->VertexAttrib[attr].Ptr = ADD_POINTERS(buffer_offset, offset);
 }