2 * Mesa 3-D graphics library
4 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * OTHER DEALINGS IN THE SOFTWARE.
30 #define GLX_GLXEXT_PROTOTYPES
34 /* The GLX API dispatcher (i.e. this code) is being built into stand-alone
35 * Mesa. We don't know anything about XFree86 or real GLX so we define a
36 * minimal __GLXContextRec here so some of the functions in this file can
39 typedef struct __GLXcontextRec
{
42 GLXDrawable currentDrawable
;
43 GLXDrawable currentReadable
;
49 * Almost all the GLX API functions get routed through this dispatch table.
50 * The exceptions are the glXGetCurrentXXX() functions.
52 * This dispatch table allows multiple GLX client-side modules to coexist.
53 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
54 * pseudo-GLX can be present at the same time. The former being used on
55 * GLX-enabled X servers and the later on non-GLX X servers.
57 * Red Hat has been using this since Red Hat Linux 7.0 (I think).
58 * This'll be a standard feature in XFree86 4.3. It basically allows one
59 * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
60 * that lack the GLX extension.
62 struct _glxapi_table
{
63 /*** GLX_VERSION_1_0 ***/
64 XVisualInfo
*(*ChooseVisual
)(Display
*dpy
, int screen
, int *list
);
65 void (*CopyContext
)(Display
*dpy
, GLXContext src
, GLXContext dst
, unsigned long mask
);
66 GLXContext (*CreateContext
)(Display
*dpy
, XVisualInfo
*visinfo
, GLXContext shareList
, Bool direct
);
67 GLXPixmap (*CreateGLXPixmap
)(Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
);
68 void (*DestroyContext
)(Display
*dpy
, GLXContext ctx
);
69 void (*DestroyGLXPixmap
)(Display
*dpy
, GLXPixmap pixmap
);
70 int (*GetConfig
)(Display
*dpy
, XVisualInfo
*visinfo
, int attrib
, int *value
);
71 GLXContext (*GetCurrentContext
)(void);
72 /*GLXDrawable (*GetCurrentDrawable)(void);*/
73 Bool (*IsDirect
)(Display
*dpy
, GLXContext ctx
);
74 Bool (*MakeCurrent
)(Display
*dpy
, GLXDrawable drawable
, GLXContext ctx
);
75 Bool (*QueryExtension
)(Display
*dpy
, int *errorb
, int *event
);
76 Bool (*QueryVersion
)(Display
*dpy
, int *maj
, int *min
);
77 void (*SwapBuffers
)(Display
*dpy
, GLXDrawable drawable
);
78 void (*UseXFont
)(Font font
, int first
, int count
, int listBase
);
82 /*** GLX_VERSION_1_1 ***/
83 const char *(*GetClientString
)(Display
*dpy
, int name
);
84 const char *(*QueryExtensionsString
)(Display
*dpy
, int screen
);
85 const char *(*QueryServerString
)(Display
*dpy
, int screen
, int name
);
87 /*** GLX_VERSION_1_2 ***/
88 /*Display *(*GetCurrentDisplay)(void);*/
90 /*** GLX_VERSION_1_3 ***/
91 GLXFBConfig
*(*ChooseFBConfig
)(Display
*dpy
, int screen
, const int *attribList
, int *nitems
);
92 GLXContext (*CreateNewContext
)(Display
*dpy
, GLXFBConfig config
, int renderType
, GLXContext shareList
, Bool direct
);
93 GLXPbuffer (*CreatePbuffer
)(Display
*dpy
, GLXFBConfig config
, const int *attribList
);
94 GLXPixmap (*CreatePixmap
)(Display
*dpy
, GLXFBConfig config
, Pixmap pixmap
, const int *attribList
);
95 GLXWindow (*CreateWindow
)(Display
*dpy
, GLXFBConfig config
, Window win
, const int *attribList
);
96 void (*DestroyPbuffer
)(Display
*dpy
, GLXPbuffer pbuf
);
97 void (*DestroyPixmap
)(Display
*dpy
, GLXPixmap pixmap
);
98 void (*DestroyWindow
)(Display
*dpy
, GLXWindow window
);
99 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
100 int (*GetFBConfigAttrib
)(Display
*dpy
, GLXFBConfig config
, int attribute
, int *value
);
101 GLXFBConfig
*(*GetFBConfigs
)(Display
*dpy
, int screen
, int *nelements
);
102 void (*GetSelectedEvent
)(Display
*dpy
, GLXDrawable drawable
, unsigned long *mask
);
103 XVisualInfo
*(*GetVisualFromFBConfig
)(Display
*dpy
, GLXFBConfig config
);
104 Bool (*MakeContextCurrent
)(Display
*dpy
, GLXDrawable draw
, GLXDrawable read
, GLXContext ctx
);
105 int (*QueryContext
)(Display
*dpy
, GLXContext ctx
, int attribute
, int *value
);
106 void (*QueryDrawable
)(Display
*dpy
, GLXDrawable draw
, int attribute
, unsigned int *value
);
107 void (*SelectEvent
)(Display
*dpy
, GLXDrawable drawable
, unsigned long mask
);
109 /*** GLX_SGI_swap_control ***/
110 int (*SwapIntervalSGI
)(int);
112 /*** GLX_SGI_video_sync ***/
113 int (*GetVideoSyncSGI
)(unsigned int *count
);
114 int (*WaitVideoSyncSGI
)(int divisor
, int remainder
, unsigned int *count
);
116 /*** GLX_SGI_make_current_read ***/
117 Bool (*MakeCurrentReadSGI
)(Display
*, GLXDrawable
, GLXDrawable
, GLXContext
);
118 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
120 /*** GLX_SGIX_video_source (needs video library) ***/
122 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX
)(Display
*, int, VLServer
, VLPath
, int, VLNode
);
123 void (*DestroyGLXVideoSourceSGIX
)(Display
*, GLXVideoSourceSGIX
);
125 void *CreateGLXVideoSourceSGIX
;
126 void *DestroyGLXVideoSourceSGIX
;
129 /*** GLX_EXT_import_context ***/
130 void (*FreeContextEXT
)(Display
*dpy
, GLXContext context
);
131 GLXContextID (*GetContextIDEXT
)(const GLXContext context
);
132 /*Display *(*GetCurrentDisplayEXT)(void);*/
133 GLXContext (*ImportContextEXT
)(Display
*dpy
, GLXContextID contextID
);
134 int (*QueryContextInfoEXT
)(Display
*dpy
, GLXContext context
, int attribute
,int *value
);
136 /*** GLX_SGIX_fbconfig ***/
137 int (*GetFBConfigAttribSGIX
)(Display
*, GLXFBConfigSGIX
, int, int *);
138 GLXFBConfigSGIX
* (*ChooseFBConfigSGIX
)(Display
*, int, int *, int *);
139 GLXPixmap (*CreateGLXPixmapWithConfigSGIX
)(Display
*, GLXFBConfigSGIX
, Pixmap
);
140 GLXContext (*CreateContextWithConfigSGIX
)(Display
*, GLXFBConfigSGIX
, int, GLXContext
, Bool
);
141 XVisualInfo
* (*GetVisualFromFBConfigSGIX
)(Display
*, GLXFBConfigSGIX
);
142 GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX
)(Display
*, XVisualInfo
*);
144 /*** GLX_SGIX_pbuffer ***/
145 GLXPbufferSGIX (*CreateGLXPbufferSGIX
)(Display
*, GLXFBConfigSGIX
, unsigned int, unsigned int, int *);
146 void (*DestroyGLXPbufferSGIX
)(Display
*, GLXPbufferSGIX
);
147 int (*QueryGLXPbufferSGIX
)(Display
*, GLXPbufferSGIX
, int, unsigned int *);
148 void (*SelectEventSGIX
)(Display
*, GLXDrawable
, unsigned long);
149 void (*GetSelectedEventSGIX
)(Display
*, GLXDrawable
, unsigned long *);
151 /*** GLX_SGI_cushion ***/
152 void (*CushionSGI
)(Display
*, Window
, float);
154 /*** GLX_SGIX_video_resize ***/
155 int (*BindChannelToWindowSGIX
)(Display
*, int, int, Window
);
156 int (*ChannelRectSGIX
)(Display
*, int, int, int, int, int, int);
157 int (*QueryChannelRectSGIX
)(Display
*, int, int, int *, int *, int *, int *);
158 int (*QueryChannelDeltasSGIX
)(Display
*, int, int, int *, int *, int *, int *);
159 int (*ChannelRectSyncSGIX
)(Display
*, int, int, GLenum
);
161 /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
162 #if defined (_DM_BUFFER_H_)
163 Bool (*AssociateDMPbufferSGIX
)(Display
*, GLXPbufferSGIX
, DMparams
*, DMbuffer
);
165 void *AssociciateDMPbufferSGIX
;
168 /*** GLX_SGIX_swap_group ***/
169 void (*JoinSwapGroupSGIX
)(Display
*, GLXDrawable
, GLXDrawable
);
171 /*** GLX_SGIX_swap_barrier ***/
172 void (*BindSwapBarrierSGIX
)(Display
*, GLXDrawable
, int);
173 Bool (*QueryMaxSwapBarriersSGIX
)(Display
*, int, int *);
175 /*** GLX_SUN_get_transparent_index ***/
176 Status (*GetTransparentIndexSUN
)(Display
*, Window
, Window
, long *);
178 /*** GLX_MESA_copy_sub_buffer ***/
179 void (*CopySubBufferMESA
)(Display
*dpy
, GLXDrawable drawable
, int x
, int y
, int width
, int height
);
181 /*** GLX_MESA_release_buffers ***/
182 Bool (*ReleaseBuffersMESA
)(Display
*dpy
, Window w
);
184 /*** GLX_MESA_pixmap_colormap ***/
185 GLXPixmap (*CreateGLXPixmapMESA
)(Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
, Colormap cmap
);
187 /*** GLX_MESA_set_3dfx_mode ***/
188 Bool (*Set3DfxModeMESA
)(int mode
);
190 /*** GLX_NV_vertex_array_range ***/
191 void * (*AllocateMemoryNV
)( GLsizei size
,
192 GLfloat readFrequency
,
193 GLfloat writeFrequency
,
195 void (*FreeMemoryNV
)( GLvoid
*pointer
);
197 /*** GLX_MESA_agp_offset ***/
198 GLuint (*GetAGPOffsetMESA
)( const GLvoid
*pointer
);
200 /*** GLX_EXT_texture_from_pixmap ***/
201 void (*BindTexImageEXT
)(Display
*dpy
, GLXDrawable drawable
, int buffer
,
202 const int *attrib_list
);
203 void (*ReleaseTexImageEXT
)(Display
*dpy
, GLXDrawable drawable
, int buffer
);
209 _glxapi_get_version(void);
213 _glxapi_get_extensions(void);
217 _glxapi_get_dispatch_table_size(void);
221 _glxapi_set_no_op_table(struct _glxapi_table
*t
);
224 extern __GLXextFuncPtr
225 _glxapi_get_proc_address(const char *funcName
);