varray.h revision 3464ebd5
11.4Spooka/*
21.1Spooka * Mesa 3-D graphics library
31.1Spooka * Version:  7.6
41.1Spooka *
51.1Spooka * Copyright (C) 1999-2008  Brian Paul   All Rights Reserved.
61.1Spooka * Copyright (C) 2009  VMware, Inc.  All Rights Reserved.
71.2Spooka *
81.2Spooka * Permission is hereby granted, free of charge, to any person obtaining a
91.1Spooka * copy of this software and associated documentation files (the "Software"),
101.1Spooka * to deal in the Software without restriction, including without limitation
111.1Spooka * the rights to use, copy, modify, merge, publish, distribute, sublicense,
121.1Spooka * and/or sell copies of the Software, and to permit persons to whom the
131.1Spooka * Software is furnished to do so, subject to the following conditions:
141.1Spooka *
151.1Spooka * The above copyright notice and this permission notice shall be included
161.1Spooka * in all copies or substantial portions of the Software.
171.1Spooka *
181.1Spooka * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
191.1Spooka * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
201.1Spooka * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
211.1Spooka * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
221.1Spooka * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
231.1Spooka * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
241.1Spooka */
251.1Spooka
261.1Spooka
271.1Spooka#ifndef VARRAY_H
281.1Spooka#define VARRAY_H
291.1Spooka
301.1Spooka
311.1Spooka#include "glheader.h"
321.1Spooka#include "mfeatures.h"
331.1Spooka
341.1Spookastruct gl_client_array;
351.1Spookastruct gl_context;
361.1Spooka
371.1Spooka
381.1Spooka/**
391.1Spooka * Compute the index of the last array element that can be safely accessed in
401.1Spooka * a vertex array.  We can really only do this when the array lives in a VBO.
411.1Spooka * The array->_MaxElement field will be updated.
421.1Spooka * Later in glDrawArrays/Elements/etc we can do some bounds checking.
431.1Spooka */
441.1Spookastatic INLINE void
451.1Spooka_mesa_update_array_max_element(struct gl_client_array *array)
461.1Spooka{
471.1Spooka   assert(array->Enabled);
481.1Spooka
491.1Spooka   if (array->BufferObj->Name) {
501.1Spooka      GLsizeiptrARB offset = (GLsizeiptrARB) array->Ptr;
511.1Spooka      GLsizeiptrARB bufSize = (GLsizeiptrARB) array->BufferObj->Size;
521.1Spooka
531.1Spooka      if (offset < bufSize) {
541.1Spooka	 array->_MaxElement = (bufSize - offset + array->StrideB
551.1Spooka                               - array->_ElementSize) / array->StrideB;
561.1Spooka      }
571.1Spooka      else {
581.1Spooka	 array->_MaxElement = 0;
591.1Spooka      }
601.1Spooka   }
611.1Spooka   else {
621.1Spooka      /* user-space array, no idea how big it is */
631.1Spooka      array->_MaxElement = 2 * 1000 * 1000 * 1000; /* just a big number */
641.3Spooka   }
651.3Spooka}
661.3Spooka
671.3Spooka
681.3Spooka#if _HAVE_FULL_GL
691.3Spooka
701.3Spookaextern void GLAPIENTRY
711.3Spooka_mesa_VertexPointer(GLint size, GLenum type, GLsizei stride,
721.3Spooka                    const GLvoid *ptr);
731.3Spooka
741.3Spookaextern void GLAPIENTRY
751.3Spooka_mesa_UnlockArraysEXT( void );
761.3Spooka
771.3Spookaextern void GLAPIENTRY
781.1Spooka_mesa_LockArraysEXT(GLint first, GLsizei count);
791.1Spooka
801.1Spooka
811.1Spookaextern void GLAPIENTRY
821.1Spooka_mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
831.1Spooka
841.1Spooka
851.1Spookaextern void GLAPIENTRY
861.1Spooka_mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
871.1Spooka
881.1Spooka
891.1Spookaextern void GLAPIENTRY
901.1Spooka_mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr);
911.1Spooka
921.1Spooka
931.1Spookaextern void GLAPIENTRY
941.1Spooka_mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride,
951.1Spooka                      const GLvoid *ptr);
961.1Spooka
971.4Spooka
981.1Spookaextern void GLAPIENTRY
991.1Spooka_mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr);
1001.1Spooka
1011.4Spooka
1021.4Spookaextern void GLAPIENTRY
1031.4Spooka_mesa_VertexPointerEXT(GLint size, GLenum type, GLsizei stride,
1041.4Spooka                       GLsizei count, const GLvoid *ptr);
1051.4Spooka
106
107extern void GLAPIENTRY
108_mesa_NormalPointerEXT(GLenum type, GLsizei stride, GLsizei count,
109                       const GLvoid *ptr);
110
111
112extern void GLAPIENTRY
113_mesa_ColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count,
114                      const GLvoid *ptr);
115
116
117extern void GLAPIENTRY
118_mesa_IndexPointerEXT(GLenum type, GLsizei stride, GLsizei count,
119                      const GLvoid *ptr);
120
121
122extern void GLAPIENTRY
123_mesa_TexCoordPointerEXT(GLint size, GLenum type, GLsizei stride,
124                         GLsizei count, const GLvoid *ptr);
125
126
127extern void GLAPIENTRY
128_mesa_EdgeFlagPointerEXT(GLsizei stride, GLsizei count, const GLboolean *ptr);
129
130
131extern void GLAPIENTRY
132_mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr);
133
134
135extern void GLAPIENTRY
136_mesa_SecondaryColorPointerEXT(GLint size, GLenum type,
137			       GLsizei stride, const GLvoid *ptr);
138
139
140extern void GLAPIENTRY
141_mesa_PointSizePointer(GLenum type, GLsizei stride, const GLvoid *ptr);
142
143
144extern void GLAPIENTRY
145_mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type,
146                            GLsizei stride, const GLvoid *pointer);
147
148
149extern void GLAPIENTRY
150_mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type,
151                             GLboolean normalized, GLsizei stride,
152                             const GLvoid *pointer);
153
154void GLAPIENTRY
155_mesa_VertexAttribIPointer(GLuint index, GLint size, GLenum type,
156                           GLsizei stride, const GLvoid *ptr);
157
158
159extern void GLAPIENTRY
160_mesa_EnableVertexAttribArrayARB(GLuint index);
161
162
163extern void GLAPIENTRY
164_mesa_DisableVertexAttribArrayARB(GLuint index);
165
166
167extern void GLAPIENTRY
168_mesa_GetVertexAttribdvARB(GLuint index, GLenum pname, GLdouble *params);
169
170
171extern void GLAPIENTRY
172_mesa_GetVertexAttribfvARB(GLuint index, GLenum pname, GLfloat *params);
173
174
175extern void GLAPIENTRY
176_mesa_GetVertexAttribivARB(GLuint index, GLenum pname, GLint *params);
177
178
179extern void GLAPIENTRY
180_mesa_GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
181
182
183extern void GLAPIENTRY
184_mesa_GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
185
186
187extern void GLAPIENTRY
188_mesa_GetVertexAttribPointervARB(GLuint index, GLenum pname, GLvoid **pointer);
189
190
191extern void GLAPIENTRY
192_mesa_InterleavedArrays(GLenum format, GLsizei stride, const GLvoid *pointer);
193
194
195extern void GLAPIENTRY
196_mesa_MultiDrawArraysEXT( GLenum mode, const GLint *first,
197                          const GLsizei *count, GLsizei primcount );
198
199extern void GLAPIENTRY
200_mesa_MultiDrawElementsEXT( GLenum mode, const GLsizei *count, GLenum type,
201                            const GLvoid **indices, GLsizei primcount );
202
203extern void GLAPIENTRY
204_mesa_MultiDrawElementsBaseVertex( GLenum mode,
205				   const GLsizei *count, GLenum type,
206				   const GLvoid **indices, GLsizei primcount,
207				   const GLint *basevertex);
208
209extern void GLAPIENTRY
210_mesa_MultiModeDrawArraysIBM( const GLenum * mode, const GLint * first,
211			      const GLsizei * count,
212			      GLsizei primcount, GLint modestride );
213
214
215extern void GLAPIENTRY
216_mesa_MultiModeDrawElementsIBM( const GLenum * mode, const GLsizei * count,
217				GLenum type, const GLvoid * const * indices,
218				GLsizei primcount, GLint modestride );
219
220extern void GLAPIENTRY
221_mesa_LockArraysEXT(GLint first, GLsizei count);
222
223extern void GLAPIENTRY
224_mesa_UnlockArraysEXT( void );
225
226
227extern void GLAPIENTRY
228_mesa_DrawArrays(GLenum mode, GLint first, GLsizei count);
229
230extern void GLAPIENTRY
231_mesa_DrawElements(GLenum mode, GLsizei count, GLenum type,
232                   const GLvoid *indices);
233
234extern void GLAPIENTRY
235_mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
236                        GLenum type, const GLvoid *indices);
237
238extern void GLAPIENTRY
239_mesa_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type,
240			     const GLvoid *indices, GLint basevertex);
241
242extern void GLAPIENTRY
243_mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end,
244				  GLsizei count, GLenum type,
245				  const GLvoid *indices,
246				  GLint basevertex);
247
248extern void GLAPIENTRY
249_mesa_PrimitiveRestartIndex(GLuint index);
250
251
252extern void GLAPIENTRY
253_mesa_VertexAttribDivisor(GLuint index, GLuint divisor);
254
255
256extern void
257_mesa_copy_client_array(struct gl_context *ctx,
258                        struct gl_client_array *dst,
259                        struct gl_client_array *src);
260
261
262extern void
263_mesa_print_arrays(struct gl_context *ctx);
264
265extern void
266_mesa_init_varray( struct gl_context * ctx );
267
268extern void
269_mesa_free_varray_data(struct gl_context *ctx);
270
271#else
272
273/** No-op */
274#define _mesa_init_varray( c )  ((void)0)
275#define _mesa_free_varray_data( c )  ((void)0)
276
277#endif
278
279#endif
280