mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.
[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 * THE AUTHORS OR COPYRIGHT HOLDERS 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
33 struct gl_client_array;
34 struct gl_context;
35
36
37 /**
38 * Compute the index of the last array element that can be safely accessed in
39 * a vertex array. We can really only do this when the array lives in a VBO.
40 * The array->_MaxElement field will be updated.
41 * Later in glDrawArrays/Elements/etc we can do some bounds checking.
42 */
43 static inline void
44 _mesa_update_array_max_element(struct gl_client_array *array)
45 {
46 assert(array->Enabled);
47
48 if (array->BufferObj->Name) {
49 GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
50 GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
51
52 if (offset < bufSize) {
53 array->_MaxElement = (bufSize - offset + array->StrideB
54 - array->_ElementSize) / array->StrideB;
55 }
56 else {
57 array->_MaxElement = 0;
58 }
59 }
60 else {
61 /* user-space array, no idea how big it is */
62 array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
63 }
64 }
65
66
67 extern void GLAPIENTRY
68 _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
69 const GLvoid *ptr);
70
71 extern void GLAPIENTRY
72 _mesa_UnlockArraysEXT( void );
73
74 extern void GLAPIENTRY
75 _mesa_LockArraysEXT(GLint first, GLsizei count);
76
77
78 extern void GLAPIENTRY
79 _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
80
81
82 extern void GLAPIENTRY
83 _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
84
85
86 extern void GLAPIENTRY
87 _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
88
89
90 extern void GLAPIENTRY
91 _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
92 const GLvoid *ptr);
93
94
95 extern void GLAPIENTRY
96 _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);
97
98
99 extern void GLAPIENTRY
100 _mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
101 GLsizei count, const GLvoid *ptr);
102
103
104 extern void GLAPIENTRY
105 _mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
106 const GLvoid *ptr);
107
108
109 extern void GLAPIENTRY
110 _mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
111 const GLvoid *ptr);
112
113
114 extern void GLAPIENTRY
115 _mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
116 const GLvoid *ptr);
117
118
119 extern void GLAPIENTRY
120 _mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
121 GLsizei count, const GLvoid *ptr);
122
123
124 extern void GLAPIENTRY
125 _mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
126
127
128 extern void GLAPIENTRY
129 _mesa_FogCoordPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
130
131
132 extern void GLAPIENTRY
133 _mesa_SecondaryColorPointer(GLint size, GLenum type,
134 GLsizei stride, const GLvoid *ptr);
135
136
137 extern void GLAPIENTRY
138 _mesa_PointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *ptr);
139
140
141 extern void GLAPIENTRY
142 _mesa_VertexAttribPointer(GLuint index, GLint size, GLenum type,
143 GLboolean normalized, GLsizei stride,
144 const GLvoid *pointer);
145
146 void GLAPIENTRY
147 _mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
148 GLsizei stride, const GLvoid *ptr);
149
150
151 extern void GLAPIENTRY
152 _mesa_EnableVertexAttribArray(GLuint index);
153
154
155 extern void GLAPIENTRY
156 _mesa_DisableVertexAttribArray(GLuint index);
157
158
159 extern void GLAPIENTRY
160 _mesa_GetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
161
162
163 extern void GLAPIENTRY
164 _mesa_GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
165
166
167 extern void GLAPIENTRY
168 _mesa_GetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
169
170
171 extern void GLAPIENTRY
172 _mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
173
174
175 extern void GLAPIENTRY
176 _mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
177
178
179 extern void GLAPIENTRY
180 _mesa_GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid **pointer);
181
182
183 extern void GLAPIENTRY
184 _mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
185
186
187 extern void GLAPIENTRY
188 _mesa_MultiDrawArrays( GLenum mode, const GLint *first,
189 const GLsizei *count, GLsizei primcount );
190
191 extern void GLAPIENTRY
192 _mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
193 const GLvoid **indices, GLsizei primcount );
194
195 extern void GLAPIENTRY
196 _mesa_MultiDrawElementsBaseVertex( GLenum mode,
197 const GLsizei *count, GLenum type,
198 const GLvoid **indices, GLsizei primcount,
199 const GLint *basevertex);
200
201 extern void GLAPIENTRY
202 _mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
203 const GLsizei * count,
204 GLsizei primcount, GLint modestride );
205
206
207 extern void GLAPIENTRY
208 _mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
209 GLenum type, const GLvoid * const * indices,
210 GLsizei primcount, GLint modestride );
211
212 extern void GLAPIENTRY
213 _mesa_LockArraysEXT(GLint first, GLsizei count);
214
215 extern void GLAPIENTRY
216 _mesa_UnlockArraysEXT( void );
217
218
219 extern void GLAPIENTRY
220 _mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
221
222 extern void GLAPIENTRY
223 _mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
224 const GLvoid *indices);
225
226 extern void GLAPIENTRY
227 _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
228 GLenum type, const GLvoid *indices);
229
230 extern void GLAPIENTRY
231 _mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
232 const GLvoid *indices, GLint basevertex);
233
234 extern void GLAPIENTRY
235 _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
236 GLsizei count, GLenum type,
237 const GLvoid *indices,
238 GLint basevertex);
239
240 extern void GLAPIENTRY
241 _mesa_DrawTransformFeedback(GLenum mode, GLuint name);
242
243 extern void GLAPIENTRY
244 _mesa_PrimitiveRestartIndex(GLuint index);
245
246
247 extern void GLAPIENTRY
248 _mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
249
250
251 extern void
252 _mesa_copy_client_array(struct gl_context *ctx,
253 struct gl_client_array *dst,
254 struct gl_client_array *src);
255
256
257 extern void
258 _mesa_print_arrays(struct gl_context *ctx);
259
260 extern void
261 _mesa_init_varray( struct gl_context * ctx );
262
263 extern void
264 _mesa_free_varray_data(struct gl_context *ctx);
265
266 #endif