blob: 63038a6f830f1d7f28ca167786606e3ee8fe2a5a [file] [log] [blame]
Brian Paulfffb8092000-03-29 18:46:11 +00001/* $Id: glapi.c,v 1.40 2000/03/29 18:46:11 brianp Exp $ */
Brian Paulfbd8f211999-11-11 01:22:25 +00002
3/*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
Brian Paulacb62972000-01-14 16:35:25 +00007 * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
Brian Paulfbd8f211999-11-11 01:22:25 +00008 *
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
Brian Paul7e1161b1999-11-25 18:17:04 +000028/*
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.
Brian Paul9f943992000-01-28 19:03:33 +000035 *
36 * It's intended that this file and the other glapi*.[ch] files are
37 * flexible enough to be reused in several places: XFree86, DRI-
38 * based libGL.so, and perhaps the SGI SI.
39 *
40 * There are no dependencies on Mesa in this code.
Brian Paul7e1161b1999-11-25 18:17:04 +000041 */
42
43
44
Brian Paul3c27be32000-02-10 21:27:48 +000045#include "glheader.h"
Brian Paulfbd8f211999-11-11 01:22:25 +000046#include "glapi.h"
47#include "glapinoop.h"
Brian Paul0c239fc1999-12-16 12:38:11 +000048#include "glapioffsets.h"
49#include "glapitable.h"
Brian Paul9f943992000-01-28 19:03:33 +000050#include "glthread.h"
Brian Paulbb72d321999-12-16 17:31:59 +000051
Brian Paulfbd8f211999-11-11 01:22:25 +000052
Brian Paul0f710251999-12-15 15:02:30 +000053/* This is used when thread safety is disabled */
Brian Paul8ceb5c32000-02-24 22:14:04 +000054struct _glapi_table *_glapi_Dispatch = (struct _glapi_table *) __glapi_noop_table;
Brian Paul0f710251999-12-15 15:02:30 +000055
Brian Paul8f91fb61999-12-17 14:51:28 +000056/* Used when thread safety disabled */
Brian Paulf9b97d92000-01-28 20:17:42 +000057void *_glapi_Context = NULL;
Brian Paul8f91fb61999-12-17 14:51:28 +000058
Brian Paul0f710251999-12-15 15:02:30 +000059
Brian Paul7fb54ae1999-11-19 22:33:50 +000060#if defined(THREADS)
Brian Paulbb72d321999-12-16 17:31:59 +000061
Brian Paul77aa8b92000-01-07 07:30:13 +000062/* Flag to indicate whether thread-safe dispatch is enabled */
63static GLboolean ThreadSafe = GL_FALSE;
64
Brian Paulbb72d321999-12-16 17:31:59 +000065static _glthread_TSD DispatchTSD;
66
Brian Paul8f91fb61999-12-17 14:51:28 +000067static _glthread_TSD ContextTSD;
68
Brian Paul0f710251999-12-15 15:02:30 +000069#endif
70
71
72
Brian Paulbb72d321999-12-16 17:31:59 +000073static GLuint MaxDispatchOffset = sizeof(struct _glapi_table) / sizeof(void *) - 1;
Brian Paul0f710251999-12-15 15:02:30 +000074static GLboolean GetSizeCalled = GL_FALSE;
Brian Paulfbd8f211999-11-11 01:22:25 +000075
Randy Frankd7361e12000-03-27 21:13:58 +000076/* strdup is actually not a standard ANSI C or POSIX routine
77 Irix will not define it if ANSI mode is in effect. */
Brian Paulfffb8092000-03-29 18:46:11 +000078static char *str_dup(const char *str)
Randy Frankd7361e12000-03-27 21:13:58 +000079{
Brian Paulfffb8092000-03-29 18:46:11 +000080 char *copy;
81 copy = (char*) malloc(strlen(str) + 1);
82 if (!copy)
83 return NULL;
84 strcpy(copy, str);
85 return copy;
Randy Frankd7361e12000-03-27 21:13:58 +000086}
87
Brian Paul7fb54ae1999-11-19 22:33:50 +000088
Brian Paulbb72d321999-12-16 17:31:59 +000089
90/*
91 * We should call this periodically from a function such as glXMakeCurrent
92 * in order to test if multiple threads are being used. When we detect
93 * that situation we should then call _glapi_enable_thread_safety()
94 */
95void
96_glapi_check_multithread(void)
97{
98#if defined(THREADS)
Brian Paul26e14d22000-01-05 04:36:17 +000099 if (!ThreadSafe) {
Brian Paulbb72d321999-12-16 17:31:59 +0000100 static unsigned long knownID;
101 static GLboolean firstCall = GL_TRUE;
102 if (firstCall) {
103 knownID = _glthread_GetID();
104 firstCall = GL_FALSE;
105 }
106 else if (knownID != _glthread_GetID()) {
Brian Paul26e14d22000-01-05 04:36:17 +0000107 ThreadSafe = GL_TRUE;
Brian Paulbb72d321999-12-16 17:31:59 +0000108 }
109 }
Brian Paul26e14d22000-01-05 04:36:17 +0000110 if (ThreadSafe) {
Brian Paulbb72d321999-12-16 17:31:59 +0000111 /* make sure that this thread's dispatch pointer isn't null */
112 if (!_glapi_get_dispatch()) {
113 _glapi_set_dispatch(NULL);
114 }
115 }
116#endif
117}
118
119
120
121/*
Brian Paul8f91fb61999-12-17 14:51:28 +0000122 * Set the current context pointer for this thread.
123 * The context pointer is an opaque type which should be cast to
124 * void from the real context pointer type.
125 */
126void
Brian Paulf9b97d92000-01-28 20:17:42 +0000127_glapi_set_context(void *context)
Brian Paul8f91fb61999-12-17 14:51:28 +0000128{
129#if defined(THREADS)
Brian Paul3c27be32000-02-10 21:27:48 +0000130 _glthread_SetTSD(&ContextTSD, context);
Brian Paul26e14d22000-01-05 04:36:17 +0000131 if (ThreadSafe)
Brian Paulf9b97d92000-01-28 20:17:42 +0000132 _glapi_Context = NULL;
Brian Paul8f91fb61999-12-17 14:51:28 +0000133 else
Brian Paulf9b97d92000-01-28 20:17:42 +0000134 _glapi_Context = context;
Brian Paul8f91fb61999-12-17 14:51:28 +0000135#else
Brian Paulf9b97d92000-01-28 20:17:42 +0000136 _glapi_Context = context;
Brian Paul8f91fb61999-12-17 14:51:28 +0000137#endif
138}
139
140
141
142/*
143 * Get the current context pointer for this thread.
144 * The context pointer is an opaque type which should be cast from
145 * void to the real context pointer type.
146 */
147void *
Brian Paulf9b97d92000-01-28 20:17:42 +0000148_glapi_get_context(void)
Brian Paul8f91fb61999-12-17 14:51:28 +0000149{
150#if defined(THREADS)
Brian Paul26e14d22000-01-05 04:36:17 +0000151 if (ThreadSafe) {
Brian Paul8f91fb61999-12-17 14:51:28 +0000152 return _glthread_GetTSD(&ContextTSD);
153 }
154 else {
Brian Paulf9b97d92000-01-28 20:17:42 +0000155 return _glapi_Context;
Brian Paul8f91fb61999-12-17 14:51:28 +0000156 }
157#else
Brian Paulf9b97d92000-01-28 20:17:42 +0000158 return _glapi_Context;
Brian Paul8f91fb61999-12-17 14:51:28 +0000159#endif
160}
161
162
163
164/*
Brian Paul7fb54ae1999-11-19 22:33:50 +0000165 * Set the global or per-thread dispatch table pointer.
166 */
167void
168_glapi_set_dispatch(struct _glapi_table *dispatch)
169{
170 if (!dispatch) {
171 /* use the no-op functions */
Brian Paul8ceb5c32000-02-24 22:14:04 +0000172 dispatch = (struct _glapi_table *) __glapi_noop_table;
Brian Paul7fb54ae1999-11-19 22:33:50 +0000173 }
174#ifdef DEBUG
175 else {
176 _glapi_check_table(dispatch);
177 }
178#endif
179
180#if defined(THREADS)
Brian Paul3c27be32000-02-10 21:27:48 +0000181 _glthread_SetTSD(&DispatchTSD, (void*) dispatch);
Brian Paul26e14d22000-01-05 04:36:17 +0000182 if (ThreadSafe)
Brian Paulc2319b42000-01-17 19:28:31 +0000183 _glapi_Dispatch = NULL;
Brian Paul590d3471999-12-17 12:20:23 +0000184 else
Brian Paulc2319b42000-01-17 19:28:31 +0000185 _glapi_Dispatch = dispatch;
Brian Paul7fb54ae1999-11-19 22:33:50 +0000186#else
Brian Paulc2319b42000-01-17 19:28:31 +0000187 _glapi_Dispatch = dispatch;
Brian Paul7fb54ae1999-11-19 22:33:50 +0000188#endif
189}
190
191
Brian Paulbb72d321999-12-16 17:31:59 +0000192
Brian Paul7fb54ae1999-11-19 22:33:50 +0000193/*
Brian Paulbb72d321999-12-16 17:31:59 +0000194 * Return pointer to current dispatch table for calling thread.
Brian Paul7fb54ae1999-11-19 22:33:50 +0000195 */
196struct _glapi_table *
197_glapi_get_dispatch(void)
198{
199#if defined(THREADS)
Brian Paul26e14d22000-01-05 04:36:17 +0000200 if (ThreadSafe) {
Brian Paulbb72d321999-12-16 17:31:59 +0000201 return (struct _glapi_table *) _glthread_GetTSD(&DispatchTSD);
202 }
Brian Paul590d3471999-12-17 12:20:23 +0000203 else {
Brian Paulc2319b42000-01-17 19:28:31 +0000204 assert(_glapi_Dispatch);
205 return _glapi_Dispatch;
Brian Paul590d3471999-12-17 12:20:23 +0000206 }
Brian Paul7fb54ae1999-11-19 22:33:50 +0000207#else
Brian Paulc2319b42000-01-17 19:28:31 +0000208 return _glapi_Dispatch;
Brian Paul7fb54ae1999-11-19 22:33:50 +0000209#endif
210}
211
212
Brian Paul91bcefa1999-11-27 21:30:40 +0000213
214/*
215 * Return size of dispatch table struct as number of functions (or
216 * slots).
217 */
218GLuint
219_glapi_get_dispatch_table_size(void)
220{
Brian Paul0f710251999-12-15 15:02:30 +0000221 /* return sizeof(struct _glapi_table) / sizeof(void *);*/
222 GetSizeCalled = GL_TRUE;
223 return MaxDispatchOffset + 1;
Brian Paul91bcefa1999-11-27 21:30:40 +0000224}
225
226
227
Brian Paul7fb54ae1999-11-19 22:33:50 +0000228/*
229 * Get API dispatcher version string.
Brian Paul7fb54ae1999-11-19 22:33:50 +0000230 */
231const char *
232_glapi_get_version(void)
233{
Brian Paul8ceb5c32000-02-24 22:14:04 +0000234 return "20000223"; /* YYYYMMDD */
Brian Paul7fb54ae1999-11-19 22:33:50 +0000235}
236
237
Brian Paul0c239fc1999-12-16 12:38:11 +0000238/*
239 * For each entry in static_functions[] which use this function
240 * we should implement a dispatch function in glapitemp.h and
241 * in glapinoop.c
242 */
Brian Paulb3674092000-01-08 11:01:24 +0000243static int NotImplemented(void)
Brian Paul0c239fc1999-12-16 12:38:11 +0000244{
Brian Paulb3674092000-01-08 11:01:24 +0000245 return 0;
Brian Paul0c239fc1999-12-16 12:38:11 +0000246}
247
248
Brian Paul959f8022000-03-19 01:10:11 +0000249struct name_address_offset {
250 const char *Name;
251 GLvoid *Address;
252 GLuint Offset;
253};
254
Brian Paul0c239fc1999-12-16 12:38:11 +0000255
Brian Paul8ceb5c32000-02-24 22:14:04 +0000256static struct name_address_offset static_functions[] = {
Brian Paul0c239fc1999-12-16 12:38:11 +0000257 /* GL 1.1 */
Brian Paul8ceb5c32000-02-24 22:14:04 +0000258 { "glNewList", (GLvoid *) glNewList, _gloffset_NewList },
259 { "glEndList", (GLvoid *) glEndList, _gloffset_EndList },
260 { "glCallList", (GLvoid *) glCallList, _gloffset_CallList },
261 { "glCallLists", (GLvoid *) glCallLists, _gloffset_CallLists },
262 { "glDeleteLists", (GLvoid *) glDeleteLists, _gloffset_DeleteLists },
263 { "glGenLists", (GLvoid *) glGenLists, _gloffset_GenLists },
264 { "glListBase", (GLvoid *) glListBase, _gloffset_ListBase },
265 { "glBegin", (GLvoid *) glBegin, _gloffset_Begin },
266 { "glBitmap", (GLvoid *) glBitmap, _gloffset_Bitmap },
267 { "glColor3b", (GLvoid *) glColor3b, _gloffset_Color3b },
268 { "glColor3bv", (GLvoid *) glColor3bv, _gloffset_Color3bv },
269 { "glColor3d", (GLvoid *) glColor3d, _gloffset_Color3d },
270 { "glColor3dv", (GLvoid *) glColor3dv, _gloffset_Color3dv },
271 { "glColor3f", (GLvoid *) glColor3f, _gloffset_Color3f },
272 { "glColor3fv", (GLvoid *) glColor3fv, _gloffset_Color3fv },
273 { "glColor3i", (GLvoid *) glColor3i, _gloffset_Color3i },
274 { "glColor3iv", (GLvoid *) glColor3iv, _gloffset_Color3iv },
275 { "glColor3s", (GLvoid *) glColor3s, _gloffset_Color3s },
276 { "glColor3sv", (GLvoid *) glColor3sv, _gloffset_Color3sv },
277 { "glColor3ub", (GLvoid *) glColor3ub, _gloffset_Color3ub },
278 { "glColor3ubv", (GLvoid *) glColor3ubv, _gloffset_Color3ubv },
279 { "glColor3ui", (GLvoid *) glColor3ui, _gloffset_Color3ui },
280 { "glColor3uiv", (GLvoid *) glColor3uiv, _gloffset_Color3uiv },
281 { "glColor3us", (GLvoid *) glColor3us, _gloffset_Color3us },
282 { "glColor3usv", (GLvoid *) glColor3usv, _gloffset_Color3usv },
283 { "glColor4b", (GLvoid *) glColor4b, _gloffset_Color4b },
284 { "glColor4bv", (GLvoid *) glColor4bv, _gloffset_Color4bv },
285 { "glColor4d", (GLvoid *) glColor4d, _gloffset_Color4d },
286 { "glColor4dv", (GLvoid *) glColor4dv, _gloffset_Color4dv },
287 { "glColor4f", (GLvoid *) glColor4f, _gloffset_Color4f },
288 { "glColor4fv", (GLvoid *) glColor4fv, _gloffset_Color4fv },
289 { "glColor4i", (GLvoid *) glColor4i, _gloffset_Color4i },
290 { "glColor4iv", (GLvoid *) glColor4iv, _gloffset_Color4iv },
291 { "glColor4s", (GLvoid *) glColor4s, _gloffset_Color4s },
292 { "glColor4sv", (GLvoid *) glColor4sv, _gloffset_Color4sv },
293 { "glColor4ub", (GLvoid *) glColor4ub, _gloffset_Color4ub },
294 { "glColor4ubv", (GLvoid *) glColor4ubv, _gloffset_Color4ubv },
295 { "glColor4ui", (GLvoid *) glColor4ui, _gloffset_Color4ui },
296 { "glColor4uiv", (GLvoid *) glColor4uiv, _gloffset_Color4uiv },
297 { "glColor4us", (GLvoid *) glColor4us, _gloffset_Color4us },
298 { "glColor4usv", (GLvoid *) glColor4usv, _gloffset_Color4usv },
299 { "glEdgeFlag", (GLvoid *) glEdgeFlag, _gloffset_EdgeFlag },
300 { "glEdgeFlagv", (GLvoid *) glEdgeFlagv, _gloffset_EdgeFlagv },
301 { "glEnd", (GLvoid *) glEnd, _gloffset_End },
302 { "glIndexd", (GLvoid *) glIndexd, _gloffset_Indexd },
303 { "glIndexdv", (GLvoid *) glIndexdv, _gloffset_Indexdv },
304 { "glIndexf", (GLvoid *) glIndexf, _gloffset_Indexf },
305 { "glIndexfv", (GLvoid *) glIndexfv, _gloffset_Indexfv },
306 { "glIndexi", (GLvoid *) glIndexi, _gloffset_Indexi },
307 { "glIndexiv", (GLvoid *) glIndexiv, _gloffset_Indexiv },
308 { "glIndexs", (GLvoid *) glIndexs, _gloffset_Indexs },
309 { "glIndexsv", (GLvoid *) glIndexsv, _gloffset_Indexsv },
310 { "glNormal3b", (GLvoid *) glNormal3b, _gloffset_Normal3b },
311 { "glNormal3bv", (GLvoid *) glNormal3bv, _gloffset_Normal3bv },
312 { "glNormal3d", (GLvoid *) glNormal3d, _gloffset_Normal3d },
313 { "glNormal3dv", (GLvoid *) glNormal3dv, _gloffset_Normal3dv },
314 { "glNormal3f", (GLvoid *) glNormal3f, _gloffset_Normal3f },
315 { "glNormal3fv", (GLvoid *) glNormal3fv, _gloffset_Normal3fv },
316 { "glNormal3i", (GLvoid *) glNormal3i, _gloffset_Normal3i },
317 { "glNormal3iv", (GLvoid *) glNormal3iv, _gloffset_Normal3iv },
318 { "glNormal3s", (GLvoid *) glNormal3s, _gloffset_Normal3s },
319 { "glNormal3sv", (GLvoid *) glNormal3sv, _gloffset_Normal3sv },
320 { "glRasterPos2d", (GLvoid *) glRasterPos2d, _gloffset_RasterPos2d },
321 { "glRasterPos2dv", (GLvoid *) glRasterPos2dv, _gloffset_RasterPos2dv },
322 { "glRasterPos2f", (GLvoid *) glRasterPos2f, _gloffset_RasterPos2f },
323 { "glRasterPos2fv", (GLvoid *) glRasterPos2fv, _gloffset_RasterPos2fv },
324 { "glRasterPos2i", (GLvoid *) glRasterPos2i, _gloffset_RasterPos2i },
325 { "glRasterPos2iv", (GLvoid *) glRasterPos2iv, _gloffset_RasterPos2iv },
326 { "glRasterPos2s", (GLvoid *) glRasterPos2s, _gloffset_RasterPos2s },
327 { "glRasterPos2sv", (GLvoid *) glRasterPos2sv, _gloffset_RasterPos2sv },
328 { "glRasterPos3d", (GLvoid *) glRasterPos3d, _gloffset_RasterPos3d },
329 { "glRasterPos3dv", (GLvoid *) glRasterPos3dv, _gloffset_RasterPos3dv },
330 { "glRasterPos3f", (GLvoid *) glRasterPos3f, _gloffset_RasterPos3f },
331 { "glRasterPos3fv", (GLvoid *) glRasterPos3fv, _gloffset_RasterPos3fv },
332 { "glRasterPos3i", (GLvoid *) glRasterPos3i, _gloffset_RasterPos3i },
333 { "glRasterPos3iv", (GLvoid *) glRasterPos3iv, _gloffset_RasterPos3iv },
334 { "glRasterPos3s", (GLvoid *) glRasterPos3s, _gloffset_RasterPos3s },
335 { "glRasterPos3sv", (GLvoid *) glRasterPos3sv, _gloffset_RasterPos3sv },
336 { "glRasterPos4d", (GLvoid *) glRasterPos4d, _gloffset_RasterPos4d },
337 { "glRasterPos4dv", (GLvoid *) glRasterPos4dv, _gloffset_RasterPos4dv },
338 { "glRasterPos4f", (GLvoid *) glRasterPos4f, _gloffset_RasterPos4f },
339 { "glRasterPos4fv", (GLvoid *) glRasterPos4fv, _gloffset_RasterPos4fv },
340 { "glRasterPos4i", (GLvoid *) glRasterPos4i, _gloffset_RasterPos4i },
341 { "glRasterPos4iv", (GLvoid *) glRasterPos4iv, _gloffset_RasterPos4iv },
342 { "glRasterPos4s", (GLvoid *) glRasterPos4s, _gloffset_RasterPos4s },
343 { "glRasterPos4sv", (GLvoid *) glRasterPos4sv, _gloffset_RasterPos4sv },
344 { "glRectd", (GLvoid *) glRectd, _gloffset_Rectd },
345 { "glRectdv", (GLvoid *) glRectdv, _gloffset_Rectdv },
346 { "glRectf", (GLvoid *) glRectf, _gloffset_Rectf },
347 { "glRectfv", (GLvoid *) glRectfv, _gloffset_Rectfv },
348 { "glRecti", (GLvoid *) glRecti, _gloffset_Recti },
349 { "glRectiv", (GLvoid *) glRectiv, _gloffset_Rectiv },
350 { "glRects", (GLvoid *) glRects, _gloffset_Rects },
351 { "glRectsv", (GLvoid *) glRectsv, _gloffset_Rectsv },
352 { "glTexCoord1d", (GLvoid *) glTexCoord1d, _gloffset_TexCoord1d },
353 { "glTexCoord1dv", (GLvoid *) glTexCoord1dv, _gloffset_TexCoord1dv },
354 { "glTexCoord1f", (GLvoid *) glTexCoord1f, _gloffset_TexCoord1f },
355 { "glTexCoord1fv", (GLvoid *) glTexCoord1fv, _gloffset_TexCoord1fv },
356 { "glTexCoord1i", (GLvoid *) glTexCoord1i, _gloffset_TexCoord1i },
357 { "glTexCoord1iv", (GLvoid *) glTexCoord1iv, _gloffset_TexCoord1iv },
358 { "glTexCoord1s", (GLvoid *) glTexCoord1s, _gloffset_TexCoord1s },
359 { "glTexCoord1sv", (GLvoid *) glTexCoord1sv, _gloffset_TexCoord1sv },
360 { "glTexCoord2d", (GLvoid *) glTexCoord2d, _gloffset_TexCoord2d },
361 { "glTexCoord2dv", (GLvoid *) glTexCoord2dv, _gloffset_TexCoord2dv },
362 { "glTexCoord2f", (GLvoid *) glTexCoord2f, _gloffset_TexCoord2f },
363 { "glTexCoord2fv", (GLvoid *) glTexCoord2fv, _gloffset_TexCoord2fv },
364 { "glTexCoord2i", (GLvoid *) glTexCoord2i, _gloffset_TexCoord2i },
365 { "glTexCoord2iv", (GLvoid *) glTexCoord2iv, _gloffset_TexCoord2iv },
366 { "glTexCoord2s", (GLvoid *) glTexCoord2s, _gloffset_TexCoord2s },
367 { "glTexCoord2sv", (GLvoid *) glTexCoord2sv, _gloffset_TexCoord2sv },
368 { "glTexCoord3d", (GLvoid *) glTexCoord3d, _gloffset_TexCoord3d },
369 { "glTexCoord3dv", (GLvoid *) glTexCoord3dv, _gloffset_TexCoord3dv },
370 { "glTexCoord3f", (GLvoid *) glTexCoord3f, _gloffset_TexCoord3f },
371 { "glTexCoord3fv", (GLvoid *) glTexCoord3fv, _gloffset_TexCoord3fv },
372 { "glTexCoord3i", (GLvoid *) glTexCoord3i, _gloffset_TexCoord3i },
373 { "glTexCoord3iv", (GLvoid *) glTexCoord3iv, _gloffset_TexCoord3iv },
374 { "glTexCoord3s", (GLvoid *) glTexCoord3s, _gloffset_TexCoord3s },
375 { "glTexCoord3sv", (GLvoid *) glTexCoord3sv, _gloffset_TexCoord3sv },
376 { "glTexCoord4d", (GLvoid *) glTexCoord4d, _gloffset_TexCoord4d },
377 { "glTexCoord4dv", (GLvoid *) glTexCoord4dv, _gloffset_TexCoord4dv },
378 { "glTexCoord4f", (GLvoid *) glTexCoord4f, _gloffset_TexCoord4f },
379 { "glTexCoord4fv", (GLvoid *) glTexCoord4fv, _gloffset_TexCoord4fv },
380 { "glTexCoord4i", (GLvoid *) glTexCoord4i, _gloffset_TexCoord4i },
381 { "glTexCoord4iv", (GLvoid *) glTexCoord4iv, _gloffset_TexCoord4iv },
382 { "glTexCoord4s", (GLvoid *) glTexCoord4s, _gloffset_TexCoord4s },
383 { "glTexCoord4sv", (GLvoid *) glTexCoord4sv, _gloffset_TexCoord4sv },
384 { "glVertex2d", (GLvoid *) glVertex2d, _gloffset_Vertex2d },
385 { "glVertex2dv", (GLvoid *) glVertex2dv, _gloffset_Vertex2dv },
386 { "glVertex2f", (GLvoid *) glVertex2f, _gloffset_Vertex2f },
387 { "glVertex2fv", (GLvoid *) glVertex2fv, _gloffset_Vertex2fv },
388 { "glVertex2i", (GLvoid *) glVertex2i, _gloffset_Vertex2i },
389 { "glVertex2iv", (GLvoid *) glVertex2iv, _gloffset_Vertex2iv },
390 { "glVertex2s", (GLvoid *) glVertex2s, _gloffset_Vertex2s },
391 { "glVertex2sv", (GLvoid *) glVertex2sv, _gloffset_Vertex2sv },
392 { "glVertex3d", (GLvoid *) glVertex3d, _gloffset_Vertex3d },
393 { "glVertex3dv", (GLvoid *) glVertex3dv, _gloffset_Vertex3dv },
394 { "glVertex3f", (GLvoid *) glVertex3f, _gloffset_Vertex3f },
395 { "glVertex3fv", (GLvoid *) glVertex3fv, _gloffset_Vertex3fv },
396 { "glVertex3i", (GLvoid *) glVertex3i, _gloffset_Vertex3i },
397 { "glVertex3iv", (GLvoid *) glVertex3iv, _gloffset_Vertex3iv },
398 { "glVertex3s", (GLvoid *) glVertex3s, _gloffset_Vertex3s },
399 { "glVertex3sv", (GLvoid *) glVertex3sv, _gloffset_Vertex3sv },
400 { "glVertex4d", (GLvoid *) glVertex4d, _gloffset_Vertex4d },
401 { "glVertex4dv", (GLvoid *) glVertex4dv, _gloffset_Vertex4dv },
402 { "glVertex4f", (GLvoid *) glVertex4f, _gloffset_Vertex4f },
403 { "glVertex4fv", (GLvoid *) glVertex4fv, _gloffset_Vertex4fv },
404 { "glVertex4i", (GLvoid *) glVertex4i, _gloffset_Vertex4i },
405 { "glVertex4iv", (GLvoid *) glVertex4iv, _gloffset_Vertex4iv },
406 { "glVertex4s", (GLvoid *) glVertex4s, _gloffset_Vertex4s },
407 { "glVertex4sv", (GLvoid *) glVertex4sv, _gloffset_Vertex4sv },
408 { "glClipPlane", (GLvoid *) glClipPlane, _gloffset_ClipPlane },
409 { "glColorMaterial", (GLvoid *) glColorMaterial, _gloffset_ColorMaterial },
410 { "glCullFace", (GLvoid *) glCullFace, _gloffset_CullFace },
411 { "glFogf", (GLvoid *) glFogf, _gloffset_Fogf },
412 { "glFogfv", (GLvoid *) glFogfv, _gloffset_Fogfv },
413 { "glFogi", (GLvoid *) glFogi, _gloffset_Fogi },
414 { "glFogiv", (GLvoid *) glFogiv, _gloffset_Fogiv },
415 { "glFrontFace", (GLvoid *) glFrontFace, _gloffset_FrontFace },
416 { "glHint", (GLvoid *) glHint, _gloffset_Hint },
417 { "glLightf", (GLvoid *) glLightf, _gloffset_Lightf },
418 { "glLightfv", (GLvoid *) glLightfv, _gloffset_Lightfv },
419 { "glLighti", (GLvoid *) glLighti, _gloffset_Lighti },
420 { "glLightiv", (GLvoid *) glLightiv, _gloffset_Lightiv },
421 { "glLightModelf", (GLvoid *) glLightModelf, _gloffset_LightModelf },
422 { "glLightModelfv", (GLvoid *) glLightModelfv, _gloffset_LightModelfv },
423 { "glLightModeli", (GLvoid *) glLightModeli, _gloffset_LightModeli },
424 { "glLightModeliv", (GLvoid *) glLightModeliv, _gloffset_LightModeliv },
425 { "glLineStipple", (GLvoid *) glLineStipple, _gloffset_LineStipple },
426 { "glLineWidth", (GLvoid *) glLineWidth, _gloffset_LineWidth },
427 { "glMaterialf", (GLvoid *) glMaterialf, _gloffset_Materialf },
428 { "glMaterialfv", (GLvoid *) glMaterialfv, _gloffset_Materialfv },
429 { "glMateriali", (GLvoid *) glMateriali, _gloffset_Materiali },
430 { "glMaterialiv", (GLvoid *) glMaterialiv, _gloffset_Materialiv },
431 { "glPointSize", (GLvoid *) glPointSize, _gloffset_PointSize },
432 { "glPolygonMode", (GLvoid *) glPolygonMode, _gloffset_PolygonMode },
433 { "glPolygonStipple", (GLvoid *) glPolygonStipple, _gloffset_PolygonStipple },
434 { "glScissor", (GLvoid *) glScissor, _gloffset_Scissor },
435 { "glShadeModel", (GLvoid *) glShadeModel, _gloffset_ShadeModel },
436 { "glTexParameterf", (GLvoid *) glTexParameterf, _gloffset_TexParameterf },
437 { "glTexParameterfv", (GLvoid *) glTexParameterfv, _gloffset_TexParameterfv },
438 { "glTexParameteri", (GLvoid *) glTexParameteri, _gloffset_TexParameteri },
439 { "glTexParameteriv", (GLvoid *) glTexParameteriv, _gloffset_TexParameteriv },
440 { "glTexImage1D", (GLvoid *) glTexImage1D, _gloffset_TexImage1D },
441 { "glTexImage2D", (GLvoid *) glTexImage2D, _gloffset_TexImage2D },
442 { "glTexEnvf", (GLvoid *) glTexEnvf, _gloffset_TexEnvf },
443 { "glTexEnvfv", (GLvoid *) glTexEnvfv, _gloffset_TexEnvfv },
444 { "glTexEnvi", (GLvoid *) glTexEnvi, _gloffset_TexEnvi },
445 { "glTexEnviv", (GLvoid *) glTexEnviv, _gloffset_TexEnviv },
446 { "glTexGend", (GLvoid *) glTexGend, _gloffset_TexGend },
447 { "glTexGendv", (GLvoid *) glTexGendv, _gloffset_TexGendv },
448 { "glTexGenf", (GLvoid *) glTexGenf, _gloffset_TexGenf },
449 { "glTexGenfv", (GLvoid *) glTexGenfv, _gloffset_TexGenfv },
450 { "glTexGeni", (GLvoid *) glTexGeni, _gloffset_TexGeni },
451 { "glTexGeniv", (GLvoid *) glTexGeniv, _gloffset_TexGeniv },
452 { "glFeedbackBuffer", (GLvoid *) glFeedbackBuffer, _gloffset_FeedbackBuffer },
453 { "glSelectBuffer", (GLvoid *) glSelectBuffer, _gloffset_SelectBuffer },
454 { "glRenderMode", (GLvoid *) glRenderMode, _gloffset_RenderMode },
455 { "glInitNames", (GLvoid *) glInitNames, _gloffset_InitNames },
456 { "glLoadName", (GLvoid *) glLoadName, _gloffset_LoadName },
457 { "glPassThrough", (GLvoid *) glPassThrough, _gloffset_PassThrough },
458 { "glPopName", (GLvoid *) glPopName, _gloffset_PopName },
459 { "glPushName", (GLvoid *) glPushName, _gloffset_PushName },
460 { "glDrawBuffer", (GLvoid *) glDrawBuffer, _gloffset_DrawBuffer },
461 { "glClear", (GLvoid *) glClear, _gloffset_Clear },
462 { "glClearAccum", (GLvoid *) glClearAccum, _gloffset_ClearAccum },
463 { "glClearIndex", (GLvoid *) glClearIndex, _gloffset_ClearIndex },
464 { "glClearColor", (GLvoid *) glClearColor, _gloffset_ClearColor },
465 { "glClearStencil", (GLvoid *) glClearStencil, _gloffset_ClearStencil },
466 { "glClearDepth", (GLvoid *) glClearDepth, _gloffset_ClearDepth },
467 { "glStencilMask", (GLvoid *) glStencilMask, _gloffset_StencilMask },
468 { "glColorMask", (GLvoid *) glColorMask, _gloffset_ColorMask },
469 { "glDepthMask", (GLvoid *) glDepthMask, _gloffset_DepthMask },
470 { "glIndexMask", (GLvoid *) glIndexMask, _gloffset_IndexMask },
471 { "glAccum", (GLvoid *) glAccum, _gloffset_Accum },
472 { "glDisable", (GLvoid *) glDisable, _gloffset_Disable },
473 { "glEnable", (GLvoid *) glEnable, _gloffset_Enable },
474 { "glFinish", (GLvoid *) glFinish, _gloffset_Finish },
475 { "glFlush", (GLvoid *) glFlush, _gloffset_Flush },
476 { "glPopAttrib", (GLvoid *) glPopAttrib, _gloffset_PopAttrib },
477 { "glPushAttrib", (GLvoid *) glPushAttrib, _gloffset_PushAttrib },
478 { "glMap1d", (GLvoid *) glMap1d, _gloffset_Map1d },
479 { "glMap1f", (GLvoid *) glMap1f, _gloffset_Map1f },
480 { "glMap2d", (GLvoid *) glMap2d, _gloffset_Map2d },
481 { "glMap2f", (GLvoid *) glMap2f, _gloffset_Map2f },
482 { "glMapGrid1d", (GLvoid *) glMapGrid1d, _gloffset_MapGrid1d },
483 { "glMapGrid1f", (GLvoid *) glMapGrid1f, _gloffset_MapGrid1f },
484 { "glMapGrid2d", (GLvoid *) glMapGrid2d, _gloffset_MapGrid2d },
485 { "glMapGrid2f", (GLvoid *) glMapGrid2f, _gloffset_MapGrid2f },
486 { "glEvalCoord1d", (GLvoid *) glEvalCoord1d, _gloffset_EvalCoord1d },
487 { "glEvalCoord1dv", (GLvoid *) glEvalCoord1dv, _gloffset_EvalCoord1dv },
488 { "glEvalCoord1f", (GLvoid *) glEvalCoord1f, _gloffset_EvalCoord1f },
489 { "glEvalCoord1fv", (GLvoid *) glEvalCoord1fv, _gloffset_EvalCoord1fv },
490 { "glEvalCoord2d", (GLvoid *) glEvalCoord2d, _gloffset_EvalCoord2d },
491 { "glEvalCoord2dv", (GLvoid *) glEvalCoord2dv, _gloffset_EvalCoord2dv },
492 { "glEvalCoord2f", (GLvoid *) glEvalCoord2f, _gloffset_EvalCoord2f },
493 { "glEvalCoord2fv", (GLvoid *) glEvalCoord2fv, _gloffset_EvalCoord2fv },
494 { "glEvalMesh1", (GLvoid *) glEvalMesh1, _gloffset_EvalMesh1 },
495 { "glEvalPoint1", (GLvoid *) glEvalPoint1, _gloffset_EvalPoint1 },
496 { "glEvalMesh2", (GLvoid *) glEvalMesh2, _gloffset_EvalMesh2 },
497 { "glEvalPoint2", (GLvoid *) glEvalPoint2, _gloffset_EvalPoint2 },
498 { "glAlphaFunc", (GLvoid *) glAlphaFunc, _gloffset_AlphaFunc },
499 { "glBlendFunc", (GLvoid *) glBlendFunc, _gloffset_BlendFunc },
500 { "glLogicOp", (GLvoid *) glLogicOp, _gloffset_LogicOp },
501 { "glStencilFunc", (GLvoid *) glStencilFunc, _gloffset_StencilFunc },
502 { "glStencilOp", (GLvoid *) glStencilOp, _gloffset_StencilOp },
503 { "glDepthFunc", (GLvoid *) glDepthFunc, _gloffset_DepthFunc },
504 { "glPixelZoom", (GLvoid *) glPixelZoom, _gloffset_PixelZoom },
505 { "glPixelTransferf", (GLvoid *) glPixelTransferf, _gloffset_PixelTransferf },
506 { "glPixelTransferi", (GLvoid *) glPixelTransferi, _gloffset_PixelTransferi },
507 { "glPixelStoref", (GLvoid *) glPixelStoref, _gloffset_PixelStoref },
508 { "glPixelStorei", (GLvoid *) glPixelStorei, _gloffset_PixelStorei },
509 { "glPixelMapfv", (GLvoid *) glPixelMapfv, _gloffset_PixelMapfv },
510 { "glPixelMapuiv", (GLvoid *) glPixelMapuiv, _gloffset_PixelMapuiv },
511 { "glPixelMapusv", (GLvoid *) glPixelMapusv, _gloffset_PixelMapusv },
512 { "glReadBuffer", (GLvoid *) glReadBuffer, _gloffset_ReadBuffer },
513 { "glCopyPixels", (GLvoid *) glCopyPixels, _gloffset_CopyPixels },
514 { "glReadPixels", (GLvoid *) glReadPixels, _gloffset_ReadPixels },
515 { "glDrawPixels", (GLvoid *) glDrawPixels, _gloffset_DrawPixels },
516 { "glGetBooleanv", (GLvoid *) glGetBooleanv, _gloffset_GetBooleanv },
517 { "glGetClipPlane", (GLvoid *) glGetClipPlane, _gloffset_GetClipPlane },
518 { "glGetDoublev", (GLvoid *) glGetDoublev, _gloffset_GetDoublev },
519 { "glGetError", (GLvoid *) glGetError, _gloffset_GetError },
520 { "glGetFloatv", (GLvoid *) glGetFloatv, _gloffset_GetFloatv },
521 { "glGetIntegerv", (GLvoid *) glGetIntegerv, _gloffset_GetIntegerv },
522 { "glGetLightfv", (GLvoid *) glGetLightfv, _gloffset_GetLightfv },
523 { "glGetLightiv", (GLvoid *) glGetLightiv, _gloffset_GetLightiv },
524 { "glGetMapdv", (GLvoid *) glGetMapdv, _gloffset_GetMapdv },
525 { "glGetMapfv", (GLvoid *) glGetMapfv, _gloffset_GetMapfv },
526 { "glGetMapiv", (GLvoid *) glGetMapiv, _gloffset_GetMapiv },
527 { "glGetMaterialfv", (GLvoid *) glGetMaterialfv, _gloffset_GetMaterialfv },
528 { "glGetMaterialiv", (GLvoid *) glGetMaterialiv, _gloffset_GetMaterialiv },
529 { "glGetPixelMapfv", (GLvoid *) glGetPixelMapfv, _gloffset_GetPixelMapfv },
530 { "glGetPixelMapuiv", (GLvoid *) glGetPixelMapuiv, _gloffset_GetPixelMapuiv },
531 { "glGetPixelMapusv", (GLvoid *) glGetPixelMapusv, _gloffset_GetPixelMapusv },
532 { "glGetPolygonStipple", (GLvoid *) glGetPolygonStipple, _gloffset_GetPolygonStipple },
533 { "glGetString", (GLvoid *) glGetString, _gloffset_GetString },
534 { "glGetTexEnvfv", (GLvoid *) glGetTexEnvfv, _gloffset_GetTexEnvfv },
535 { "glGetTexEnviv", (GLvoid *) glGetTexEnviv, _gloffset_GetTexEnviv },
536 { "glGetTexGendv", (GLvoid *) glGetTexGendv, _gloffset_GetTexGendv },
537 { "glGetTexGenfv", (GLvoid *) glGetTexGenfv, _gloffset_GetTexGenfv },
538 { "glGetTexGeniv", (GLvoid *) glGetTexGeniv, _gloffset_GetTexGeniv },
539 { "glGetTexImage", (GLvoid *) glGetTexImage, _gloffset_GetTexImage },
540 { "glGetTexParameterfv", (GLvoid *) glGetTexParameterfv, _gloffset_GetTexParameterfv },
541 { "glGetTexParameteriv", (GLvoid *) glGetTexParameteriv, _gloffset_GetTexParameteriv },
542 { "glGetTexLevelParameterfv", (GLvoid *) glGetTexLevelParameterfv, _gloffset_GetTexLevelParameterfv },
543 { "glGetTexLevelParameteriv", (GLvoid *) glGetTexLevelParameteriv, _gloffset_GetTexLevelParameteriv },
544 { "glIsEnabled", (GLvoid *) glIsEnabled, _gloffset_IsEnabled },
545 { "glIsList", (GLvoid *) glIsList, _gloffset_IsList },
546 { "glDepthRange", (GLvoid *) glDepthRange, _gloffset_DepthRange },
547 { "glFrustum", (GLvoid *) glFrustum, _gloffset_Frustum },
548 { "glLoadIdentity", (GLvoid *) glLoadIdentity, _gloffset_LoadIdentity },
549 { "glLoadMatrixf", (GLvoid *) glLoadMatrixf, _gloffset_LoadMatrixf },
550 { "glLoadMatrixd", (GLvoid *) glLoadMatrixd, _gloffset_LoadMatrixd },
551 { "glMatrixMode", (GLvoid *) glMatrixMode, _gloffset_MatrixMode },
552 { "glMultMatrixf", (GLvoid *) glMultMatrixf, _gloffset_MultMatrixf },
553 { "glMultMatrixd", (GLvoid *) glMultMatrixd, _gloffset_MultMatrixd },
554 { "glOrtho", (GLvoid *) glOrtho, _gloffset_Ortho },
555 { "glPopMatrix", (GLvoid *) glPopMatrix, _gloffset_PopMatrix },
556 { "glPushMatrix", (GLvoid *) glPushMatrix, _gloffset_PushMatrix },
557 { "glRotated", (GLvoid *) glRotated, _gloffset_Rotated },
558 { "glRotatef", (GLvoid *) glRotatef, _gloffset_Rotatef },
559 { "glScaled", (GLvoid *) glScaled, _gloffset_Scaled },
560 { "glScalef", (GLvoid *) glScalef, _gloffset_Scalef },
561 { "glTranslated", (GLvoid *) glTranslated, _gloffset_Translated },
562 { "glTranslatef", (GLvoid *) glTranslatef, _gloffset_Translatef },
563 { "glViewport", (GLvoid *) glViewport, _gloffset_Viewport },
564 /* 1.1 */
565 { "glArrayElement", (GLvoid *) glArrayElement, _gloffset_ArrayElement },
566 { "glColorPointer", (GLvoid *) glColorPointer, _gloffset_ColorPointer },
567 { "glDisableClientState", (GLvoid *) glDisableClientState, _gloffset_DisableClientState },
568 { "glDrawArrays", (GLvoid *) glDrawArrays, _gloffset_DrawArrays },
569 { "glDrawElements", (GLvoid *) glDrawElements, _gloffset_DrawElements },
570 { "glEdgeFlagPointer", (GLvoid *) glEdgeFlagPointer, _gloffset_EdgeFlagPointer },
571 { "glEnableClientState", (GLvoid *) glEnableClientState, _gloffset_EnableClientState },
572 { "glGetPointerv", (GLvoid *) glGetPointerv, _gloffset_GetPointerv },
573 { "glIndexPointer", (GLvoid *) glIndexPointer, _gloffset_IndexPointer },
574 { "glInterleavedArrays", (GLvoid *) glInterleavedArrays, _gloffset_InterleavedArrays },
575 { "glNormalPointer", (GLvoid *) glNormalPointer, _gloffset_NormalPointer },
576 { "glTexCoordPointer", (GLvoid *) glTexCoordPointer, _gloffset_TexCoordPointer },
577 { "glVertexPointer", (GLvoid *) glVertexPointer, _gloffset_VertexPointer },
578 { "glPolygonOffset", (GLvoid *) glPolygonOffset, _gloffset_PolygonOffset },
579 { "glCopyTexImage1D", (GLvoid *) glCopyTexImage1D, _gloffset_CopyTexImage1D },
580 { "glCopyTexImage2D", (GLvoid *) glCopyTexImage2D, _gloffset_CopyTexImage2D },
581 { "glCopyTexSubImage1D", (GLvoid *) glCopyTexSubImage1D, _gloffset_CopyTexSubImage1D },
582 { "glCopyTexSubImage2D", (GLvoid *) glCopyTexSubImage2D, _gloffset_CopyTexSubImage2D },
583 { "glTexSubImage1D", (GLvoid *) glTexSubImage1D, _gloffset_TexSubImage1D },
584 { "glTexSubImage2D", (GLvoid *) glTexSubImage2D, _gloffset_TexSubImage2D },
585 { "glAreTexturesResident", (GLvoid *) glAreTexturesResident, _gloffset_AreTexturesResident },
586 { "glBindTexture", (GLvoid *) glBindTexture, _gloffset_BindTexture },
587 { "glDeleteTextures", (GLvoid *) glDeleteTextures, _gloffset_DeleteTextures },
588 { "glGenTextures", (GLvoid *) glGenTextures, _gloffset_GenTextures },
589 { "glIsTexture", (GLvoid *) glIsTexture, _gloffset_IsTexture },
590 { "glPrioritizeTextures", (GLvoid *) glPrioritizeTextures, _gloffset_PrioritizeTextures },
591 { "glIndexub", (GLvoid *) glIndexub, _gloffset_Indexub },
592 { "glIndexubv", (GLvoid *) glIndexubv, _gloffset_Indexubv },
593 { "glPopClientAttrib", (GLvoid *) glPopClientAttrib, _gloffset_PopClientAttrib },
594 { "glPushClientAttrib", (GLvoid *) glPushClientAttrib, _gloffset_PushClientAttrib },
595 /* 1.2 */
Brian Paul77aa8b92000-01-07 07:30:13 +0000596#ifdef GL_VERSION_1_2
597#define NAME(X) X
598#else
599#define NAME(X) NotImplemented
600#endif
Brian Paul8ceb5c32000-02-24 22:14:04 +0000601 { "glBlendColor", (GLvoid *) NAME(glBlendColor), _gloffset_BlendColor },
602 { "glBlendEquation", (GLvoid *) NAME(glBlendEquation), _gloffset_BlendEquation },
603 { "glDrawRangeElements", (GLvoid *) NAME(glDrawRangeElements), _gloffset_DrawRangeElements },
604 { "glColorTable", (GLvoid *) NAME(glColorTable), _gloffset_ColorTable },
605 { "glColorTableParameterfv", (GLvoid *) NAME(glColorTableParameterfv), _gloffset_ColorTableParameterfv },
606 { "glColorTableParameteriv", (GLvoid *) NAME(glColorTableParameteriv), _gloffset_ColorTableParameteriv },
607 { "glCopyColorTable", (GLvoid *) NAME(glCopyColorTable), _gloffset_CopyColorTable },
608 { "glGetColorTable", (GLvoid *) NAME(glGetColorTable), _gloffset_GetColorTable },
609 { "glGetColorTableParameterfv", (GLvoid *) NAME(glGetColorTableParameterfv), _gloffset_GetColorTableParameterfv },
610 { "glGetColorTableParameteriv", (GLvoid *) NAME(glGetColorTableParameteriv), _gloffset_GetColorTableParameteriv },
611 { "glColorSubTable", (GLvoid *) NAME(glColorSubTable), _gloffset_ColorSubTable },
612 { "glCopyColorSubTable", (GLvoid *) NAME(glCopyColorSubTable), _gloffset_CopyColorSubTable },
613 { "glConvolutionFilter1D", (GLvoid *) NAME(glConvolutionFilter1D), _gloffset_ConvolutionFilter1D },
614 { "glConvolutionFilter2D", (GLvoid *) NAME(glConvolutionFilter2D), _gloffset_ConvolutionFilter2D },
615 { "glConvolutionParameterf", (GLvoid *) NAME(glConvolutionParameterf), _gloffset_ConvolutionParameterf },
616 { "glConvolutionParameterfv", (GLvoid *) NAME(glConvolutionParameterfv), _gloffset_ConvolutionParameterfv },
617 { "glConvolutionParameteri", (GLvoid *) NAME(glConvolutionParameteri), _gloffset_ConvolutionParameteri },
618 { "glConvolutionParameteriv", (GLvoid *) NAME(glConvolutionParameteriv), _gloffset_ConvolutionParameteriv },
619 { "glCopyConvolutionFilter1D", (GLvoid *) NAME(glCopyConvolutionFilter1D), _gloffset_CopyConvolutionFilter1D },
620 { "glCopyConvolutionFilter2D", (GLvoid *) NAME(glCopyConvolutionFilter2D), _gloffset_CopyConvolutionFilter2D },
621 { "glGetConvolutionFilter", (GLvoid *) NAME(glGetConvolutionFilter), _gloffset_GetConvolutionFilter },
622 { "glGetConvolutionParameterfv", (GLvoid *) NAME(glGetConvolutionParameterfv), _gloffset_GetConvolutionParameterfv },
623 { "glGetConvolutionParameteriv", (GLvoid *) NAME(glGetConvolutionParameteriv), _gloffset_GetConvolutionParameteriv },
624 { "glGetSeparableFilter", (GLvoid *) NAME(glGetSeparableFilter), _gloffset_GetSeparableFilter },
625 { "glSeparableFilter2D", (GLvoid *) NAME(glSeparableFilter2D), _gloffset_SeparableFilter2D },
626 { "glGetHistogram", (GLvoid *) NAME(glGetHistogram), _gloffset_GetHistogram },
627 { "glGetHistogramParameterfv", (GLvoid *) NAME(glGetHistogramParameterfv), _gloffset_GetHistogramParameterfv },
628 { "glGetHistogramParameteriv", (GLvoid *) NAME(glGetHistogramParameteriv), _gloffset_GetHistogramParameteriv },
629 { "glGetMinmax", (GLvoid *) NAME(glGetMinmax), _gloffset_GetMinmax },
630 { "glGetMinmaxParameterfv", (GLvoid *) NAME(glGetMinmaxParameterfv), _gloffset_GetMinmaxParameterfv },
631 { "glGetMinmaxParameteriv", (GLvoid *) NAME(glGetMinmaxParameteriv), _gloffset_GetMinmaxParameteriv },
632 { "glHistogram", (GLvoid *) NAME(glHistogram), _gloffset_Histogram },
633 { "glMinmax", (GLvoid *) NAME(glMinmax), _gloffset_Minmax },
634 { "glResetHistogram", (GLvoid *) NAME(glResetHistogram), _gloffset_ResetHistogram },
635 { "glResetMinmax", (GLvoid *) NAME(glResetMinmax), _gloffset_ResetMinmax },
636 { "glTexImage3D", (GLvoid *) NAME(glTexImage3D), _gloffset_TexImage3D },
637 { "glTexSubImage3D", (GLvoid *) NAME(glTexSubImage3D), _gloffset_TexSubImage3D },
638 { "glCopyTexSubImage3D", (GLvoid *) NAME(glCopyTexSubImage3D), _gloffset_CopyTexSubImage3D },
Brian Paul77aa8b92000-01-07 07:30:13 +0000639#undef NAME
Brian Paul91bcefa1999-11-27 21:30:40 +0000640
Brian Paul67661b01999-12-15 12:52:31 +0000641 /* GL_ARB_multitexture */
Brian Paul77aa8b92000-01-07 07:30:13 +0000642#ifdef GL_ARB_multitexture
643#define NAME(X) X
644#else
645#define NAME(X) NotImplemented
646#endif
Brian Paul8ceb5c32000-02-24 22:14:04 +0000647 { "glActiveTextureARB", (GLvoid *) NAME(glActiveTextureARB), _gloffset_ActiveTextureARB },
648 { "glClientActiveTextureARB", (GLvoid *) NAME(glClientActiveTextureARB), _gloffset_ClientActiveTextureARB },
649 { "glMultiTexCoord1dARB", (GLvoid *) NAME(glMultiTexCoord1dARB), _gloffset_MultiTexCoord1dARB },
650 { "glMultiTexCoord1dvARB", (GLvoid *) NAME(glMultiTexCoord1dvARB), _gloffset_MultiTexCoord1dvARB },
651 { "glMultiTexCoord1fARB", (GLvoid *) NAME(glMultiTexCoord1fARB), _gloffset_MultiTexCoord1fARB },
652 { "glMultiTexCoord1fvARB", (GLvoid *) NAME(glMultiTexCoord1fvARB), _gloffset_MultiTexCoord1fvARB },
653 { "glMultiTexCoord1iARB", (GLvoid *) NAME(glMultiTexCoord1iARB), _gloffset_MultiTexCoord1iARB },
654 { "glMultiTexCoord1ivARB", (GLvoid *) NAME(glMultiTexCoord1ivARB), _gloffset_MultiTexCoord1ivARB },
655 { "glMultiTexCoord1sARB", (GLvoid *) NAME(glMultiTexCoord1sARB), _gloffset_MultiTexCoord1sARB },
656 { "glMultiTexCoord1svARB", (GLvoid *) NAME(glMultiTexCoord1svARB), _gloffset_MultiTexCoord1svARB },
657 { "glMultiTexCoord2dARB", (GLvoid *) NAME(glMultiTexCoord2dARB), _gloffset_MultiTexCoord2dARB },
658 { "glMultiTexCoord2dvARB", (GLvoid *) NAME(glMultiTexCoord2dvARB), _gloffset_MultiTexCoord2dvARB },
659 { "glMultiTexCoord2fARB", (GLvoid *) NAME(glMultiTexCoord2fARB), _gloffset_MultiTexCoord2fARB },
660 { "glMultiTexCoord2fvARB", (GLvoid *) NAME(glMultiTexCoord2fvARB), _gloffset_MultiTexCoord2fvARB },
661 { "glMultiTexCoord2iARB", (GLvoid *) NAME(glMultiTexCoord2iARB), _gloffset_MultiTexCoord2iARB },
662 { "glMultiTexCoord2ivARB", (GLvoid *) NAME(glMultiTexCoord2ivARB), _gloffset_MultiTexCoord2ivARB },
663 { "glMultiTexCoord2sARB", (GLvoid *) NAME(glMultiTexCoord2sARB), _gloffset_MultiTexCoord2sARB },
664 { "glMultiTexCoord2svARB", (GLvoid *) NAME(glMultiTexCoord2svARB), _gloffset_MultiTexCoord2svARB },
665 { "glMultiTexCoord3dARB", (GLvoid *) NAME(glMultiTexCoord3dARB), _gloffset_MultiTexCoord3dARB },
666 { "glMultiTexCoord3dvARB", (GLvoid *) NAME(glMultiTexCoord3dvARB), _gloffset_MultiTexCoord3dvARB },
667 { "glMultiTexCoord3fARB", (GLvoid *) NAME(glMultiTexCoord3fARB), _gloffset_MultiTexCoord3fARB },
668 { "glMultiTexCoord3fvARB", (GLvoid *) NAME(glMultiTexCoord3fvARB), _gloffset_MultiTexCoord3fvARB },
669 { "glMultiTexCoord3iARB", (GLvoid *) NAME(glMultiTexCoord3iARB), _gloffset_MultiTexCoord3iARB },
670 { "glMultiTexCoord3ivARB", (GLvoid *) NAME(glMultiTexCoord3ivARB), _gloffset_MultiTexCoord3ivARB },
671 { "glMultiTexCoord3sARB", (GLvoid *) NAME(glMultiTexCoord3sARB), _gloffset_MultiTexCoord3sARB },
672 { "glMultiTexCoord3svARB", (GLvoid *) NAME(glMultiTexCoord3svARB), _gloffset_MultiTexCoord3svARB },
673 { "glMultiTexCoord4dARB", (GLvoid *) NAME(glMultiTexCoord4dARB), _gloffset_MultiTexCoord4dARB },
674 { "glMultiTexCoord4dvARB", (GLvoid *) NAME(glMultiTexCoord4dvARB), _gloffset_MultiTexCoord4dvARB },
675 { "glMultiTexCoord4fARB", (GLvoid *) NAME(glMultiTexCoord4fARB), _gloffset_MultiTexCoord4fARB },
676 { "glMultiTexCoord4fvARB", (GLvoid *) NAME(glMultiTexCoord4fvARB), _gloffset_MultiTexCoord4fvARB },
677 { "glMultiTexCoord4iARB", (GLvoid *) NAME(glMultiTexCoord4iARB), _gloffset_MultiTexCoord4iARB },
678 { "glMultiTexCoord4ivARB", (GLvoid *) NAME(glMultiTexCoord4ivARB), _gloffset_MultiTexCoord4ivARB },
679 { "glMultiTexCoord4sARB", (GLvoid *) NAME(glMultiTexCoord4sARB), _gloffset_MultiTexCoord4sARB },
680 { "glMultiTexCoord4svARB", (GLvoid *) NAME(glMultiTexCoord4svARB), _gloffset_MultiTexCoord4svARB },
Brian Paul77aa8b92000-01-07 07:30:13 +0000681#undef NAME
Brian Paul91bcefa1999-11-27 21:30:40 +0000682
Brian Paul67661b01999-12-15 12:52:31 +0000683 /* GL_ARB_transpose_matrix */
Brian Paul77aa8b92000-01-07 07:30:13 +0000684#ifdef GL_ARB_transpose_matrix
685#define NAME(X) X
686#else
687#define NAME(X) NotImplemented
688#endif
Brian Paul8ceb5c32000-02-24 22:14:04 +0000689 { "glLoadTransposeMatrixdARB", (GLvoid *) NAME(glLoadTransposeMatrixdARB), _gloffset_LoadTransposeMatrixdARB },
690 { "glLoadTransposeMatrixfARB", (GLvoid *) NAME(glLoadTransposeMatrixfARB), _gloffset_LoadTransposeMatrixfARB },
691 { "glMultTransposeMatrixdARB", (GLvoid *) NAME(glMultTransposeMatrixdARB), _gloffset_MultTransposeMatrixdARB },
692 { "glMultTransposeMatrixfARB", (GLvoid *) NAME(glMultTransposeMatrixfARB), _gloffset_MultTransposeMatrixfARB },
Brian Paul77aa8b92000-01-07 07:30:13 +0000693#undef NAME
694
Brian Paul8ceb5c32000-02-24 22:14:04 +0000695 /* GL_ARB_multisample */
696#ifdef GL_ARB_multisample
697#define NAME(X) X
698#else
699#define NAME(X) NotImplemented
700#endif
701 { "glSampleCoverageARB", (GLvoid *) NAME(glSampleCoverageARB), _gloffset_SampleCoverageARB },
702 { "glSamplePassARB", (GLvoid *) NAME(glSamplePassARB), _gloffset_SamplePassARB },
703#undef NAME
704
705 /* 2. GL_EXT_blend_color */
706#ifdef GL_EXT_blend_color
707#define NAME(X) X
708#else
709#define NAME(X) NotImplemented
710#endif
711 { "glBlendColorEXT", (GLvoid *) NAME(glBlendColorEXT), _gloffset_BlendColor },
712#undef NAME
713
714 /* 3. GL_EXT_polygon_offset */
715#ifdef GL_EXT_polygon_offset
716#define NAME(X) X
717#else
718#define NAME(X) NotImplemented
719#endif
720 { "glPolygonOffsetEXT", (GLvoid *) NAME(glPolygonOffsetEXT), _gloffset_PolygonOffsetEXT },
721#undef NAME
722
723 /* 6. GL_EXT_texture3D */
724#ifdef GL_EXT_texture3D
725#define NAME(X) X
726#else
727#define NAME(X) NotImplemented
728#endif
729 { "glCopyTexSubImage3DEXT", (GLvoid *) NAME(glCopyTexSubImage3DEXT), _gloffset_CopyTexSubImage3D },
730 { "glTexImage3DEXT", (GLvoid *) NAME(glTexImage3DEXT), _gloffset_TexImage3D },
731 { "glTexSubImage3DEXT", (GLvoid *) NAME(glTexSubImage3DEXT), _gloffset_TexSubImage3D },
732#undef NAME
733
734 /* 7. GL_SGI_texture_filter4 */
735#ifdef GL_SGI_texture_filter4
736#define NAME(X) X
737#else
738#define NAME(X) NotImplemented
739#endif
740 { "glGetTexFilterFuncSGIS", (GLvoid *) NAME(glGetTexFilterFuncSGIS), _gloffset_GetTexFilterFuncSGIS },
741 { "glTexFilterFuncSGIS", (GLvoid *) NAME(glTexFilterFuncSGIS), _gloffset_TexFilterFuncSGIS },
742#undef NAME
743
744 /* 9. GL_EXT_subtexture */
745#ifdef GL_EXT_subtexture
746#define NAME(X) X
747#else
748#define NAME(X) NotImplemented
749#endif
750 { "glTexSubImage1DEXT", (GLvoid *) NAME(glTexSubImage1DEXT), _gloffset_TexSubImage1D },
751 { "glTexSubImage2DEXT", (GLvoid *) NAME(glTexSubImage2DEXT), _gloffset_TexSubImage2D },
752#undef NAME
753
754 /* 10. GL_EXT_copy_texture */
755#ifdef GL_EXT_copy_texture
756#define NAME(X) X
757#else
758#define NAME(X) NotImplemented
759#endif
760 { "glCopyTexImage1DEXT", (GLvoid *) NAME(glCopyTexImage1DEXT), _gloffset_CopyTexImage1D },
761 { "glCopyTexImage2DEXT", (GLvoid *) NAME(glCopyTexImage2DEXT), _gloffset_CopyTexImage2D },
762 { "glCopyTexSubImage1DEXT", (GLvoid *) NAME(glCopyTexSubImage1DEXT), _gloffset_CopyTexSubImage1D },
763 { "glCopyTexSubImage2DEXT", (GLvoid *) NAME(glCopyTexSubImage2DEXT), _gloffset_CopyTexSubImage2D },
764#undef NAME
765
766 /* 11. GL_EXT_histogram */
767#ifdef GL_EXT_histogram
768#define NAME(X) X
769#else
770#define NAME(X) NotImplemented
771#endif
772 { "glGetHistogramEXT", (GLvoid *) NAME(glGetHistogramEXT), _gloffset_GetHistogramEXT },
773 { "glGetHistogramParameterfvEXT", (GLvoid *) NAME(glGetHistogramParameterfvEXT), _gloffset_GetHistogramParameterfvEXT },
774 { "glGetHistogramParameterivEXT", (GLvoid *) NAME(glGetHistogramParameterivEXT), _gloffset_GetHistogramParameterivEXT },
775 { "glGetMinmaxEXT", (GLvoid *) NAME(glGetMinmaxEXT), _gloffset_GetMinmaxEXT },
776 { "glGetMinmaxParameterfvEXT", (GLvoid *) NAME(glGetMinmaxParameterfvEXT), _gloffset_GetMinmaxParameterfvEXT },
777 { "glGetMinmaxParameterivEXT", (GLvoid *) NAME(glGetMinmaxParameterivEXT), _gloffset_GetMinmaxParameterivEXT },
778 { "glHistogramEXT", (GLvoid *) NAME(glHistogramEXT), _gloffset_Histogram },
779 { "glMinmaxEXT", (GLvoid *) NAME(glMinmaxEXT), _gloffset_Minmax },
780 { "glResetHistogramEXT", (GLvoid *) NAME(glResetHistogramEXT), _gloffset_ResetHistogram },
781 { "glResetMinmaxEXT", (GLvoid *) NAME(glResetMinmaxEXT), _gloffset_ResetMinmax },
782#undef NAME
783
784 /* 12. GL_EXT_convolution */
785#ifdef GL_EXT_convolution
786#define NAME(X) X
787#else
788#define NAME(X) NotImplemented
789#endif
790 { "glConvolutionFilter1DEXT", (GLvoid *) NAME(glConvolutionFilter1DEXT), _gloffset_ConvolutionFilter1D },
791 { "glConvolutionFilter2DEXT", (GLvoid *) NAME(glConvolutionFilter2DEXT), _gloffset_ConvolutionFilter2D },
792 { "glConvolutionParameterfEXT", (GLvoid *) NAME(glConvolutionParameterfEXT), _gloffset_ConvolutionParameterf },
793 { "glConvolutionParameterfvEXT", (GLvoid *) NAME(glConvolutionParameterfvEXT), _gloffset_ConvolutionParameterfv },
794 { "glConvolutionParameteriEXT", (GLvoid *) NAME(glConvolutionParameteriEXT), _gloffset_ConvolutionParameteri },
795 { "glConvolutionParameterivEXT", (GLvoid *) NAME(glConvolutionParameterivEXT), _gloffset_ConvolutionParameteriv },
796 { "glCopyConvolutionFilter1DEXT", (GLvoid *) NAME(glCopyConvolutionFilter1DEXT), _gloffset_CopyConvolutionFilter1D },
797 { "glCopyConvolutionFilter2DEXT", (GLvoid *) NAME(glCopyConvolutionFilter2DEXT), _gloffset_CopyConvolutionFilter2D },
798 { "glGetConvolutionFilterEXT", (GLvoid *) NAME(glGetConvolutionFilterEXT), _gloffset_GetConvolutionFilterEXT },
799 { "glGetConvolutionParameterivEXT", (GLvoid *) NAME(glGetConvolutionParameterivEXT), _gloffset_GetConvolutionParameterivEXT },
800 { "glGetConvolutionParameterfvEXT", (GLvoid *) NAME(glGetConvolutionParameterfvEXT), _gloffset_GetConvolutionParameterfvEXT },
801 { "glGetSeparableFilterEXT", (GLvoid *) NAME(glGetSeparableFilterEXT), _gloffset_GetSeparableFilterEXT },
802 { "glSeparableFilter2DEXT", (GLvoid *) NAME(glSeparableFilter2DEXT), _gloffset_SeparableFilter2D },
803#undef NAME
804
805 /* 14. GL_SGI_color_table */
806#ifdef GL_SGI_color_table
807#define NAME(X) X
808#else
809#define NAME(X) NotImplemented
810#endif
811 { "glColorTableSGI", (GLvoid *) NAME(glColorTableSGI), _gloffset_ColorTable },
812 { "glColorTableParameterfvSGI", (GLvoid *) NAME(glColorTableParameterfvSGI), _gloffset_ColorTableParameterfv },
813 { "glColorTableParameterivSGI", (GLvoid *) NAME(glColorTableParameterivSGI), _gloffset_ColorTableParameteriv },
814 { "glCopyColorTableSGI", (GLvoid *) NAME(glCopyColorTableSGI), _gloffset_CopyColorTable },
815 { "glGetColorTableSGI", (GLvoid *) NAME(glGetColorTableSGI), _gloffset_GetColorTableSGI },
816 { "glGetColorTableParameterfvSGI", (GLvoid *) NAME(glGetColorTableParameterfvSGI), _gloffset_GetColorTableParameterfvSGI },
817 { "glGetColorTableParameterivSGI", (GLvoid *) NAME(glGetColorTableParameterivSGI), _gloffset_GetColorTableParameterivSGI },
818#undef NAME
819
820 /* 15. GL_SGIS_pixel_texture */
821#ifdef GL_SGIS_pixel_texture
822#define NAME(X) X
823#else
824#define NAME(X) NotImplemented
825#endif
826 { "glPixelTexGenParameterfSGIS", (GLvoid *) NAME(glPixelTexGenParameterfSGIS), _gloffset_PixelTexGenParameterfSGIS },
827 { "glPixelTexGenParameteriSGIS", (GLvoid *) NAME(glPixelTexGenParameteriSGIS), _gloffset_PixelTexGenParameteriSGIS },
828 { "glGetPixelTexGenParameterfvSGIS", (GLvoid *) NAME(glGetPixelTexGenParameterfvSGIS), _gloffset_GetPixelTexGenParameterfvSGIS },
829 { "glGetPixelTexGenParameterivSGIS", (GLvoid *) NAME(glGetPixelTexGenParameterivSGIS), _gloffset_GetPixelTexGenParameterivSGIS },
830#undef NAME
831
832 /* 16. GL_SGIS_texture4D */
833#ifdef GL_SGIS_texture4D
834#define NAME(X) X
835#else
836#define NAME(X) NotImplemented
837#endif
838 { "glTexImage4DSGIS", (GLvoid *) NAME(glTexImage4DSGIS), _gloffset_TexImage4DSGIS },
839 { "glTexSubImage4DSGIS", (GLvoid *) NAME(glTexSubImage4DSGIS), _gloffset_TexSubImage4DSGIS },
840#undef NAME
841
842 /* 20. GL_EXT_texture_object */
843#ifdef GL_EXT_texture_object
844#define NAME(X) X
845#else
846#define NAME(X) NotImplemented
847#endif
848 { "glAreTexturesResidentEXT", (GLvoid *) NAME(glAreTexturesResidentEXT), _gloffset_AreTexturesResidentEXT },
849 { "glBindTextureEXT", (GLvoid *) NAME(glBindTextureEXT), _gloffset_BindTexture },
850 { "glDeleteTexturesEXT", (GLvoid *) NAME(glDeleteTexturesEXT), _gloffset_DeleteTextures },
851 { "glGenTexturesEXT", (GLvoid *) NAME(glGenTexturesEXT), _gloffset_GenTexturesEXT },
852 { "glIsTextureEXT", (GLvoid *) NAME(glIsTextureEXT), _gloffset_IsTextureEXT },
853 { "glPrioritizeTexturesEXT", (GLvoid *) NAME(glPrioritizeTexturesEXT), _gloffset_PrioritizeTextures },
854#undef NAME
855
856 /* 21. GL_SGIS_detail_texture */
857#ifdef GL_SGIS_detail_texture
858#define NAME(X) X
859#else
860#define NAME(X) NotImplemented
861#endif
862 { "glDetailTexFuncSGIS", (GLvoid *) NAME(glDetailTexFuncSGIS), _gloffset_DetailTexFuncSGIS },
863 { "glGetDetailTexFuncSGIS", (GLvoid *) NAME(glGetDetailTexFuncSGIS), _gloffset_GetDetailTexFuncSGIS },
864#undef NAME
865
866 /* 22. GL_SGIS_sharpen_texture */
867#ifdef GL_SGIS_sharpen_texture
868#define NAME(X) X
869#else
870#define NAME(X) NotImplemented
871#endif
872 { "glGetSharpenTexFuncSGIS", (GLvoid *) NAME(glGetSharpenTexFuncSGIS), _gloffset_GetSharpenTexFuncSGIS },
873 { "glSharpenTexFuncSGIS", (GLvoid *) NAME(glSharpenTexFuncSGIS), _gloffset_SharpenTexFuncSGIS },
874#undef NAME
875
876 /* 25. GL_SGIS_multisample */
877#ifdef GL_SGIS_multisample
878#define NAME(X) X
879#else
880#define NAME(X) NotImplemented
881#endif
882 { "glSampleMaskSGIS", (GLvoid *) NAME(glSampleMaskSGIS), _gloffset_SampleMaskSGIS },
883 { "glSamplePatternSGIS", (GLvoid *) NAME(glSamplePatternSGIS), _gloffset_SamplePatternSGIS },
884#undef NAME
885
886 /* 30. GL_EXT_vertex_array */
887#ifdef GL_EXT_vertex_array
888#define NAME(X) X
889#else
890#define NAME(X) NotImplemented
891#endif
892 { "glArrayElementEXT", (GLvoid *) NAME(glArrayElementEXT), _gloffset_ArrayElement },
893 { "glColorPointerEXT", (GLvoid *) NAME(glColorPointerEXT), _gloffset_ColorPointerEXT },
894 { "glDrawArraysEXT", (GLvoid *) NAME(glDrawArraysEXT), _gloffset_DrawArrays },
895 { "glEdgeFlagPointerEXT", (GLvoid *) NAME(glEdgeFlagPointerEXT), _gloffset_EdgeFlagPointerEXT },
896 { "glGetPointervEXT", (GLvoid *) NAME(glGetPointervEXT), _gloffset_GetPointerv },
897 { "glIndexPointerEXT", (GLvoid *) NAME(glIndexPointerEXT), _gloffset_IndexPointerEXT },
898 { "glNormalPointerEXT", (GLvoid *) NAME(glNormalPointerEXT), _gloffset_NormalPointerEXT },
899 { "glTexCoordPointerEXT", (GLvoid *) NAME(glTexCoordPointerEXT), _gloffset_TexCoordPointerEXT },
900 { "glVertexPointerEXT", (GLvoid *) NAME(glVertexPointerEXT), _gloffset_VertexPointerEXT },
901#undef NAME
902
903 /* 37. GL_EXT_blend_minmax */
904#ifdef GL_EXT_blend_minmax
905#define NAME(X) X
906#else
907#define NAME(X) NotImplemented
908#endif
909 { "glBlendEquationEXT", (GLvoid *) NAME(glBlendEquationEXT), _gloffset_BlendEquation },
910#undef NAME
911
912 /* 52. GL_SGIX_sprite */
913#ifdef GL_SGIX_sprite
914#define NAME(X) X
915#else
916#define NAME(X) NotImplemented
917#endif
918 { "glSpriteParameterfSGIX", (GLvoid *) NAME(glSpriteParameterfSGIX), _gloffset_SpriteParameterfSGIX },
919 { "glSpriteParameterfvSGIX", (GLvoid *) NAME(glSpriteParameterfvSGIX), _gloffset_SpriteParameterfvSGIX },
920 { "glSpriteParameteriSGIX", (GLvoid *) NAME(glSpriteParameteriSGIX), _gloffset_SpriteParameteriSGIX },
921 { "glSpriteParameterivSGIX", (GLvoid *) NAME(glSpriteParameterivSGIX), _gloffset_SpriteParameterivSGIX },
922#undef NAME
923
924 /* 54. GL_EXT_point_parameters */
925#ifdef GL_EXT_point_parameters
926#define NAME(X) X
927#else
928#define NAME(X) NotImplemented
929#endif
930 { "glPointParameterfEXT", (GLvoid *) NAME(glPointParameterfEXT), _gloffset_PointParameterfEXT },
931 { "glPointParameterfvEXT", (GLvoid *) NAME(glPointParameterfvEXT), _gloffset_PointParameterfvEXT },
932#undef NAME
933
934 /* 55. GL_SGIX_instruments */
935#ifdef GL_SGIX_instruments
936#define NAME(X) X
937#else
938#define NAME(X) NotImplemented
939#endif
940 { "glInstrumentsBufferSGIX", (GLvoid *) NAME(glInstrumentsBufferSGIX), _gloffset_InstrumentsBufferSGIX },
941 { "glStartInstrumentsSGIX", (GLvoid *) NAME(glStartInstrumentsSGIX), _gloffset_StartInstrumentsSGIX },
942 { "glStopInstrumentsSGIX", (GLvoid *) NAME(glStopInstrumentsSGIX), _gloffset_StopInstrumentsSGIX },
943 { "glReadInstrumentsSGIX", (GLvoid *) NAME(glReadInstrumentsSGIX), _gloffset_ReadInstrumentsSGIX },
944 { "glPollInstrumentsSGIX", (GLvoid *) NAME(glPollInstrumentsSGIX), _gloffset_PollInstrumentsSGIX },
945 { "glGetInstrumentsSGIX", (GLvoid *) NAME(glGetInstrumentsSGIX), _gloffset_GetInstrumentsSGIX },
946#undef NAME
947
948 /* 57. GL_SGIX_framezoom */
949#ifdef GL_SGIX_framezoom
950#define NAME(X) X
951#else
952#define NAME(X) NotImplemented
953#endif
954 { "glFrameZoomSGIX", (GLvoid *) NAME(glFrameZoomSGIX), _gloffset_FrameZoomSGIX },
955#undef NAME
956
957 /* 58. GL_SGIX_tag_sample_buffer */
958#ifdef GL_SGIX_tag_sample_buffer
959#define NAME(X) X
960#else
961#define NAME(X) NotImplemented
962#endif
963 { "glTagSampleBufferSGIX", (GLvoid *) NAME(glTagSampleBufferSGIX), _gloffset_TagSampleBufferSGIX },
964#undef NAME
965
966 /* 60. GL_SGIX_reference_plane */
967#ifdef GL_SGIX_reference_plane
968#define NAME(X) X
969#else
970#define NAME(X) NotImplemented
971#endif
972 { "glReferencePlaneSGIX", (GLvoid *) NAME(glReferencePlaneSGIX), _gloffset_ReferencePlaneSGIX },
973#undef NAME
974
975 /* 61. GL_SGIX_flush_raster */
976#ifdef GL_SGIX_flush_raster
977#define NAME(X) X
978#else
979#define NAME(X) NotImplemented
980#endif
981 { "glFlushRasterSGIX", (GLvoid *) NAME(glFlushRasterSGIX), _gloffset_FlushRasterSGIX },
982#undef NAME
983
984 /* 66. GL_HP_image_transform */
985#if 0
986#ifdef GL_HP_image_transform
987#define NAME(X) X
988#else
989#define NAME(X) NotImplemented
990#endif
991 { "glGetImageTransformParameterfvHP", (GLvoid *) NAME(glGetImageTransformParameterfvHP), _gloffset_GetImageTransformParameterfvHP },
992 { "glGetImageTransformParameterivHP", (GLvoid *) NAME(glGetImageTransformParameterivHP), _gloffset_GetImageTransformParameterivHP },
993 { "glImageTransformParameterfHP", (GLvoid *) NAME(glImageTransformParameterfHP), _gloffset_ImageTransformParameterfHP },
994 { "glImageTransformParameterfvHP", (GLvoid *) NAME(glImageTransformParameterfvHP), _gloffset_ImageTransformParameterfvHP },
995 { "glImageTransformParameteriHP", (GLvoid *) NAME(glImageTransformParameteriHP), _gloffset_ImageTransformParameteriHP },
996 { "glImageTransformParameterivHP", (GLvoid *) NAME(glImageTransformParameterivHP), _gloffset_ImageTransformParameterivHP },
997#undef NAME
998#endif
999
1000 /* 74. GL_EXT_color_subtable */
1001#ifdef GL_EXT_color_subtable
1002#define NAME(X) X
1003#else
1004#define NAME(X) NotImplemented
1005#endif
1006 { "glColorSubTableEXT", (GLvoid *) NAME(glColorSubTableEXT), _gloffset_ColorSubTable },
1007 { "glCopyColorSubTableEXT", (GLvoid *) NAME(glCopyColorSubTableEXT), _gloffset_CopyColorSubTable },
1008#undef NAME
1009
1010 /* 77. GL_PGI_misc_hints */
1011#ifdef GL_PGI_misc_hints
1012#define NAME(X) X
1013#else
1014#define NAME(X) NotImplemented
1015#endif
1016 { "glHintPGI", (GLvoid *) NAME(glHintPGI), _gloffset_HintPGI },
1017#undef NAME
1018
1019 /* 78. GL_EXT_paletted_texture */
1020#ifdef GL_EXT_paletted_texture
1021#define NAME(X) X
1022#else
1023#define NAME(X) NotImplemented
1024#endif
1025 { "glColorTableEXT", (GLvoid *) NAME(glColorTableEXT), _gloffset_ColorTable },
1026 { "glGetColorTableEXT", (GLvoid *) NAME(glGetColorTableEXT), _gloffset_GetColorTable },
1027 { "glGetColorTableParameterfvEXT", (GLvoid *) NAME(glGetColorTableParameterfvEXT), _gloffset_GetColorTableParameterfv },
1028 { "glGetColorTableParameterivEXT", (GLvoid *) NAME(glGetColorTableParameterivEXT), _gloffset_GetColorTableParameteriv },
1029#undef NAME
1030
1031 /* 80. GL_SGIX_list_priority */
1032#ifdef GL_SGIX_list_priority
1033#define NAME(X) X
1034#else
1035#define NAME(X) NotImplemented
1036#endif
1037 { "glGetListParameterfvSGIX", (GLvoid *) NAME(glGetListParameterfvSGIX), _gloffset_GetListParameterfvSGIX },
1038 { "glGetListParameterivSGIX", (GLvoid *) NAME(glGetListParameterivSGIX), _gloffset_GetListParameterivSGIX },
1039 { "glListParameterfSGIX", (GLvoid *) NAME(glListParameterfSGIX), _gloffset_ListParameterfSGIX },
1040 { "glListParameterfvSGIX", (GLvoid *) NAME(glListParameterfvSGIX), _gloffset_ListParameterfvSGIX },
1041 { "glListParameteriSGIX", (GLvoid *) NAME(glListParameteriSGIX), _gloffset_ListParameteriSGIX },
1042 { "glListParameterivSGIX", (GLvoid *) NAME(glListParameterivSGIX), _gloffset_ListParameterivSGIX },
1043#undef NAME
1044
1045 /* 94. GL_EXT_index_material */
1046#ifdef GL_EXT_index_material
1047#define NAME(X) X
1048#else
1049#define NAME(X) NotImplemented
1050#endif
1051 { "glIndexMaterialEXT", (GLvoid *) NAME(glIndexMaterialEXT), _gloffset_IndexMaterialEXT },
1052#undef NAME
1053
1054 /* 95. GL_EXT_index_func */
1055#ifdef GL_EXT_index_func
1056#define NAME(X) X
1057#else
1058#define NAME(X) NotImplemented
1059#endif
1060 { "glIndexFuncEXT", (GLvoid *) NAME(glIndexFuncEXT), _gloffset_IndexFuncEXT },
1061#undef NAME
1062
1063 /* 97. GL_EXT_compiled_vertex_array */
1064#ifdef GL_EXT_compiled_vertex_array
1065#define NAME(X) X
1066#else
1067#define NAME(X) NotImplemented
1068#endif
1069 { "glLockArraysEXT", (GLvoid *) NAME(glLockArraysEXT), _gloffset_LockArraysEXT },
1070 { "glUnlockArraysEXT", (GLvoid *) NAME(glUnlockArraysEXT), _gloffset_UnlockArraysEXT },
1071#undef NAME
1072
1073 /* 98. GL_EXT_cull_vertex */
1074#ifdef GL_EXT_cull_vertex
1075#define NAME(X) X
1076#else
1077#define NAME(X) NotImplemented
1078#endif
1079 { "glCullParameterfvEXT", (GLvoid *) NAME(glCullParameterfvEXT), _gloffset_CullParameterfvEXT },
1080 { "glCullParameterdvEXT", (GLvoid *) NAME(glCullParameterdvEXT), _gloffset_CullParameterdvEXT },
1081#undef NAME
1082
1083 /* 102. GL_SGIX_fragment_lighting */
1084#ifdef GL_SGIX_fragment_lighting
1085#define NAME(X) X
1086#else
1087#define NAME(X) NotImplemented
1088#endif
1089 { "glFragmentColorMaterialSGIX", (GLvoid *) NAME(glFragmentColorMaterialSGIX), _gloffset_FragmentColorMaterialSGIX },
1090 { "glFragmentLightfSGIX", (GLvoid *) NAME(glFragmentLightfSGIX), _gloffset_FragmentLightfSGIX },
1091 { "glFragmentLightfvSGIX", (GLvoid *) NAME(glFragmentLightfvSGIX), _gloffset_FragmentLightfvSGIX },
1092 { "glFragmentLightiSGIX", (GLvoid *) NAME(glFragmentLightiSGIX), _gloffset_FragmentLightiSGIX },
1093 { "glFragmentLightivSGIX", (GLvoid *) NAME(glFragmentLightivSGIX), _gloffset_FragmentLightivSGIX },
1094 { "glFragmentLightModelfSGIX", (GLvoid *) NAME(glFragmentLightModelfSGIX), _gloffset_FragmentLightModelfSGIX },
1095 { "glFragmentLightModelfvSGIX", (GLvoid *) NAME(glFragmentLightModelfvSGIX), _gloffset_FragmentLightModelfvSGIX },
1096 { "glFragmentLightModeliSGIX", (GLvoid *) NAME(glFragmentLightModeliSGIX), _gloffset_FragmentLightModeliSGIX },
1097 { "glFragmentLightModelivSGIX", (GLvoid *) NAME(glFragmentLightModelivSGIX), _gloffset_FragmentLightModelivSGIX },
1098 { "glFragmentMaterialfSGIX", (GLvoid *) NAME(glFragmentMaterialfSGIX), _gloffset_FragmentMaterialfSGIX },
1099 { "glFragmentMaterialfvSGIX", (GLvoid *) NAME(glFragmentMaterialfvSGIX), _gloffset_FragmentMaterialfvSGIX },
1100 { "glFragmentMaterialiSGIX", (GLvoid *) NAME(glFragmentMaterialiSGIX), _gloffset_FragmentMaterialiSGIX },
1101 { "glFragmentMaterialivSGIX", (GLvoid *) NAME(glFragmentMaterialivSGIX), _gloffset_FragmentMaterialivSGIX },
1102 { "glGetFragmentLightfvSGIX", (GLvoid *) NAME(glGetFragmentLightfvSGIX), _gloffset_GetFragmentLightfvSGIX },
1103 { "glGetFragmentLightivSGIX", (GLvoid *) NAME(glGetFragmentLightivSGIX), _gloffset_GetFragmentLightivSGIX },
1104 { "glGetFragmentMaterialfvSGIX", (GLvoid *) NAME(glGetFragmentMaterialfvSGIX), _gloffset_GetFragmentMaterialfvSGIX },
1105 { "glGetFragmentMaterialivSGIX", (GLvoid *) NAME(glGetFragmentMaterialivSGIX), _gloffset_GetFragmentMaterialivSGIX },
1106 { "glLightEnviSGIX", (GLvoid *) NAME(glLightEnviSGIX), _gloffset_LightEnviSGIX },
1107#undef NAME
1108
1109 /* 149. GL_EXT_fog_coord */
1110#ifdef GL_EXT_fog_coord
1111#define NAME(X) X
1112#else
1113#define NAME(X) NotImplemented
1114#endif
1115 { "glFogCoordfEXT", (GLvoid *) NAME(glFogCoordfEXT), _gloffset_FogCoordfEXT },
1116 { "glFogCoordfvEXT", (GLvoid *) NAME(glFogCoordfvEXT), _gloffset_FogCoordfvEXT },
1117 { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT },
1118 { "glFogCoorddEXT", (GLvoid *) NAME(glFogCoorddEXT), _gloffset_FogCoorddEXT },
1119 { "glFogCoordPointerEXT", (GLvoid *) NAME(glFogCoordPointerEXT), _gloffset_FogCoordPointerEXT },
1120#undef NAME
1121
1122 /* 173. GL_EXT/INGR_blend_func_separate */
1123#ifdef GL_EXT_blend_func_separate
1124#define NAME(X) X
1125#else
1126#define NAME(X) NotImplemented
1127#endif
1128 { "glBlendFuncSeparateEXT", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT },
1129 { "glBlendFuncSeparateINGR", (GLvoid *) NAME(glBlendFuncSeparateEXT), _gloffset_BlendFuncSeparateEXT },
1130#undef NAME
1131
1132 /* 188. GL_EXT_vertex_weighting */
1133#ifdef GL_EXT_vertex_weighting
1134#define NAME(X) X
1135#else
1136#define NAME(X) NotImplemented
1137#endif
1138 { "glVertexWeightfEXT", (GLvoid *) NAME(glVertexWeightfEXT), _gloffset_VertexWeightfEXT },
1139 { "glVertexWeightfvEXT", (GLvoid *) NAME(glVertexWeightfvEXT), _gloffset_VertexWeightfvEXT },
1140 { "glVertexWeightPointerEXT", (GLvoid *) NAME(glVertexWeightPointerEXT), _gloffset_VertexWeightPointerEXT },
1141#undef NAME
1142
1143 /* 190. GL_NV_vertex_array_range */
1144#ifdef GL_NV_vertex_array_range
1145#define NAME(X) X
1146#else
1147#define NAME(X) NotImplemented
1148#endif
1149 { "glFlushVertexArrayRangeNV", (GLvoid *) NAME(glFlushVertexArrayRangeNV), _gloffset_FlushVertexArrayRangeNV },
1150 { "glVertexArrayRangeNV", (GLvoid *) NAME(glVertexArrayRangeNV), _gloffset_VertexArrayRangeNV },
1151#undef NAME
1152
1153 /* 191. GL_NV_register_combiners */
1154#ifdef GL_NV_register_combiners
1155#define NAME(X) X
1156#else
1157#define NAME(X) NotImplemented
1158#endif
1159 { "glCombinerParameterfvNV", (GLvoid *) NAME(glCombinerParameterfvNV), _gloffset_CombinerParameterfvNV },
1160 { "glCombinerParameterfNV", (GLvoid *) NAME(glCombinerParameterfNV), _gloffset_CombinerParameterfNV },
1161 { "glCombinerParameterivNV", (GLvoid *) NAME(glCombinerParameterivNV), _gloffset_CombinerParameterivNV },
1162 { "glCombinerParameteriNV", (GLvoid *) NAME(glCombinerParameteriNV), _gloffset_CombinerParameteriNV },
1163 { "glCombinerInputNV", (GLvoid *) NAME(glCombinerInputNV), _gloffset_CombinerInputNV },
1164 { "glCombinerOutputNV", (GLvoid *) NAME(glCombinerOutputNV), _gloffset_CombinerOutputNV },
1165 { "glFinalCombinerInputNV", (GLvoid *) NAME(glFinalCombinerInputNV), _gloffset_FinalCombinerInputNV },
1166 { "glGetCombinerInputParameterfvNV", (GLvoid *) NAME(glGetCombinerInputParameterfvNV), _gloffset_GetCombinerInputParameterfvNV },
1167 { "glGetCombinerInputParameterivNV", (GLvoid *) NAME(glGetCombinerInputParameterivNV), _gloffset_GetCombinerInputParameterivNV },
1168 { "glGetCombinerOutputParameterfvNV", (GLvoid *) NAME(glGetCombinerOutputParameterfvNV), _gloffset_GetCombinerOutputParameterfvNV },
1169 { "glGetCombinerOutputParameterivNV", (GLvoid *) NAME(glGetCombinerOutputParameterivNV), _gloffset_GetCombinerOutputParameterivNV },
1170 { "glGetFinalCombinerInputParameterfvNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterfvNV), _gloffset_GetFinalCombinerInputParameterfvNV },
1171 { "glGetFinalCombinerInputParameterivNV", (GLvoid *) NAME(glGetFinalCombinerInputParameterivNV), _gloffset_GetFinalCombinerInputParameterivNV },
1172#undef NAME
1173
1174 /* 196. GL_MESA_resize_buffers */
1175#ifdef MESA_resize_buffers
1176#define NAME(X) X
1177#else
1178#define NAME(X) NotImplemented
1179#endif
1180 { "glResizeBuffersMESA", (GLvoid *) NAME(glResizeBuffersMESA), _gloffset_ResizeBuffersMESA },
1181#undef NAME
1182
1183 /* 197. GL_MESA_window_pos */
1184#ifdef MESA_window_pos
1185#define NAME(X) X
1186#else
1187#define NAME(X) NotImplemented
1188#endif
1189 { "glWindowPos4fMESA", (GLvoid *) NAME(glWindowPos4fMESA), _gloffset_WindowPos4fMESA },
1190#undef NAME
1191
Brian Paulcd963881999-12-10 20:01:06 +00001192
Brian Paul67661b01999-12-15 12:52:31 +00001193 { NULL, NULL } /* end of list marker */
Brian Paul91bcefa1999-11-27 21:30:40 +00001194};
Brian Paul7fb54ae1999-11-19 22:33:50 +00001195
Brian Paul959f8022000-03-19 01:10:11 +00001196
1197
1198/*
1199 * Return dispatch table offset of the named static (built-in) function.
1200 * Return -1 if function not found.
1201 */
1202static GLint
1203get_static_proc_offset(const char *funcName)
1204{
1205 GLuint i;
1206 for (i = 0; static_functions[i].Name; i++) {
1207 if (strcmp(static_functions[i].Name, funcName) == 0) {
1208 return static_functions[i].Offset;
1209 }
1210 }
1211 return -1;
1212}
1213
1214
1215/*
1216 * Return dispatch function address the named static (built-in) function.
1217 * Return NULL if function not found.
1218 */
1219static GLvoid *
1220get_static_proc_address(const char *funcName)
1221{
1222 GLint i = get_static_proc_offset(funcName);
1223 if (i >= 0)
1224 return static_functions[i].Address;
1225 else
1226 return NULL;
1227}
1228
1229
1230
1231/**********************************************************************
1232 * Extension function management.
1233 */
1234
1235
1236#define MAX_EXTENSION_FUNCS 1000
1237
1238static struct name_address_offset ExtEntryTable[MAX_EXTENSION_FUNCS];
1239static GLuint NumExtEntryPoints = 0;
1240
1241
1242
1243/*
1244 * Generate a dispatch function (entrypoint) which jumps through
1245 * the given slot number (offset) in the current dispatch table.
1246 * We need assembly language in order to accomplish this.
1247 */
1248static void *
1249generate_entrypoint(GLuint functionOffset)
1250{
1251#if defined(USE_X86_ASM)
1252 /*
1253 * This x86 code contributed by Josh Vanderhoof.
1254 *
1255 * 0: a1 10 32 54 76 movl __glapi_Dispatch,%eax
1256 * 00 01 02 03 04
1257 * 5: 85 c0 testl %eax,%eax
1258 * 05 06
1259 * 7: 74 06 je f <entrypoint+0xf>
1260 * 07 08
1261 * 9: ff a0 10 32 54 76 jmp *0x76543210(%eax)
1262 * 09 0a 0b 0c 0d 0e
1263 * f: e8 fc ff ff ff call __glapi_get_dispatch
1264 * 0f 10 11 12 13
1265 * 14: ff a0 10 32 54 76 jmp *0x76543210(%eax)
1266 * 14 15 16 17 18 19
1267 */
1268 static const unsigned char temp[] = {
1269 0xa1, 0x00, 0x00, 0x00, 0x00,
1270 0x85, 0xc0,
1271 0x74, 0x06,
1272 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00,
1273 0xe8, 0x00, 0x00, 0x00, 0x00,
1274 0xff, 0xa0, 0x00, 0x00, 0x00, 0x00
1275 };
1276 unsigned char *code = malloc(sizeof(temp));
1277 unsigned int next_insn;
1278 if (code) {
1279 memcpy(code, temp, sizeof(temp));
1280
1281 *(unsigned int *)(code + 0x01) = (unsigned int)&_glapi_Dispatch;
1282 *(unsigned int *)(code + 0x0b) = (unsigned int)functionOffset * 4;
1283 next_insn = (unsigned int)(code + 0x14);
1284 *(unsigned int *)(code + 0x10) = (unsigned int)_glapi_get_dispatch - next_insn;
1285 *(unsigned int *)(code + 0x16) = (unsigned int)functionOffset * 4;
1286 }
1287 return code;
1288#else
1289 return NULL;
1290#endif
1291}
1292
1293
1294
1295/*
1296 * Add a new extension function entrypoint.
1297 * Return: GL_TRUE = success or GL_FALSE = failure
1298 */
1299GLboolean
1300_glapi_add_entrypoint(const char *funcName, GLuint offset)
1301{
1302 /* Make sure we don't try to add a new entrypoint after someone
1303 * has already called _glapi_get_dispatch_table_size()! If that's
1304 * happened the caller's information will now be out of date.
1305 */
1306 assert(!GetSizeCalled);
1307
1308 /* first check if the named function is already statically present */
1309 {
1310 GLint index = get_static_proc_offset(funcName);
1311 if (index >= 0) {
1312 return (GLboolean) (index == offset); /* bad offset! */
1313 }
1314 }
1315
1316 {
1317 /* make sure this offset/name pair is legal */
1318 const char *name = _glapi_get_proc_name(offset);
1319 if (name && strcmp(name, funcName) != 0)
1320 return GL_FALSE; /* bad name! */
1321 }
1322
1323 {
1324 /* be sure index and name match known data */
1325 GLuint i;
1326 for (i = 0; i < NumExtEntryPoints; i++) {
1327 if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
1328 /* function already registered with api */
1329 if (ExtEntryTable[i].Offset == offset) {
1330 return GL_TRUE; /* offsets match */
1331 }
1332 else {
1333 return GL_FALSE; /* bad offset! */
1334 }
1335 }
1336 }
1337
1338 /* make sure we have space */
1339 if (NumExtEntryPoints >= MAX_EXTENSION_FUNCS) {
1340 return GL_FALSE;
1341 }
1342 else {
1343 void *entrypoint = generate_entrypoint(offset);
1344 if (!entrypoint)
1345 return GL_FALSE;
1346
Brian Paulfffb8092000-03-29 18:46:11 +00001347 ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName);
Brian Paul959f8022000-03-19 01:10:11 +00001348 ExtEntryTable[NumExtEntryPoints].Offset = offset;
1349 ExtEntryTable[NumExtEntryPoints].Address = entrypoint;
1350 NumExtEntryPoints++;
1351
1352 if (offset > MaxDispatchOffset)
1353 MaxDispatchOffset = offset;
1354
1355 return GL_TRUE; /* success */
1356 }
1357 }
1358
1359 /* should never get here, but play it safe */
1360 return GL_FALSE;
1361}
1362
1363
1364
1365#if 0000 /* prototype code for dynamic extension slot allocation */
1366
1367static int NextFreeOffset = 409; /*XXX*/
1368#define MAX_DISPATCH_TABLE_SIZE 1000
1369
1370/*
1371 * Dynamically allocate a dispatch slot for an extension entrypoint
1372 * and generate the assembly language dispatch stub.
1373 * Return the dispatch offset for the function or -1 if no room or error.
1374 */
1375GLint
1376_glapi_add_entrypoint2(const char *funcName)
1377{
1378 int offset;
1379
1380 /* first see if extension func is already known */
1381 offset = _glapi_get_proc_offset(funcName);
1382 if (offset >= 0)
1383 return offset;
1384
1385 if (NumExtEntryPoints < MAX_EXTENSION_FUNCS
1386 && NextFreeOffset < MAX_DISPATCH_TABLE_SIZE) {
1387 void *entryPoint;
1388 offset = NextFreeOffset;
1389 entryPoint = generate_entrypoint(offset);
1390 if (entryPoint) {
1391 NextFreeOffset++;
Brian Paulfffb8092000-03-29 18:46:11 +00001392 ExtEntryTable[NumExtEntryPoints].Name = str_dup(funcName);
Brian Paul959f8022000-03-19 01:10:11 +00001393 ExtEntryTable[NumExtEntryPoints].Offset = offset;
1394 ExtEntryTable[NumExtEntryPoints].Address = entryPoint;
1395 NumExtEntryPoints++;
1396 return offset;
1397 }
1398 }
1399 return -1;
1400}
1401
1402#endif
1403
1404
1405
1406/*
1407 * Return offset of entrypoint for named function within dispatch table.
1408 */
1409GLint
1410_glapi_get_proc_offset(const char *funcName)
1411{
1412 /* search extension functions first */
1413 GLint i;
1414 for (i = 0; i < NumExtEntryPoints; i++) {
1415 if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
1416 return ExtEntryTable[i].Offset;
1417 }
1418 }
1419
1420 /* search static functions */
1421 return get_static_proc_offset(funcName);
1422}
1423
1424
1425
1426/*
1427 * Return entrypoint for named function.
1428 */
1429const GLvoid *
1430_glapi_get_proc_address(const char *funcName)
1431{
1432 /* search extension functions first */
1433 GLint i;
1434 for (i = 0; i < NumExtEntryPoints; i++) {
1435 if (strcmp(ExtEntryTable[i].Name, funcName) == 0) {
1436 return ExtEntryTable[i].Address;
1437 }
1438 }
1439
1440 /* search static functions */
1441 return get_static_proc_address(funcName);
1442}
1443
1444
1445
1446
1447/*
1448 * Return the name of the function at the given dispatch offset.
1449 * This is only intended for debugging.
1450 */
1451const char *
1452_glapi_get_proc_name(GLuint offset)
1453{
1454 const GLuint n = sizeof(static_functions) / sizeof(struct name_address_offset);
1455 GLuint i;
1456 for (i = 0; i < n; i++) {
1457 if (static_functions[i].Offset == offset)
1458 return static_functions[i].Name;
1459 }
1460
1461 /* search added extension functions */
1462 for (i = 0; i < NumExtEntryPoints; i++) {
1463 if (ExtEntryTable[i].Offset == offset) {
1464 return ExtEntryTable[i].Name;
1465 }
1466 }
1467 return NULL;
1468}
1469
1470
1471
1472/*
1473 * Make sure there are no NULL pointers in the given dispatch table.
1474 * Intented for debugging purposes.
1475 */
1476void
1477_glapi_check_table(const struct _glapi_table *table)
1478{
1479 const GLuint entries = _glapi_get_dispatch_table_size();
1480 const void **tab = (const void **) table;
1481 GLuint i;
1482 for (i = 1; i < entries; i++) {
1483 assert(tab[i]);
1484 }
1485
1486#ifdef DEBUG
1487 /* Do some spot checks to be sure that the dispatch table
1488 * slots are assigned correctly.
1489 */
1490 {
1491 GLuint BeginOffset = _glapi_get_proc_offset("glBegin");
1492 char *BeginFunc = (char*) &table->Begin;
1493 GLuint offset = (BeginFunc - (char *) table) / sizeof(void *);
1494 assert(BeginOffset == _gloffset_Begin);
1495 assert(BeginOffset == offset);
1496 }
1497 {
1498 GLuint viewportOffset = _glapi_get_proc_offset("glViewport");
1499 char *viewportFunc = (char*) &table->Viewport;
1500 GLuint offset = (viewportFunc - (char *) table) / sizeof(void *);
1501 assert(viewportOffset == _gloffset_Viewport);
1502 assert(viewportOffset == offset);
1503 }
1504 {
1505 GLuint VertexPointerOffset = _glapi_get_proc_offset("glVertexPointer");
1506 char *VertexPointerFunc = (char*) &table->VertexPointer;
1507 GLuint offset = (VertexPointerFunc - (char *) table) / sizeof(void *);
1508 assert(VertexPointerOffset == _gloffset_VertexPointer);
1509 assert(VertexPointerOffset == offset);
1510 }
1511 {
1512 GLuint ResetMinMaxOffset = _glapi_get_proc_offset("glResetMinmax");
1513 char *ResetMinMaxFunc = (char*) &table->ResetMinmax;
1514 GLuint offset = (ResetMinMaxFunc - (char *) table) / sizeof(void *);
1515 assert(ResetMinMaxOffset == _gloffset_ResetMinmax);
1516 assert(ResetMinMaxOffset == offset);
1517 }
1518 {
1519 GLuint blendColorOffset = _glapi_get_proc_offset("glBlendColor");
1520 char *blendColorFunc = (char*) &table->BlendColor;
1521 GLuint offset = (blendColorFunc - (char *) table) / sizeof(void *);
1522 assert(blendColorOffset == _gloffset_BlendColor);
1523 assert(blendColorOffset == offset);
1524 }
1525 {
1526 GLuint istextureOffset = _glapi_get_proc_offset("glIsTextureEXT");
1527 char *istextureFunc = (char*) &table->IsTextureEXT;
1528 GLuint offset = (istextureFunc - (char *) table) / sizeof(void *);
1529 assert(istextureOffset == _gloffset_IsTextureEXT);
1530 assert(istextureOffset == offset);
1531 }
1532#endif
1533}
1534
1535
1536
1537