2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
5 * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
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:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
32 #define GLX_GLXEXT_PROTOTYPES
35 #include "pipe/p_compiler.h"
37 #include "glapi/glapi.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_SUN_get_transparent_index ***/
151 { "glXGetTransparentIndexSUN", (__GLXextFuncPtr
) glXGetTransparentIndexSUN
},
153 /*** GLX_MESA_copy_sub_buffer ***/
154 { "glXCopySubBufferMESA", (__GLXextFuncPtr
) glXCopySubBufferMESA
},
156 /*** GLX_MESA_pixmap_colormap ***/
157 { "glXCreateGLXPixmapMESA", (__GLXextFuncPtr
) glXCreateGLXPixmapMESA
},
159 /*** GLX_MESA_release_buffers ***/
160 { "glXReleaseBuffersMESA", (__GLXextFuncPtr
) glXReleaseBuffersMESA
},
162 /*** GLX_ARB_get_proc_address ***/
163 { "glXGetProcAddressARB", (__GLXextFuncPtr
) glXGetProcAddressARB
},
165 /*** GLX_ARB_create_context ***/
166 { "glXCreateContextAttribsARB", (__GLXextFuncPtr
) glXCreateContextAttribsARB
},
168 /*** GLX_EXT_texture_from_pixmap ***/
169 { "glXBindTexImageEXT", (__GLXextFuncPtr
) glXBindTexImageEXT
},
170 { "glXReleaseTexImageEXT", (__GLXextFuncPtr
) glXReleaseTexImageEXT
},
172 { NULL
, NULL
} /* end of list */
178 * Return address of named glX function, or NULL if not found.
180 static __GLXextFuncPtr
181 _glxapi_get_proc_address(const char *funcName
)
184 for (i
= 0; GLX_functions
[i
].Name
; i
++) {
185 if (strcmp(GLX_functions
[i
].Name
, funcName
) == 0)
186 return GLX_functions
[i
].Address
;
192 PUBLIC __GLXextFuncPtr
193 glXGetProcAddressARB(const GLubyte
*procName
)
197 f
= _glxapi_get_proc_address((const char *) procName
);
202 f
= (__GLXextFuncPtr
) _glapi_get_proc_address((const char *) procName
);
209 void (*glXGetProcAddress(const GLubyte
*procName
))()
211 return glXGetProcAddressARB(procName
);