glsl2: Add and use new variable mode ir_var_temporary
[mesa/nouveau-pmpeg.git] / src / gallium / state_trackers / glx / xlib / glx_getproc.c
blob26fcae78eceeecedf112305019b55df11a412075
1 /*
2 * Mesa 3-D graphics library
3 * Version: 7.6
4 *
5 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
6 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
7 *
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.
27 /**
28 * glXGetProcAddress()
32 #define GLX_GLXEXT_PROTOTYPES
34 #include <string.h>
35 #include "GL/glx.h"
36 #include "glapi/glapi.h"
39 struct name_address_pair {
40 const char *Name;
41 __GLXextFuncPtr Address;
45 static struct name_address_pair GLX_functions[] = {
46 /*** GLX_VERSION_1_0 ***/
47 { "glXChooseVisual", (__GLXextFuncPtr) glXChooseVisual },
48 { "glXCopyContext", (__GLXextFuncPtr) glXCopyContext },
49 { "glXCreateContext", (__GLXextFuncPtr) glXCreateContext },
50 { "glXCreateGLXPixmap", (__GLXextFuncPtr) glXCreateGLXPixmap },
51 { "glXDestroyContext", (__GLXextFuncPtr) glXDestroyContext },
52 { "glXDestroyGLXPixmap", (__GLXextFuncPtr) glXDestroyGLXPixmap },
53 { "glXGetConfig", (__GLXextFuncPtr) glXGetConfig },
54 { "glXGetCurrentContext", (__GLXextFuncPtr) glXGetCurrentContext },
55 { "glXGetCurrentDrawable", (__GLXextFuncPtr) glXGetCurrentDrawable },
56 { "glXIsDirect", (__GLXextFuncPtr) glXIsDirect },
57 { "glXMakeCurrent", (__GLXextFuncPtr) glXMakeCurrent },
58 { "glXQueryExtension", (__GLXextFuncPtr) glXQueryExtension },
59 { "glXQueryVersion", (__GLXextFuncPtr) glXQueryVersion },
60 { "glXSwapBuffers", (__GLXextFuncPtr) glXSwapBuffers },
61 { "glXUseXFont", (__GLXextFuncPtr) glXUseXFont },
62 { "glXWaitGL", (__GLXextFuncPtr) glXWaitGL },
63 { "glXWaitX", (__GLXextFuncPtr) glXWaitX },
65 /*** GLX_VERSION_1_1 ***/
66 { "glXGetClientString", (__GLXextFuncPtr) glXGetClientString },
67 { "glXQueryExtensionsString", (__GLXextFuncPtr) glXQueryExtensionsString },
68 { "glXQueryServerString", (__GLXextFuncPtr) glXQueryServerString },
70 /*** GLX_VERSION_1_2 ***/
71 { "glXGetCurrentDisplay", (__GLXextFuncPtr) glXGetCurrentDisplay },
73 /*** GLX_VERSION_1_3 ***/
74 { "glXChooseFBConfig", (__GLXextFuncPtr) glXChooseFBConfig },
75 { "glXCreateNewContext", (__GLXextFuncPtr) glXCreateNewContext },
76 { "glXCreatePbuffer", (__GLXextFuncPtr) glXCreatePbuffer },
77 { "glXCreatePixmap", (__GLXextFuncPtr) glXCreatePixmap },
78 { "glXCreateWindow", (__GLXextFuncPtr) glXCreateWindow },
79 { "glXDestroyPbuffer", (__GLXextFuncPtr) glXDestroyPbuffer },
80 { "glXDestroyPixmap", (__GLXextFuncPtr) glXDestroyPixmap },
81 { "glXDestroyWindow", (__GLXextFuncPtr) glXDestroyWindow },
82 { "glXGetCurrentReadDrawable", (__GLXextFuncPtr) glXGetCurrentReadDrawable },
83 { "glXGetFBConfigAttrib", (__GLXextFuncPtr) glXGetFBConfigAttrib },
84 { "glXGetFBConfigs", (__GLXextFuncPtr) glXGetFBConfigs },
85 { "glXGetSelectedEvent", (__GLXextFuncPtr) glXGetSelectedEvent },
86 { "glXGetVisualFromFBConfig", (__GLXextFuncPtr) glXGetVisualFromFBConfig },
87 { "glXMakeContextCurrent", (__GLXextFuncPtr) glXMakeContextCurrent },
88 { "glXQueryContext", (__GLXextFuncPtr) glXQueryContext },
89 { "glXQueryDrawable", (__GLXextFuncPtr) glXQueryDrawable },
90 { "glXSelectEvent", (__GLXextFuncPtr) glXSelectEvent },
92 /*** GLX_VERSION_1_4 ***/
93 { "glXGetProcAddress", (__GLXextFuncPtr) glXGetProcAddress },
95 /*** GLX_SGI_swap_control ***/
96 { "glXSwapIntervalSGI", (__GLXextFuncPtr) glXSwapIntervalSGI },
98 /*** GLX_SGI_video_sync ***/
99 { "glXGetVideoSyncSGI", (__GLXextFuncPtr) glXGetVideoSyncSGI },
100 { "glXWaitVideoSyncSGI", (__GLXextFuncPtr) glXWaitVideoSyncSGI },
102 /*** GLX_SGI_make_current_read ***/
103 { "glXMakeCurrentReadSGI", (__GLXextFuncPtr) glXMakeCurrentReadSGI },
104 { "glXGetCurrentReadDrawableSGI", (__GLXextFuncPtr) glXGetCurrentReadDrawableSGI },
106 /*** GLX_SGIX_video_source ***/
107 #if defined(_VL_H)
108 { "glXCreateGLXVideoSourceSGIX", (__GLXextFuncPtr) glXCreateGLXVideoSourceSGIX },
109 { "glXDestroyGLXVideoSourceSGIX", (__GLXextFuncPtr) glXDestroyGLXVideoSourceSGIX },
110 #endif
112 /*** GLX_EXT_import_context ***/
113 { "glXFreeContextEXT", (__GLXextFuncPtr) glXFreeContextEXT },
114 { "glXGetContextIDEXT", (__GLXextFuncPtr) glXGetContextIDEXT },
115 { "glXGetCurrentDisplayEXT", (__GLXextFuncPtr) glXGetCurrentDisplayEXT },
116 { "glXImportContextEXT", (__GLXextFuncPtr) glXImportContextEXT },
117 { "glXQueryContextInfoEXT", (__GLXextFuncPtr) glXQueryContextInfoEXT },
119 /*** GLX_SGIX_fbconfig ***/
120 { "glXGetFBConfigAttribSGIX", (__GLXextFuncPtr) glXGetFBConfigAttribSGIX },
121 { "glXChooseFBConfigSGIX", (__GLXextFuncPtr) glXChooseFBConfigSGIX },
122 { "glXCreateGLXPixmapWithConfigSGIX", (__GLXextFuncPtr) glXCreateGLXPixmapWithConfigSGIX },
123 { "glXCreateContextWithConfigSGIX", (__GLXextFuncPtr) glXCreateContextWithConfigSGIX },
124 { "glXGetVisualFromFBConfigSGIX", (__GLXextFuncPtr) glXGetVisualFromFBConfigSGIX },
125 { "glXGetFBConfigFromVisualSGIX", (__GLXextFuncPtr) glXGetFBConfigFromVisualSGIX },
127 /*** GLX_SGIX_pbuffer ***/
128 { "glXCreateGLXPbufferSGIX", (__GLXextFuncPtr) glXCreateGLXPbufferSGIX },
129 { "glXDestroyGLXPbufferSGIX", (__GLXextFuncPtr) glXDestroyGLXPbufferSGIX },
130 { "glXQueryGLXPbufferSGIX", (__GLXextFuncPtr) glXQueryGLXPbufferSGIX },
131 { "glXSelectEventSGIX", (__GLXextFuncPtr) glXSelectEventSGIX },
132 { "glXGetSelectedEventSGIX", (__GLXextFuncPtr) glXGetSelectedEventSGIX },
134 /*** GLX_SGI_cushion ***/
135 { "glXCushionSGI", (__GLXextFuncPtr) glXCushionSGI },
137 /*** GLX_SGIX_video_resize ***/
138 { "glXBindChannelToWindowSGIX", (__GLXextFuncPtr) glXBindChannelToWindowSGIX },
139 { "glXChannelRectSGIX", (__GLXextFuncPtr) glXChannelRectSGIX },
140 { "glXQueryChannelRectSGIX", (__GLXextFuncPtr) glXQueryChannelRectSGIX },
141 { "glXQueryChannelDeltasSGIX", (__GLXextFuncPtr) glXQueryChannelDeltasSGIX },
142 { "glXChannelRectSyncSGIX", (__GLXextFuncPtr) glXChannelRectSyncSGIX },
144 /*** GLX_SGIX_dmbuffer **/
145 #if defined(_DM_BUFFER_H_)
146 { "glXAssociateDMPbufferSGIX", (__GLXextFuncPtr) glXAssociateDMPbufferSGIX },
147 #endif
149 /*** GLX_SGIX_swap_group ***/
150 { "glXJoinSwapGroupSGIX", (__GLXextFuncPtr) glXJoinSwapGroupSGIX },
152 /*** GLX_SGIX_swap_barrier ***/
153 { "glXBindSwapBarrierSGIX", (__GLXextFuncPtr) glXBindSwapBarrierSGIX },
154 { "glXQueryMaxSwapBarriersSGIX", (__GLXextFuncPtr) glXQueryMaxSwapBarriersSGIX },
156 /*** GLX_SUN_get_transparent_index ***/
157 { "glXGetTransparentIndexSUN", (__GLXextFuncPtr) glXGetTransparentIndexSUN },
159 /*** GLX_MESA_copy_sub_buffer ***/
160 { "glXCopySubBufferMESA", (__GLXextFuncPtr) glXCopySubBufferMESA },
162 /*** GLX_MESA_pixmap_colormap ***/
163 { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr) glXCreateGLXPixmapMESA },
165 /*** GLX_MESA_release_buffers ***/
166 { "glXReleaseBuffersMESA", (__GLXextFuncPtr) glXReleaseBuffersMESA },
168 /*** GLX_ARB_get_proc_address ***/
169 { "glXGetProcAddressARB", (__GLXextFuncPtr) glXGetProcAddressARB },
171 /*** GLX_EXT_texture_from_pixmap ***/
172 { "glXBindTexImageEXT", (__GLXextFuncPtr) glXBindTexImageEXT },
173 { "glXReleaseTexImageEXT", (__GLXextFuncPtr) glXReleaseTexImageEXT },
175 { NULL, NULL } /* end of list */
181 * Return address of named glX function, or NULL if not found.
183 static __GLXextFuncPtr
184 _glxapi_get_proc_address(const char *funcName)
186 GLuint i;
187 for (i = 0; GLX_functions[i].Name; i++) {
188 if (strcmp(GLX_functions[i].Name, funcName) == 0)
189 return GLX_functions[i].Address;
191 return NULL;
195 PUBLIC __GLXextFuncPtr
196 glXGetProcAddressARB(const GLubyte *procName)
198 __GLXextFuncPtr f;
200 f = _glxapi_get_proc_address((const char *) procName);
201 if (f) {
202 return f;
205 f = (__GLXextFuncPtr) _glapi_get_proc_address((const char *) procName);
206 return f;
210 /* GLX 1.4 */
211 PUBLIC
212 void (*glXGetProcAddress(const GLubyte *procName))()
214 return glXGetProcAddressARB(procName);