blob: 5c7e8eb90cd460c935f01319e09ee1bb8da15ae4 [file] [log] [blame]
jtgafb833d1999-08-19 00:55:39 +00001/*
2 * Mesa 3-D graphics library
Brianfd545642007-05-19 08:27:35 -06003 * Version: 7.1
jtgafb833d1999-08-19 00:55:39 +00004 *
Brianfd545642007-05-19 08:27:35 -06005 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
jtgafb833d1999-08-19 00:55:39 +00006 *
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25
jtgafb833d1999-08-19 00:55:39 +000026/*
Brian Paule17ba711999-11-28 20:07:33 +000027 * This is the GLX API dispatcher. Calls to the glX* functions are
Brian Paulb0bb4f62001-05-25 21:51:02 +000028 * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions.
Brian Paul1d822ea2002-03-15 18:33:12 +000029 * See the glxapi.h file for more details.
jtgafb833d1999-08-19 00:55:39 +000030 */
31
32
Brian Paule17ba711999-11-28 20:07:33 +000033#include <assert.h>
34#include <stdlib.h>
Brian Paul55ed11b2001-05-24 00:00:57 +000035#include <stdio.h>
Jon Taylor1487b3e2000-11-19 23:42:32 +000036#include <string.h>
Brian Paulbf5e5732008-06-05 16:05:02 -060037#include "main/glheader.h"
Brian Paulf2c02322009-02-22 15:43:29 -070038#include "main/compiler.h"
Brian Paulbf5e5732008-06-05 16:05:02 -060039#include "glapi/glapi.h"
Brian Paule17ba711999-11-28 20:07:33 +000040#include "glxapi.h"
jtgafb833d1999-08-19 00:55:39 +000041
42
Brian Paulb0bb4f62001-05-25 21:51:02 +000043extern struct _glxapi_table *_real_GetGLXDispatchTable(void);
Brian Paule17ba711999-11-28 20:07:33 +000044extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
Brian Paule17ba711999-11-28 20:07:33 +000045
46
47struct display_dispatch {
48 Display *Dpy;
49 struct _glxapi_table *Table;
50 struct display_dispatch *Next;
51};
52
Chia-I Wu88842932009-10-15 18:07:22 +080053
54/**
55 * When GLX_INDIRECT_RENDERING is defined, some symbols are missing in
56 * libglapi.a. We need to define them here.
57 */
58#ifdef GLX_INDIRECT_RENDERING
59
60#include "glapi/dispatch.h"
61
62#define KEYWORD1 PUBLIC
63
64#if defined(USE_MGL_NAMESPACE)
65#define NAME(func) mgl##func
66#else
67#define NAME(func) gl##func
68#endif
69
70#define DISPATCH(FUNC, ARGS, MESSAGE) \
71 CALL_ ## FUNC(GET_DISPATCH(), ARGS);
72
73#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \
74 return CALL_ ## FUNC(GET_DISPATCH(), ARGS);
75
76/* skip normal ones */
77#define _GLAPI_SKIP_NORMAL_ENTRY_POINTS
78#include "glapi/glapitemp.h"
79
80#endif /* GLX_INDIRECT_RENDERING */
81
82
Brian Paule17ba711999-11-28 20:07:33 +000083static struct display_dispatch *DispatchList = NULL;
84
85
Brian Paul55ed11b2001-05-24 00:00:57 +000086/* Display -> Dispatch caching */
87static Display *prevDisplay = NULL;
88static struct _glxapi_table *prevTable = NULL;
89
90
Brian Paule17ba711999-11-28 20:07:33 +000091static struct _glxapi_table *
92get_dispatch(Display *dpy)
jtgafb833d1999-08-19 00:55:39 +000093{
Brian Paule17ba711999-11-28 20:07:33 +000094 if (!dpy)
95 return NULL;
96
Brian Paule17ba711999-11-28 20:07:33 +000097 /* search list of display/dispatch pairs for this display */
98 {
99 const struct display_dispatch *d = DispatchList;
100 while (d) {
101 if (d->Dpy == dpy) {
102 prevDisplay = dpy;
103 prevTable = d->Table;
104 return d->Table; /* done! */
105 }
106 d = d->Next;
107 }
108 }
109
Brian Paulb0bb4f62001-05-25 21:51:02 +0000110 /* A new display, determine if we should use real GLX
Brian Paule17ba711999-11-28 20:07:33 +0000111 * or Mesa's pseudo-GLX.
jtgafb833d1999-08-19 00:55:39 +0000112 */
Brian Paule17ba711999-11-28 20:07:33 +0000113 {
Ian Romanickab7c6ff2005-07-26 22:53:38 +0000114 struct _glxapi_table *t = _mesa_GetGLXDispatchTable();
Brian Paule17ba711999-11-28 20:07:33 +0000115
116 if (t) {
117 struct display_dispatch *d;
118 d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch));
119 if (d) {
120 d->Dpy = dpy;
121 d->Table = t;
122 /* insert at head of list */
123 d->Next = DispatchList;
124 DispatchList = d;
125 /* update cache */
126 prevDisplay = dpy;
127 prevTable = t;
128 return t;
129 }
jtgafb833d1999-08-19 00:55:39 +0000130 }
131 }
Brian Paule17ba711999-11-28 20:07:33 +0000132
133 /* If we get here that means we can't use real GLX on this display
134 * and the Mesa pseudo-GLX software renderer wasn't compiled in.
135 * Or, we ran out of memory!
136 */
137 return NULL;
jtgafb833d1999-08-19 00:55:39 +0000138}
139
140
Brian Paul2b177412006-03-16 18:06:34 +0000141/* Don't use the GET_DISPATCH defined in glthread.h */
142#undef GET_DISPATCH
143
Brian Paul55ed11b2001-05-24 00:00:57 +0000144#define GET_DISPATCH(DPY, TABLE) \
145 if (DPY == prevDisplay) { \
146 TABLE = prevTable; \
147 } \
148 else if (!DPY) { \
149 TABLE = NULL; \
150 } \
151 else { \
152 TABLE = get_dispatch(DPY); \
153 }
154
155
156
jtgafb833d1999-08-19 00:55:39 +0000157
Brian Pauld41d29b2006-09-20 14:39:47 +0000158/**
159 * GLX API current context.
160 */
161#if defined(GLX_USE_TLS)
162PUBLIC __thread void * CurrentContext
163 __attribute__((tls_model("initial-exec")));
164#elif defined(THREADS)
165static _glthread_TSD ContextTSD; /**< Per-thread context pointer */
166#else
Brian Paule17ba711999-11-28 20:07:33 +0000167static GLXContext CurrentContext = 0;
Brian Pauld41d29b2006-09-20 14:39:47 +0000168#endif
169
170
171static void
172SetCurrentContext(GLXContext c)
173{
174#if defined(GLX_USE_TLS)
Brianc1ba3082007-06-12 08:57:12 -0600175 CurrentContext = c;
Brian Pauld41d29b2006-09-20 14:39:47 +0000176#elif defined(THREADS)
177 _glthread_SetTSD(&ContextTSD, c);
178#else
179 CurrentContext = c;
180#endif
181}
Brian Paulb82d9931999-11-22 21:52:23 +0000182
183
Brian Paulad6fd8e1999-11-23 19:54:27 +0000184/*
Brian Paule17ba711999-11-28 20:07:33 +0000185 * GLX API entrypoints
Brian Paulad6fd8e1999-11-23 19:54:27 +0000186 */
Brian Paule17ba711999-11-28 20:07:33 +0000187
Brian Paulb0bb4f62001-05-25 21:51:02 +0000188/*** GLX_VERSION_1_0 ***/
Brian Paule17ba711999-11-28 20:07:33 +0000189
Brian Paulbe2de8b2004-11-25 23:25:33 +0000190XVisualInfo PUBLIC *
191glXChooseVisual(Display *dpy, int screen, int *list)
Brian Paulad6fd8e1999-11-23 19:54:27 +0000192{
Brian Paul55ed11b2001-05-24 00:00:57 +0000193 struct _glxapi_table *t;
194 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000195 if (!t)
196 return NULL;
197 return (t->ChooseVisual)(dpy, screen, list);
Brian Paulad6fd8e1999-11-23 19:54:27 +0000198}
199
200
Brian Paulbe2de8b2004-11-25 23:25:33 +0000201void PUBLIC
202glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
Brian Paulad6fd8e1999-11-23 19:54:27 +0000203{
Brian Paul55ed11b2001-05-24 00:00:57 +0000204 struct _glxapi_table *t;
205 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000206 if (!t)
207 return;
208 (t->CopyContext)(dpy, src, dst, mask);
Brian Paulad6fd8e1999-11-23 19:54:27 +0000209}
210
211
Brian Paulbe2de8b2004-11-25 23:25:33 +0000212GLXContext PUBLIC
213glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct)
Brian Paulad6fd8e1999-11-23 19:54:27 +0000214{
Brian Paul55ed11b2001-05-24 00:00:57 +0000215 struct _glxapi_table *t;
216 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000217 if (!t)
jtgafb833d1999-08-19 00:55:39 +0000218 return 0;
Brian Paule17ba711999-11-28 20:07:33 +0000219 return (t->CreateContext)(dpy, visinfo, shareList, direct);
220}
221
222
Brian Paulbe2de8b2004-11-25 23:25:33 +0000223GLXPixmap PUBLIC
224glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap)
Brian Paule17ba711999-11-28 20:07:33 +0000225{
Brian Paul55ed11b2001-05-24 00:00:57 +0000226 struct _glxapi_table *t;
227 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000228 if (!t)
229 return 0;
230 return (t->CreateGLXPixmap)(dpy, visinfo, pixmap);
231}
232
233
Brian Paulbe2de8b2004-11-25 23:25:33 +0000234void PUBLIC
235glXDestroyContext(Display *dpy, GLXContext ctx)
Brian Paule17ba711999-11-28 20:07:33 +0000236{
Brian Paul55ed11b2001-05-24 00:00:57 +0000237 struct _glxapi_table *t;
238 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000239 if (!t)
240 return;
Brian Pauld41d29b2006-09-20 14:39:47 +0000241 if (glXGetCurrentContext() == ctx)
242 SetCurrentContext(NULL);
Brian Paule17ba711999-11-28 20:07:33 +0000243 (t->DestroyContext)(dpy, ctx);
244}
245
246
Brian Paulbe2de8b2004-11-25 23:25:33 +0000247void PUBLIC
248glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
Brian Paule17ba711999-11-28 20:07:33 +0000249{
Brian Paul55ed11b2001-05-24 00:00:57 +0000250 struct _glxapi_table *t;
251 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000252 if (!t)
253 return;
254 (t->DestroyGLXPixmap)(dpy, pixmap);
255}
256
257
Brian Paulbe2de8b2004-11-25 23:25:33 +0000258int PUBLIC
259glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value)
Brian Paule17ba711999-11-28 20:07:33 +0000260{
Brian Paul55ed11b2001-05-24 00:00:57 +0000261 struct _glxapi_table *t;
262 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000263 if (!t)
264 return GLX_NO_EXTENSION;
265 return (t->GetConfig)(dpy, visinfo, attrib, value);
266}
267
268
Brian Paulbe2de8b2004-11-25 23:25:33 +0000269GLXContext PUBLIC
270glXGetCurrentContext(void)
Brian Paule17ba711999-11-28 20:07:33 +0000271{
Brian Pauld41d29b2006-09-20 14:39:47 +0000272#if defined(GLX_USE_TLS)
Brian Paule17ba711999-11-28 20:07:33 +0000273 return CurrentContext;
Brian Pauld41d29b2006-09-20 14:39:47 +0000274#elif defined(THREADS)
Brian18d1fde2007-01-23 11:46:02 -0700275 return (GLXContext) _glthread_GetTSD(&ContextTSD);
Brian Pauld41d29b2006-09-20 14:39:47 +0000276#else
277 return CurrentContext;
278#endif
Brian Paule17ba711999-11-28 20:07:33 +0000279}
280
281
Brian Paulbe2de8b2004-11-25 23:25:33 +0000282GLXDrawable PUBLIC
283glXGetCurrentDrawable(void)
Brian Paule17ba711999-11-28 20:07:33 +0000284{
Brian Paul12c1bee2001-05-24 20:05:32 +0000285 __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
Brian Paul7cf50e12001-05-24 19:06:21 +0000286 return gc ? gc->currentDrawable : 0;
Brian Paule17ba711999-11-28 20:07:33 +0000287}
288
289
Brian Paulbe2de8b2004-11-25 23:25:33 +0000290Bool PUBLIC
291glXIsDirect(Display *dpy, GLXContext ctx)
Brian Paule17ba711999-11-28 20:07:33 +0000292{
Brian Paul55ed11b2001-05-24 00:00:57 +0000293 struct _glxapi_table *t;
294 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000295 if (!t)
296 return False;
297 return (t->IsDirect)(dpy, ctx);
298}
299
300
Brian Paulbe2de8b2004-11-25 23:25:33 +0000301Bool PUBLIC
302glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
Brian Paule17ba711999-11-28 20:07:33 +0000303{
304 Bool b;
Brian Paul55ed11b2001-05-24 00:00:57 +0000305 struct _glxapi_table *t;
306 GET_DISPATCH(dpy, t);
Brian Paul84cac842001-05-29 23:15:07 +0000307 if (!t) {
Brian Paule17ba711999-11-28 20:07:33 +0000308 return False;
Brian Paul84cac842001-05-29 23:15:07 +0000309 }
Brian Paule17ba711999-11-28 20:07:33 +0000310 b = (*t->MakeCurrent)(dpy, drawable, ctx);
311 if (b) {
Brian Pauld41d29b2006-09-20 14:39:47 +0000312 SetCurrentContext(ctx);
Brian Paule17ba711999-11-28 20:07:33 +0000313 }
314 return b;
315}
316
317
Brian Paulbe2de8b2004-11-25 23:25:33 +0000318Bool PUBLIC
319glXQueryExtension(Display *dpy, int *errorb, int *event)
Brian Paule17ba711999-11-28 20:07:33 +0000320{
Brian Paul55ed11b2001-05-24 00:00:57 +0000321 struct _glxapi_table *t;
322 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000323 if (!t)
324 return False;
325 return (t->QueryExtension)(dpy, errorb, event);
326}
327
328
Brian Paulbe2de8b2004-11-25 23:25:33 +0000329Bool PUBLIC
330glXQueryVersion(Display *dpy, int *maj, int *min)
Brian Paule17ba711999-11-28 20:07:33 +0000331{
Brian Paul55ed11b2001-05-24 00:00:57 +0000332 struct _glxapi_table *t;
333 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000334 if (!t)
335 return False;
336 return (t->QueryVersion)(dpy, maj, min);
337}
338
339
Brian Paulbe2de8b2004-11-25 23:25:33 +0000340void PUBLIC
341glXSwapBuffers(Display *dpy, GLXDrawable drawable)
Brian Paule17ba711999-11-28 20:07:33 +0000342{
Brian Paul55ed11b2001-05-24 00:00:57 +0000343 struct _glxapi_table *t;
344 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000345 if (!t)
346 return;
347 (t->SwapBuffers)(dpy, drawable);
348}
349
350
Brian Paulbe2de8b2004-11-25 23:25:33 +0000351void PUBLIC
352glXUseXFont(Font font, int first, int count, int listBase)
Brian Paule17ba711999-11-28 20:07:33 +0000353{
Brian Paul55ed11b2001-05-24 00:00:57 +0000354 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +0000355 Display *dpy = glXGetCurrentDisplay();
356 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000357 if (!t)
358 return;
359 (t->UseXFont)(font, first, count, listBase);
360}
361
362
Brian Paulbe2de8b2004-11-25 23:25:33 +0000363void PUBLIC
364glXWaitGL(void)
Brian Paule17ba711999-11-28 20:07:33 +0000365{
Brian Paul55ed11b2001-05-24 00:00:57 +0000366 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +0000367 Display *dpy = glXGetCurrentDisplay();
368 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000369 if (!t)
370 return;
371 (t->WaitGL)();
372}
373
374
Brian Paulbe2de8b2004-11-25 23:25:33 +0000375void PUBLIC
376glXWaitX(void)
Brian Paule17ba711999-11-28 20:07:33 +0000377{
Brian Paul55ed11b2001-05-24 00:00:57 +0000378 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +0000379 Display *dpy = glXGetCurrentDisplay();
380 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000381 if (!t)
382 return;
383 (t->WaitX)();
384}
385
386
387
Brian Paulb0bb4f62001-05-25 21:51:02 +0000388/*** GLX_VERSION_1_1 ***/
Brian Paule17ba711999-11-28 20:07:33 +0000389
Brian Paulbe2de8b2004-11-25 23:25:33 +0000390const char PUBLIC *
391glXGetClientString(Display *dpy, int name)
Brian Paule17ba711999-11-28 20:07:33 +0000392{
Brian Paul55ed11b2001-05-24 00:00:57 +0000393 struct _glxapi_table *t;
394 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000395 if (!t)
396 return NULL;
397 return (t->GetClientString)(dpy, name);
398}
399
400
Brian Paulbe2de8b2004-11-25 23:25:33 +0000401const char PUBLIC *
402glXQueryExtensionsString(Display *dpy, int screen)
Brian Paule17ba711999-11-28 20:07:33 +0000403{
Brian Paul55ed11b2001-05-24 00:00:57 +0000404 struct _glxapi_table *t;
405 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000406 if (!t)
407 return NULL;
408 return (t->QueryExtensionsString)(dpy, screen);
409}
410
411
Brian Paulbe2de8b2004-11-25 23:25:33 +0000412const char PUBLIC *
413glXQueryServerString(Display *dpy, int screen, int name)
Brian Paule17ba711999-11-28 20:07:33 +0000414{
Brian Paul55ed11b2001-05-24 00:00:57 +0000415 struct _glxapi_table *t;
416 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000417 if (!t)
418 return NULL;
419 return (t->QueryServerString)(dpy, screen, name);
420}
421
Brian Paule17ba711999-11-28 20:07:33 +0000422
Brian Paulb0bb4f62001-05-25 21:51:02 +0000423/*** GLX_VERSION_1_2 ***/
Brian Paule17ba711999-11-28 20:07:33 +0000424
Brian Paulbe2de8b2004-11-25 23:25:33 +0000425Display PUBLIC *
426glXGetCurrentDisplay(void)
Brian Paule17ba711999-11-28 20:07:33 +0000427{
Brian Paul7cf50e12001-05-24 19:06:21 +0000428 /* Same code as in libGL's glxext.c */
Brian Paul12c1bee2001-05-24 20:05:32 +0000429 __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
Brian Paul7cf50e12001-05-24 19:06:21 +0000430 if (NULL == gc) return NULL;
431 return gc->currentDpy;
jtgafb833d1999-08-19 00:55:39 +0000432}
jtgafb833d1999-08-19 00:55:39 +0000433
434
435
Brian Paulb0bb4f62001-05-25 21:51:02 +0000436/*** GLX_VERSION_1_3 ***/
jtgafb833d1999-08-19 00:55:39 +0000437
Brian Paulbe2de8b2004-11-25 23:25:33 +0000438GLXFBConfig PUBLIC *
439glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
Brian Paule17ba711999-11-28 20:07:33 +0000440{
Brian Paul55ed11b2001-05-24 00:00:57 +0000441 struct _glxapi_table *t;
442 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000443 if (!t)
444 return 0;
445 return (t->ChooseFBConfig)(dpy, screen, attribList, nitems);
446}
447
448
Brian Paulbe2de8b2004-11-25 23:25:33 +0000449GLXContext PUBLIC
450glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
Brian Paule17ba711999-11-28 20:07:33 +0000451{
Brian Paul55ed11b2001-05-24 00:00:57 +0000452 struct _glxapi_table *t;
453 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000454 if (!t)
455 return 0;
456 return (t->CreateNewContext)(dpy, config, renderType, shareList, direct);
457}
458
459
Brian Paulbe2de8b2004-11-25 23:25:33 +0000460GLXPbuffer PUBLIC
461glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
Brian Paule17ba711999-11-28 20:07:33 +0000462{
Brian Paul55ed11b2001-05-24 00:00:57 +0000463 struct _glxapi_table *t;
464 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000465 if (!t)
466 return 0;
467 return (t->CreatePbuffer)(dpy, config, attribList);
468}
469
470
Brian Paulbe2de8b2004-11-25 23:25:33 +0000471GLXPixmap PUBLIC
472glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
Brian Paule17ba711999-11-28 20:07:33 +0000473{
Brian Paul55ed11b2001-05-24 00:00:57 +0000474 struct _glxapi_table *t;
475 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000476 if (!t)
477 return 0;
478 return (t->CreatePixmap)(dpy, config, pixmap, attribList);
479}
480
481
Brian Paulbe2de8b2004-11-25 23:25:33 +0000482GLXWindow PUBLIC
483glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
Brian Paule17ba711999-11-28 20:07:33 +0000484{
Brian Paul55ed11b2001-05-24 00:00:57 +0000485 struct _glxapi_table *t;
486 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000487 if (!t)
488 return 0;
489 return (t->CreateWindow)(dpy, config, win, attribList);
490}
491
492
Brian Paulbe2de8b2004-11-25 23:25:33 +0000493void PUBLIC
494glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
Brian Paule17ba711999-11-28 20:07:33 +0000495{
Brian Paul55ed11b2001-05-24 00:00:57 +0000496 struct _glxapi_table *t;
497 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000498 if (!t)
499 return;
500 (t->DestroyPbuffer)(dpy, pbuf);
501}
502
503
Brian Paulbe2de8b2004-11-25 23:25:33 +0000504void PUBLIC
505glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
Brian Paule17ba711999-11-28 20:07:33 +0000506{
Brian Paul55ed11b2001-05-24 00:00:57 +0000507 struct _glxapi_table *t;
508 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000509 if (!t)
510 return;
511 (t->DestroyPixmap)(dpy, pixmap);
512}
513
514
Brian Paulbe2de8b2004-11-25 23:25:33 +0000515void PUBLIC
516glXDestroyWindow(Display *dpy, GLXWindow window)
Brian Paule17ba711999-11-28 20:07:33 +0000517{
Brian Paul55ed11b2001-05-24 00:00:57 +0000518 struct _glxapi_table *t;
519 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000520 if (!t)
521 return;
522 (t->DestroyWindow)(dpy, window);
523}
524
525
Brian Paulbe2de8b2004-11-25 23:25:33 +0000526GLXDrawable PUBLIC
527glXGetCurrentReadDrawable(void)
Brian Paule17ba711999-11-28 20:07:33 +0000528{
Brian Paul12c1bee2001-05-24 20:05:32 +0000529 __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
Brian Paul7cf50e12001-05-24 19:06:21 +0000530 return gc ? gc->currentReadable : 0;
Brian Paule17ba711999-11-28 20:07:33 +0000531}
532
533
Brian Paulbe2de8b2004-11-25 23:25:33 +0000534int PUBLIC
535glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
Brian Paule17ba711999-11-28 20:07:33 +0000536{
Brian Paul55ed11b2001-05-24 00:00:57 +0000537 struct _glxapi_table *t;
538 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000539 if (!t)
540 return GLX_NO_EXTENSION;
541 return (t->GetFBConfigAttrib)(dpy, config, attribute, value);
542}
543
544
Brian Paulbe2de8b2004-11-25 23:25:33 +0000545GLXFBConfig PUBLIC *
546glXGetFBConfigs(Display *dpy, int screen, int *nelements)
Brian Paul56057982000-04-10 21:13:19 +0000547{
Brian Paul55ed11b2001-05-24 00:00:57 +0000548 struct _glxapi_table *t;
549 GET_DISPATCH(dpy, t);
Brian Paul56057982000-04-10 21:13:19 +0000550 if (!t)
551 return 0;
552 return (t->GetFBConfigs)(dpy, screen, nelements);
553}
554
Brian Paulbe2de8b2004-11-25 23:25:33 +0000555void PUBLIC
556glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
Brian Paule17ba711999-11-28 20:07:33 +0000557{
Brian Paul55ed11b2001-05-24 00:00:57 +0000558 struct _glxapi_table *t;
559 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000560 if (!t)
561 return;
562 (t->GetSelectedEvent)(dpy, drawable, mask);
563}
564
565
Brian Paulbe2de8b2004-11-25 23:25:33 +0000566XVisualInfo PUBLIC *
567glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
Brian Paule17ba711999-11-28 20:07:33 +0000568{
Brian Paul55ed11b2001-05-24 00:00:57 +0000569 struct _glxapi_table *t;
570 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000571 if (!t)
572 return NULL;
573 return (t->GetVisualFromFBConfig)(dpy, config);
574}
575
576
Brian Paulbe2de8b2004-11-25 23:25:33 +0000577Bool PUBLIC
578glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
Brian Paule17ba711999-11-28 20:07:33 +0000579{
Brian Paule17ba711999-11-28 20:07:33 +0000580 Bool b;
Brian Paul55ed11b2001-05-24 00:00:57 +0000581 struct _glxapi_table *t;
582 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000583 if (!t)
584 return False;
585 b = (t->MakeContextCurrent)(dpy, draw, read, ctx);
586 if (b) {
Brian Pauld41d29b2006-09-20 14:39:47 +0000587 SetCurrentContext(ctx);
Brian Paule17ba711999-11-28 20:07:33 +0000588 }
589 return b;
590}
591
592
Brian Paulbe2de8b2004-11-25 23:25:33 +0000593int PUBLIC
594glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
Brian Paule17ba711999-11-28 20:07:33 +0000595{
Brian Paul55ed11b2001-05-24 00:00:57 +0000596 struct _glxapi_table *t;
597 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000598 assert(t);
599 if (!t)
600 return 0; /* XXX correct? */
601 return (t->QueryContext)(dpy, ctx, attribute, value);
602}
603
604
Brian Paulbe2de8b2004-11-25 23:25:33 +0000605void PUBLIC
606glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
Brian Paule17ba711999-11-28 20:07:33 +0000607{
Brian Paul55ed11b2001-05-24 00:00:57 +0000608 struct _glxapi_table *t;
609 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000610 if (!t)
611 return;
612 (t->QueryDrawable)(dpy, draw, attribute, value);
613}
614
615
Brian Paulbe2de8b2004-11-25 23:25:33 +0000616void PUBLIC
617glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
Brian Paule17ba711999-11-28 20:07:33 +0000618{
Brian Paul55ed11b2001-05-24 00:00:57 +0000619 struct _glxapi_table *t;
620 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000621 if (!t)
622 return;
623 (t->SelectEvent)(dpy, drawable, mask);
624}
625
Brian Paule17ba711999-11-28 20:07:33 +0000626
627
Brian Paulb0bb4f62001-05-25 21:51:02 +0000628/*** GLX_SGI_swap_control ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000629
Brian Paulbe2de8b2004-11-25 23:25:33 +0000630int PUBLIC
631glXSwapIntervalSGI(int interval)
Brian Paul783d7df2000-12-15 04:02:50 +0000632{
Brian Paul55ed11b2001-05-24 00:00:57 +0000633 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +0000634 Display *dpy = glXGetCurrentDisplay();
635 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000636 if (!t)
637 return 0;
638 return (t->SwapIntervalSGI)(interval);
639}
640
Brian Paul783d7df2000-12-15 04:02:50 +0000641
642
Brian Paulb0bb4f62001-05-25 21:51:02 +0000643/*** GLX_SGI_video_sync ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000644
Brian Paulbe2de8b2004-11-25 23:25:33 +0000645int PUBLIC
646glXGetVideoSyncSGI(unsigned int *count)
Brian Paul783d7df2000-12-15 04:02:50 +0000647{
Brian Paul55ed11b2001-05-24 00:00:57 +0000648 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +0000649 Display *dpy = glXGetCurrentDisplay();
650 GET_DISPATCH(dpy, t);
Brian Paul2d087482006-06-13 23:04:41 +0000651 if (!t || !glXGetCurrentContext())
652 return GLX_BAD_CONTEXT;
Brian Paul783d7df2000-12-15 04:02:50 +0000653 return (t->GetVideoSyncSGI)(count);
654}
655
Brian Paulbe2de8b2004-11-25 23:25:33 +0000656int PUBLIC
657glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
Brian Paul783d7df2000-12-15 04:02:50 +0000658{
Brian Paul55ed11b2001-05-24 00:00:57 +0000659 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +0000660 Display *dpy = glXGetCurrentDisplay();
661 GET_DISPATCH(dpy, t);
Brian Paul2d087482006-06-13 23:04:41 +0000662 if (!t || !glXGetCurrentContext())
663 return GLX_BAD_CONTEXT;
Brian Paul783d7df2000-12-15 04:02:50 +0000664 return (t->WaitVideoSyncSGI)(divisor, remainder, count);
665}
666
Brian Paul783d7df2000-12-15 04:02:50 +0000667
668
Brian Paulb0bb4f62001-05-25 21:51:02 +0000669/*** GLX_SGI_make_current_read ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000670
Brian Paulbe2de8b2004-11-25 23:25:33 +0000671Bool PUBLIC
672glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
Brian Paul783d7df2000-12-15 04:02:50 +0000673{
Brian Paul55ed11b2001-05-24 00:00:57 +0000674 struct _glxapi_table *t;
675 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000676 if (!t)
Brian Paul2d087482006-06-13 23:04:41 +0000677 return False;
Brian Paul783d7df2000-12-15 04:02:50 +0000678 return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx);
679}
680
Brian Paulbe2de8b2004-11-25 23:25:33 +0000681GLXDrawable PUBLIC
682glXGetCurrentReadDrawableSGI(void)
Brian Paul783d7df2000-12-15 04:02:50 +0000683{
Brian Paul7cf50e12001-05-24 19:06:21 +0000684 return glXGetCurrentReadDrawable();
Brian Paul783d7df2000-12-15 04:02:50 +0000685}
Brian Paul783d7df2000-12-15 04:02:50 +0000686
687
Brian Paulb0bb4f62001-05-25 21:51:02 +0000688#if defined(_VL_H)
Brian Paul783d7df2000-12-15 04:02:50 +0000689
Brian Paulbe2de8b2004-11-25 23:25:33 +0000690GLXVideoSourceSGIX PUBLIC
691glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
Brian Paul783d7df2000-12-15 04:02:50 +0000692{
Brian Paul55ed11b2001-05-24 00:00:57 +0000693 struct _glxapi_table *t;
694 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000695 if (!t)
696 return 0;
697 return (t->CreateGLXVideoSourceSGIX)(dpy, screen, server, path, nodeClass, drainNode);
698}
699
Brian Paulbe2de8b2004-11-25 23:25:33 +0000700void PUBLIC
701glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
Brian Paul783d7df2000-12-15 04:02:50 +0000702{
Brian Paul55ed11b2001-05-24 00:00:57 +0000703 struct _glxapi_table *t;
704 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000705 if (!t)
706 return 0;
707 return (t->DestroyGLXVideoSourceSGIX)(dpy, src);
708}
709
710#endif
711
712
Brian Paulb0bb4f62001-05-25 21:51:02 +0000713/*** GLX_EXT_import_context ***/
Brian Paule17ba711999-11-28 20:07:33 +0000714
Brian Paulbe2de8b2004-11-25 23:25:33 +0000715void PUBLIC
716glXFreeContextEXT(Display *dpy, GLXContext context)
Brian Paule17ba711999-11-28 20:07:33 +0000717{
Brian Paul55ed11b2001-05-24 00:00:57 +0000718 struct _glxapi_table *t;
719 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000720 if (!t)
721 return;
722 (t->FreeContextEXT)(dpy, context);
723}
724
Brian Paulbe2de8b2004-11-25 23:25:33 +0000725GLXContextID PUBLIC
726glXGetContextIDEXT(const GLXContext context)
Brian Paule17ba711999-11-28 20:07:33 +0000727{
Brian Paul12c1bee2001-05-24 20:05:32 +0000728 return ((__GLXcontext *) context)->xid;
Brian Paule17ba711999-11-28 20:07:33 +0000729}
730
Brian Paulbe2de8b2004-11-25 23:25:33 +0000731Display PUBLIC *
732glXGetCurrentDisplayEXT(void)
Brian Paule17ba711999-11-28 20:07:33 +0000733{
Brian Paul7cf50e12001-05-24 19:06:21 +0000734 return glXGetCurrentDisplay();
Brian Paule17ba711999-11-28 20:07:33 +0000735}
736
Brian Paulbe2de8b2004-11-25 23:25:33 +0000737GLXContext PUBLIC
738glXImportContextEXT(Display *dpy, GLXContextID contextID)
Brian Paule17ba711999-11-28 20:07:33 +0000739{
Brian Paul55ed11b2001-05-24 00:00:57 +0000740 struct _glxapi_table *t;
741 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000742 if (!t)
743 return 0;
744 return (t->ImportContextEXT)(dpy, contextID);
745}
746
Brian Paulbe2de8b2004-11-25 23:25:33 +0000747int PUBLIC
748glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *value)
Brian Paule17ba711999-11-28 20:07:33 +0000749{
Brian Paul55ed11b2001-05-24 00:00:57 +0000750 struct _glxapi_table *t;
751 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000752 if (!t)
753 return 0; /* XXX ok? */
754 return (t->QueryContextInfoEXT)(dpy, context, attribute, value);
755}
756
Brian Paule17ba711999-11-28 20:07:33 +0000757
758
Brian Paulb0bb4f62001-05-25 21:51:02 +0000759/*** GLX_SGIX_fbconfig ***/
Brian Paule17ba711999-11-28 20:07:33 +0000760
Brian Paulbe2de8b2004-11-25 23:25:33 +0000761int PUBLIC
762glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
jtgafb833d1999-08-19 00:55:39 +0000763{
Brian Paul55ed11b2001-05-24 00:00:57 +0000764 struct _glxapi_table *t;
765 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000766 if (!t)
767 return 0;
Brian Paul783d7df2000-12-15 04:02:50 +0000768 return (t->GetFBConfigAttribSGIX)(dpy, config, attribute, value);
Brian Paule17ba711999-11-28 20:07:33 +0000769}
770
Brian Paulbe2de8b2004-11-25 23:25:33 +0000771GLXFBConfigSGIX PUBLIC *
772glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
Brian Paule17ba711999-11-28 20:07:33 +0000773{
Brian Paul55ed11b2001-05-24 00:00:57 +0000774 struct _glxapi_table *t;
775 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +0000776 if (!t)
777 return 0;
Brian Paul783d7df2000-12-15 04:02:50 +0000778 return (t->ChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
779}
780
Brian Paulbe2de8b2004-11-25 23:25:33 +0000781GLXPixmap PUBLIC
782glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
Brian Paul783d7df2000-12-15 04:02:50 +0000783{
Brian Paul55ed11b2001-05-24 00:00:57 +0000784 struct _glxapi_table *t;
785 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000786 if (!t)
787 return 0;
788 return (t->CreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
789}
790
Brian Paulbe2de8b2004-11-25 23:25:33 +0000791GLXContext PUBLIC
792glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
Brian Paul783d7df2000-12-15 04:02:50 +0000793{
Brian Paul55ed11b2001-05-24 00:00:57 +0000794 struct _glxapi_table *t;
795 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000796 if (!t)
797 return 0;
798 return (t->CreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
799}
800
Brian Paulbe2de8b2004-11-25 23:25:33 +0000801XVisualInfo PUBLIC *
802glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
Brian Paul783d7df2000-12-15 04:02:50 +0000803{
Brian Paul55ed11b2001-05-24 00:00:57 +0000804 struct _glxapi_table *t;
805 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000806 if (!t)
807 return 0;
808 return (t->GetVisualFromFBConfigSGIX)(dpy, config);
809}
810
Brian Paulbe2de8b2004-11-25 23:25:33 +0000811GLXFBConfigSGIX PUBLIC
812glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
Brian Paul783d7df2000-12-15 04:02:50 +0000813{
Brian Paul55ed11b2001-05-24 00:00:57 +0000814 struct _glxapi_table *t;
815 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000816 if (!t)
817 return 0;
818 return (t->GetFBConfigFromVisualSGIX)(dpy, vis);
819}
820
Brian Paul783d7df2000-12-15 04:02:50 +0000821
822
Brian Paulb0bb4f62001-05-25 21:51:02 +0000823/*** GLX_SGIX_pbuffer ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000824
Brian Paulbe2de8b2004-11-25 23:25:33 +0000825GLXPbufferSGIX PUBLIC
826glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list)
Brian Paul783d7df2000-12-15 04:02:50 +0000827{
Brian Paul55ed11b2001-05-24 00:00:57 +0000828 struct _glxapi_table *t;
829 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000830 if (!t)
831 return 0;
832 return (t->CreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
833}
834
Brian Paulbe2de8b2004-11-25 23:25:33 +0000835void PUBLIC
836glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
Brian Paul783d7df2000-12-15 04:02:50 +0000837{
Brian Paul55ed11b2001-05-24 00:00:57 +0000838 struct _glxapi_table *t;
839 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000840 if (!t)
841 return;
842 (t->DestroyGLXPbufferSGIX)(dpy, pbuf);
843}
844
Brian Paulbe2de8b2004-11-25 23:25:33 +0000845int PUBLIC
846glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value)
Brian Paul783d7df2000-12-15 04:02:50 +0000847{
Brian Paul55ed11b2001-05-24 00:00:57 +0000848 struct _glxapi_table *t;
849 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000850 if (!t)
851 return 0;
852 return (t->QueryGLXPbufferSGIX)(dpy, pbuf, attribute, value);
853}
854
Brian Paulbe2de8b2004-11-25 23:25:33 +0000855void PUBLIC
856glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
Brian Paul783d7df2000-12-15 04:02:50 +0000857{
Brian Paul55ed11b2001-05-24 00:00:57 +0000858 struct _glxapi_table *t;
859 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000860 if (!t)
861 return;
862 (t->SelectEventSGIX)(dpy, drawable, mask);
863}
864
Brian Paulbe2de8b2004-11-25 23:25:33 +0000865void PUBLIC
866glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
Brian Paul783d7df2000-12-15 04:02:50 +0000867{
Brian Paul55ed11b2001-05-24 00:00:57 +0000868 struct _glxapi_table *t;
869 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000870 if (!t)
871 return;
872 (t->GetSelectedEventSGIX)(dpy, drawable, mask);
873}
874
Brian Paul783d7df2000-12-15 04:02:50 +0000875
876
Brian Paulb0bb4f62001-05-25 21:51:02 +0000877/*** GLX_SGI_cushion ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000878
Brian Paulbe2de8b2004-11-25 23:25:33 +0000879void PUBLIC
880glXCushionSGI(Display *dpy, Window win, float cushion)
Brian Paul783d7df2000-12-15 04:02:50 +0000881{
Brian Paul55ed11b2001-05-24 00:00:57 +0000882 struct _glxapi_table *t;
883 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000884 if (!t)
885 return;
886 (t->CushionSGI)(dpy, win, cushion);
Brian Paule17ba711999-11-28 20:07:33 +0000887}
888
Brian Paule17ba711999-11-28 20:07:33 +0000889
890
Brian Paulb0bb4f62001-05-25 21:51:02 +0000891/*** GLX_SGIX_video_resize ***/
Brian Paul45360212000-12-14 17:44:08 +0000892
Brian Paulbe2de8b2004-11-25 23:25:33 +0000893int PUBLIC
894glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
Brian Paul45360212000-12-14 17:44:08 +0000895{
Brian Paul55ed11b2001-05-24 00:00:57 +0000896 struct _glxapi_table *t;
897 GET_DISPATCH(dpy, t);
Brian Paul45360212000-12-14 17:44:08 +0000898 if (!t)
899 return 0;
900 return (t->BindChannelToWindowSGIX)(dpy, screen, channel, window);
901}
902
Brian Paulbe2de8b2004-11-25 23:25:33 +0000903int PUBLIC
904glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
Brian Paul45360212000-12-14 17:44:08 +0000905{
Brian Paul55ed11b2001-05-24 00:00:57 +0000906 struct _glxapi_table *t;
907 GET_DISPATCH(dpy, t);
Brian Paul45360212000-12-14 17:44:08 +0000908 if (!t)
909 return 0;
910 return (t->ChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
911}
912
Brian Paulbe2de8b2004-11-25 23:25:33 +0000913int PUBLIC
914glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
Brian Paul45360212000-12-14 17:44:08 +0000915{
Brian Paul55ed11b2001-05-24 00:00:57 +0000916 struct _glxapi_table *t;
917 GET_DISPATCH(dpy, t);
Brian Paul45360212000-12-14 17:44:08 +0000918 if (!t)
919 return 0;
920 return (t->QueryChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
921}
922
Brian Paulbe2de8b2004-11-25 23:25:33 +0000923int PUBLIC
924glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
Brian Paul45360212000-12-14 17:44:08 +0000925{
Brian Paul55ed11b2001-05-24 00:00:57 +0000926 struct _glxapi_table *t;
927 GET_DISPATCH(dpy, t);
Brian Paul45360212000-12-14 17:44:08 +0000928 if (!t)
929 return 0;
930 return (t->QueryChannelDeltasSGIX)(dpy, screen, channel, dx, dy, dw, dh);
931}
932
Brian Paulbe2de8b2004-11-25 23:25:33 +0000933int PUBLIC
934glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
Brian Paul45360212000-12-14 17:44:08 +0000935{
Brian Paul55ed11b2001-05-24 00:00:57 +0000936 struct _glxapi_table *t;
937 GET_DISPATCH(dpy, t);
Brian Paul45360212000-12-14 17:44:08 +0000938 if (!t)
939 return 0;
940 return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype);
941}
942
Brian Paul45360212000-12-14 17:44:08 +0000943
944
Brian Paulb0bb4f62001-05-25 21:51:02 +0000945#if defined(_DM_BUFFER_H_)
Brian Paul45360212000-12-14 17:44:08 +0000946
Brian Paulbe2de8b2004-11-25 23:25:33 +0000947Bool PUBLIC
948glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
Brian Paul45360212000-12-14 17:44:08 +0000949{
Brian Paul55ed11b2001-05-24 00:00:57 +0000950 struct _glxapi_table *t;
951 GET_DISPATCH(dpy, t);
Brian Paul45360212000-12-14 17:44:08 +0000952 if (!t)
Brian Paul783d7df2000-12-15 04:02:50 +0000953 return False;
954 return (t->AssociateDMPbufferSGIX)(dpy, pbuffer, params, dmbuffer);
Brian Paul45360212000-12-14 17:44:08 +0000955}
956
957#endif
958
959
Brian Paulb0bb4f62001-05-25 21:51:02 +0000960/*** GLX_SGIX_swap_group ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000961
Brian Paulbe2de8b2004-11-25 23:25:33 +0000962void PUBLIC
963glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member)
Brian Paul783d7df2000-12-15 04:02:50 +0000964{
Brian Paul55ed11b2001-05-24 00:00:57 +0000965 struct _glxapi_table *t;
966 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000967 if (!t)
968 return;
969 (*t->JoinSwapGroupSGIX)(dpy, drawable, member);
970}
971
Brian Paul783d7df2000-12-15 04:02:50 +0000972
Brian Paulb0bb4f62001-05-25 21:51:02 +0000973/*** GLX_SGIX_swap_barrier ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000974
Brian Paulbe2de8b2004-11-25 23:25:33 +0000975void PUBLIC
976glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
Brian Paul783d7df2000-12-15 04:02:50 +0000977{
Brian Paul55ed11b2001-05-24 00:00:57 +0000978 struct _glxapi_table *t;
979 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000980 if (!t)
981 return;
982 (*t->BindSwapBarrierSGIX)(dpy, drawable, barrier);
983}
984
Brian Paulbe2de8b2004-11-25 23:25:33 +0000985Bool PUBLIC
986glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
Brian Paul783d7df2000-12-15 04:02:50 +0000987{
Brian Paul55ed11b2001-05-24 00:00:57 +0000988 struct _glxapi_table *t;
989 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +0000990 if (!t)
991 return False;
992 return (*t->QueryMaxSwapBarriersSGIX)(dpy, screen, max);
993}
994
Brian Paul783d7df2000-12-15 04:02:50 +0000995
996
Brian Paulb0bb4f62001-05-25 21:51:02 +0000997/*** GLX_SUN_get_transparent_index ***/
Brian Paul783d7df2000-12-15 04:02:50 +0000998
Brian Paulbe2de8b2004-11-25 23:25:33 +0000999Status PUBLIC
1000glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
Brian Paul783d7df2000-12-15 04:02:50 +00001001{
Brian Paul55ed11b2001-05-24 00:00:57 +00001002 struct _glxapi_table *t;
1003 GET_DISPATCH(dpy, t);
Brian Paul783d7df2000-12-15 04:02:50 +00001004 if (!t)
1005 return False;
1006 return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent);
1007}
1008
Brian Paul783d7df2000-12-15 04:02:50 +00001009
Brian Paul45360212000-12-14 17:44:08 +00001010
Brian Paulb0bb4f62001-05-25 21:51:02 +00001011/*** GLX_MESA_copy_sub_buffer ***/
Brian Paule17ba711999-11-28 20:07:33 +00001012
Brian Paulbe2de8b2004-11-25 23:25:33 +00001013void PUBLIC
1014glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height)
Brian Paule17ba711999-11-28 20:07:33 +00001015{
Brian Paul55ed11b2001-05-24 00:00:57 +00001016 struct _glxapi_table *t;
1017 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +00001018 if (!t)
1019 return;
1020 (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height);
1021}
1022
Brian Paule17ba711999-11-28 20:07:33 +00001023
1024
Brian Paulb0bb4f62001-05-25 21:51:02 +00001025/*** GLX_MESA_release_buffers ***/
Brian Paule17ba711999-11-28 20:07:33 +00001026
Brian Paulbe2de8b2004-11-25 23:25:33 +00001027Bool PUBLIC
1028glXReleaseBuffersMESA(Display *dpy, Window w)
Brian Paule17ba711999-11-28 20:07:33 +00001029{
Brian Paul55ed11b2001-05-24 00:00:57 +00001030 struct _glxapi_table *t;
1031 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +00001032 if (!t)
1033 return False;
1034 return (t->ReleaseBuffersMESA)(dpy, w);
1035}
1036
Brian Paule17ba711999-11-28 20:07:33 +00001037
1038
Brian Paulb0bb4f62001-05-25 21:51:02 +00001039/*** GLX_MESA_pixmap_colormap ***/
Brian Paule17ba711999-11-28 20:07:33 +00001040
Brian Paulbe2de8b2004-11-25 23:25:33 +00001041GLXPixmap PUBLIC
1042glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap)
Brian Paule17ba711999-11-28 20:07:33 +00001043{
Brian Paul55ed11b2001-05-24 00:00:57 +00001044 struct _glxapi_table *t;
1045 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +00001046 if (!t)
1047 return 0;
1048 return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
1049}
1050
Brian Paule17ba711999-11-28 20:07:33 +00001051
1052
Brian Paulb0bb4f62001-05-25 21:51:02 +00001053/*** GLX_MESA_set_3dfx_mode ***/
Brian Paule17ba711999-11-28 20:07:33 +00001054
Brian Paulbe2de8b2004-11-25 23:25:33 +00001055Bool PUBLIC
1056glXSet3DfxModeMESA(int mode)
Brian Paule17ba711999-11-28 20:07:33 +00001057{
Brian Paul55ed11b2001-05-24 00:00:57 +00001058 struct _glxapi_table *t;
Brian Paul7cf50e12001-05-24 19:06:21 +00001059 Display *dpy = glXGetCurrentDisplay();
1060 GET_DISPATCH(dpy, t);
Brian Paule17ba711999-11-28 20:07:33 +00001061 if (!t)
1062 return False;
1063 return (t->Set3DfxModeMESA)(mode);
1064}
1065
Brian Paule17ba711999-11-28 20:07:33 +00001066
1067
Brian Pauld6113fc2002-11-18 15:11:49 +00001068/*** GLX_NV_vertex_array_range ***/
Brian Paul8fefafa2002-08-22 21:10:01 +00001069
Brian Paulbe2de8b2004-11-25 23:25:33 +00001070void PUBLIC *
Brian Paul8fefafa2002-08-22 21:10:01 +00001071glXAllocateMemoryNV( GLsizei size,
1072 GLfloat readFrequency,
1073 GLfloat writeFrequency,
1074 GLfloat priority )
1075{
1076 struct _glxapi_table *t;
1077 Display *dpy = glXGetCurrentDisplay();
1078 GET_DISPATCH(dpy, t);
1079 if (!t)
1080 return NULL;
1081 return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority);
1082}
1083
1084
Brian Paulbe2de8b2004-11-25 23:25:33 +00001085void PUBLIC
Brian Paul8fefafa2002-08-22 21:10:01 +00001086glXFreeMemoryNV( GLvoid *pointer )
1087{
1088 struct _glxapi_table *t;
1089 Display *dpy = glXGetCurrentDisplay();
1090 GET_DISPATCH(dpy, t);
1091 if (!t)
1092 return;
1093 (t->FreeMemoryNV)(pointer);
1094}
1095
1096
Brian Paul7cd2ae92005-03-01 02:51:07 +00001097
1098
Brian Pauld6113fc2002-11-18 15:11:49 +00001099/*** GLX_MESA_agp_offset */
1100
Brian Paulbe2de8b2004-11-25 23:25:33 +00001101GLuint PUBLIC
Brian Pauld6113fc2002-11-18 15:11:49 +00001102glXGetAGPOffsetMESA( const GLvoid *pointer )
1103{
1104 struct _glxapi_table *t;
1105 Display *dpy = glXGetCurrentDisplay();
1106 GET_DISPATCH(dpy, t);
1107 if (!t)
1108 return ~0;
1109 return (t->GetAGPOffsetMESA)(pointer);
1110}
1111
Brian Paule17ba711999-11-28 20:07:33 +00001112
Brian Paul7cd2ae92005-03-01 02:51:07 +00001113/*** GLX_MESA_allocate_memory */
1114
1115void *
1116glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size,
1117 float readfreq, float writefreq, float priority)
1118{
1119 /* dummy */
1120 return NULL;
1121}
1122
1123void
1124glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
1125{
1126 /* dummy */
1127}
1128
1129
1130GLuint
1131glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer)
1132{
1133 /* dummy */
1134 return 0;
1135}
1136
1137
Brianfd545642007-05-19 08:27:35 -06001138/*** GLX_EXT_texture_from_pixmap */
1139
1140void
1141glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer,
1142 const int *attrib_list)
1143{
1144 struct _glxapi_table *t;
1145 GET_DISPATCH(dpy, t);
1146 if (t)
1147 t->BindTexImageEXT(dpy, drawable, buffer, attrib_list);
1148}
1149
1150void
1151glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer)
1152{
1153 struct _glxapi_table *t;
1154 GET_DISPATCH(dpy, t);
1155 if (t)
1156 t->ReleaseTexImageEXT(dpy, drawable, buffer);
1157}
1158
Brian Paul7cd2ae92005-03-01 02:51:07 +00001159
Brian Paule17ba711999-11-28 20:07:33 +00001160/**********************************************************************/
1161/* GLX API management functions */
1162/**********************************************************************/
1163
1164
1165const char *
1166_glxapi_get_version(void)
1167{
1168 return "1.3";
1169}
1170
1171
1172/*
1173 * Return array of extension strings.
1174 */
1175const char **
1176_glxapi_get_extensions(void)
1177{
1178 static const char *extensions[] = {
Brian Paul4c07bd52000-06-08 22:50:28 +00001179#ifdef GLX_EXT_import_context
Brian Paule17ba711999-11-28 20:07:33 +00001180 "GLX_EXT_import_context",
1181#endif
Brian Paul4c07bd52000-06-08 22:50:28 +00001182#ifdef GLX_SGI_video_sync
Brian Paule17ba711999-11-28 20:07:33 +00001183 "GLX_SGI_video_sync",
1184#endif
Brian Paul4c07bd52000-06-08 22:50:28 +00001185#ifdef GLX_MESA_copy_sub_buffer
Brian Paule17ba711999-11-28 20:07:33 +00001186 "GLX_MESA_copy_sub_buffer",
1187#endif
Brian Paul4c07bd52000-06-08 22:50:28 +00001188#ifdef GLX_MESA_release_buffers
Brian Paule17ba711999-11-28 20:07:33 +00001189 "GLX_MESA_release_buffers",
1190#endif
Brian Paul4c07bd52000-06-08 22:50:28 +00001191#ifdef GLX_MESA_pixmap_colormap
Brian Paule17ba711999-11-28 20:07:33 +00001192 "GLX_MESA_pixmap_colormap",
1193#endif
Brian Paul4c07bd52000-06-08 22:50:28 +00001194#ifdef GLX_MESA_set_3dfx_mode
Brian Paule17ba711999-11-28 20:07:33 +00001195 "GLX_MESA_set_3dfx_mode",
1196#endif
Brian Paul3c5bfac2003-01-14 04:49:07 +00001197#ifdef GLX_SGIX_fbconfig
1198 "GLX_SGIX_fbconfig",
1199#endif
1200#ifdef GLX_SGIX_pbuffer
1201 "GLX_SGIX_pbuffer",
1202#endif
Brianc1ba3082007-06-12 08:57:12 -06001203#ifdef GLX_EXT_texture_from_pixmap
Brianfd545642007-05-19 08:27:35 -06001204 "GLX_EXT_texture_from_pixmap",
1205#endif
Jesse Barnes7f170572009-11-12 16:48:07 +00001206#ifdef GLX_INTEL_swap_event
1207 "GLX_INTEL_swap_event",
1208#endif
Brian Paule17ba711999-11-28 20:07:33 +00001209 NULL
1210 };
1211 return extensions;
1212}
1213
1214
1215/*
1216 * Return size of the GLX dispatch table, in entries, not bytes.
1217 */
1218GLuint
1219_glxapi_get_dispatch_table_size(void)
1220{
1221 return sizeof(struct _glxapi_table) / sizeof(void *);
1222}
1223
1224
1225static int
1226generic_no_op_func(void)
1227{
jtgafb833d1999-08-19 00:55:39 +00001228 return 0;
1229}
1230
1231
1232/*
Brian Paule17ba711999-11-28 20:07:33 +00001233 * Initialize all functions in given dispatch table to be no-ops
jtgafb833d1999-08-19 00:55:39 +00001234 */
Brian Paule17ba711999-11-28 20:07:33 +00001235void
1236_glxapi_set_no_op_table(struct _glxapi_table *t)
jtgafb833d1999-08-19 00:55:39 +00001237{
Brian Paulbe2de8b2004-11-25 23:25:33 +00001238 typedef int (*nop_func)(void);
1239 nop_func *dispatch = (nop_func *) t;
Brian Paule17ba711999-11-28 20:07:33 +00001240 GLuint n = _glxapi_get_dispatch_table_size();
1241 GLuint i;
Brian Paule17ba711999-11-28 20:07:33 +00001242 for (i = 0; i < n; i++) {
Brian Paulbe2de8b2004-11-25 23:25:33 +00001243 dispatch[i] = generic_no_op_func;
Brian Paule17ba711999-11-28 20:07:33 +00001244 }
jtgafb833d1999-08-19 00:55:39 +00001245}
1246
Brian Paule17ba711999-11-28 20:07:33 +00001247
Brian Paule17ba711999-11-28 20:07:33 +00001248struct name_address_pair {
1249 const char *Name;
Brian Paulbe2de8b2004-11-25 23:25:33 +00001250 __GLXextFuncPtr Address;
Brian Paule17ba711999-11-28 20:07:33 +00001251};
1252
1253static struct name_address_pair GLX_functions[] = {
Brian Paulb0bb4f62001-05-25 21:51:02 +00001254 /*** GLX_VERSION_1_0 ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001255 { "glXChooseVisual", (__GLXextFuncPtr) glXChooseVisual },
1256 { "glXCopyContext", (__GLXextFuncPtr) glXCopyContext },
1257 { "glXCreateContext", (__GLXextFuncPtr) glXCreateContext },
1258 { "glXCreateGLXPixmap", (__GLXextFuncPtr) glXCreateGLXPixmap },
1259 { "glXDestroyContext", (__GLXextFuncPtr) glXDestroyContext },
1260 { "glXDestroyGLXPixmap", (__GLXextFuncPtr) glXDestroyGLXPixmap },
1261 { "glXGetConfig", (__GLXextFuncPtr) glXGetConfig },
1262 { "glXGetCurrentContext", (__GLXextFuncPtr) glXGetCurrentContext },
1263 { "glXGetCurrentDrawable", (__GLXextFuncPtr) glXGetCurrentDrawable },
1264 { "glXIsDirect", (__GLXextFuncPtr) glXIsDirect },
1265 { "glXMakeCurrent", (__GLXextFuncPtr) glXMakeCurrent },
1266 { "glXQueryExtension", (__GLXextFuncPtr) glXQueryExtension },
1267 { "glXQueryVersion", (__GLXextFuncPtr) glXQueryVersion },
1268 { "glXSwapBuffers", (__GLXextFuncPtr) glXSwapBuffers },
1269 { "glXUseXFont", (__GLXextFuncPtr) glXUseXFont },
1270 { "glXWaitGL", (__GLXextFuncPtr) glXWaitGL },
1271 { "glXWaitX", (__GLXextFuncPtr) glXWaitX },
Brian Paule17ba711999-11-28 20:07:33 +00001272
Brian Paulb0bb4f62001-05-25 21:51:02 +00001273 /*** GLX_VERSION_1_1 ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001274 { "glXGetClientString", (__GLXextFuncPtr) glXGetClientString },
1275 { "glXQueryExtensionsString", (__GLXextFuncPtr) glXQueryExtensionsString },
1276 { "glXQueryServerString", (__GLXextFuncPtr) glXQueryServerString },
Brian Paul89a42b71999-09-11 11:33:45 +00001277
Brian Paulb0bb4f62001-05-25 21:51:02 +00001278 /*** GLX_VERSION_1_2 ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001279 { "glXGetCurrentDisplay", (__GLXextFuncPtr) glXGetCurrentDisplay },
Brian Paule17ba711999-11-28 20:07:33 +00001280
Brian Paulb0bb4f62001-05-25 21:51:02 +00001281 /*** GLX_VERSION_1_3 ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001282 { "glXChooseFBConfig", (__GLXextFuncPtr) glXChooseFBConfig },
1283 { "glXCreateNewContext", (__GLXextFuncPtr) glXCreateNewContext },
1284 { "glXCreatePbuffer", (__GLXextFuncPtr) glXCreatePbuffer },
1285 { "glXCreatePixmap", (__GLXextFuncPtr) glXCreatePixmap },
1286 { "glXCreateWindow", (__GLXextFuncPtr) glXCreateWindow },
1287 { "glXDestroyPbuffer", (__GLXextFuncPtr) glXDestroyPbuffer },
1288 { "glXDestroyPixmap", (__GLXextFuncPtr) glXDestroyPixmap },
1289 { "glXDestroyWindow", (__GLXextFuncPtr) glXDestroyWindow },
1290 { "glXGetCurrentReadDrawable", (__GLXextFuncPtr) glXGetCurrentReadDrawable },
1291 { "glXGetFBConfigAttrib", (__GLXextFuncPtr) glXGetFBConfigAttrib },
1292 { "glXGetFBConfigs", (__GLXextFuncPtr) glXGetFBConfigs },
1293 { "glXGetSelectedEvent", (__GLXextFuncPtr) glXGetSelectedEvent },
1294 { "glXGetVisualFromFBConfig", (__GLXextFuncPtr) glXGetVisualFromFBConfig },
1295 { "glXMakeContextCurrent", (__GLXextFuncPtr) glXMakeContextCurrent },
1296 { "glXQueryContext", (__GLXextFuncPtr) glXQueryContext },
1297 { "glXQueryDrawable", (__GLXextFuncPtr) glXQueryDrawable },
1298 { "glXSelectEvent", (__GLXextFuncPtr) glXSelectEvent },
Brian Paule17ba711999-11-28 20:07:33 +00001299
Brian Paulba57e522001-09-14 02:43:03 +00001300 /*** GLX_VERSION_1_4 ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001301 { "glXGetProcAddress", (__GLXextFuncPtr) glXGetProcAddress },
Brian Paulba57e522001-09-14 02:43:03 +00001302
Brian Paulffa10b12001-05-29 16:23:26 +00001303 /*** GLX_SGI_swap_control ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001304 { "glXSwapIntervalSGI", (__GLXextFuncPtr) glXSwapIntervalSGI },
Brian Paulffa10b12001-05-29 16:23:26 +00001305
Brian Paulb0bb4f62001-05-25 21:51:02 +00001306 /*** GLX_SGI_video_sync ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001307 { "glXGetVideoSyncSGI", (__GLXextFuncPtr) glXGetVideoSyncSGI },
1308 { "glXWaitVideoSyncSGI", (__GLXextFuncPtr) glXWaitVideoSyncSGI },
Brian Paule17ba711999-11-28 20:07:33 +00001309
Brian Paulffa10b12001-05-29 16:23:26 +00001310 /*** GLX_SGI_make_current_read ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001311 { "glXMakeCurrentReadSGI", (__GLXextFuncPtr) glXMakeCurrentReadSGI },
1312 { "glXGetCurrentReadDrawableSGI", (__GLXextFuncPtr) glXGetCurrentReadDrawableSGI },
Brian Paulffa10b12001-05-29 16:23:26 +00001313
1314 /*** GLX_SGIX_video_source ***/
1315#if defined(_VL_H)
Brian Paulbe2de8b2004-11-25 23:25:33 +00001316 { "glXCreateGLXVideoSourceSGIX", (__GLXextFuncPtr) glXCreateGLXVideoSourceSGIX },
1317 { "glXDestroyGLXVideoSourceSGIX", (__GLXextFuncPtr) glXDestroyGLXVideoSourceSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001318#endif
1319
1320 /*** GLX_EXT_import_context ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001321 { "glXFreeContextEXT", (__GLXextFuncPtr) glXFreeContextEXT },
1322 { "glXGetContextIDEXT", (__GLXextFuncPtr) glXGetContextIDEXT },
1323 { "glXGetCurrentDisplayEXT", (__GLXextFuncPtr) glXGetCurrentDisplayEXT },
1324 { "glXImportContextEXT", (__GLXextFuncPtr) glXImportContextEXT },
1325 { "glXQueryContextInfoEXT", (__GLXextFuncPtr) glXQueryContextInfoEXT },
Brian Paulffa10b12001-05-29 16:23:26 +00001326
1327 /*** GLX_SGIX_fbconfig ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001328 { "glXGetFBConfigAttribSGIX", (__GLXextFuncPtr) glXGetFBConfigAttribSGIX },
1329 { "glXChooseFBConfigSGIX", (__GLXextFuncPtr) glXChooseFBConfigSGIX },
1330 { "glXCreateGLXPixmapWithConfigSGIX", (__GLXextFuncPtr) glXCreateGLXPixmapWithConfigSGIX },
1331 { "glXCreateContextWithConfigSGIX", (__GLXextFuncPtr) glXCreateContextWithConfigSGIX },
1332 { "glXGetVisualFromFBConfigSGIX", (__GLXextFuncPtr) glXGetVisualFromFBConfigSGIX },
1333 { "glXGetFBConfigFromVisualSGIX", (__GLXextFuncPtr) glXGetFBConfigFromVisualSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001334
1335 /*** GLX_SGIX_pbuffer ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001336 { "glXCreateGLXPbufferSGIX", (__GLXextFuncPtr) glXCreateGLXPbufferSGIX },
1337 { "glXDestroyGLXPbufferSGIX", (__GLXextFuncPtr) glXDestroyGLXPbufferSGIX },
1338 { "glXQueryGLXPbufferSGIX", (__GLXextFuncPtr) glXQueryGLXPbufferSGIX },
1339 { "glXSelectEventSGIX", (__GLXextFuncPtr) glXSelectEventSGIX },
1340 { "glXGetSelectedEventSGIX", (__GLXextFuncPtr) glXGetSelectedEventSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001341
1342 /*** GLX_SGI_cushion ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001343 { "glXCushionSGI", (__GLXextFuncPtr) glXCushionSGI },
Brian Paulffa10b12001-05-29 16:23:26 +00001344
1345 /*** GLX_SGIX_video_resize ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001346 { "glXBindChannelToWindowSGIX", (__GLXextFuncPtr) glXBindChannelToWindowSGIX },
1347 { "glXChannelRectSGIX", (__GLXextFuncPtr) glXChannelRectSGIX },
1348 { "glXQueryChannelRectSGIX", (__GLXextFuncPtr) glXQueryChannelRectSGIX },
1349 { "glXQueryChannelDeltasSGIX", (__GLXextFuncPtr) glXQueryChannelDeltasSGIX },
1350 { "glXChannelRectSyncSGIX", (__GLXextFuncPtr) glXChannelRectSyncSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001351
1352 /*** GLX_SGIX_dmbuffer **/
1353#if defined(_DM_BUFFER_H_)
Brian Paulbe2de8b2004-11-25 23:25:33 +00001354 { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001355#endif
1356
1357 /*** GLX_SGIX_swap_group ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001358 { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001359
1360 /*** GLX_SGIX_swap_barrier ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001361 { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX },
1362 { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX },
Brian Paulffa10b12001-05-29 16:23:26 +00001363
1364 /*** GLX_SUN_get_transparent_index ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001365 { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN },
Brian Paulffa10b12001-05-29 16:23:26 +00001366
Brian Paulb0bb4f62001-05-25 21:51:02 +00001367 /*** GLX_MESA_copy_sub_buffer ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001368 { "glXCopySubBufferMESA", (__GLXextFuncPtr) glXCopySubBufferMESA },
Brian Paule17ba711999-11-28 20:07:33 +00001369
Brian Paulb0bb4f62001-05-25 21:51:02 +00001370 /*** GLX_MESA_pixmap_colormap ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001371 { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr) glXCreateGLXPixmapMESA },
Brian Paule17ba711999-11-28 20:07:33 +00001372
Brian Paulffa10b12001-05-29 16:23:26 +00001373 /*** GLX_MESA_release_buffers ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001374 { "glXReleaseBuffersMESA", (__GLXextFuncPtr) glXReleaseBuffersMESA },
Brian Paulffa10b12001-05-29 16:23:26 +00001375
Brian Paulb0bb4f62001-05-25 21:51:02 +00001376 /*** GLX_MESA_set_3dfx_mode ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001377 { "glXSet3DfxModeMESA", (__GLXextFuncPtr) glXSet3DfxModeMESA },
Brian Paule17ba711999-11-28 20:07:33 +00001378
Brian Paulb0bb4f62001-05-25 21:51:02 +00001379 /*** GLX_ARB_get_proc_address ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001380 { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB },
Brian Paule7d9d971999-12-10 15:16:49 +00001381
Brian Pauld6113fc2002-11-18 15:11:49 +00001382 /*** GLX_NV_vertex_array_range ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001383 { "glXAllocateMemoryNV", (__GLXextFuncPtr) glXAllocateMemoryNV },
1384 { "glXFreeMemoryNV", (__GLXextFuncPtr) glXFreeMemoryNV },
Brian Paul8fefafa2002-08-22 21:10:01 +00001385
Brian Pauld6113fc2002-11-18 15:11:49 +00001386 /*** GLX_MESA_agp_offset ***/
Brian Paulbe2de8b2004-11-25 23:25:33 +00001387 { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA },
Brian Paul3c5bfac2003-01-14 04:49:07 +00001388
Brian Paul7cd2ae92005-03-01 02:51:07 +00001389 /*** GLX_MESA_allocate_memory ***/
1390 { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA },
1391 { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA },
1392 { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA },
1393
Brianfd545642007-05-19 08:27:35 -06001394 /*** GLX_EXT_texture_from_pixmap ***/
1395 { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT },
1396 { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT },
1397
Brian Paule17ba711999-11-28 20:07:33 +00001398 { NULL, NULL } /* end of list */
1399};
Brian Paul89a42b71999-09-11 11:33:45 +00001400
Brian Paul43c9c2c1999-09-16 15:52:51 +00001401
Brian Paule17ba711999-11-28 20:07:33 +00001402
1403/*
1404 * Return address of named glX function, or NULL if not found.
1405 */
Brian Paulbe2de8b2004-11-25 23:25:33 +00001406__GLXextFuncPtr
Brian Paule17ba711999-11-28 20:07:33 +00001407_glxapi_get_proc_address(const char *funcName)
Brian Paul89a42b71999-09-11 11:33:45 +00001408{
Brian Paule17ba711999-11-28 20:07:33 +00001409 GLuint i;
1410 for (i = 0; GLX_functions[i].Name; i++) {
Tom Fogal7399d562009-02-23 08:20:38 -07001411#ifdef MANGLE
1412 /* skip the "m" prefix on the name */
1413 if (strcmp(GLX_functions[i].Name, funcName+1) == 0)
1414#else
Brian Paule17ba711999-11-28 20:07:33 +00001415 if (strcmp(GLX_functions[i].Name, funcName) == 0)
Tom Fogal7399d562009-02-23 08:20:38 -07001416#endif
Brian Paule17ba711999-11-28 20:07:33 +00001417 return GLX_functions[i].Address;
1418 }
Brian Paul43c9c2c1999-09-16 15:52:51 +00001419 return NULL;
Brian Paul89a42b71999-09-11 11:33:45 +00001420}
Brian Paule7d9d971999-12-10 15:16:49 +00001421
1422
1423
1424/*
1425 * This function does not get dispatched through the dispatch table
1426 * since it's really a "meta" function.
1427 */
Brian Paulbe2de8b2004-11-25 23:25:33 +00001428__GLXextFuncPtr
1429glXGetProcAddressARB(const GLubyte *procName)
Brian Paule7d9d971999-12-10 15:16:49 +00001430{
Brian Paulbe2de8b2004-11-25 23:25:33 +00001431 __GLXextFuncPtr f;
Brian Paule7d9d971999-12-10 15:16:49 +00001432
Brian Paulbe2de8b2004-11-25 23:25:33 +00001433 f = _glxapi_get_proc_address((const char *) procName);
Brian Paule7d9d971999-12-10 15:16:49 +00001434 if (f) {
1435 return f;
1436 }
1437
Brian Paulbe2de8b2004-11-25 23:25:33 +00001438 f = (__GLXextFuncPtr) _glapi_get_proc_address((const char *) procName);
Brian Paule7d9d971999-12-10 15:16:49 +00001439 return f;
1440}
Brian Paulba57e522001-09-14 02:43:03 +00001441
1442
1443/* GLX 1.4 */
1444void (*glXGetProcAddress(const GLubyte *procName))()
1445{
1446 return glXGetProcAddressARB(procName);
1447}