2 * Mesa 3-D graphics library
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
15 * The above copyright notice and this permission notice shall be included
16 * in all copies or substantial portions of the Software.
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
22 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 #define GLX_GLXEXT_PROTOTYPES
36 #include "glapi/glapi.h"
37 #include "pipe/p_compiler.h"
40 struct name_address_pair
{
42 __GLXextFuncPtr Address
;
46 static struct name_address_pair GLX_functions
[] = {
47 /*** GLX_VERSION_1_0 ***/
48 { "glXChooseVisual", (__GLXextFuncPtr
) glXChooseVisual
},
49 { "glXCopyContext", (__GLXextFuncPtr
) glXCopyContext
},
50 { "glXCreateContext", (__GLXextFuncPtr
) glXCreateContext
},
51 { "glXCreateGLXPixmap", (__GLXextFuncPtr
) glXCreateGLXPixmap
},
52 { "glXDestroyContext", (__GLXextFuncPtr
) glXDestroyContext
},
53 { "glXDestroyGLXPixmap", (__GLXextFuncPtr
) glXDestroyGLXPixmap
},
54 { "glXGetConfig", (__GLXextFuncPtr
) glXGetConfig
},
55 { "glXGetCurrentContext", (__GLXextFuncPtr
) glXGetCurrentContext
},
56 { "glXGetCurrentDrawable", (__GLXextFuncPtr
) glXGetCurrentDrawable
},
57 { "glXIsDirect", (__GLXextFuncPtr
) glXIsDirect
},
58 { "glXMakeCurrent", (__GLXextFuncPtr
) glXMakeCurrent
},
59 { "glXQueryExtension", (__GLXextFuncPtr
) glXQueryExtension
},
60 { "glXQueryVersion", (__GLXextFuncPtr
) glXQueryVersion
},
61 { "glXSwapBuffers", (__GLXextFuncPtr
) glXSwapBuffers
},
62 { "glXUseXFont", (__GLXextFuncPtr
) glXUseXFont
},
63 { "glXWaitGL", (__GLXextFuncPtr
) glXWaitGL
},
64 { "glXWaitX", (__GLXextFuncPtr
) glXWaitX
},
66 /*** GLX_VERSION_1_1 ***/
67 { "glXGetClientString", (__GLXextFuncPtr
) glXGetClientString
},
68 { "glXQueryExtensionsString", (__GLXextFuncPtr
) glXQueryExtensionsString
},
69 { "glXQueryServerString", (__GLXextFuncPtr
) glXQueryServerString
},
71 /*** GLX_VERSION_1_2 ***/
72 { "glXGetCurrentDisplay", (__GLXextFuncPtr
) glXGetCurrentDisplay
},
74 /*** GLX_VERSION_1_3 ***/
75 { "glXChooseFBConfig", (__GLXextFuncPtr
) glXChooseFBConfig
},
76 { "glXCreateNewContext", (__GLXextFuncPtr
) glXCreateNewContext
},
77 { "glXCreatePbuffer", (__GLXextFuncPtr
) glXCreatePbuffer
},
78 { "glXCreatePixmap", (__GLXextFuncPtr
) glXCreatePixmap
},
79 { "glXCreateWindow", (__GLXextFuncPtr
) glXCreateWindow
},
80 { "glXDestroyPbuffer", (__GLXextFuncPtr
) glXDestroyPbuffer
},
81 { "glXDestroyPixmap", (__GLXextFuncPtr
) glXDestroyPixmap
},
82 { "glXDestroyWindow", (__GLXextFuncPtr
) glXDestroyWindow
},
83 { "glXGetCurrentReadDrawable", (__GLXextFuncPtr
) glXGetCurrentReadDrawable
},
84 { "glXGetFBConfigAttrib", (__GLXextFuncPtr
) glXGetFBConfigAttrib
},
85 { "glXGetFBConfigs", (__GLXextFuncPtr
) glXGetFBConfigs
},
86 { "glXGetSelectedEvent", (__GLXextFuncPtr
) glXGetSelectedEvent
},
87 { "glXGetVisualFromFBConfig", (__GLXextFuncPtr
) glXGetVisualFromFBConfig
},
88 { "glXMakeContextCurrent", (__GLXextFuncPtr
) glXMakeContextCurrent
},
89 { "glXQueryContext", (__GLXextFuncPtr
) glXQueryContext
},
90 { "glXQueryDrawable", (__GLXextFuncPtr
) glXQueryDrawable
},
91 { "glXSelectEvent", (__GLXextFuncPtr
) glXSelectEvent
},
93 /*** GLX_VERSION_1_4 ***/
94 { "glXGetProcAddress", (__GLXextFuncPtr
) glXGetProcAddress
},
96 /*** GLX_SGI_swap_control ***/
97 { "glXSwapIntervalSGI", (__GLXextFuncPtr
) glXSwapIntervalSGI
},
99 /*** GLX_SGI_video_sync ***/
100 { "glXGetVideoSyncSGI", (__GLXextFuncPtr
) glXGetVideoSyncSGI
},
101 { "glXWaitVideoSyncSGI", (__GLXextFuncPtr
) glXWaitVideoSyncSGI
},
103 /*** GLX_SGI_make_current_read ***/
104 { "glXMakeCurrentReadSGI", (__GLXextFuncPtr
) glXMakeCurrentReadSGI
},
105 { "glXGetCurrentReadDrawableSGI", (__GLXextFuncPtr
) glXGetCurrentReadDrawableSGI
},
107 /*** GLX_SGIX_video_source ***/
109 { "glXCreateGLXVideoSourceSGIX", (__GLXextFuncPtr
) glXCreateGLXVideoSourceSGIX
},
110 { "glXDestroyGLXVideoSourceSGIX", (__GLXextFuncPtr
) glXDestroyGLXVideoSourceSGIX
},
113 /*** GLX_EXT_import_context ***/
114 { "glXFreeContextEXT", (__GLXextFuncPtr
) glXFreeContextEXT
},
115 { "glXGetContextIDEXT", (__GLXextFuncPtr
) glXGetContextIDEXT
},
116 { "glXGetCurrentDisplayEXT", (__GLXextFuncPtr
) glXGetCurrentDisplayEXT
},
117 { "glXImportContextEXT", (__GLXextFuncPtr
) glXImportContextEXT
},
118 { "glXQueryContextInfoEXT", (__GLXextFuncPtr
) glXQueryContextInfoEXT
},
120 /*** GLX_SGIX_fbconfig ***/
121 { "glXGetFBConfigAttribSGIX", (__GLXextFuncPtr
) glXGetFBConfigAttribSGIX
},
122 { "glXChooseFBConfigSGIX", (__GLXextFuncPtr
) glXChooseFBConfigSGIX
},
123 { "glXCreateGLXPixmapWithConfigSGIX", (__GLXextFuncPtr
) glXCreateGLXPixmapWithConfigSGIX
},
124 { "glXCreateContextWithConfigSGIX", (__GLXextFuncPtr
) glXCreateContextWithConfigSGIX
},
125 { "glXGetVisualFromFBConfigSGIX", (__GLXextFuncPtr
) glXGetVisualFromFBConfigSGIX
},
126 { "glXGetFBConfigFromVisualSGIX", (__GLXextFuncPtr
) glXGetFBConfigFromVisualSGIX
},
128 /*** GLX_SGIX_pbuffer ***/
129 { "glXCreateGLXPbufferSGIX", (__GLXextFuncPtr
) glXCreateGLXPbufferSGIX
},
130 { "glXDestroyGLXPbufferSGIX", (__GLXextFuncPtr
) glXDestroyGLXPbufferSGIX
},
131 { "glXQueryGLXPbufferSGIX", (__GLXextFuncPtr
) glXQueryGLXPbufferSGIX
},
132 { "glXSelectEventSGIX", (__GLXextFuncPtr
) glXSelectEventSGIX
},
133 { "glXGetSelectedEventSGIX", (__GLXextFuncPtr
) glXGetSelectedEventSGIX
},
135 /*** GLX_SGI_cushion ***/
136 { "glXCushionSGI", (__GLXextFuncPtr
) glXCushionSGI
},
138 /*** GLX_SGIX_video_resize ***/
139 { "glXBindChannelToWindowSGIX", (__GLXextFuncPtr
) glXBindChannelToWindowSGIX
},
140 { "glXChannelRectSGIX", (__GLXextFuncPtr
) glXChannelRectSGIX
},
141 { "glXQueryChannelRectSGIX", (__GLXextFuncPtr
) glXQueryChannelRectSGIX
},
142 { "glXQueryChannelDeltasSGIX", (__GLXextFuncPtr
) glXQueryChannelDeltasSGIX
},
143 { "glXChannelRectSyncSGIX", (__GLXextFuncPtr
) glXChannelRectSyncSGIX
},
145 /*** GLX_SGIX_dmbuffer **/
146 #if defined(_DM_BUFFER_H_)
147 { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr
) glXAssociateDMPbufferSGIX
},
150 /*** GLX_SGIX_swap_group ***/
151 { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr
) glXJoinSwapGroupSGIX
},
153 /*** GLX_SGIX_swap_barrier ***/
154 { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr
) glXBindSwapBarrierSGIX
},
155 { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr
) glXQueryMaxSwapBarriersSGIX
},
157 /*** GLX_SUN_get_transparent_index ***/
158 { "glXGetTransparentIndexSUN", (__GLXextFuncPtr
) glXGetTransparentIndexSUN
},
160 /*** GLX_MESA_copy_sub_buffer ***/
161 { "glXCopySubBufferMESA", (__GLXextFuncPtr
) glXCopySubBufferMESA
},
163 /*** GLX_MESA_pixmap_colormap ***/
164 { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr
) glXCreateGLXPixmapMESA
},
166 /*** GLX_MESA_release_buffers ***/
167 { "glXReleaseBuffersMESA", (__GLXextFuncPtr
) glXReleaseBuffersMESA
},
169 /*** GLX_ARB_get_proc_address ***/
170 { "glXGetProcAddressARB", (__GLXextFuncPtr
) glXGetProcAddressARB
},
172 /*** GLX_EXT_texture_from_pixmap ***/
173 { "glXBindTexImageEXT", (__GLXextFuncPtr
) glXBindTexImageEXT
},
174 { "glXReleaseTexImageEXT", (__GLXextFuncPtr
) glXReleaseTexImageEXT
},
176 { NULL
, NULL
} /* end of list */
182 * Return address of named glX function, or NULL if not found.
184 static __GLXextFuncPtr
185 _glxapi_get_proc_address(const char *funcName
)
188 for (i
= 0; GLX_functions
[i
].Name
; i
++) {
189 if (strcmp(GLX_functions
[i
].Name
, funcName
) == 0)
190 return GLX_functions
[i
].Address
;
196 PUBLIC __GLXextFuncPtr
197 glXGetProcAddressARB(const GLubyte
*procName
)
201 f
= _glxapi_get_proc_address((const char *) procName
);
206 f
= (__GLXextFuncPtr
) _glapi_get_proc_address((const char *) procName
);
213 void (*glXGetProcAddress(const GLubyte
*procName
))()
215 return glXGetProcAddressARB(procName
);