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