mesa: Replace MESA_VERSION with PACKAGE_VERSION.
[mesa.git] / src / mesa / main / varray.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.6
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26
27 #ifndef VARRAY_H
28 #define VARRAY_H
29
30
31 #include "glheader.h"
32 #include "mfeatures.h"
33
34 struct gl_client_array;
35 struct gl_context;
36
37
38 /**
39 * Compute the index of the last array element that can be safely accessed in
40 * a vertex array. We can really only do this when the array lives in a VBO.
41 * The array->_MaxElement field will be updated.
42 * Later in glDrawArrays/Elements/etc we can do some bounds checking.
43 */
44 static inline void
45 _mesa_update_array_max_element(struct gl_client_array *array)
46 {
47 assert(array->Enabled);
48
49 if (array->BufferObj->Name) {
50 GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
51 GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
52
53 if (offset < bufSize) {
54 array->_MaxElement = (bufSize - offset + array->StrideB
55 - array->_ElementSize) / array->StrideB;
56 }
57 else {
58 array->_MaxElement = 0;
59 }
60 }
61 else {
62 /* user-space array, no idea how big it is */
63 array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
64 }
65 }
66
67
68 extern void GLAPIENTRY
69 _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
70 const GLvoid *ptr);
71
72 extern void GLAPIENTRY
73 _mesa_UnlockArraysEXT( void );
74
75 extern void GLAPIENTRY
76 _mesa_LockArraysEXT(GLint first, GLsizei count);
77
78
79 extern void GLAPIENTRY
80 _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
81
82
83 extern void GLAPIENTRY
84 _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
85
86
87 extern void GLAPIENTRY
88 _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
89
90
91 extern void GLAPIENTRY
92 _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
93 const GLvoid *ptr);
94
95
96 extern void GLAPIENTRY
97 _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);
98
99
100 extern void GLAPIENTRY
101 _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
102 GLsizei count, const GLvoid *ptr);
103
104
105 extern void GLAPIENTRY
106 _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
107 const GLvoid *ptr);
108
109
110 extern void GLAPIENTRY
111 _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
112 const GLvoid *ptr);
113
114
115 extern void GLAPIENTRY
116 _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
117 const GLvoid *ptr);
118
119
120 extern void GLAPIENTRY
121 _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
122 GLsizei count, const GLvoid *ptr);
123
124
125 extern void GLAPIENTRY
126 _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
127
128
129 extern void GLAPIENTRY
130 _mesa_FogCoordPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
131
132
133 extern void GLAPIENTRY
134 _mesa_SecondaryColorPointer(GLint size, GLenum type,
135 GLsizei stride, const GLvoid *ptr);
136
137
138 extern void GLAPIENTRY
139 _mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr);
140
141
142 extern void GLAPIENTRY
143 _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
144 GLboolean normalized, GLsizei stride,
145 const GLvoid *pointer);
146
147 void GLAPIENTRY
148 _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
149 GLsizei stride, const GLvoid *ptr);
150
151
152 extern void GLAPIENTRY
153 _mesa_EnableVertexAttribArray(GLuint index);
154
155
156 extern void GLAPIENTRY
157 _mesa_DisableVertexAttribArray(GLuint index);
158
159
160 extern void GLAPIENTRY
161 _mesa_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
162
163
164 extern void GLAPIENTRY
165 _mesa_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
166
167
168 extern void GLAPIENTRY
169 _mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
170
171
172 extern void GLAPIENTRY
173 _mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
174
175
176 extern void GLAPIENTRY
177 _mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
178
179
180 extern void GLAPIENTRY
181 _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer);
182
183
184 extern void GLAPIENTRY
185 _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
186
187
188 extern void GLAPIENTRY
189 _mesa_MultiDrawArrays( GLenum mode, const GLint *first,
190 const GLsizei *count, GLsizei primcount );
191
192 extern void GLAPIENTRY
193 _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
194 const GLvoid **indices, GLsizei primcount );
195
196 extern void GLAPIENTRY
197 _mesa_MultiDrawElementsBaseVertex( GLenum mode,
198 const GLsizei *count, GLenum type,
199 const GLvoid **indices, GLsizei primcount,
200 const GLint *basevertex);
201
202 extern void GLAPIENTRY
203 _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
204 const GLsizei * count,
205 GLsizei primcount, GLint modestride );
206
207
208 extern void GLAPIENTRY
209 _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
210 GLenum type, const GLvoid * const * indices,
211 GLsizei primcount, GLint modestride );
212
213 extern void GLAPIENTRY
214 _mesa_LockArraysEXT(GLint first, GLsizei count);
215
216 extern void GLAPIENTRY
217 _mesa_UnlockArraysEXT( void );
218
219
220 extern void GLAPIENTRY
221 _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
222
223 extern void GLAPIENTRY
224 _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
225 const GLvoid *indices);
226
227 extern void GLAPIENTRY
228 _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
229 GLenum type, const GLvoid *indices);
230
231 extern void GLAPIENTRY
232 _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
233 const GLvoid *indices, GLint basevertex);
234
235 extern void GLAPIENTRY
236 _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
237 GLsizei count, GLenum type,
238 const GLvoid *indices,
239 GLint basevertex);
240
241 extern void GLAPIENTRY
242 _mesa_DrawTransformFeedback(GLenum mode, GLuint name);
243
244 extern void GLAPIENTRY
245 _mesa_PrimitiveRestartIndex(GLuint index);
246
247
248 extern void GLAPIENTRY
249 _mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
250
251
252 extern void
253 _mesa_copy_client_array(struct gl_context *ctx,
254 struct gl_client_array *dst,
255 struct gl_client_array *src);
256
257
258 extern void
259 _mesa_print_arrays(struct gl_context *ctx);
260
261 extern void
262 _mesa_init_varray( struct gl_context * ctx );
263
264 extern void
265 _mesa_free_varray_data(struct gl_context *ctx);
266
267 #endif