mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.
[mesa.git] / src / mesa / main / varray.h
index a5fa33fa00e0c50fee4bc9a8830180f7df8464b3..3d16aba173d55516396e0997d2dd14f52bce24d0 100644 (file)
@@ -18,7 +18,7 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 #define VARRAY_H
 
 
-#include "mtypes.h"
+#include "glheader.h"
+
+struct gl_client_array;
+struct gl_context;
+
+
+/**
+ * Compute the index of the last array element that can be safely accessed in
+ * a vertex array.  We can really only do this when the array lives in a VBO.
+ * The array->_MaxElement field will be updated.
+ * Later in glDrawArrays/Elements/etc we can do some bounds checking.
+ */
+static inline void
+_mesa_update_array_max_element(struct gl_client_array *array)
+{
+   assert(array->Enabled);
+
+   if (array->BufferObj->Name) {
+      GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
+      GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
+
+      if (offset < bufSize) {
+        array->_MaxElement = (bufSize - offset + array->StrideB
+                               - array->_ElementSize) / array->StrideB;
+      }
+      else {
+        array->_MaxElement = 0;
+      }
+   }
+   else {
+      /* user-space array, no idea how big it is */
+      array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
+   }
+}
 
-#if _HAVE_FULL_GL
 
 extern void GLAPIENTRY
 _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
@@ -94,52 +126,46 @@ _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
 
 
 extern void GLAPIENTRY
-_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr);
+_mesa_FogCoordPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
 
 
 extern void GLAPIENTRY
-_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
+_mesa_SecondaryColorPointer(GLint size, GLenum type,
                               GLsizei stride, const GLvoid *ptr);
 
 
 extern void GLAPIENTRY
-_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr);
+_mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr);
 
 
 extern void GLAPIENTRY
-_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
-                            GLsizei stride, const GLvoid *pointer);
-
-
-extern void GLAPIENTRY
-_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
+_mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
                              GLboolean normalized, GLsizei stride,
                              const GLvoid *pointer);
 
 void GLAPIENTRY
 _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
-                           GLboolean normalized,
                            GLsizei stride, const GLvoid *ptr);
 
 
 extern void GLAPIENTRY
-_mesa_EnableVertexAttribArrayARB(GLuint index);
+_mesa_EnableVertexAttribArray(GLuint index);
 
 
 extern void GLAPIENTRY
-_mesa_DisableVertexAttribArrayARB(GLuint index);
+_mesa_DisableVertexAttribArray(GLuint index);
 
 
 extern void GLAPIENTRY
-_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params);
+_mesa_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
 
 
 extern void GLAPIENTRY
-_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params);
+_mesa_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
 
 
 extern void GLAPIENTRY
-_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params);
+_mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
 
 
 extern void GLAPIENTRY
@@ -151,7 +177,7 @@ _mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
 
 
 extern void GLAPIENTRY
-_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer);
+_mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer);
 
 
 extern void GLAPIENTRY
@@ -159,7 +185,7 @@ _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
 
 
 extern void GLAPIENTRY
-_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
+_mesa_MultiDrawArrays( GLenum mode, const GLint *first,
                           const GLsizei *count, GLsizei primcount );
 
 extern void GLAPIENTRY
@@ -211,10 +237,17 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
                                  const GLvoid *indices,
                                  GLint basevertex);
 
+extern void GLAPIENTRY
+_mesa_DrawTransformFeedback(GLenum mode, GLuint name);
+
 extern void GLAPIENTRY
 _mesa_PrimitiveRestartIndex(GLuint index);
 
 
+extern void GLAPIENTRY
+_mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
+
+
 extern void
 _mesa_copy_client_array(struct gl_context *ctx,
                         struct gl_client_array *dst,
@@ -230,12 +263,4 @@ _mesa_init_varray( struct gl_context * ctx );
 extern void 
 _mesa_free_varray_data(struct gl_context *ctx);
 
-#else
-
-/** No-op */
-#define _mesa_init_varray( c )  ((void)0)
-#define _mesa_free_varray_data( c )  ((void)0)
-
-#endif
-
 #endif