mesa: use GLenum16 in a few more places
[mesa.git] / src / mesa / main / arrayobj.h
index d72761db15f368feef90299411978e0a5445301f..5de74505bb80285d360a66e6c2a93b1c51858f29 100644 (file)
@@ -35,7 +35,7 @@ struct gl_context;
 
 /**
  * \file arrayobj.h
- * Functions for the GL_APPLE_vertex_array_object extension.
+ * Functions for the GL_ARB_vertex_array_object extension.
  *
  * \author Ian Romanick <idr@us.ibm.com>
  * \author Brian Paul
@@ -48,6 +48,9 @@ struct gl_context;
 extern struct gl_vertex_array_object *
 _mesa_lookup_vao(struct gl_context *ctx, GLuint id);
 
+extern struct gl_vertex_array_object *
+_mesa_lookup_vao_err(struct gl_context *ctx, GLuint id, const char *caller);
+
 extern struct gl_vertex_array_object *
 _mesa_new_vao(struct gl_context *ctx, GLuint name);
 
@@ -75,36 +78,62 @@ _mesa_initialize_vao(struct gl_context *ctx,
 
 
 extern void
-_mesa_update_vao_max_element(struct gl_context *ctx,
-                             struct gl_vertex_array_object *vao);
+_mesa_update_vao_derived_arrays(struct gl_context *ctx,
+                                struct gl_vertex_array_object *vao);
 
-extern void
-_mesa_update_vao_client_arrays(struct gl_context *ctx,
-                               struct gl_vertex_array_object *vao);
+/* Returns true if all varying arrays reside in vbos */
+extern bool
+_mesa_all_varyings_in_vbos(const struct gl_vertex_array_object *vao);
 
+/* Returns true if all vbos are unmapped */
+extern bool
+_mesa_all_buffers_are_unmapped(const struct gl_vertex_array_object *vao);
 
-/** Returns the bitmask of all enabled arrays in fixed function mode.
- *
- *  In fixed function mode only the traditional fixed function arrays
- *  are available.
+
+/**
+ * Array to apply the position/generic0 aliasing map to
+ * an attribute value used in vertex processing inputs to an attribute
+ * as they appear in the vao.
+ */
+extern const GLubyte
+_mesa_vao_attribute_map[ATTRIBUTE_MAP_MODE_MAX][VERT_ATTRIB_MAX];
+
+
+/**
+ * Apply the position/generic0 aliasing map to a bitfield from the vao.
+ * Use for example to convert gl_vertex_array_object::_Enabled
+ * or gl_vertex_buffer_binding::_VertexBinding from the vao numbering to
+ * the numbering used with vertex processing inputs.
  */
-static inline GLbitfield64
-_mesa_array_object_get_enabled_ff(const struct gl_vertex_array_object *vao)
+static inline GLbitfield
+_mesa_vao_enable_to_vp_inputs(gl_attribute_map_mode mode, GLbitfield enabled)
 {
-   return vao->_Enabled & VERT_BIT_FF_ALL;
+   switch (mode) {
+   case ATTRIBUTE_MAP_MODE_IDENTITY:
+      return enabled;
+   case ATTRIBUTE_MAP_MODE_POSITION:
+      /* Copy VERT_ATTRIB_POS enable bit into GENERIC0 position */
+      return (enabled & ~VERT_BIT_GENERIC0)
+         | ((enabled & VERT_BIT_POS) << VERT_ATTRIB_GENERIC0);
+   case ATTRIBUTE_MAP_MODE_GENERIC0:
+      /* Copy VERT_ATTRIB_GENERIC0 enable bit into POS position */
+      return (enabled & ~VERT_BIT_POS)
+         | ((enabled & VERT_BIT_GENERIC0) >> VERT_ATTRIB_GENERIC0);
+   default:
+      return 0;
+   }
 }
 
-/** Returns the bitmask of all enabled arrays in arb/glsl shader mode.
- *
- *  In arb/glsl shader mode all the fixed function and the arb/glsl generic
- *  arrays are available. Only the first generic array takes
- *  precedence over the legacy position array.
+
+/**
+ * Return the vp_inputs enabled bitmask after application of
+ * the position/generic0 aliasing map.
  */
-static inline GLbitfield64
-_mesa_array_object_get_enabled_arb(const struct gl_vertex_array_object *vao)
+static inline GLbitfield
+_mesa_get_vao_vp_inputs(const struct gl_vertex_array_object *vao)
 {
-   GLbitfield64 enabled = vao->_Enabled;
-   return enabled & ~(VERT_BIT_POS & (enabled >> VERT_ATTRIB_GENERIC0));
+   const gl_attribute_map_mode mode = vao->_AttributeMapMode;
+   return _mesa_vao_enable_to_vp_inputs(mode, vao->_Enabled);
 }
 
 
@@ -113,16 +142,33 @@ _mesa_array_object_get_enabled_arb(const struct gl_vertex_array_object *vao)
  */
 
 
+void GLAPIENTRY
+_mesa_BindVertexArray_no_error(GLuint id);
+
 void GLAPIENTRY _mesa_BindVertexArray( GLuint id );
 
-void GLAPIENTRY _mesa_BindVertexArrayAPPLE( GLuint id );
+void GLAPIENTRY
+_mesa_DeleteVertexArrays_no_error(GLsizei n, const GLuint *ids);
 
 void GLAPIENTRY _mesa_DeleteVertexArrays(GLsizei n, const GLuint *ids);
 
+void GLAPIENTRY
+_mesa_GenVertexArrays_no_error(GLsizei n, GLuint *arrays);
+
 void GLAPIENTRY _mesa_GenVertexArrays(GLsizei n, GLuint *arrays);
 
-void GLAPIENTRY _mesa_GenVertexArraysAPPLE(GLsizei n, GLuint *buffer);
+void GLAPIENTRY
+_mesa_CreateVertexArrays_no_error(GLsizei n, GLuint *arrays);
+
+void GLAPIENTRY _mesa_CreateVertexArrays(GLsizei n, GLuint *arrays);
 
 GLboolean GLAPIENTRY _mesa_IsVertexArray( GLuint id );
 
+void GLAPIENTRY
+_mesa_VertexArrayElementBuffer_no_error(GLuint vaobj, GLuint buffer);
+
+void GLAPIENTRY _mesa_VertexArrayElementBuffer(GLuint vaobj, GLuint buffer);
+
+void GLAPIENTRY _mesa_GetVertexArrayiv(GLuint vaobj, GLenum pname, GLint *param);
+
 #endif /* ARRAYOBJ_H */