1 2 /* 3 * Mesa 3-D graphics library 4 * Version: 5.1 5 * 6 * Copyright (C) 1999-2002 Brian Paul 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: 14 * 15 * The above copyright notice and this permission notice shall be included 16 * in all copies or substantial portions of the Software. 17 * 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. 24 */ 25 26 27 #include <assert.h> 28 #include <GL/glx.h> 29 #include "realglx.h" 30 #include "glxapi.h" 31 32 33 struct _glxapi_table * 34 _real_GetGLXDispatchTable(void) 35 { 36 static struct _glxapi_table glx; 37 38 /* be sure our dispatch table size <= libGL's table */ 39 { 40 GLuint size = sizeof(struct _glxapi_table) / sizeof(void *); 41 (void) size; 42 assert(_glxapi_get_dispatch_table_size() >= size); 43 } 44 45 /* initialize the whole table to no-ops */ 46 _glxapi_set_no_op_table(&glx); 47 48 /* now initialize the table with the functions I implement */ 49 50 /*** GLX_VERSION_1_0 ***/ 51 glx.ChooseVisual = _real_glXChooseVisual; 52 glx.CopyContext = _real_glXCopyContext; 53 glx.CreateContext = _real_glXCreateContext; 54 glx.CreateGLXPixmap = _real_glXCreateGLXPixmap; 55 glx.DestroyContext = _real_glXDestroyContext; 56 glx.DestroyGLXPixmap = _real_glXDestroyGLXPixmap; 57 glx.GetConfig = _real_glXGetConfig; 58 /*glx.GetCurrentContext = _real_glXGetCurrentContext;*/ 59 /*glx.GetCurrentDrawable = _real_glXGetCurrentDrawable;*/ 60 glx.IsDirect = _real_glXIsDirect; 61 glx.MakeCurrent = _real_glXMakeCurrent; 62 glx.QueryExtension = _real_glXQueryExtension; 63 glx.QueryVersion = _real_glXQueryVersion; 64 glx.SwapBuffers = _real_glXSwapBuffers; 65 glx.UseXFont = _real_glXUseXFont; 66 glx.WaitGL = _real_glXWaitGL; 67 glx.WaitX = _real_glXWaitX; 68 69 /*** GLX_VERSION_1_1 ***/ 70 glx.GetClientString = _real_glXGetClientString; 71 glx.QueryExtensionsString = _real_glXQueryExtensionsString; 72 glx.QueryServerString = _real_glXQueryServerString; 73 74 /*** GLX_VERSION_1_2 ***/ 75 /*glx.GetCurrentDisplay = _real_glXGetCurrentDisplay;*/ 76 77 /*** GLX_VERSION_1_3 ***/ 78 glx.ChooseFBConfig = _real_glXChooseFBConfig; 79 glx.CreateNewContext = _real_glXCreateNewContext; 80 glx.CreatePbuffer = _real_glXCreatePbuffer; 81 glx.CreatePixmap = _real_glXCreatePixmap; 82 glx.CreateWindow = _real_glXCreateWindow; 83 glx.DestroyPbuffer = _real_glXDestroyPbuffer; 84 glx.DestroyPixmap = _real_glXDestroyPixmap; 85 glx.DestroyWindow = _real_glXDestroyWindow; 86 /*glx.GetCurrentReadDrawable = _real_glXGetCurrentReadDrawable;*/ 87 glx.GetFBConfigAttrib = _real_glXGetFBConfigAttrib; 88 glx.GetFBConfigs = _real_glXGetFBConfigs; 89 glx.GetSelectedEvent = _real_glXGetSelectedEvent; 90 glx.GetVisualFromFBConfig = _real_glXGetVisualFromFBConfig; 91 glx.MakeContextCurrent = _real_glXMakeContextCurrent; 92 glx.QueryContext = _real_glXQueryContext; 93 glx.QueryDrawable = _real_glXQueryDrawable; 94 glx.SelectEvent = _real_glXSelectEvent; 95 96 /*** GLX_SGI_swap_control ***/ 97 glx.SwapIntervalSGI = _real_glXSwapIntervalSGI; 98 99 /*** GLX_SGI_video_sync ***/ 100 glx.GetVideoSyncSGI = _real_glXGetVideoSyncSGI; 101 glx.WaitVideoSyncSGI = _real_glXWaitVideoSyncSGI; 102 103 /*** GLX_SGI_make_current_read ***/ 104 glx.MakeCurrentReadSGI = _real_glXMakeCurrentReadSGI; 105 /*glx.GetCurrentReadDrawableSGI = _real_glXGetCurrentReadDrawableSGI;*/ 106 107 #if defined(_VL_H) 108 /*** GLX_SGIX_video_source ***/ 109 glx.CreateGLXVideoSourceSGIX = _real_glXCreateGLXVideoSourceSGIX; 110 glx.DestroyGLXVideoSourceSGIX = _real_glXDestroyGLXVideoSourceSGIX; 111 #endif 112 113 /*** GLX_EXT_import_context ***/ 114 glx.FreeContextEXT = _real_glXFreeContextEXT; 115 /*glx.GetContextIDEXT = _real_glXGetContextIDEXT;*/ 116 /*glx.GetCurrentDisplayEXT = _real_glXGetCurrentDisplayEXT;*/ 117 glx.ImportContextEXT = _real_glXImportContextEXT; 118 glx.QueryContextInfoEXT = _real_glXQueryContextInfoEXT; 119 120 /*** GLX_SGIX_fbconfig ***/ 121 glx.GetFBConfigAttribSGIX = _real_glXGetFBConfigAttribSGIX; 122 glx.ChooseFBConfigSGIX = _real_glXChooseFBConfigSGIX; 123 glx.CreateGLXPixmapWithConfigSGIX = _real_glXCreateGLXPixmapWithConfigSGIX; 124 glx.CreateContextWithConfigSGIX = _real_glXCreateContextWithConfigSGIX; 125 glx.GetVisualFromFBConfigSGIX = _real_glXGetVisualFromFBConfigSGIX; 126 glx.GetFBConfigFromVisualSGIX = _real_glXGetFBConfigFromVisualSGIX; 127 128 /*** GLX_SGIX_pbuffer ***/ 129 glx.CreateGLXPbufferSGIX = _real_glXCreateGLXPbufferSGIX; 130 glx.DestroyGLXPbufferSGIX = _real_glXDestroyGLXPbufferSGIX; 131 glx.QueryGLXPbufferSGIX = _real_glXQueryGLXPbufferSGIX; 132 glx.SelectEventSGIX = _real_glXSelectEventSGIX; 133 glx.GetSelectedEventSGIX = _real_glXGetSelectedEventSGIX; 134 135 /*** GLX_SGI_cushion ***/ 136 glx.CushionSGI = _real_glXCushionSGI; 137 138 /*** GLX_SGIX_video_resize ***/ 139 glx.BindChannelToWindowSGIX = _real_glXBindChannelToWindowSGIX; 140 glx.ChannelRectSGIX = _real_glXChannelRectSGIX; 141 glx.QueryChannelRectSGIX = _real_glXQueryChannelRectSGIX; 142 glx.QueryChannelDeltasSGIX = _real_glXQueryChannelDeltasSGIX; 143 glx.ChannelRectSyncSGIX = _real_glXChannelRectSyncSGIX; 144 145 #if defined(_DM_BUFFER_H_) 146 /*** (GLX_SGIX_dmbuffer ***/ 147 glx.AssociateDMPbufferSGIX = NULL; 148 #endif 149 150 /*** GLX_SGIX_swap_group ***/ 151 glx.JoinSwapGroupSGIX = _real_glXJoinSwapGroupSGIX; 152 153 /*** GLX_SGIX_swap_barrier ***/ 154 glx.BindSwapBarrierSGIX = _real_glXBindSwapBarrierSGIX; 155 glx.QueryMaxSwapBarriersSGIX = _real_glXQueryMaxSwapBarriersSGIX; 156 157 /*** GLX_SUN_get_transparent_index ***/ 158 glx.GetTransparentIndexSUN = _real_glXGetTransparentIndexSUN; 159 160 /*** GLX_MESA_copy_sub_buffer ***/ 161 glx.CopySubBufferMESA = _real_glXCopySubBufferMESA; 162 163 /*** GLX_MESA_release_buffers ***/ 164 glx.ReleaseBuffersMESA = _real_glXReleaseBuffersMESA; 165 166 /*** GLX_MESA_pixmap_colormap ***/ 167 glx.CreateGLXPixmapMESA = _real_glXCreateGLXPixmapMESA; 168 169 /*** GLX_MESA_set_3dfx_mode ***/ 170 glx.Set3DfxModeMESA = _real_glXSet3DfxModeMESA; 171 172 /*** GLX_NV_vertex_array_range ***/ 173 glx.AllocateMemoryNV = _real_glXAllocateMemoryNV; 174 glx.FreeMemoryNV = _real_glXFreeMemoryNV; 175 176 /*** GLX_MESA_agp_offset ***/ 177 glx.GetAGPOffsetMESA = _real_glXGetAGPOffsetMESA; 178 179 return &glx; 180 } 181