944e77ac53868b8dec5d1682091f456c49bae6cd
[mesa.git] / src / mesa / glapi / glapi.c
1 /* $Id: glapi.c,v 1.13 1999/12/15 15:02:30 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 /*
29 * This file manages the OpenGL API dispatch layer.
30 * The dispatch table (struct _glapi_table) is basically just a list
31 * of function pointers.
32 * There are functions to set/get the current dispatch table for the
33 * current thread and to manage registration/dispatch of dynamically
34 * added extension functions.
35 */
36
37
38
39 #include <assert.h>
40 #include <stdlib.h> /* to get NULL */
41 #include <string.h>
42 #include "glapi.h"
43 #include "glapinoop.h"
44
45
46 /* Flag to indicate whether thread-safe dispatch is enabled */
47 static GLboolean ThreadSafe = GL_FALSE;
48
49 /* This is used when thread safety is disabled */
50 static struct _glapi_table *Dispatch = &__glapi_noop_table;
51
52
53 #if defined(THREADS)
54 #include "mthreads.h"
55 static MesaTSD mesa_dispatch_tsd;
56 static void mesa_dispatch_thread_init() {
57 MesaInitTSD(&mesa_dispatch_tsd);
58 }
59 #endif
60
61
62
63 #define DISPATCH_SETUP \
64 const struct _glapi_table *dispatch; \
65 if (ThreadSafe) { \
66 dispatch = _glapi_get_dispatch(); \
67 } \
68 else { \
69 dispatch = Dispatch; \
70 }
71
72 #define DISPATCH(FUNC, ARGS) (dispatch->FUNC) ARGS
73
74
75 static GLuint MaxDispatchOffset = sizeof(struct _glapi_table) / sizeof(void *);
76 static GLboolean GetSizeCalled = GL_FALSE;
77
78
79 /*
80 * Set the global or per-thread dispatch table pointer.
81 */
82 void
83 _glapi_set_dispatch(struct _glapi_table *dispatch)
84 {
85 if (!dispatch) {
86 /* use the no-op functions */
87 dispatch = &__glapi_noop_table;
88 }
89 #ifdef DEBUG
90 else {
91 _glapi_check_table(dispatch);
92 }
93 #endif
94
95 #if defined(THREADS)
96 MesaSetTSD(&mesa_dispatch_tsd, (void*) dispatch, mesa_dispatch_thread_init);
97 #else
98 Dispatch = dispatch;
99 #endif
100 }
101
102
103 /*
104 * Get the global or per-thread dispatch table pointer.
105 */
106 struct _glapi_table *
107 _glapi_get_dispatch(void)
108 {
109 #if defined(THREADS)
110 /* return this thread's dispatch pointer */
111 return (struct _glapi_table *) MesaGetTSD(&mesa_dispatch_tsd);
112 #else
113 return Dispatch;
114 #endif
115 }
116
117
118
119 void
120 _glapi_enable_thread_safety(void)
121 {
122 ThreadSafe = GL_TRUE;
123 }
124
125
126
127 /*
128 * Return size of dispatch table struct as number of functions (or
129 * slots).
130 */
131 GLuint
132 _glapi_get_dispatch_table_size(void)
133 {
134 /* return sizeof(struct _glapi_table) / sizeof(void *);*/
135 GetSizeCalled = GL_TRUE;
136 return MaxDispatchOffset + 1;
137 }
138
139
140
141 /*
142 * Get API dispatcher version string.
143 * XXX this isn't well defined yet.
144 */
145 const char *
146 _glapi_get_version(void)
147 {
148 return "1.2";
149 }
150
151
152 struct name_address_pair {
153 const char *Name;
154 GLvoid *Address;
155 };
156
157 static struct name_address_pair static_functions[] = {
158 { "glAccum", (GLvoid *) glAccum },
159 { "glAlphaFunc", (GLvoid *) glAlphaFunc },
160 { "glBegin", (GLvoid *) glBegin },
161 { "glBitmap", (GLvoid *) glBitmap },
162 { "glAccum", (GLvoid *) glAccum },
163 { "glAlphaFunc", (GLvoid *) glAlphaFunc },
164 { "glBegin", (GLvoid *) glBegin },
165 { "glBitmap", (GLvoid *) glBitmap },
166 { "glBlendFunc", (GLvoid *) glBlendFunc },
167 { "glCallList", (GLvoid *) glCallList },
168 { "glCallLists", (GLvoid *) glCallLists },
169 { "glClear", (GLvoid *) glClear },
170 { "glClearAccum", (GLvoid *) glClearAccum },
171 { "glClearColor", (GLvoid *) glClearColor },
172 { "glClearDepth", (GLvoid *) glClearDepth },
173 { "glClearIndex", (GLvoid *) glClearIndex },
174 { "glClearStencil", (GLvoid *) glClearStencil },
175 { "glClipPlane", (GLvoid *) glClipPlane },
176 { "glColor3b", (GLvoid *) glColor3b },
177 { "glColor3bv", (GLvoid *) glColor3bv },
178 { "glColor3d", (GLvoid *) glColor3d },
179 { "glColor3dv", (GLvoid *) glColor3dv },
180 { "glColor3f", (GLvoid *) glColor3f },
181 { "glColor3fv", (GLvoid *) glColor3fv },
182 { "glColor3i", (GLvoid *) glColor3i },
183 { "glColor3iv", (GLvoid *) glColor3iv },
184 { "glColor3s", (GLvoid *) glColor3s },
185 { "glColor3sv", (GLvoid *) glColor3sv },
186 { "glColor3ub", (GLvoid *) glColor3ub },
187 { "glColor3ubv", (GLvoid *) glColor3ubv },
188 { "glColor3ui", (GLvoid *) glColor3ui },
189 { "glColor3uiv", (GLvoid *) glColor3uiv },
190 { "glColor3us", (GLvoid *) glColor3us },
191 { "glColor3usv", (GLvoid *) glColor3usv },
192 { "glColor4b", (GLvoid *) glColor4b },
193 { "glColor4bv", (GLvoid *) glColor4bv },
194 { "glColor4d", (GLvoid *) glColor4d },
195 { "glColor4dv", (GLvoid *) glColor4dv },
196 { "glColor4f", (GLvoid *) glColor4f },
197 { "glColor4fv", (GLvoid *) glColor4fv },
198 { "glColor4i", (GLvoid *) glColor4i },
199 { "glColor4iv", (GLvoid *) glColor4iv },
200 { "glColor4s", (GLvoid *) glColor4s },
201 { "glColor4sv", (GLvoid *) glColor4sv },
202 { "glColor4ub", (GLvoid *) glColor4ub },
203 { "glColor4ubv", (GLvoid *) glColor4ubv },
204 { "glColor4ui", (GLvoid *) glColor4ui },
205 { "glColor4uiv", (GLvoid *) glColor4uiv },
206 { "glColor4us", (GLvoid *) glColor4us },
207 { "glColor4usv", (GLvoid *) glColor4usv },
208 { "glColorMask", (GLvoid *) glColorMask },
209 { "glColorMaterial", (GLvoid *) glColorMaterial },
210 { "glCopyPixels", (GLvoid *) glCopyPixels },
211 { "glCullFace", (GLvoid *) glCullFace },
212 { "glDeleteLists", (GLvoid *) glDeleteLists },
213 { "glDepthFunc", (GLvoid *) glDepthFunc },
214 { "glDepthMask", (GLvoid *) glDepthMask },
215 { "glDepthRange", (GLvoid *) glDepthRange },
216 { "glDisable", (GLvoid *) glDisable },
217 { "glDrawBuffer", (GLvoid *) glDrawBuffer },
218 { "glDrawPixels", (GLvoid *) glDrawPixels },
219 { "glEdgeFlag", (GLvoid *) glEdgeFlag },
220 { "glEdgeFlagv", (GLvoid *) glEdgeFlagv },
221 { "glEnable", (GLvoid *) glEnable },
222 { "glEnd", (GLvoid *) glEnd },
223 { "glEndList", (GLvoid *) glEndList },
224 { "glEvalCoord1d", (GLvoid *) glEvalCoord1d },
225 { "glEvalCoord1dv", (GLvoid *) glEvalCoord1dv },
226 { "glEvalCoord1f", (GLvoid *) glEvalCoord1f },
227 { "glEvalCoord1fv", (GLvoid *) glEvalCoord1fv },
228 { "glEvalCoord2d", (GLvoid *) glEvalCoord2d },
229 { "glEvalCoord2dv", (GLvoid *) glEvalCoord2dv },
230 { "glEvalCoord2f", (GLvoid *) glEvalCoord2f },
231 { "glEvalCoord2fv", (GLvoid *) glEvalCoord2fv },
232 { "glEvalMesh1", (GLvoid *) glEvalMesh1 },
233 { "glEvalMesh2", (GLvoid *) glEvalMesh2 },
234 { "glEvalPoint1", (GLvoid *) glEvalPoint1 },
235 { "glEvalPoint2", (GLvoid *) glEvalPoint2 },
236 { "glFeedbackBuffer", (GLvoid *) glFeedbackBuffer },
237 { "glFinish", (GLvoid *) glFinish },
238 { "glFlush", (GLvoid *) glFlush },
239 { "glFogf", (GLvoid *) glFogf },
240 { "glFogfv", (GLvoid *) glFogfv },
241 { "glFogi", (GLvoid *) glFogi },
242 { "glFogiv", (GLvoid *) glFogiv },
243 { "glFrontFace", (GLvoid *) glFrontFace },
244 { "glFrustum", (GLvoid *) glFrustum },
245 { "glGenLists", (GLvoid *) glGenLists },
246 { "glGetBooleanv", (GLvoid *) glGetBooleanv },
247 { "glGetClipPlane", (GLvoid *) glGetClipPlane },
248 { "glGetDoublev", (GLvoid *) glGetDoublev },
249 { "glGetError", (GLvoid *) glGetError },
250 { "glGetFloatv", (GLvoid *) glGetFloatv },
251 { "glGetIntegerv", (GLvoid *) glGetIntegerv },
252 { "glGetLightfv", (GLvoid *) glGetLightfv },
253 { "glGetLightiv", (GLvoid *) glGetLightiv },
254 { "glGetMapdv", (GLvoid *) glGetMapdv },
255 { "glGetMapfv", (GLvoid *) glGetMapfv },
256 { "glGetMapiv", (GLvoid *) glGetMapiv },
257 { "glGetMaterialfv", (GLvoid *) glGetMaterialfv },
258 { "glGetMaterialiv", (GLvoid *) glGetMaterialiv },
259 { "glGetPixelMapfv", (GLvoid *) glGetPixelMapfv },
260 { "glGetPixelMapuiv", (GLvoid *) glGetPixelMapuiv },
261 { "glGetPixelMapusv", (GLvoid *) glGetPixelMapusv },
262 { "glGetPolygonStipple", (GLvoid *) glGetPolygonStipple },
263 { "glGetString", (GLvoid *) glGetString },
264 { "glGetTexEnvfv", (GLvoid *) glGetTexEnvfv },
265 { "glGetTexEnviv", (GLvoid *) glGetTexEnviv },
266 { "glGetTexGendv", (GLvoid *) glGetTexGendv },
267 { "glGetTexGenfv", (GLvoid *) glGetTexGenfv },
268 { "glGetTexGeniv", (GLvoid *) glGetTexGeniv },
269 { "glGetTexImage", (GLvoid *) glGetTexImage },
270 { "glGetTexLevelParameterfv", (GLvoid *) glGetTexLevelParameterfv },
271 { "glGetTexLevelParameteriv", (GLvoid *) glGetTexLevelParameteriv },
272 { "glGetTexParameterfv", (GLvoid *) glGetTexParameterfv },
273 { "glGetTexParameteriv", (GLvoid *) glGetTexParameteriv },
274 { "glHint", (GLvoid *) glHint },
275 { "glIndexMask", (GLvoid *) glIndexMask },
276 { "glIndexd", (GLvoid *) glIndexd },
277 { "glIndexdv", (GLvoid *) glIndexdv },
278 { "glIndexf", (GLvoid *) glIndexf },
279 { "glIndexfv", (GLvoid *) glIndexfv },
280 { "glIndexi", (GLvoid *) glIndexi },
281 { "glIndexiv", (GLvoid *) glIndexiv },
282 { "glIndexs", (GLvoid *) glIndexs },
283 { "glIndexsv", (GLvoid *) glIndexsv },
284 { "glInitNames", (GLvoid *) glInitNames },
285 { "glIsEnabled", (GLvoid *) glIsEnabled },
286 { "glIsList", (GLvoid *) glIsList },
287 { "glLightModelf", (GLvoid *) glLightModelf },
288 { "glLightModelfv", (GLvoid *) glLightModelfv },
289 { "glLightModeli", (GLvoid *) glLightModeli },
290 { "glLightModeliv", (GLvoid *) glLightModeliv },
291 { "glLightf", (GLvoid *) glLightf },
292 { "glLightfv", (GLvoid *) glLightfv },
293 { "glLighti", (GLvoid *) glLighti },
294 { "glLightiv", (GLvoid *) glLightiv },
295 { "glLineStipple", (GLvoid *) glLineStipple },
296 { "glLineWidth", (GLvoid *) glLineWidth },
297 { "glListBase", (GLvoid *) glListBase },
298 { "glLoadIdentity", (GLvoid *) glLoadIdentity },
299 { "glLoadMatrixd", (GLvoid *) glLoadMatrixd },
300 { "glLoadMatrixf", (GLvoid *) glLoadMatrixf },
301 { "glLoadName", (GLvoid *) glLoadName },
302 { "glLogicOp", (GLvoid *) glLogicOp },
303 { "glMap1d", (GLvoid *) glMap1d },
304 { "glMap1f", (GLvoid *) glMap1f },
305 { "glMap2d", (GLvoid *) glMap2d },
306 { "glMap2f", (GLvoid *) glMap2f },
307 { "glMapGrid1d", (GLvoid *) glMapGrid1d },
308 { "glMapGrid1f", (GLvoid *) glMapGrid1f },
309 { "glMapGrid2d", (GLvoid *) glMapGrid2d },
310 { "glMapGrid2f", (GLvoid *) glMapGrid2f },
311 { "glMaterialf", (GLvoid *) glMaterialf },
312 { "glMaterialfv", (GLvoid *) glMaterialfv },
313 { "glMateriali", (GLvoid *) glMateriali },
314 { "glMaterialiv", (GLvoid *) glMaterialiv },
315 { "glMatrixMode", (GLvoid *) glMatrixMode },
316 { "glMultMatrixd", (GLvoid *) glMultMatrixd },
317 { "glMultMatrixf", (GLvoid *) glMultMatrixf },
318 { "glNewList", (GLvoid *) glNewList },
319 { "glNormal3b", (GLvoid *) glNormal3b },
320 { "glNormal3bv", (GLvoid *) glNormal3bv },
321 { "glNormal3d", (GLvoid *) glNormal3d },
322 { "glNormal3dv", (GLvoid *) glNormal3dv },
323 { "glNormal3f", (GLvoid *) glNormal3f },
324 { "glNormal3fv", (GLvoid *) glNormal3fv },
325 { "glNormal3i", (GLvoid *) glNormal3i },
326 { "glNormal3iv", (GLvoid *) glNormal3iv },
327 { "glNormal3s", (GLvoid *) glNormal3s },
328 { "glNormal3sv", (GLvoid *) glNormal3sv },
329 { "glOrtho", (GLvoid *) glOrtho },
330 { "glPassThrough", (GLvoid *) glPassThrough },
331 { "glPixelMapfv", (GLvoid *) glPixelMapfv },
332 { "glPixelMapuiv", (GLvoid *) glPixelMapuiv },
333 { "glPixelMapusv", (GLvoid *) glPixelMapusv },
334 { "glPixelStoref", (GLvoid *) glPixelStoref },
335 { "glPixelStorei", (GLvoid *) glPixelStorei },
336 { "glPixelTransferf", (GLvoid *) glPixelTransferf },
337 { "glPixelTransferi", (GLvoid *) glPixelTransferi },
338 { "glPixelZoom", (GLvoid *) glPixelZoom },
339 { "glPointSize", (GLvoid *) glPointSize },
340 { "glPolygonMode", (GLvoid *) glPolygonMode },
341 { "glPolygonOffset", (GLvoid *) glPolygonOffset },
342 { "glPolygonStipple", (GLvoid *) glPolygonStipple },
343 { "glPopAttrib", (GLvoid *) glPopAttrib },
344 { "glPopMatrix", (GLvoid *) glPopMatrix },
345 { "glPopName", (GLvoid *) glPopName },
346 { "glPushAttrib", (GLvoid *) glPushAttrib },
347 { "glPushMatrix", (GLvoid *) glPushMatrix },
348 { "glPushName", (GLvoid *) glPushName },
349 { "glRasterPos2d", (GLvoid *) glRasterPos2d },
350 { "glRasterPos2dv", (GLvoid *) glRasterPos2dv },
351 { "glRasterPos2f", (GLvoid *) glRasterPos2f },
352 { "glRasterPos2fv", (GLvoid *) glRasterPos2fv },
353 { "glRasterPos2i", (GLvoid *) glRasterPos2i },
354 { "glRasterPos2iv", (GLvoid *) glRasterPos2iv },
355 { "glRasterPos2s", (GLvoid *) glRasterPos2s },
356 { "glRasterPos2sv", (GLvoid *) glRasterPos2sv },
357 { "glRasterPos3d", (GLvoid *) glRasterPos3d },
358 { "glRasterPos3dv", (GLvoid *) glRasterPos3dv },
359 { "glRasterPos3f", (GLvoid *) glRasterPos3f },
360 { "glRasterPos3fv", (GLvoid *) glRasterPos3fv },
361 { "glRasterPos3i", (GLvoid *) glRasterPos3i },
362 { "glRasterPos3iv", (GLvoid *) glRasterPos3iv },
363 { "glRasterPos3s", (GLvoid *) glRasterPos3s },
364 { "glRasterPos3sv", (GLvoid *) glRasterPos3sv },
365 { "glRasterPos4d", (GLvoid *) glRasterPos4d },
366 { "glRasterPos4dv", (GLvoid *) glRasterPos4dv },
367 { "glRasterPos4f", (GLvoid *) glRasterPos4f },
368 { "glRasterPos4fv", (GLvoid *) glRasterPos4fv },
369 { "glRasterPos4i", (GLvoid *) glRasterPos4i },
370 { "glRasterPos4iv", (GLvoid *) glRasterPos4iv },
371 { "glRasterPos4s", (GLvoid *) glRasterPos4s },
372 { "glRasterPos4sv", (GLvoid *) glRasterPos4sv },
373 { "glReadBuffer", (GLvoid *) glReadBuffer },
374 { "glReadPixels", (GLvoid *) glReadPixels },
375 { "glRectd", (GLvoid *) glRectd },
376 { "glRectdv", (GLvoid *) glRectdv },
377 { "glRectf", (GLvoid *) glRectf },
378 { "glRectfv", (GLvoid *) glRectfv },
379 { "glRecti", (GLvoid *) glRecti },
380 { "glRectiv", (GLvoid *) glRectiv },
381 { "glRects", (GLvoid *) glRects },
382 { "glRectsv", (GLvoid *) glRectsv },
383 { "glRenderMode", (GLvoid *) glRenderMode },
384 { "glRotated", (GLvoid *) glRotated },
385 { "glRotatef", (GLvoid *) glRotatef },
386 { "glScaled", (GLvoid *) glScaled },
387 { "glScalef", (GLvoid *) glScalef },
388 { "glScissor", (GLvoid *) glScissor },
389 { "glSelectBuffer", (GLvoid *) glSelectBuffer },
390 { "glShadeModel", (GLvoid *) glShadeModel },
391 { "glStencilFunc", (GLvoid *) glStencilFunc },
392 { "glStencilMask", (GLvoid *) glStencilMask },
393 { "glStencilOp", (GLvoid *) glStencilOp },
394 { "glTexCoord1d", (GLvoid *) glTexCoord1d },
395 { "glTexCoord1dv", (GLvoid *) glTexCoord1dv },
396 { "glTexCoord1f", (GLvoid *) glTexCoord1f },
397 { "glTexCoord1fv", (GLvoid *) glTexCoord1fv },
398 { "glTexCoord1i", (GLvoid *) glTexCoord1i },
399 { "glTexCoord1iv", (GLvoid *) glTexCoord1iv },
400 { "glTexCoord1s", (GLvoid *) glTexCoord1s },
401 { "glTexCoord1sv", (GLvoid *) glTexCoord1sv },
402 { "glTexCoord2d", (GLvoid *) glTexCoord2d },
403 { "glTexCoord2dv", (GLvoid *) glTexCoord2dv },
404 { "glTexCoord2f", (GLvoid *) glTexCoord2f },
405 { "glTexCoord2fv", (GLvoid *) glTexCoord2fv },
406 { "glTexCoord2i", (GLvoid *) glTexCoord2i },
407 { "glTexCoord2iv", (GLvoid *) glTexCoord2iv },
408 { "glTexCoord2s", (GLvoid *) glTexCoord2s },
409 { "glTexCoord2sv", (GLvoid *) glTexCoord2sv },
410 { "glTexCoord3d", (GLvoid *) glTexCoord3d },
411 { "glTexCoord3dv", (GLvoid *) glTexCoord3dv },
412 { "glTexCoord3f", (GLvoid *) glTexCoord3f },
413 { "glTexCoord3fv", (GLvoid *) glTexCoord3fv },
414 { "glTexCoord3i", (GLvoid *) glTexCoord3i },
415 { "glTexCoord3iv", (GLvoid *) glTexCoord3iv },
416 { "glTexCoord3s", (GLvoid *) glTexCoord3s },
417 { "glTexCoord3sv", (GLvoid *) glTexCoord3sv },
418 { "glTexCoord4d", (GLvoid *) glTexCoord4d },
419 { "glTexCoord4dv", (GLvoid *) glTexCoord4dv },
420 { "glTexCoord4f", (GLvoid *) glTexCoord4f },
421 { "glTexCoord4fv", (GLvoid *) glTexCoord4fv },
422 { "glTexCoord4i", (GLvoid *) glTexCoord4i },
423 { "glTexCoord4iv", (GLvoid *) glTexCoord4iv },
424 { "glTexCoord4s", (GLvoid *) glTexCoord4s },
425 { "glTexCoord4sv", (GLvoid *) glTexCoord4sv },
426 { "glTexEnvf", (GLvoid *) glTexEnvf },
427 { "glTexEnvfv", (GLvoid *) glTexEnvfv },
428 { "glTexEnvi", (GLvoid *) glTexEnvi },
429 { "glTexEnviv", (GLvoid *) glTexEnviv },
430 { "glTexGend", (GLvoid *) glTexGend },
431 { "glTexGendv", (GLvoid *) glTexGendv },
432 { "glTexGenf", (GLvoid *) glTexGenf },
433 { "glTexGenfv", (GLvoid *) glTexGenfv },
434 { "glTexGeni", (GLvoid *) glTexGeni },
435 { "glTexGeniv", (GLvoid *) glTexGeniv },
436 { "glTexImage1D", (GLvoid *) glTexImage1D },
437 { "glTexImage2D", (GLvoid *) glTexImage2D },
438 { "glTexParameterf", (GLvoid *) glTexParameterf },
439 { "glTexParameterfv", (GLvoid *) glTexParameterfv },
440 { "glTexParameteri", (GLvoid *) glTexParameteri },
441 { "glTexParameteriv", (GLvoid *) glTexParameteriv },
442 { "glTranslated", (GLvoid *) glTranslated },
443 { "glTranslatef", (GLvoid *) glTranslatef },
444 { "glVertex2d", (GLvoid *) glVertex2d },
445 { "glVertex2dv", (GLvoid *) glVertex2dv },
446 { "glVertex2f", (GLvoid *) glVertex2f },
447 { "glVertex2fv", (GLvoid *) glVertex2fv },
448 { "glVertex2i", (GLvoid *) glVertex2i },
449 { "glVertex2iv", (GLvoid *) glVertex2iv },
450 { "glVertex2s", (GLvoid *) glVertex2s },
451 { "glVertex2sv", (GLvoid *) glVertex2sv },
452 { "glVertex3d", (GLvoid *) glVertex3d },
453 { "glVertex3dv", (GLvoid *) glVertex3dv },
454 { "glVertex3f", (GLvoid *) glVertex3f },
455 { "glVertex3fv", (GLvoid *) glVertex3fv },
456 { "glVertex3i", (GLvoid *) glVertex3i },
457 { "glVertex3iv", (GLvoid *) glVertex3iv },
458 { "glVertex3s", (GLvoid *) glVertex3s },
459 { "glVertex3sv", (GLvoid *) glVertex3sv },
460 { "glVertex4d", (GLvoid *) glVertex4d },
461 { "glVertex4dv", (GLvoid *) glVertex4dv },
462 { "glVertex4f", (GLvoid *) glVertex4f },
463 { "glVertex4fv", (GLvoid *) glVertex4fv },
464 { "glVertex4i", (GLvoid *) glVertex4i },
465 { "glVertex4iv", (GLvoid *) glVertex4iv },
466 { "glVertex4s", (GLvoid *) glVertex4s },
467 { "glVertex4sv", (GLvoid *) glVertex4sv },
468 { "glViewport", (GLvoid *) glViewport },
469
470 #ifdef _GLAPI_VERSION_1_1
471 { "glAreTexturesResident", (GLvoid *) glAreTexturesResident },
472 { "glArrayElement", (GLvoid *) glArrayElement },
473 { "glBindTexture", (GLvoid *) glBindTexture },
474 { "glColorPointer", (GLvoid *) glColorPointer },
475 { "glCopyTexImage1D", (GLvoid *) glCopyTexImage1D },
476 { "glCopyTexImage2D", (GLvoid *) glCopyTexImage2D },
477 { "glCopyTexSubImage1D", (GLvoid *) glCopyTexSubImage1D },
478 { "glCopyTexSubImage2D", (GLvoid *) glCopyTexSubImage2D },
479 { "glDeleteTextures", (GLvoid *) glDeleteTextures },
480 { "glDisableClientState", (GLvoid *) glDisableClientState },
481 { "glDrawArrays", (GLvoid *) glDrawArrays },
482 { "glDrawElements", (GLvoid *) glDrawElements },
483 { "glEdgeFlagPointer", (GLvoid *) glEdgeFlagPointer },
484 { "glEnableClientState", (GLvoid *) glEnableClientState },
485 { "glGenTextures", (GLvoid *) glGenTextures },
486 { "glGetPointerv", (GLvoid *) glGetPointerv },
487 { "glIndexPointer", (GLvoid *) glIndexPointer },
488 { "glIndexub", (GLvoid *) glIndexub },
489 { "glIndexubv", (GLvoid *) glIndexubv },
490 { "glInterleavedArrays", (GLvoid *) glInterleavedArrays },
491 { "glIsTexture", (GLvoid *) glIsTexture },
492 { "glNormalPointer", (GLvoid *) glNormalPointer },
493 { "glPopClientAttrib", (GLvoid *) glPopClientAttrib },
494 { "glPrioritizeTextures", (GLvoid *) glPrioritizeTextures },
495 { "glPushClientAttrib", (GLvoid *) glPushClientAttrib },
496 { "glTexCoordPointer", (GLvoid *) glTexCoordPointer },
497 { "glTexSubImage1D", (GLvoid *) glTexSubImage1D },
498 { "glTexSubImage2D", (GLvoid *) glTexSubImage2D },
499 { "glVertexPointer", (GLvoid *) glVertexPointer },
500 #endif
501
502 #ifdef _GLAPI_VERSION_1_2
503 { "glCopyTexSubImage3D", (GLvoid *) glCopyTexSubImage3D },
504 { "glDrawRangeElements", (GLvoid *) glDrawRangeElements },
505 { "glTexImage3D", (GLvoid *) glTexImage3D },
506 { "glTexSubImage3D", (GLvoid *) glTexSubImage3D },
507
508 #ifdef _GLAPI_ARB_imaging
509 { "glBlendColor", (GLvoid *) glBlendColor },
510 { "glBlendEquation", (GLvoid *) glBlendEquation },
511 { "glColorSubTable", (GLvoid *) glColorSubTable },
512 { "glColorTable", (GLvoid *) glColorTable },
513 { "glColorTableParameterfv", (GLvoid *) glColorTableParameterfv },
514 { "glColorTableParameteriv", (GLvoid *) glColorTableParameteriv },
515 { "glConvolutionFilter1D", (GLvoid *) glConvolutionFilter1D },
516 { "glConvolutionFilter2D", (GLvoid *) glConvolutionFilter2D },
517 { "glConvolutionParameterf", (GLvoid *) glConvolutionParameterf },
518 { "glConvolutionParameterfv", (GLvoid *) glConvolutionParameterfv },
519 { "glConvolutionParameteri", (GLvoid *) glConvolutionParameteri },
520 { "glConvolutionParameteriv", (GLvoid *) glConvolutionParameteriv },
521 { "glCopyColorSubTable", (GLvoid *) glCopyColorSubTable },
522 { "glCopyColorTable", (GLvoid *) glCopyColorTable },
523 { "glCopyConvolutionFilter1D", (GLvoid *) glCopyConvolutionFilter1D },
524 { "glCopyConvolutionFilter2D", (GLvoid *) glCopyConvolutionFilter2D },
525 { "glGetColorTable", (GLvoid *) glGetColorTable },
526 { "glGetColorTableParameterfv", (GLvoid *) glGetColorTableParameterfv },
527 { "glGetColorTableParameteriv", (GLvoid *) glGetColorTableParameteriv },
528 { "glGetConvolutionFilter", (GLvoid *) glGetConvolutionFilter },
529 { "glGetConvolutionParameterfv", (GLvoid *) glGetConvolutionParameterfv },
530 { "glGetConvolutionParameteriv", (GLvoid *) glGetConvolutionParameteriv },
531 { "glGetHistogram", (GLvoid *) glGetHistogram },
532 { "glGetHistogramParameterfv", (GLvoid *) glGetHistogramParameterfv },
533 { "glGetHistogramParameteriv", (GLvoid *) glGetHistogramParameteriv },
534 { "glGetMinmax", (GLvoid *) glGetMinmax },
535 { "glGetMinmaxParameterfv", (GLvoid *) glGetMinmaxParameterfv },
536 { "glGetMinmaxParameteriv", (GLvoid *) glGetMinmaxParameteriv },
537 { "glGetSeparableFilter", (GLvoid *) glGetSeparableFilter },
538 { "glHistogram", (GLvoid *) glHistogram },
539 { "glMinmax", (GLvoid *) glMinmax },
540 { "glResetHistogram", (GLvoid *) glResetHistogram },
541 { "glResetMinmax", (GLvoid *) glResetMinmax },
542 { "glSeparableFilter2D", (GLvoid *) glSeparableFilter2D },
543 #endif
544 #endif
545
546 /* GL_ARB_multitexture */
547 { "glActiveTextureARB", (GLvoid *) glActiveTextureARB },
548 { "glClientActiveTextureARB", (GLvoid *) glClientActiveTextureARB },
549 { "glMultiTexCoord1dARB", (GLvoid *) glMultiTexCoord1dARB },
550 { "glMultiTexCoord1dvARB", (GLvoid *) glMultiTexCoord1dvARB },
551 { "glMultiTexCoord1fARB", (GLvoid *) glMultiTexCoord1fARB },
552 { "glMultiTexCoord1fvARB", (GLvoid *) glMultiTexCoord1fvARB },
553 { "glMultiTexCoord1iARB", (GLvoid *) glMultiTexCoord1iARB },
554 { "glMultiTexCoord1ivARB", (GLvoid *) glMultiTexCoord1ivARB },
555 { "glMultiTexCoord1sARB", (GLvoid *) glMultiTexCoord1sARB },
556 { "glMultiTexCoord1svARB", (GLvoid *) glMultiTexCoord1svARB },
557 { "glMultiTexCoord2dARB", (GLvoid *) glMultiTexCoord2dARB },
558 { "glMultiTexCoord2dvARB", (GLvoid *) glMultiTexCoord2dvARB },
559 { "glMultiTexCoord2fARB", (GLvoid *) glMultiTexCoord2fARB },
560 { "glMultiTexCoord2fvARB", (GLvoid *) glMultiTexCoord2fvARB },
561 { "glMultiTexCoord2iARB", (GLvoid *) glMultiTexCoord2iARB },
562 { "glMultiTexCoord2ivARB", (GLvoid *) glMultiTexCoord2ivARB },
563 { "glMultiTexCoord2sARB", (GLvoid *) glMultiTexCoord2sARB },
564 { "glMultiTexCoord2svARB", (GLvoid *) glMultiTexCoord2svARB },
565 { "glMultiTexCoord3dARB", (GLvoid *) glMultiTexCoord3dARB },
566 { "glMultiTexCoord3dvARB", (GLvoid *) glMultiTexCoord3dvARB },
567 { "glMultiTexCoord3fARB", (GLvoid *) glMultiTexCoord3fARB },
568 { "glMultiTexCoord3fvARB", (GLvoid *) glMultiTexCoord3fvARB },
569 { "glMultiTexCoord3iARB", (GLvoid *) glMultiTexCoord3iARB },
570 { "glMultiTexCoord3ivARB", (GLvoid *) glMultiTexCoord3ivARB },
571 { "glMultiTexCoord3sARB", (GLvoid *) glMultiTexCoord3sARB },
572 { "glMultiTexCoord3svARB", (GLvoid *) glMultiTexCoord3svARB },
573 { "glMultiTexCoord4dARB", (GLvoid *) glMultiTexCoord4dARB },
574 { "glMultiTexCoord4dvARB", (GLvoid *) glMultiTexCoord4dvARB },
575 { "glMultiTexCoord4fARB", (GLvoid *) glMultiTexCoord4fARB },
576 { "glMultiTexCoord4fvARB", (GLvoid *) glMultiTexCoord4fvARB },
577 { "glMultiTexCoord4iARB", (GLvoid *) glMultiTexCoord4iARB },
578 { "glMultiTexCoord4ivARB", (GLvoid *) glMultiTexCoord4ivARB },
579 { "glMultiTexCoord4sARB", (GLvoid *) glMultiTexCoord4sARB },
580 { "glMultiTexCoord4svARB", (GLvoid *) glMultiTexCoord4svARB },
581
582 /* 2. GL_EXT_blend_color */
583 { "glBlendColorEXT", (GLvoid *) glBlendColorEXT },
584
585 /* 3. GL_EXT_polygon_offset */
586 { "glPolygonOffsetEXT", (GLvoid *) glPolygonOffsetEXT },
587
588 /* 54. GL_EXT_point_parameters */
589 { "glPointParameterfEXT", (GLvoid *) glPointParameterfEXT },
590 { "glPointParameterfvEXT", (GLvoid *) glPointParameterfvEXT },
591
592 /* 78. GL_EXT_paletted_texture */
593 { "glColorTableEXT", (GLvoid *) glColorTableEXT },
594 { "glColorSubTableEXT", (GLvoid *) glColorSubTableEXT },
595 { "glGetColorTableEXT", (GLvoid *) glGetColorTableEXT },
596 { "glGetColorTableParameterfvEXT", (GLvoid *) glGetColorTableParameterfvEXT },
597 { "glGetColorTableParameterivEXT", (GLvoid *) glGetColorTableParameterivEXT },
598
599 /* 97. GL_EXT_compiled_vertex_array */
600 { "glLockArraysEXT", (GLvoid *) glLockArraysEXT },
601 { "glUnlockArraysEXT", (GLvoid *) glUnlockArraysEXT },
602
603 /* 37. GL_EXT_blend_minmax */
604 { "glBlendEquationEXT", (GLvoid *) glBlendEquationEXT },
605
606 /* 173. GL_EXT/INGR_blend_func_separate */
607 { "glBlendFuncSeparateINGR", (GLvoid *) glBlendFuncSeparateINGR },
608
609 /* GL_MESA_window_pos */
610 { "glWindowPos4fMESA", (GLvoid *) glWindowPos4fMESA },
611
612 /* GL_MESA_resize_buffers */
613 { "glResizeBuffersMESA", (GLvoid *) glResizeBuffersMESA },
614
615 /* GL_ARB_transpose_matrix */
616 { "glLoadTransposeMatrixdARB", (GLvoid *) glLoadTransposeMatrixdARB },
617 { "glLoadTransposeMatrixfARB", (GLvoid *) glLoadTransposeMatrixfARB },
618 { "glMultTransposeMatrixdARB", (GLvoid *) glMultTransposeMatrixdARB },
619 { "glMultTransposeMatrixfARB", (GLvoid *) glMultTransposeMatrixfARB },
620
621 { NULL, NULL } /* end of list marker */
622 };
623
624
625
626 /*
627 * Return dispatch table offset of the named static (built-in) function.
628 * Return -1 if function not found.
629 */
630 static GLint
631 get_static_proc_offset(const char *funcName)
632 {
633 GLuint i;
634 for (i = 0; static_functions[i].Name; i++) {
635 if (strcmp(static_functions[i].Name, funcName) == 0) {
636 return i;
637 }
638 }
639 return -1;
640 }
641
642
643 /*
644 * Return dispatch function address the named static (built-in) function.
645 * Return NULL if function not found.
646 */
647 static GLvoid *
648 get_static_proc_address(const char *funcName)
649 {
650 GLuint i = get_static_proc_offset(funcName);
651 if (i >= 0)
652 return static_functions[i].Address;
653 else
654 return NULL;
655 }
656
657
658
659 /**********************************************************************
660 * Extension function management.
661 **********************************************************************/
662
663
664 struct _glapi_ext_entrypoint {
665 const char *Name; /* the extension function's name */
666 GLuint Offset; /* relative to start of dispatch table */
667 GLvoid *Address; /* address of dispatch function */
668 };
669
670 static struct _glapi_ext_entrypoint ExtEntryTable[_GLAPI_EXTRA_SLOTS];
671 static GLuint NumExtEntryPoints = 0;
672
673
674
675 /*
676 * Generate a dispatch function (entrypoint) which jumps through
677 * the given slot number (offset) in the current dispatch table.
678 */
679 static void *
680 generate_entrypoint(GLuint offset)
681 {
682 /* XXX need to generate some assembly code here */
683
684 return NULL;
685 }
686
687
688
689 /*
690 * Add a new extension function entrypoint.
691 * Return: GL_TRUE = success or GL_FALSE = failure
692 */
693 GLboolean
694 _glapi_add_entrypoint(const char *funcName, GLuint offset)
695 {
696 GLint index;
697
698 /* Make sure we don't try to add a new entrypoint after someone
699 * has already called _glapi_get_dispatch_table_size()! If that's
700 * happened the caller's information will now be out of date.
701 */
702 assert(!GetSizeCalled);
703
704 /* first check if the named function is already statically present */
705 index = get_static_proc_offset(funcName);
706
707 if (index >= 0) {
708 assert(index == offset);
709 return GL_TRUE;
710 }
711 /* else if (offset < _glapi_get_dispatch_table_size()) { */
712 else {
713 /* be sure index and name match known data */
714 GLuint i;
715 for (i = 0; i < NumExtEntryPoints; i++) {
716 if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
717 /* function already registered with api */
718 if (ExtEntryTable[i].Offset == offset) {
719 return GL_TRUE; /* offsets match */
720 }
721 else {
722 return GL_FALSE; /* bad offset! */
723 }
724 }
725 }
726 assert(NumExtEntryPoints < _GLAPI_EXTRA_SLOTS);
727 ExtEntryTable[NumExtEntryPoints].Name = strdup(funcName);
728 ExtEntryTable[NumExtEntryPoints].Offset = offset;
729 ExtEntryTable[NumExtEntryPoints].Address = generate_entrypoint(offset);
730 NumExtEntryPoints++;
731
732 if (offset > MaxDispatchOffset)
733 MaxDispatchOffset = offset;
734
735 return GL_TRUE;
736 }
737 /*
738 else {
739 return GL_FALSE;
740 }
741 */
742 }
743
744
745
746 /*
747 * Return offset of entrypoint for named function within dispatch table.
748 */
749 GLint
750 _glapi_get_proc_offset(const char *funcName)
751 {
752 /* search extension functions first */
753 GLint i;
754 for (i = 0; i < NumExtEntryPoints; i++) {
755 if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
756 return ExtEntryTable[i].Offset;
757 }
758 }
759
760 /* search static functions */
761 return get_static_proc_offset(funcName);
762 }
763
764
765
766 /*
767 * Return entrypoint for named function.
768 */
769 const GLvoid *
770 _glapi_get_proc_address(const char *funcName)
771 {
772 /* search extension functions first */
773 GLint i;
774 for (i = 0; i < NumExtEntryPoints; i++) {
775 if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
776 return ExtEntryTable[i].Address;
777 }
778 }
779
780 /* search static functions */
781 return get_static_proc_address(funcName);
782 }
783
784
785
786 /*
787 * Make sure there are no NULL pointers in the given dispatch table.
788 * Intented for debugging purposes.
789 */
790 void
791 _glapi_check_table(const struct _glapi_table *table)
792 {
793 const GLuint entries = _glapi_get_dispatch_table_size();
794 const void **tab = (const void **) table;
795 GLuint i;
796 for (i = 0; i < entries; i++) {
797 assert(tab[i]);
798 }
799 #if 000
800 assert(table->Accum);
801 assert(table->AlphaFunc);
802 assert(table->Begin);
803 assert(table->Bitmap);
804 assert(table->BlendFunc);
805 assert(table->CallList);
806 assert(table->CallLists);
807 assert(table->Clear);
808 assert(table->ClearAccum);
809 assert(table->ClearColor);
810 assert(table->ClearDepth);
811 assert(table->ClearIndex);
812 assert(table->ClearStencil);
813 assert(table->ClipPlane);
814 assert(table->Color3b);
815 assert(table->Color3bv);
816 assert(table->Color3d);
817 assert(table->Color3dv);
818 assert(table->Color3f);
819 assert(table->Color3fv);
820 assert(table->Color3i);
821 assert(table->Color3iv);
822 assert(table->Color3s);
823 assert(table->Color3sv);
824 assert(table->Color3ub);
825 assert(table->Color3ubv);
826 assert(table->Color3ui);
827 assert(table->Color3uiv);
828 assert(table->Color3us);
829 assert(table->Color3usv);
830 assert(table->Color4b);
831 assert(table->Color4bv);
832 assert(table->Color4d);
833 assert(table->Color4dv);
834 assert(table->Color4f);
835 assert(table->Color4fv);
836 assert(table->Color4i);
837 assert(table->Color4iv);
838 assert(table->Color4s);
839 assert(table->Color4sv);
840 assert(table->Color4ub);
841 assert(table->Color4ubv);
842 assert(table->Color4ui);
843 assert(table->Color4uiv);
844 assert(table->Color4us);
845 assert(table->Color4usv);
846 assert(table->ColorMask);
847 assert(table->ColorMaterial);
848 assert(table->CopyPixels);
849 assert(table->CullFace);
850 assert(table->DeleteLists);
851 assert(table->DepthFunc);
852 assert(table->DepthMask);
853 assert(table->DepthRange);
854 assert(table->Disable);
855 assert(table->DrawBuffer);
856 assert(table->DrawElements);
857 assert(table->DrawPixels);
858 assert(table->EdgeFlag);
859 assert(table->EdgeFlagv);
860 assert(table->Enable);
861 assert(table->End);
862 assert(table->EndList);
863 assert(table->EvalCoord1d);
864 assert(table->EvalCoord1dv);
865 assert(table->EvalCoord1f);
866 assert(table->EvalCoord1fv);
867 assert(table->EvalCoord2d);
868 assert(table->EvalCoord2dv);
869 assert(table->EvalCoord2f);
870 assert(table->EvalCoord2fv);
871 assert(table->EvalMesh1);
872 assert(table->EvalMesh2);
873 assert(table->EvalPoint1);
874 assert(table->EvalPoint2);
875 assert(table->FeedbackBuffer);
876 assert(table->Finish);
877 assert(table->Flush);
878 assert(table->Fogf);
879 assert(table->Fogfv);
880 assert(table->Fogi);
881 assert(table->Fogiv);
882 assert(table->FrontFace);
883 assert(table->Frustum);
884 assert(table->GenLists);
885 assert(table->GetBooleanv);
886 assert(table->GetClipPlane);
887 assert(table->GetDoublev);
888 assert(table->GetError);
889 assert(table->GetFloatv);
890 assert(table->GetIntegerv);
891 assert(table->GetLightfv);
892 assert(table->GetLightiv);
893 assert(table->GetMapdv);
894 assert(table->GetMapfv);
895 assert(table->GetMapiv);
896 assert(table->GetMaterialfv);
897 assert(table->GetMaterialiv);
898 assert(table->GetPixelMapfv);
899 assert(table->GetPixelMapuiv);
900 assert(table->GetPixelMapusv);
901 assert(table->GetPolygonStipple);
902 assert(table->GetString);
903 assert(table->GetTexEnvfv);
904 assert(table->GetTexEnviv);
905 assert(table->GetTexGendv);
906 assert(table->GetTexGenfv);
907 assert(table->GetTexGeniv);
908 assert(table->GetTexImage);
909 assert(table->GetTexLevelParameterfv);
910 assert(table->GetTexLevelParameteriv);
911 assert(table->GetTexParameterfv);
912 assert(table->GetTexParameteriv);
913 assert(table->Hint);
914 assert(table->IndexMask);
915 assert(table->Indexd);
916 assert(table->Indexdv);
917 assert(table->Indexf);
918 assert(table->Indexfv);
919 assert(table->Indexi);
920 assert(table->Indexiv);
921 assert(table->Indexs);
922 assert(table->Indexsv);
923 assert(table->InitNames);
924 assert(table->IsEnabled);
925 assert(table->IsList);
926 assert(table->LightModelf);
927 assert(table->LightModelfv);
928 assert(table->LightModeli);
929 assert(table->LightModeliv);
930 assert(table->Lightf);
931 assert(table->Lightfv);
932 assert(table->Lighti);
933 assert(table->Lightiv);
934 assert(table->LineStipple);
935 assert(table->LineWidth);
936 assert(table->ListBase);
937 assert(table->LoadIdentity);
938 assert(table->LoadMatrixd);
939 assert(table->LoadMatrixf);
940 assert(table->LoadName);
941 assert(table->LogicOp);
942 assert(table->Map1d);
943 assert(table->Map1f);
944 assert(table->Map2d);
945 assert(table->Map2f);
946 assert(table->MapGrid1d);
947 assert(table->MapGrid1f);
948 assert(table->MapGrid2d);
949 assert(table->MapGrid2f);
950 assert(table->Materialf);
951 assert(table->Materialfv);
952 assert(table->Materiali);
953 assert(table->Materialiv);
954 assert(table->MatrixMode);
955 assert(table->MultMatrixd);
956 assert(table->MultMatrixf);
957 assert(table->NewList);
958 assert(table->Normal3b);
959 assert(table->Normal3bv);
960 assert(table->Normal3d);
961 assert(table->Normal3dv);
962 assert(table->Normal3f);
963 assert(table->Normal3fv);
964 assert(table->Normal3i);
965 assert(table->Normal3iv);
966 assert(table->Normal3s);
967 assert(table->Normal3sv);
968 assert(table->Ortho);
969 assert(table->PassThrough);
970 assert(table->PixelMapfv);
971 assert(table->PixelMapuiv);
972 assert(table->PixelMapusv);
973 assert(table->PixelStoref);
974 assert(table->PixelStorei);
975 assert(table->PixelTransferf);
976 assert(table->PixelTransferi);
977 assert(table->PixelZoom);
978 assert(table->PointSize);
979 assert(table->PolygonMode);
980 assert(table->PolygonOffset);
981 assert(table->PolygonStipple);
982 assert(table->PopAttrib);
983 assert(table->PopMatrix);
984 assert(table->PopName);
985 assert(table->PushAttrib);
986 assert(table->PushMatrix);
987 assert(table->PushName);
988 assert(table->RasterPos2d);
989 assert(table->RasterPos2dv);
990 assert(table->RasterPos2f);
991 assert(table->RasterPos2fv);
992 assert(table->RasterPos2i);
993 assert(table->RasterPos2iv);
994 assert(table->RasterPos2s);
995 assert(table->RasterPos2sv);
996 assert(table->RasterPos3d);
997 assert(table->RasterPos3dv);
998 assert(table->RasterPos3f);
999 assert(table->RasterPos3fv);
1000 assert(table->RasterPos3i);
1001 assert(table->RasterPos3iv);
1002 assert(table->RasterPos3s);
1003 assert(table->RasterPos3sv);
1004 assert(table->RasterPos4d);
1005 assert(table->RasterPos4dv);
1006 assert(table->RasterPos4f);
1007 assert(table->RasterPos4fv);
1008 assert(table->RasterPos4i);
1009 assert(table->RasterPos4iv);
1010 assert(table->RasterPos4s);
1011 assert(table->RasterPos4sv);
1012 assert(table->ReadBuffer);
1013 assert(table->ReadPixels);
1014 assert(table->Rectd);
1015 assert(table->Rectdv);
1016 assert(table->Rectf);
1017 assert(table->Rectfv);
1018 assert(table->Recti);
1019 assert(table->Rectiv);
1020 assert(table->Rects);
1021 assert(table->Rectsv);
1022 assert(table->RenderMode);
1023 assert(table->Rotated);
1024 assert(table->Rotatef);
1025 assert(table->Scaled);
1026 assert(table->Scalef);
1027 assert(table->Scissor);
1028 assert(table->SelectBuffer);
1029 assert(table->ShadeModel);
1030 assert(table->StencilFunc);
1031 assert(table->StencilMask);
1032 assert(table->StencilOp);
1033 assert(table->TexCoord1d);
1034 assert(table->TexCoord1dv);
1035 assert(table->TexCoord1f);
1036 assert(table->TexCoord1fv);
1037 assert(table->TexCoord1i);
1038 assert(table->TexCoord1iv);
1039 assert(table->TexCoord1s);
1040 assert(table->TexCoord1sv);
1041 assert(table->TexCoord2d);
1042 assert(table->TexCoord2dv);
1043 assert(table->TexCoord2f);
1044 assert(table->TexCoord2fv);
1045 assert(table->TexCoord2i);
1046 assert(table->TexCoord2iv);
1047 assert(table->TexCoord2s);
1048 assert(table->TexCoord2sv);
1049 assert(table->TexCoord3d);
1050 assert(table->TexCoord3dv);
1051 assert(table->TexCoord3f);
1052 assert(table->TexCoord3fv);
1053 assert(table->TexCoord3i);
1054 assert(table->TexCoord3iv);
1055 assert(table->TexCoord3s);
1056 assert(table->TexCoord3sv);
1057 assert(table->TexCoord4d);
1058 assert(table->TexCoord4dv);
1059 assert(table->TexCoord4f);
1060 assert(table->TexCoord4fv);
1061 assert(table->TexCoord4i);
1062 assert(table->TexCoord4iv);
1063 assert(table->TexCoord4s);
1064 assert(table->TexCoord4sv);
1065 assert(table->TexEnvf);
1066 assert(table->TexEnvfv);
1067 assert(table->TexEnvi);
1068 assert(table->TexEnviv);
1069 assert(table->TexGend);
1070 assert(table->TexGendv);
1071 assert(table->TexGenf);
1072 assert(table->TexGenfv);
1073 assert(table->TexGeni);
1074 assert(table->TexGeniv);
1075 assert(table->TexImage1D);
1076 assert(table->TexImage2D);
1077 assert(table->TexParameterf);
1078 assert(table->TexParameterfv);
1079 assert(table->TexParameteri);
1080 assert(table->TexParameteriv);
1081 assert(table->Translated);
1082 assert(table->Translatef);
1083 assert(table->Vertex2d);
1084 assert(table->Vertex2dv);
1085 assert(table->Vertex2f);
1086 assert(table->Vertex2fv);
1087 assert(table->Vertex2i);
1088 assert(table->Vertex2iv);
1089 assert(table->Vertex2s);
1090 assert(table->Vertex2sv);
1091 assert(table->Vertex3d);
1092 assert(table->Vertex3dv);
1093 assert(table->Vertex3f);
1094 assert(table->Vertex3fv);
1095 assert(table->Vertex3i);
1096 assert(table->Vertex3iv);
1097 assert(table->Vertex3s);
1098 assert(table->Vertex3sv);
1099 assert(table->Vertex4d);
1100 assert(table->Vertex4dv);
1101 assert(table->Vertex4f);
1102 assert(table->Vertex4fv);
1103 assert(table->Vertex4i);
1104 assert(table->Vertex4iv);
1105 assert(table->Vertex4s);
1106 assert(table->Vertex4sv);
1107 assert(table->Viewport);
1108
1109 #ifdef _GLAPI_VERSION_1_1
1110 assert(table->AreTexturesResident);
1111 assert(table->ArrayElement);
1112 assert(table->BindTexture);
1113 assert(table->ColorPointer);
1114 assert(table->CopyTexImage1D);
1115 assert(table->CopyTexImage2D);
1116 assert(table->CopyTexSubImage1D);
1117 assert(table->CopyTexSubImage2D);
1118 assert(table->DeleteTextures);
1119 assert(table->DisableClientState);
1120 assert(table->DrawArrays);
1121 assert(table->EdgeFlagPointer);
1122 assert(table->EnableClientState);
1123 assert(table->GenTextures);
1124 assert(table->GetPointerv);
1125 assert(table->IndexPointer);
1126 assert(table->Indexub);
1127 assert(table->Indexubv);
1128 assert(table->InterleavedArrays);
1129 assert(table->IsTexture);
1130 assert(table->NormalPointer);
1131 assert(table->PopClientAttrib);
1132 assert(table->PrioritizeTextures);
1133 assert(table->PushClientAttrib);
1134 assert(table->TexCoordPointer);
1135 assert(table->TexSubImage1D);
1136 assert(table->TexSubImage2D);
1137 assert(table->VertexPointer);
1138 #endif
1139
1140 #ifdef _GLAPI_VERSION_1_2
1141 assert(table->CopyTexSubImage3D);
1142 assert(table->DrawRangeElements);
1143 assert(table->TexImage3D);
1144 assert(table->TexSubImage3D);
1145 #ifdef _GLAPI_ARB_imaging
1146 assert(table->BlendColor);
1147 assert(table->BlendEquation);
1148 assert(table->ColorSubTable);
1149 assert(table->ColorTable);
1150 assert(table->ColorTableParameterfv);
1151 assert(table->ColorTableParameteriv);
1152 assert(table->ConvolutionFilter1D);
1153 assert(table->ConvolutionFilter2D);
1154 assert(table->ConvolutionParameterf);
1155 assert(table->ConvolutionParameterfv);
1156 assert(table->ConvolutionParameteri);
1157 assert(table->ConvolutionParameteriv);
1158 assert(table->CopyColorSubTable);
1159 assert(table->CopyColorTable);
1160 assert(table->CopyConvolutionFilter1D);
1161 assert(table->CopyConvolutionFilter2D);
1162 assert(table->GetColorTable);
1163 assert(table->GetColorTableParameterfv);
1164 assert(table->GetColorTableParameteriv);
1165 assert(table->GetConvolutionFilter);
1166 assert(table->GetConvolutionParameterfv);
1167 assert(table->GetConvolutionParameteriv);
1168 assert(table->GetHistogram);
1169 assert(table->GetHistogramParameterfv);
1170 assert(table->GetHistogramParameteriv);
1171 assert(table->GetMinmax);
1172 assert(table->GetMinmaxParameterfv);
1173 assert(table->GetMinmaxParameteriv);
1174 assert(table->Histogram);
1175 assert(table->Minmax);
1176 assert(table->ResetHistogram);
1177 assert(table->ResetMinmax);
1178 assert(table->SeparableFilter2D);
1179 #endif
1180 #endif
1181
1182
1183 #ifdef _GLAPI_EXT_paletted_texture
1184 assert(table->ColorTableEXT);
1185 assert(table->ColorSubTableEXT);
1186 assert(table->GetColorTableEXT);
1187 assert(table->GetColorTableParameterfvEXT);
1188 assert(table->GetColorTableParameterivEXT);
1189 #endif
1190
1191 #ifdef _GLAPI_EXT_compiled_vertex_array
1192 assert(table->LockArraysEXT);
1193 assert(table->UnlockArraysEXT);
1194 #endif
1195
1196 #ifdef _GLAPI_EXT_point_parameter
1197 assert(table->PointParameterfEXT);
1198 assert(table->PointParameterfvEXT);
1199 #endif
1200
1201 #ifdef _GLAPI_EXT_polygon_offset
1202 assert(table->PolygonOffsetEXT);
1203 #endif
1204
1205 #ifdef _GLAPI_ARB_multitexture
1206 assert(table->ActiveTextureARB);
1207 assert(table->ClientActiveTextureARB);
1208 assert(table->MultiTexCoord1dARB);
1209 assert(table->MultiTexCoord1dvARB);
1210 assert(table->MultiTexCoord1fARB);
1211 assert(table->MultiTexCoord1fvARB);
1212 assert(table->MultiTexCoord1iARB);
1213 assert(table->MultiTexCoord1ivARB);
1214 assert(table->MultiTexCoord1sARB);
1215 assert(table->MultiTexCoord1svARB);
1216 assert(table->MultiTexCoord2dARB);
1217 assert(table->MultiTexCoord2dvARB);
1218 assert(table->MultiTexCoord2fARB);
1219 assert(table->MultiTexCoord2fvARB);
1220 assert(table->MultiTexCoord2iARB);
1221 assert(table->MultiTexCoord2ivARB);
1222 assert(table->MultiTexCoord2sARB);
1223 assert(table->MultiTexCoord2svARB);
1224 assert(table->MultiTexCoord3dARB);
1225 assert(table->MultiTexCoord3dvARB);
1226 assert(table->MultiTexCoord3fARB);
1227 assert(table->MultiTexCoord3fvARB);
1228 assert(table->MultiTexCoord3iARB);
1229 assert(table->MultiTexCoord3ivARB);
1230 assert(table->MultiTexCoord3sARB);
1231 assert(table->MultiTexCoord3svARB);
1232 assert(table->MultiTexCoord4dARB);
1233 assert(table->MultiTexCoord4dvARB);
1234 assert(table->MultiTexCoord4fARB);
1235 assert(table->MultiTexCoord4fvARB);
1236 assert(table->MultiTexCoord4iARB);
1237 assert(table->MultiTexCoord4ivARB);
1238 assert(table->MultiTexCoord4sARB);
1239 assert(table->MultiTexCoord4svARB);
1240 #endif
1241
1242 #ifdef _GLAPI_INGR_blend_func_separate
1243 assert(table->BlendFuncSeparateINGR);
1244 #endif
1245
1246 #ifdef _GLAPI_MESA_window_pos
1247 assert(table->WindowPos4fMESA);
1248 #endif
1249
1250 #ifdef _GLAPI_MESA_resize_buffers
1251 assert(table->ResizeBuffersMESA);
1252 #endif
1253
1254 #ifdef _GLAPI_ARB_transpose_matrix
1255 assert(table->LoadTransposeMatrixdARB);
1256 assert(table->LoadTransposeMatrixfARB);
1257 assert(table->MultTransposeMatrixdARB);
1258 assert(table->MultTransposeMatrixfARB);
1259 #endif
1260 #endif
1261 }
1262
1263
1264
1265 /*
1266 * Generate the GL entrypoint functions here.
1267 */
1268
1269 #define KEYWORD1
1270 #define KEYWORD2 GLAPIENTRY
1271 #ifdef USE_MGL_NAMESPACE
1272 #define NAME(func) mgl##func
1273 #else
1274 #define NAME(func) gl##func
1275 #endif
1276
1277 #include "glapitemp.h"
1278