Merge commit 'origin/gallium-0.1' into gallium-0.2
[mesa.git] / src / gallium / winsys / xlib / glxapi.c
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.1
4 *
5 * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
6 *
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
26 /*
27 * This is the GLX API dispatcher. Calls to the glX* functions are
28 * either routed to the real GLX encoders or to Mesa's pseudo-GLX functions.
29 * See the glxapi.h file for more details.
30 */
31
32
33 #include <assert.h>
34 #include <stdlib.h>
35 #include <stdio.h>
36 #include <string.h>
37 #include "main/glheader.h"
38 #include "glapi/glapi.h"
39 #include "glxapi.h"
40 #include "pipe/p_thread.h"
41
42
43 extern struct _glxapi_table *_real_GetGLXDispatchTable(void);
44 extern struct _glxapi_table *_mesa_GetGLXDispatchTable(void);
45
46
47 struct display_dispatch {
48 Display *Dpy;
49 struct _glxapi_table *Table;
50 struct display_dispatch *Next;
51 };
52
53 static struct display_dispatch *DispatchList = NULL;
54
55
56 /* Display -> Dispatch caching */
57 static Display *prevDisplay = NULL;
58 static struct _glxapi_table *prevTable = NULL;
59
60
61 static struct _glxapi_table *
62 get_dispatch(Display *dpy)
63 {
64 if (!dpy)
65 return NULL;
66
67 /* search list of display/dispatch pairs for this display */
68 {
69 const struct display_dispatch *d = DispatchList;
70 while (d) {
71 if (d->Dpy == dpy) {
72 prevDisplay = dpy;
73 prevTable = d->Table;
74 return d->Table; /* done! */
75 }
76 d = d->Next;
77 }
78 }
79
80 /* A new display, determine if we should use real GLX
81 * or Mesa's pseudo-GLX.
82 */
83 {
84 struct _glxapi_table *t = _mesa_GetGLXDispatchTable();
85
86 if (t) {
87 struct display_dispatch *d;
88 d = (struct display_dispatch *) malloc(sizeof(struct display_dispatch));
89 if (d) {
90 d->Dpy = dpy;
91 d->Table = t;
92 /* insert at head of list */
93 d->Next = DispatchList;
94 DispatchList = d;
95 /* update cache */
96 prevDisplay = dpy;
97 prevTable = t;
98 return t;
99 }
100 }
101 }
102
103 /* If we get here that means we can't use real GLX on this display
104 * and the Mesa pseudo-GLX software renderer wasn't compiled in.
105 * Or, we ran out of memory!
106 */
107 return NULL;
108 }
109
110
111 /* Don't use the GET_DISPATCH defined in glthread.h */
112 #undef GET_DISPATCH
113
114 #define GET_DISPATCH(DPY, TABLE) \
115 if (DPY == prevDisplay) { \
116 TABLE = prevTable; \
117 } \
118 else if (!DPY) { \
119 TABLE = NULL; \
120 } \
121 else { \
122 TABLE = get_dispatch(DPY); \
123 }
124
125
126
127
128 /**
129 * GLX API current context.
130 */
131 pipe_tsd ContextTSD;
132
133
134 static void
135 SetCurrentContext(GLXContext c)
136 {
137 pipe_tsd_set(&ContextTSD, c);
138 }
139
140
141 /*
142 * GLX API entrypoints
143 */
144
145 /*** GLX_VERSION_1_0 ***/
146
147 XVisualInfo PUBLIC *
148 glXChooseVisual(Display *dpy, int screen, int *list)
149 {
150 struct _glxapi_table *t;
151 GET_DISPATCH(dpy, t);
152 if (!t)
153 return NULL;
154 return (t->ChooseVisual)(dpy, screen, list);
155 }
156
157
158 void PUBLIC
159 glXCopyContext(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask)
160 {
161 struct _glxapi_table *t;
162 GET_DISPATCH(dpy, t);
163 if (!t)
164 return;
165 (t->CopyContext)(dpy, src, dst, mask);
166 }
167
168
169 GLXContext PUBLIC
170 glXCreateContext(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct)
171 {
172 struct _glxapi_table *t;
173 GET_DISPATCH(dpy, t);
174 if (!t)
175 return 0;
176 return (t->CreateContext)(dpy, visinfo, shareList, direct);
177 }
178
179
180 GLXPixmap PUBLIC
181 glXCreateGLXPixmap(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap)
182 {
183 struct _glxapi_table *t;
184 GET_DISPATCH(dpy, t);
185 if (!t)
186 return 0;
187 return (t->CreateGLXPixmap)(dpy, visinfo, pixmap);
188 }
189
190
191 void PUBLIC
192 glXDestroyContext(Display *dpy, GLXContext ctx)
193 {
194 struct _glxapi_table *t;
195 GET_DISPATCH(dpy, t);
196 if (!t)
197 return;
198 if (glXGetCurrentContext() == ctx)
199 SetCurrentContext(NULL);
200 (t->DestroyContext)(dpy, ctx);
201 }
202
203
204 void PUBLIC
205 glXDestroyGLXPixmap(Display *dpy, GLXPixmap pixmap)
206 {
207 struct _glxapi_table *t;
208 GET_DISPATCH(dpy, t);
209 if (!t)
210 return;
211 (t->DestroyGLXPixmap)(dpy, pixmap);
212 }
213
214
215 int PUBLIC
216 glXGetConfig(Display *dpy, XVisualInfo *visinfo, int attrib, int *value)
217 {
218 struct _glxapi_table *t;
219 GET_DISPATCH(dpy, t);
220 if (!t)
221 return GLX_NO_EXTENSION;
222 return (t->GetConfig)(dpy, visinfo, attrib, value);
223 }
224
225
226 GLXContext PUBLIC
227 glXGetCurrentContext(void)
228 {
229 return (GLXContext) pipe_tsd_get(&ContextTSD);
230 }
231
232
233 GLXDrawable PUBLIC
234 glXGetCurrentDrawable(void)
235 {
236 __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
237 return gc ? gc->currentDrawable : 0;
238 }
239
240
241 Bool PUBLIC
242 glXIsDirect(Display *dpy, GLXContext ctx)
243 {
244 struct _glxapi_table *t;
245 GET_DISPATCH(dpy, t);
246 if (!t)
247 return False;
248 return (t->IsDirect)(dpy, ctx);
249 }
250
251
252 Bool PUBLIC
253 glXMakeCurrent(Display *dpy, GLXDrawable drawable, GLXContext ctx)
254 {
255 Bool b;
256 struct _glxapi_table *t;
257 GET_DISPATCH(dpy, t);
258 if (!t) {
259 return False;
260 }
261 b = (*t->MakeCurrent)(dpy, drawable, ctx);
262 if (b) {
263 SetCurrentContext(ctx);
264 }
265 return b;
266 }
267
268
269 Bool PUBLIC
270 glXQueryExtension(Display *dpy, int *errorb, int *event)
271 {
272 struct _glxapi_table *t;
273 GET_DISPATCH(dpy, t);
274 if (!t)
275 return False;
276 return (t->QueryExtension)(dpy, errorb, event);
277 }
278
279
280 Bool PUBLIC
281 glXQueryVersion(Display *dpy, int *maj, int *min)
282 {
283 struct _glxapi_table *t;
284 GET_DISPATCH(dpy, t);
285 if (!t)
286 return False;
287 return (t->QueryVersion)(dpy, maj, min);
288 }
289
290
291 void PUBLIC
292 glXSwapBuffers(Display *dpy, GLXDrawable drawable)
293 {
294 struct _glxapi_table *t;
295 GET_DISPATCH(dpy, t);
296 if (!t)
297 return;
298 (t->SwapBuffers)(dpy, drawable);
299 }
300
301
302 void PUBLIC
303 glXUseXFont(Font font, int first, int count, int listBase)
304 {
305 struct _glxapi_table *t;
306 Display *dpy = glXGetCurrentDisplay();
307 GET_DISPATCH(dpy, t);
308 if (!t)
309 return;
310 (t->UseXFont)(font, first, count, listBase);
311 }
312
313
314 void PUBLIC
315 glXWaitGL(void)
316 {
317 struct _glxapi_table *t;
318 Display *dpy = glXGetCurrentDisplay();
319 GET_DISPATCH(dpy, t);
320 if (!t)
321 return;
322 (t->WaitGL)();
323 }
324
325
326 void PUBLIC
327 glXWaitX(void)
328 {
329 struct _glxapi_table *t;
330 Display *dpy = glXGetCurrentDisplay();
331 GET_DISPATCH(dpy, t);
332 if (!t)
333 return;
334 (t->WaitX)();
335 }
336
337
338
339 /*** GLX_VERSION_1_1 ***/
340
341 const char PUBLIC *
342 glXGetClientString(Display *dpy, int name)
343 {
344 struct _glxapi_table *t;
345 GET_DISPATCH(dpy, t);
346 if (!t)
347 return NULL;
348 return (t->GetClientString)(dpy, name);
349 }
350
351
352 const char PUBLIC *
353 glXQueryExtensionsString(Display *dpy, int screen)
354 {
355 struct _glxapi_table *t;
356 GET_DISPATCH(dpy, t);
357 if (!t)
358 return NULL;
359 return (t->QueryExtensionsString)(dpy, screen);
360 }
361
362
363 const char PUBLIC *
364 glXQueryServerString(Display *dpy, int screen, int name)
365 {
366 struct _glxapi_table *t;
367 GET_DISPATCH(dpy, t);
368 if (!t)
369 return NULL;
370 return (t->QueryServerString)(dpy, screen, name);
371 }
372
373
374 /*** GLX_VERSION_1_2 ***/
375
376 Display PUBLIC *
377 glXGetCurrentDisplay(void)
378 {
379 /* Same code as in libGL's glxext.c */
380 __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
381 if (NULL == gc) return NULL;
382 return gc->currentDpy;
383 }
384
385
386
387 /*** GLX_VERSION_1_3 ***/
388
389 GLXFBConfig PUBLIC *
390 glXChooseFBConfig(Display *dpy, int screen, const int *attribList, int *nitems)
391 {
392 struct _glxapi_table *t;
393 GET_DISPATCH(dpy, t);
394 if (!t)
395 return 0;
396 return (t->ChooseFBConfig)(dpy, screen, attribList, nitems);
397 }
398
399
400 GLXContext PUBLIC
401 glXCreateNewContext(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct)
402 {
403 struct _glxapi_table *t;
404 GET_DISPATCH(dpy, t);
405 if (!t)
406 return 0;
407 return (t->CreateNewContext)(dpy, config, renderType, shareList, direct);
408 }
409
410
411 GLXPbuffer PUBLIC
412 glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attribList)
413 {
414 struct _glxapi_table *t;
415 GET_DISPATCH(dpy, t);
416 if (!t)
417 return 0;
418 return (t->CreatePbuffer)(dpy, config, attribList);
419 }
420
421
422 GLXPixmap PUBLIC
423 glXCreatePixmap(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList)
424 {
425 struct _glxapi_table *t;
426 GET_DISPATCH(dpy, t);
427 if (!t)
428 return 0;
429 return (t->CreatePixmap)(dpy, config, pixmap, attribList);
430 }
431
432
433 GLXWindow PUBLIC
434 glXCreateWindow(Display *dpy, GLXFBConfig config, Window win, const int *attribList)
435 {
436 struct _glxapi_table *t;
437 GET_DISPATCH(dpy, t);
438 if (!t)
439 return 0;
440 return (t->CreateWindow)(dpy, config, win, attribList);
441 }
442
443
444 void PUBLIC
445 glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
446 {
447 struct _glxapi_table *t;
448 GET_DISPATCH(dpy, t);
449 if (!t)
450 return;
451 (t->DestroyPbuffer)(dpy, pbuf);
452 }
453
454
455 void PUBLIC
456 glXDestroyPixmap(Display *dpy, GLXPixmap pixmap)
457 {
458 struct _glxapi_table *t;
459 GET_DISPATCH(dpy, t);
460 if (!t)
461 return;
462 (t->DestroyPixmap)(dpy, pixmap);
463 }
464
465
466 void PUBLIC
467 glXDestroyWindow(Display *dpy, GLXWindow window)
468 {
469 struct _glxapi_table *t;
470 GET_DISPATCH(dpy, t);
471 if (!t)
472 return;
473 (t->DestroyWindow)(dpy, window);
474 }
475
476
477 GLXDrawable PUBLIC
478 glXGetCurrentReadDrawable(void)
479 {
480 __GLXcontext *gc = (__GLXcontext *) glXGetCurrentContext();
481 return gc ? gc->currentReadable : 0;
482 }
483
484
485 int PUBLIC
486 glXGetFBConfigAttrib(Display *dpy, GLXFBConfig config, int attribute, int *value)
487 {
488 struct _glxapi_table *t;
489 GET_DISPATCH(dpy, t);
490 if (!t)
491 return GLX_NO_EXTENSION;
492 return (t->GetFBConfigAttrib)(dpy, config, attribute, value);
493 }
494
495
496 GLXFBConfig PUBLIC *
497 glXGetFBConfigs(Display *dpy, int screen, int *nelements)
498 {
499 struct _glxapi_table *t;
500 GET_DISPATCH(dpy, t);
501 if (!t)
502 return 0;
503 return (t->GetFBConfigs)(dpy, screen, nelements);
504 }
505
506 void PUBLIC
507 glXGetSelectedEvent(Display *dpy, GLXDrawable drawable, unsigned long *mask)
508 {
509 struct _glxapi_table *t;
510 GET_DISPATCH(dpy, t);
511 if (!t)
512 return;
513 (t->GetSelectedEvent)(dpy, drawable, mask);
514 }
515
516
517 XVisualInfo PUBLIC *
518 glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
519 {
520 struct _glxapi_table *t;
521 GET_DISPATCH(dpy, t);
522 if (!t)
523 return NULL;
524 return (t->GetVisualFromFBConfig)(dpy, config);
525 }
526
527
528 Bool PUBLIC
529 glXMakeContextCurrent(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
530 {
531 Bool b;
532 struct _glxapi_table *t;
533 GET_DISPATCH(dpy, t);
534 if (!t)
535 return False;
536 b = (t->MakeContextCurrent)(dpy, draw, read, ctx);
537 if (b) {
538 SetCurrentContext(ctx);
539 }
540 return b;
541 }
542
543
544 int PUBLIC
545 glXQueryContext(Display *dpy, GLXContext ctx, int attribute, int *value)
546 {
547 struct _glxapi_table *t;
548 GET_DISPATCH(dpy, t);
549 assert(t);
550 if (!t)
551 return 0; /* XXX correct? */
552 return (t->QueryContext)(dpy, ctx, attribute, value);
553 }
554
555
556 void PUBLIC
557 glXQueryDrawable(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value)
558 {
559 struct _glxapi_table *t;
560 GET_DISPATCH(dpy, t);
561 if (!t)
562 return;
563 (t->QueryDrawable)(dpy, draw, attribute, value);
564 }
565
566
567 void PUBLIC
568 glXSelectEvent(Display *dpy, GLXDrawable drawable, unsigned long mask)
569 {
570 struct _glxapi_table *t;
571 GET_DISPATCH(dpy, t);
572 if (!t)
573 return;
574 (t->SelectEvent)(dpy, drawable, mask);
575 }
576
577
578
579 /*** GLX_SGI_swap_control ***/
580
581 int PUBLIC
582 glXSwapIntervalSGI(int interval)
583 {
584 struct _glxapi_table *t;
585 Display *dpy = glXGetCurrentDisplay();
586 GET_DISPATCH(dpy, t);
587 if (!t)
588 return 0;
589 return (t->SwapIntervalSGI)(interval);
590 }
591
592
593
594 /*** GLX_SGI_video_sync ***/
595
596 int PUBLIC
597 glXGetVideoSyncSGI(unsigned int *count)
598 {
599 struct _glxapi_table *t;
600 Display *dpy = glXGetCurrentDisplay();
601 GET_DISPATCH(dpy, t);
602 if (!t || !glXGetCurrentContext())
603 return GLX_BAD_CONTEXT;
604 return (t->GetVideoSyncSGI)(count);
605 }
606
607 int PUBLIC
608 glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count)
609 {
610 struct _glxapi_table *t;
611 Display *dpy = glXGetCurrentDisplay();
612 GET_DISPATCH(dpy, t);
613 if (!t || !glXGetCurrentContext())
614 return GLX_BAD_CONTEXT;
615 return (t->WaitVideoSyncSGI)(divisor, remainder, count);
616 }
617
618
619
620 /*** GLX_SGI_make_current_read ***/
621
622 Bool PUBLIC
623 glXMakeCurrentReadSGI(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx)
624 {
625 struct _glxapi_table *t;
626 GET_DISPATCH(dpy, t);
627 if (!t)
628 return False;
629 return (t->MakeCurrentReadSGI)(dpy, draw, read, ctx);
630 }
631
632 GLXDrawable PUBLIC
633 glXGetCurrentReadDrawableSGI(void)
634 {
635 return glXGetCurrentReadDrawable();
636 }
637
638
639 #if defined(_VL_H)
640
641 GLXVideoSourceSGIX PUBLIC
642 glXCreateGLXVideoSourceSGIX(Display *dpy, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode)
643 {
644 struct _glxapi_table *t;
645 GET_DISPATCH(dpy, t);
646 if (!t)
647 return 0;
648 return (t->CreateGLXVideoSourceSGIX)(dpy, screen, server, path, nodeClass, drainNode);
649 }
650
651 void PUBLIC
652 glXDestroyGLXVideoSourceSGIX(Display *dpy, GLXVideoSourceSGIX src)
653 {
654 struct _glxapi_table *t;
655 GET_DISPATCH(dpy, t);
656 if (!t)
657 return 0;
658 return (t->DestroyGLXVideoSourceSGIX)(dpy, src);
659 }
660
661 #endif
662
663
664 /*** GLX_EXT_import_context ***/
665
666 void PUBLIC
667 glXFreeContextEXT(Display *dpy, GLXContext context)
668 {
669 struct _glxapi_table *t;
670 GET_DISPATCH(dpy, t);
671 if (!t)
672 return;
673 (t->FreeContextEXT)(dpy, context);
674 }
675
676 GLXContextID PUBLIC
677 glXGetContextIDEXT(const GLXContext context)
678 {
679 return ((__GLXcontext *) context)->xid;
680 }
681
682 Display PUBLIC *
683 glXGetCurrentDisplayEXT(void)
684 {
685 return glXGetCurrentDisplay();
686 }
687
688 GLXContext PUBLIC
689 glXImportContextEXT(Display *dpy, GLXContextID contextID)
690 {
691 struct _glxapi_table *t;
692 GET_DISPATCH(dpy, t);
693 if (!t)
694 return 0;
695 return (t->ImportContextEXT)(dpy, contextID);
696 }
697
698 int PUBLIC
699 glXQueryContextInfoEXT(Display *dpy, GLXContext context, int attribute,int *value)
700 {
701 struct _glxapi_table *t;
702 GET_DISPATCH(dpy, t);
703 if (!t)
704 return 0; /* XXX ok? */
705 return (t->QueryContextInfoEXT)(dpy, context, attribute, value);
706 }
707
708
709
710 /*** GLX_SGIX_fbconfig ***/
711
712 int PUBLIC
713 glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute, int *value)
714 {
715 struct _glxapi_table *t;
716 GET_DISPATCH(dpy, t);
717 if (!t)
718 return 0;
719 return (t->GetFBConfigAttribSGIX)(dpy, config, attribute, value);
720 }
721
722 GLXFBConfigSGIX PUBLIC *
723 glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_list, int *nelements)
724 {
725 struct _glxapi_table *t;
726 GET_DISPATCH(dpy, t);
727 if (!t)
728 return 0;
729 return (t->ChooseFBConfigSGIX)(dpy, screen, attrib_list, nelements);
730 }
731
732 GLXPixmap PUBLIC
733 glXCreateGLXPixmapWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap)
734 {
735 struct _glxapi_table *t;
736 GET_DISPATCH(dpy, t);
737 if (!t)
738 return 0;
739 return (t->CreateGLXPixmapWithConfigSGIX)(dpy, config, pixmap);
740 }
741
742 GLXContext PUBLIC
743 glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct)
744 {
745 struct _glxapi_table *t;
746 GET_DISPATCH(dpy, t);
747 if (!t)
748 return 0;
749 return (t->CreateContextWithConfigSGIX)(dpy, config, render_type, share_list, direct);
750 }
751
752 XVisualInfo PUBLIC *
753 glXGetVisualFromFBConfigSGIX(Display *dpy, GLXFBConfigSGIX config)
754 {
755 struct _glxapi_table *t;
756 GET_DISPATCH(dpy, t);
757 if (!t)
758 return 0;
759 return (t->GetVisualFromFBConfigSGIX)(dpy, config);
760 }
761
762 GLXFBConfigSGIX PUBLIC
763 glXGetFBConfigFromVisualSGIX(Display *dpy, XVisualInfo *vis)
764 {
765 struct _glxapi_table *t;
766 GET_DISPATCH(dpy, t);
767 if (!t)
768 return 0;
769 return (t->GetFBConfigFromVisualSGIX)(dpy, vis);
770 }
771
772
773
774 /*** GLX_SGIX_pbuffer ***/
775
776 GLXPbufferSGIX PUBLIC
777 glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list)
778 {
779 struct _glxapi_table *t;
780 GET_DISPATCH(dpy, t);
781 if (!t)
782 return 0;
783 return (t->CreateGLXPbufferSGIX)(dpy, config, width, height, attrib_list);
784 }
785
786 void PUBLIC
787 glXDestroyGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf)
788 {
789 struct _glxapi_table *t;
790 GET_DISPATCH(dpy, t);
791 if (!t)
792 return;
793 (t->DestroyGLXPbufferSGIX)(dpy, pbuf);
794 }
795
796 int PUBLIC
797 glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value)
798 {
799 struct _glxapi_table *t;
800 GET_DISPATCH(dpy, t);
801 if (!t)
802 return 0;
803 return (t->QueryGLXPbufferSGIX)(dpy, pbuf, attribute, value);
804 }
805
806 void PUBLIC
807 glXSelectEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long mask)
808 {
809 struct _glxapi_table *t;
810 GET_DISPATCH(dpy, t);
811 if (!t)
812 return;
813 (t->SelectEventSGIX)(dpy, drawable, mask);
814 }
815
816 void PUBLIC
817 glXGetSelectedEventSGIX(Display *dpy, GLXDrawable drawable, unsigned long *mask)
818 {
819 struct _glxapi_table *t;
820 GET_DISPATCH(dpy, t);
821 if (!t)
822 return;
823 (t->GetSelectedEventSGIX)(dpy, drawable, mask);
824 }
825
826
827
828 /*** GLX_SGI_cushion ***/
829
830 void PUBLIC
831 glXCushionSGI(Display *dpy, Window win, float cushion)
832 {
833 struct _glxapi_table *t;
834 GET_DISPATCH(dpy, t);
835 if (!t)
836 return;
837 (t->CushionSGI)(dpy, win, cushion);
838 }
839
840
841
842 /*** GLX_SGIX_video_resize ***/
843
844 int PUBLIC
845 glXBindChannelToWindowSGIX(Display *dpy, int screen, int channel , Window window)
846 {
847 struct _glxapi_table *t;
848 GET_DISPATCH(dpy, t);
849 if (!t)
850 return 0;
851 return (t->BindChannelToWindowSGIX)(dpy, screen, channel, window);
852 }
853
854 int PUBLIC
855 glXChannelRectSGIX(Display *dpy, int screen, int channel, int x, int y, int w, int h)
856 {
857 struct _glxapi_table *t;
858 GET_DISPATCH(dpy, t);
859 if (!t)
860 return 0;
861 return (t->ChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
862 }
863
864 int PUBLIC
865 glXQueryChannelRectSGIX(Display *dpy, int screen, int channel, int *x, int *y, int *w, int *h)
866 {
867 struct _glxapi_table *t;
868 GET_DISPATCH(dpy, t);
869 if (!t)
870 return 0;
871 return (t->QueryChannelRectSGIX)(dpy, screen, channel, x, y, w, h);
872 }
873
874 int PUBLIC
875 glXQueryChannelDeltasSGIX(Display *dpy, int screen, int channel, int *dx, int *dy, int *dw, int *dh)
876 {
877 struct _glxapi_table *t;
878 GET_DISPATCH(dpy, t);
879 if (!t)
880 return 0;
881 return (t->QueryChannelDeltasSGIX)(dpy, screen, channel, dx, dy, dw, dh);
882 }
883
884 int PUBLIC
885 glXChannelRectSyncSGIX(Display *dpy, int screen, int channel, GLenum synctype)
886 {
887 struct _glxapi_table *t;
888 GET_DISPATCH(dpy, t);
889 if (!t)
890 return 0;
891 return (t->ChannelRectSyncSGIX)(dpy, screen, channel, synctype);
892 }
893
894
895
896 #if defined(_DM_BUFFER_H_)
897
898 Bool PUBLIC
899 glXAssociateDMPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer)
900 {
901 struct _glxapi_table *t;
902 GET_DISPATCH(dpy, t);
903 if (!t)
904 return False;
905 return (t->AssociateDMPbufferSGIX)(dpy, pbuffer, params, dmbuffer);
906 }
907
908 #endif
909
910
911 /*** GLX_SGIX_swap_group ***/
912
913 void PUBLIC
914 glXJoinSwapGroupSGIX(Display *dpy, GLXDrawable drawable, GLXDrawable member)
915 {
916 struct _glxapi_table *t;
917 GET_DISPATCH(dpy, t);
918 if (!t)
919 return;
920 (*t->JoinSwapGroupSGIX)(dpy, drawable, member);
921 }
922
923
924 /*** GLX_SGIX_swap_barrier ***/
925
926 void PUBLIC
927 glXBindSwapBarrierSGIX(Display *dpy, GLXDrawable drawable, int barrier)
928 {
929 struct _glxapi_table *t;
930 GET_DISPATCH(dpy, t);
931 if (!t)
932 return;
933 (*t->BindSwapBarrierSGIX)(dpy, drawable, barrier);
934 }
935
936 Bool PUBLIC
937 glXQueryMaxSwapBarriersSGIX(Display *dpy, int screen, int *max)
938 {
939 struct _glxapi_table *t;
940 GET_DISPATCH(dpy, t);
941 if (!t)
942 return False;
943 return (*t->QueryMaxSwapBarriersSGIX)(dpy, screen, max);
944 }
945
946
947
948 /*** GLX_SUN_get_transparent_index ***/
949
950 Status PUBLIC
951 glXGetTransparentIndexSUN(Display *dpy, Window overlay, Window underlay, long *pTransparent)
952 {
953 struct _glxapi_table *t;
954 GET_DISPATCH(dpy, t);
955 if (!t)
956 return False;
957 return (*t->GetTransparentIndexSUN)(dpy, overlay, underlay, pTransparent);
958 }
959
960
961
962 /*** GLX_MESA_copy_sub_buffer ***/
963
964 void PUBLIC
965 glXCopySubBufferMESA(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height)
966 {
967 struct _glxapi_table *t;
968 GET_DISPATCH(dpy, t);
969 if (!t)
970 return;
971 (t->CopySubBufferMESA)(dpy, drawable, x, y, width, height);
972 }
973
974
975
976 /*** GLX_MESA_release_buffers ***/
977
978 Bool PUBLIC
979 glXReleaseBuffersMESA(Display *dpy, Window w)
980 {
981 struct _glxapi_table *t;
982 GET_DISPATCH(dpy, t);
983 if (!t)
984 return False;
985 return (t->ReleaseBuffersMESA)(dpy, w);
986 }
987
988
989
990 /*** GLX_MESA_pixmap_colormap ***/
991
992 GLXPixmap PUBLIC
993 glXCreateGLXPixmapMESA(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap)
994 {
995 struct _glxapi_table *t;
996 GET_DISPATCH(dpy, t);
997 if (!t)
998 return 0;
999 return (t->CreateGLXPixmapMESA)(dpy, visinfo, pixmap, cmap);
1000 }
1001
1002
1003
1004 /*** GLX_MESA_set_3dfx_mode ***/
1005
1006 Bool PUBLIC
1007 glXSet3DfxModeMESA(int mode)
1008 {
1009 struct _glxapi_table *t;
1010 Display *dpy = glXGetCurrentDisplay();
1011 GET_DISPATCH(dpy, t);
1012 if (!t)
1013 return False;
1014 return (t->Set3DfxModeMESA)(mode);
1015 }
1016
1017
1018
1019 /*** GLX_NV_vertex_array_range ***/
1020
1021 void PUBLIC *
1022 glXAllocateMemoryNV( GLsizei size,
1023 GLfloat readFrequency,
1024 GLfloat writeFrequency,
1025 GLfloat priority )
1026 {
1027 struct _glxapi_table *t;
1028 Display *dpy = glXGetCurrentDisplay();
1029 GET_DISPATCH(dpy, t);
1030 if (!t)
1031 return NULL;
1032 return (t->AllocateMemoryNV)(size, readFrequency, writeFrequency, priority);
1033 }
1034
1035
1036 void PUBLIC
1037 glXFreeMemoryNV( GLvoid *pointer )
1038 {
1039 struct _glxapi_table *t;
1040 Display *dpy = glXGetCurrentDisplay();
1041 GET_DISPATCH(dpy, t);
1042 if (!t)
1043 return;
1044 (t->FreeMemoryNV)(pointer);
1045 }
1046
1047
1048
1049
1050 /*** GLX_MESA_agp_offset */
1051
1052 GLuint PUBLIC
1053 glXGetAGPOffsetMESA( const GLvoid *pointer )
1054 {
1055 struct _glxapi_table *t;
1056 Display *dpy = glXGetCurrentDisplay();
1057 GET_DISPATCH(dpy, t);
1058 if (!t)
1059 return ~0;
1060 return (t->GetAGPOffsetMESA)(pointer);
1061 }
1062
1063
1064 /*** GLX_MESA_allocate_memory */
1065
1066 void *
1067 glXAllocateMemoryMESA(Display *dpy, int scrn, size_t size,
1068 float readfreq, float writefreq, float priority)
1069 {
1070 /* dummy */
1071 return NULL;
1072 }
1073
1074 void
1075 glXFreeMemoryMESA(Display *dpy, int scrn, void *pointer)
1076 {
1077 /* dummy */
1078 }
1079
1080
1081 GLuint
1082 glXGetMemoryOffsetMESA(Display *dpy, int scrn, const void *pointer)
1083 {
1084 /* dummy */
1085 return 0;
1086 }
1087
1088
1089 /*** GLX_EXT_texture_from_pixmap */
1090
1091 void
1092 glXBindTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer,
1093 const int *attrib_list)
1094 {
1095 struct _glxapi_table *t;
1096 GET_DISPATCH(dpy, t);
1097 if (t)
1098 t->BindTexImageEXT(dpy, drawable, buffer, attrib_list);
1099 }
1100
1101 void
1102 glXReleaseTexImageEXT(Display *dpy, GLXDrawable drawable, int buffer)
1103 {
1104 struct _glxapi_table *t;
1105 GET_DISPATCH(dpy, t);
1106 if (t)
1107 t->ReleaseTexImageEXT(dpy, drawable, buffer);
1108 }
1109
1110
1111 /**********************************************************************/
1112 /* GLX API management functions */
1113 /**********************************************************************/
1114
1115
1116 const char *
1117 _glxapi_get_version(void)
1118 {
1119 return "1.3";
1120 }
1121
1122
1123 /*
1124 * Return array of extension strings.
1125 */
1126 const char **
1127 _glxapi_get_extensions(void)
1128 {
1129 static const char *extensions[] = {
1130 #ifdef GLX_EXT_import_context
1131 "GLX_EXT_import_context",
1132 #endif
1133 #ifdef GLX_SGI_video_sync
1134 "GLX_SGI_video_sync",
1135 #endif
1136 #ifdef GLX_MESA_copy_sub_buffer
1137 "GLX_MESA_copy_sub_buffer",
1138 #endif
1139 #ifdef GLX_MESA_release_buffers
1140 "GLX_MESA_release_buffers",
1141 #endif
1142 #ifdef GLX_MESA_pixmap_colormap
1143 "GLX_MESA_pixmap_colormap",
1144 #endif
1145 #ifdef GLX_MESA_set_3dfx_mode
1146 "GLX_MESA_set_3dfx_mode",
1147 #endif
1148 #ifdef GLX_SGIX_fbconfig
1149 "GLX_SGIX_fbconfig",
1150 #endif
1151 #ifdef GLX_SGIX_pbuffer
1152 "GLX_SGIX_pbuffer",
1153 #endif
1154 #ifdef GLX_EXT_texture_from_pixmap
1155 "GLX_EXT_texture_from_pixmap",
1156 #endif
1157 NULL
1158 };
1159 return extensions;
1160 }
1161
1162
1163 /*
1164 * Return size of the GLX dispatch table, in entries, not bytes.
1165 */
1166 GLuint
1167 _glxapi_get_dispatch_table_size(void)
1168 {
1169 return sizeof(struct _glxapi_table) / sizeof(void *);
1170 }
1171
1172
1173 static int
1174 generic_no_op_func(void)
1175 {
1176 return 0;
1177 }
1178
1179
1180 /*
1181 * Initialize all functions in given dispatch table to be no-ops
1182 */
1183 void
1184 _glxapi_set_no_op_table(struct _glxapi_table *t)
1185 {
1186 typedef int (*nop_func)(void);
1187 nop_func *dispatch = (nop_func *) t;
1188 GLuint n = _glxapi_get_dispatch_table_size();
1189 GLuint i;
1190 for (i = 0; i < n; i++) {
1191 dispatch[i] = generic_no_op_func;
1192 }
1193 }
1194
1195
1196 struct name_address_pair {
1197 const char *Name;
1198 __GLXextFuncPtr Address;
1199 };
1200
1201 static struct name_address_pair GLX_functions[] = {
1202 /*** GLX_VERSION_1_0 ***/
1203 { "glXChooseVisual", (__GLXextFuncPtr) glXChooseVisual },
1204 { "glXCopyContext", (__GLXextFuncPtr) glXCopyContext },
1205 { "glXCreateContext", (__GLXextFuncPtr) glXCreateContext },
1206 { "glXCreateGLXPixmap", (__GLXextFuncPtr) glXCreateGLXPixmap },
1207 { "glXDestroyContext", (__GLXextFuncPtr) glXDestroyContext },
1208 { "glXDestroyGLXPixmap", (__GLXextFuncPtr) glXDestroyGLXPixmap },
1209 { "glXGetConfig", (__GLXextFuncPtr) glXGetConfig },
1210 { "glXGetCurrentContext", (__GLXextFuncPtr) glXGetCurrentContext },
1211 { "glXGetCurrentDrawable", (__GLXextFuncPtr) glXGetCurrentDrawable },
1212 { "glXIsDirect", (__GLXextFuncPtr) glXIsDirect },
1213 { "glXMakeCurrent", (__GLXextFuncPtr) glXMakeCurrent },
1214 { "glXQueryExtension", (__GLXextFuncPtr) glXQueryExtension },
1215 { "glXQueryVersion", (__GLXextFuncPtr) glXQueryVersion },
1216 { "glXSwapBuffers", (__GLXextFuncPtr) glXSwapBuffers },
1217 { "glXUseXFont", (__GLXextFuncPtr) glXUseXFont },
1218 { "glXWaitGL", (__GLXextFuncPtr) glXWaitGL },
1219 { "glXWaitX", (__GLXextFuncPtr) glXWaitX },
1220
1221 /*** GLX_VERSION_1_1 ***/
1222 { "glXGetClientString", (__GLXextFuncPtr) glXGetClientString },
1223 { "glXQueryExtensionsString", (__GLXextFuncPtr) glXQueryExtensionsString },
1224 { "glXQueryServerString", (__GLXextFuncPtr) glXQueryServerString },
1225
1226 /*** GLX_VERSION_1_2 ***/
1227 { "glXGetCurrentDisplay", (__GLXextFuncPtr) glXGetCurrentDisplay },
1228
1229 /*** GLX_VERSION_1_3 ***/
1230 { "glXChooseFBConfig", (__GLXextFuncPtr) glXChooseFBConfig },
1231 { "glXCreateNewContext", (__GLXextFuncPtr) glXCreateNewContext },
1232 { "glXCreatePbuffer", (__GLXextFuncPtr) glXCreatePbuffer },
1233 { "glXCreatePixmap", (__GLXextFuncPtr) glXCreatePixmap },
1234 { "glXCreateWindow", (__GLXextFuncPtr) glXCreateWindow },
1235 { "glXDestroyPbuffer", (__GLXextFuncPtr) glXDestroyPbuffer },
1236 { "glXDestroyPixmap", (__GLXextFuncPtr) glXDestroyPixmap },
1237 { "glXDestroyWindow", (__GLXextFuncPtr) glXDestroyWindow },
1238 { "glXGetCurrentReadDrawable", (__GLXextFuncPtr) glXGetCurrentReadDrawable },
1239 { "glXGetFBConfigAttrib", (__GLXextFuncPtr) glXGetFBConfigAttrib },
1240 { "glXGetFBConfigs", (__GLXextFuncPtr) glXGetFBConfigs },
1241 { "glXGetSelectedEvent", (__GLXextFuncPtr) glXGetSelectedEvent },
1242 { "glXGetVisualFromFBConfig", (__GLXextFuncPtr) glXGetVisualFromFBConfig },
1243 { "glXMakeContextCurrent", (__GLXextFuncPtr) glXMakeContextCurrent },
1244 { "glXQueryContext", (__GLXextFuncPtr) glXQueryContext },
1245 { "glXQueryDrawable", (__GLXextFuncPtr) glXQueryDrawable },
1246 { "glXSelectEvent", (__GLXextFuncPtr) glXSelectEvent },
1247
1248 /*** GLX_VERSION_1_4 ***/
1249 { "glXGetProcAddress", (__GLXextFuncPtr) glXGetProcAddress },
1250
1251 /*** GLX_SGI_swap_control ***/
1252 { "glXSwapIntervalSGI", (__GLXextFuncPtr) glXSwapIntervalSGI },
1253
1254 /*** GLX_SGI_video_sync ***/
1255 { "glXGetVideoSyncSGI", (__GLXextFuncPtr) glXGetVideoSyncSGI },
1256 { "glXWaitVideoSyncSGI", (__GLXextFuncPtr) glXWaitVideoSyncSGI },
1257
1258 /*** GLX_SGI_make_current_read ***/
1259 { "glXMakeCurrentReadSGI", (__GLXextFuncPtr) glXMakeCurrentReadSGI },
1260 { "glXGetCurrentReadDrawableSGI", (__GLXextFuncPtr) glXGetCurrentReadDrawableSGI },
1261
1262 /*** GLX_SGIX_video_source ***/
1263 #if defined(_VL_H)
1264 { "glXCreateGLXVideoSourceSGIX", (__GLXextFuncPtr) glXCreateGLXVideoSourceSGIX },
1265 { "glXDestroyGLXVideoSourceSGIX", (__GLXextFuncPtr) glXDestroyGLXVideoSourceSGIX },
1266 #endif
1267
1268 /*** GLX_EXT_import_context ***/
1269 { "glXFreeContextEXT", (__GLXextFuncPtr) glXFreeContextEXT },
1270 { "glXGetContextIDEXT", (__GLXextFuncPtr) glXGetContextIDEXT },
1271 { "glXGetCurrentDisplayEXT", (__GLXextFuncPtr) glXGetCurrentDisplayEXT },
1272 { "glXImportContextEXT", (__GLXextFuncPtr) glXImportContextEXT },
1273 { "glXQueryContextInfoEXT", (__GLXextFuncPtr) glXQueryContextInfoEXT },
1274
1275 /*** GLX_SGIX_fbconfig ***/
1276 { "glXGetFBConfigAttribSGIX", (__GLXextFuncPtr) glXGetFBConfigAttribSGIX },
1277 { "glXChooseFBConfigSGIX", (__GLXextFuncPtr) glXChooseFBConfigSGIX },
1278 { "glXCreateGLXPixmapWithConfigSGIX", (__GLXextFuncPtr) glXCreateGLXPixmapWithConfigSGIX },
1279 { "glXCreateContextWithConfigSGIX", (__GLXextFuncPtr) glXCreateContextWithConfigSGIX },
1280 { "glXGetVisualFromFBConfigSGIX", (__GLXextFuncPtr) glXGetVisualFromFBConfigSGIX },
1281 { "glXGetFBConfigFromVisualSGIX", (__GLXextFuncPtr) glXGetFBConfigFromVisualSGIX },
1282
1283 /*** GLX_SGIX_pbuffer ***/
1284 { "glXCreateGLXPbufferSGIX", (__GLXextFuncPtr) glXCreateGLXPbufferSGIX },
1285 { "glXDestroyGLXPbufferSGIX", (__GLXextFuncPtr) glXDestroyGLXPbufferSGIX },
1286 { "glXQueryGLXPbufferSGIX", (__GLXextFuncPtr) glXQueryGLXPbufferSGIX },
1287 { "glXSelectEventSGIX", (__GLXextFuncPtr) glXSelectEventSGIX },
1288 { "glXGetSelectedEventSGIX", (__GLXextFuncPtr) glXGetSelectedEventSGIX },
1289
1290 /*** GLX_SGI_cushion ***/
1291 { "glXCushionSGI", (__GLXextFuncPtr) glXCushionSGI },
1292
1293 /*** GLX_SGIX_video_resize ***/
1294 { "glXBindChannelToWindowSGIX", (__GLXextFuncPtr) glXBindChannelToWindowSGIX },
1295 { "glXChannelRectSGIX", (__GLXextFuncPtr) glXChannelRectSGIX },
1296 { "glXQueryChannelRectSGIX", (__GLXextFuncPtr) glXQueryChannelRectSGIX },
1297 { "glXQueryChannelDeltasSGIX", (__GLXextFuncPtr) glXQueryChannelDeltasSGIX },
1298 { "glXChannelRectSyncSGIX", (__GLXextFuncPtr) glXChannelRectSyncSGIX },
1299
1300 /*** GLX_SGIX_dmbuffer **/
1301 #if defined(_DM_BUFFER_H_)
1302 { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX },
1303 #endif
1304
1305 /*** GLX_SGIX_swap_group ***/
1306 { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX },
1307
1308 /*** GLX_SGIX_swap_barrier ***/
1309 { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX },
1310 { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX },
1311
1312 /*** GLX_SUN_get_transparent_index ***/
1313 { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN },
1314
1315 /*** GLX_MESA_copy_sub_buffer ***/
1316 { "glXCopySubBufferMESA", (__GLXextFuncPtr) glXCopySubBufferMESA },
1317
1318 /*** GLX_MESA_pixmap_colormap ***/
1319 { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr) glXCreateGLXPixmapMESA },
1320
1321 /*** GLX_MESA_release_buffers ***/
1322 { "glXReleaseBuffersMESA", (__GLXextFuncPtr) glXReleaseBuffersMESA },
1323
1324 /*** GLX_MESA_set_3dfx_mode ***/
1325 { "glXSet3DfxModeMESA", (__GLXextFuncPtr) glXSet3DfxModeMESA },
1326
1327 /*** GLX_ARB_get_proc_address ***/
1328 { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB },
1329
1330 /*** GLX_NV_vertex_array_range ***/
1331 { "glXAllocateMemoryNV", (__GLXextFuncPtr) glXAllocateMemoryNV },
1332 { "glXFreeMemoryNV", (__GLXextFuncPtr) glXFreeMemoryNV },
1333
1334 /*** GLX_MESA_agp_offset ***/
1335 { "glXGetAGPOffsetMESA", (__GLXextFuncPtr) glXGetAGPOffsetMESA },
1336
1337 /*** GLX_MESA_allocate_memory ***/
1338 { "glXAllocateMemoryMESA", (__GLXextFuncPtr) glXAllocateMemoryMESA },
1339 { "glXFreeMemoryMESA", (__GLXextFuncPtr) glXFreeMemoryMESA },
1340 { "glXGetMemoryOffsetMESA", (__GLXextFuncPtr) glXGetMemoryOffsetMESA },
1341
1342 /*** GLX_EXT_texture_from_pixmap ***/
1343 { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT },
1344 { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT },
1345
1346 { NULL, NULL } /* end of list */
1347 };
1348
1349
1350
1351 /*
1352 * Return address of named glX function, or NULL if not found.
1353 */
1354 __GLXextFuncPtr
1355 _glxapi_get_proc_address(const char *funcName)
1356 {
1357 GLuint i;
1358 for (i = 0; GLX_functions[i].Name; i++) {
1359 if (strcmp(GLX_functions[i].Name, funcName) == 0)
1360 return GLX_functions[i].Address;
1361 }
1362 return NULL;
1363 }
1364
1365
1366
1367 /*
1368 * This function does not get dispatched through the dispatch table
1369 * since it's really a "meta" function.
1370 */
1371 __GLXextFuncPtr
1372 glXGetProcAddressARB(const GLubyte *procName)
1373 {
1374 __GLXextFuncPtr f;
1375
1376 f = _glxapi_get_proc_address((const char *) procName);
1377 if (f) {
1378 return f;
1379 }
1380
1381 f = (__GLXextFuncPtr) _glapi_get_proc_address((const char *) procName);
1382 return f;
1383 }
1384
1385
1386 /* GLX 1.4 */
1387 void (*glXGetProcAddress(const GLubyte *procName))()
1388 {
1389 return glXGetProcAddressARB(procName);
1390 }