00001 00002 /* 00003 * Mesa 3-D graphics library 00004 * Version: 5.1 00005 * 00006 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. 00007 * 00008 * Permission is hereby granted, free of charge, to any person obtaining a 00009 * copy of this software and associated documentation files (the "Software"), 00010 * to deal in the Software without restriction, including without limitation 00011 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 00012 * and/or sell copies of the Software, and to permit persons to whom the 00013 * Software is furnished to do so, subject to the following conditions: 00014 * 00015 * The above copyright notice and this permission notice shall be included 00016 * in all copies or substantial portions of the Software. 00017 * 00018 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00019 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00020 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 00021 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 00022 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00023 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 00024 */ 00025 00026 00027 #include <assert.h> 00028 #include <GL/glx.h> 00029 #include "realglx.h" 00030 #include "glxapi.h" 00031 00032 00033 struct _glxapi_table * 00034 _real_GetGLXDispatchTable(void) 00035 { 00036 static struct _glxapi_table glx; 00037 00038 /* be sure our dispatch table size <= libGL's table */ 00039 { 00040 GLuint size = sizeof(struct _glxapi_table) / sizeof(void *); 00041 (void) size; 00042 assert(_glxapi_get_dispatch_table_size() >= size); 00043 } 00044 00045 /* initialize the whole table to no-ops */ 00046 _glxapi_set_no_op_table(&glx); 00047 00048 /* now initialize the table with the functions I implement */ 00049 00050 /*** GLX_VERSION_1_0 ***/ 00051 glx.ChooseVisual = _real_glXChooseVisual; 00052 glx.CopyContext = _real_glXCopyContext; 00053 glx.CreateContext = _real_glXCreateContext; 00054 glx.CreateGLXPixmap = _real_glXCreateGLXPixmap; 00055 glx.DestroyContext = _real_glXDestroyContext; 00056 glx.DestroyGLXPixmap = _real_glXDestroyGLXPixmap; 00057 glx.GetConfig = _real_glXGetConfig; 00058 /*glx.GetCurrentContext = _real_glXGetCurrentContext;*/ 00059 /*glx.GetCurrentDrawable = _real_glXGetCurrentDrawable;*/ 00060 glx.IsDirect = _real_glXIsDirect; 00061 glx.MakeCurrent = _real_glXMakeCurrent; 00062 glx.QueryExtension = _real_glXQueryExtension; 00063 glx.QueryVersion = _real_glXQueryVersion; 00064 glx.SwapBuffers = _real_glXSwapBuffers; 00065 glx.UseXFont = _real_glXUseXFont; 00066 glx.WaitGL = _real_glXWaitGL; 00067 glx.WaitX = _real_glXWaitX; 00068 00069 /*** GLX_VERSION_1_1 ***/ 00070 glx.GetClientString = _real_glXGetClientString; 00071 glx.QueryExtensionsString = _real_glXQueryExtensionsString; 00072 glx.QueryServerString = _real_glXQueryServerString; 00073 00074 /*** GLX_VERSION_1_2 ***/ 00075 /*glx.GetCurrentDisplay = _real_glXGetCurrentDisplay;*/ 00076 00077 /*** GLX_VERSION_1_3 ***/ 00078 glx.ChooseFBConfig = _real_glXChooseFBConfig; 00079 glx.CreateNewContext = _real_glXCreateNewContext; 00080 glx.CreatePbuffer = _real_glXCreatePbuffer; 00081 glx.CreatePixmap = _real_glXCreatePixmap; 00082 glx.CreateWindow = _real_glXCreateWindow; 00083 glx.DestroyPbuffer = _real_glXDestroyPbuffer; 00084 glx.DestroyPixmap = _real_glXDestroyPixmap; 00085 glx.DestroyWindow = _real_glXDestroyWindow; 00086 /*glx.GetCurrentReadDrawable = _real_glXGetCurrentReadDrawable;*/ 00087 glx.GetFBConfigAttrib = _real_glXGetFBConfigAttrib; 00088 glx.GetFBConfigs = _real_glXGetFBConfigs; 00089 glx.GetSelectedEvent = _real_glXGetSelectedEvent; 00090 glx.GetVisualFromFBConfig = _real_glXGetVisualFromFBConfig; 00091 glx.MakeContextCurrent = _real_glXMakeContextCurrent; 00092 glx.QueryContext = _real_glXQueryContext; 00093 glx.QueryDrawable = _real_glXQueryDrawable; 00094 glx.SelectEvent = _real_glXSelectEvent; 00095 00096 /*** GLX_SGI_swap_control ***/ 00097 glx.SwapIntervalSGI = _real_glXSwapIntervalSGI; 00098 00099 /*** GLX_SGI_video_sync ***/ 00100 glx.GetVideoSyncSGI = _real_glXGetVideoSyncSGI; 00101 glx.WaitVideoSyncSGI = _real_glXWaitVideoSyncSGI; 00102 00103 /*** GLX_SGI_make_current_read ***/ 00104 glx.MakeCurrentReadSGI = _real_glXMakeCurrentReadSGI; 00105 /*glx.GetCurrentReadDrawableSGI = _real_glXGetCurrentReadDrawableSGI;*/ 00106 00107 #if defined(_VL_H) 00108 /*** GLX_SGIX_video_source ***/ 00109 glx.CreateGLXVideoSourceSGIX = _real_glXCreateGLXVideoSourceSGIX; 00110 glx.DestroyGLXVideoSourceSGIX = _real_glXDestroyGLXVideoSourceSGIX; 00111 #endif 00112 00113 /*** GLX_EXT_import_context ***/ 00114 glx.FreeContextEXT = _real_glXFreeContextEXT; 00115 /*glx.GetContextIDEXT = _real_glXGetContextIDEXT;*/ 00116 /*glx.GetCurrentDisplayEXT = _real_glXGetCurrentDisplayEXT;*/ 00117 glx.ImportContextEXT = _real_glXImportContextEXT; 00118 glx.QueryContextInfoEXT = _real_glXQueryContextInfoEXT; 00119 00120 /*** GLX_SGIX_fbconfig ***/ 00121 glx.GetFBConfigAttribSGIX = _real_glXGetFBConfigAttribSGIX; 00122 glx.ChooseFBConfigSGIX = _real_glXChooseFBConfigSGIX; 00123 glx.CreateGLXPixmapWithConfigSGIX = _real_glXCreateGLXPixmapWithConfigSGIX; 00124 glx.CreateContextWithConfigSGIX = _real_glXCreateContextWithConfigSGIX; 00125 glx.GetVisualFromFBConfigSGIX = _real_glXGetVisualFromFBConfigSGIX; 00126 glx.GetFBConfigFromVisualSGIX = _real_glXGetFBConfigFromVisualSGIX; 00127 00128 /*** GLX_SGIX_pbuffer ***/ 00129 glx.CreateGLXPbufferSGIX = _real_glXCreateGLXPbufferSGIX; 00130 glx.DestroyGLXPbufferSGIX = _real_glXDestroyGLXPbufferSGIX; 00131 glx.QueryGLXPbufferSGIX = _real_glXQueryGLXPbufferSGIX; 00132 glx.SelectEventSGIX = _real_glXSelectEventSGIX; 00133 glx.GetSelectedEventSGIX = _real_glXGetSelectedEventSGIX; 00134 00135 /*** GLX_SGI_cushion ***/ 00136 glx.CushionSGI = _real_glXCushionSGI; 00137 00138 /*** GLX_SGIX_video_resize ***/ 00139 glx.BindChannelToWindowSGIX = _real_glXBindChannelToWindowSGIX; 00140 glx.ChannelRectSGIX = _real_glXChannelRectSGIX; 00141 glx.QueryChannelRectSGIX = _real_glXQueryChannelRectSGIX; 00142 glx.QueryChannelDeltasSGIX = _real_glXQueryChannelDeltasSGIX; 00143 glx.ChannelRectSyncSGIX = _real_glXChannelRectSyncSGIX; 00144 00145 #if defined(_DM_BUFFER_H_) 00146 /*** (GLX_SGIX_dmbuffer ***/ 00147 glx.AssociateDMPbufferSGIX = NULL; 00148 #endif 00149 00150 /*** GLX_SGIX_swap_group ***/ 00151 glx.JoinSwapGroupSGIX = _real_glXJoinSwapGroupSGIX; 00152 00153 /*** GLX_SGIX_swap_barrier ***/ 00154 glx.BindSwapBarrierSGIX = _real_glXBindSwapBarrierSGIX; 00155 glx.QueryMaxSwapBarriersSGIX = _real_glXQueryMaxSwapBarriersSGIX; 00156 00157 /*** GLX_SUN_get_transparent_index ***/ 00158 glx.GetTransparentIndexSUN = _real_glXGetTransparentIndexSUN; 00159 00160 /*** GLX_MESA_copy_sub_buffer ***/ 00161 glx.CopySubBufferMESA = _real_glXCopySubBufferMESA; 00162 00163 /*** GLX_MESA_release_buffers ***/ 00164 glx.ReleaseBuffersMESA = _real_glXReleaseBuffersMESA; 00165 00166 /*** GLX_MESA_pixmap_colormap ***/ 00167 glx.CreateGLXPixmapMESA = _real_glXCreateGLXPixmapMESA; 00168 00169 /*** GLX_MESA_set_3dfx_mode ***/ 00170 glx.Set3DfxModeMESA = _real_glXSet3DfxModeMESA; 00171 00172 /*** GLX_NV_vertex_array_range ***/ 00173 glx.AllocateMemoryNV = _real_glXAllocateMemoryNV; 00174 glx.FreeMemoryNV = _real_glXFreeMemoryNV; 00175 00176 /*** GLX_MESA_agp_offset ***/ 00177 glx.GetAGPOffsetMESA = _real_glXGetAGPOffsetMESA; 00178 00179 return &glx; 00180 }