3 * Mesa 3-D graphics library
6 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
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.
31 #define GLX_GLXEXT_PROTOTYPES
35 #ifdef GLX_BUILT_IN_XMESA
36 /* The GLX API dispatcher (i.e. this code) is being built into XFree86's
37 * libGL so we'll use the __GLXContextRec defined in xc/lib/GL/glx/glxclient.h
39 #include "glxclient.h"
41 /* The GLX API dispatcher (i.e. this code) is being built into stand-alone
42 * Mesa. We don't know anything about XFree86 or real GLX so we define a
43 * minimal __GLXContextRec here so some of the functions in this file can
46 typedef struct __GLXcontextRec
{
49 GLXDrawable currentDrawable
;
50 GLXDrawable currentReadable
;
57 * Almost all the GLX API functions get routed through this dispatch table.
58 * The exceptions are the glXGetCurrentXXX() functions.
60 * This dispatch table allows multiple GLX client-side modules to coexist.
61 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
62 * pseudo-GLX can be present at the same time. The former being used on
63 * GLX-enabled X servers and the later on non-GLX X servers.
65 * Red Hat has been using this since Red Hat Linux 7.0 (I think).
66 * This'll be a standard feature in XFree86 4.3. It basically allows one
67 * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
68 * that lack the GLX extension.
70 struct _glxapi_table
{
71 /*** GLX_VERSION_1_0 ***/
72 XVisualInfo
*(*ChooseVisual
)(Display
*dpy
, int screen
, int *list
);
73 void (*CopyContext
)(Display
*dpy
, GLXContext src
, GLXContext dst
, unsigned long mask
);
74 GLXContext (*CreateContext
)(Display
*dpy
, XVisualInfo
*visinfo
, GLXContext shareList
, Bool direct
);
75 GLXPixmap (*CreateGLXPixmap
)(Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
);
76 void (*DestroyContext
)(Display
*dpy
, GLXContext ctx
);
77 void (*DestroyGLXPixmap
)(Display
*dpy
, GLXPixmap pixmap
);
78 int (*GetConfig
)(Display
*dpy
, XVisualInfo
*visinfo
, int attrib
, int *value
);
79 /*GLXContext (*GetCurrentContext)(void);*/
80 /*GLXDrawable (*GetCurrentDrawable)(void);*/
81 Bool (*IsDirect
)(Display
*dpy
, GLXContext ctx
);
82 Bool (*MakeCurrent
)(Display
*dpy
, GLXDrawable drawable
, GLXContext ctx
);
83 Bool (*QueryExtension
)(Display
*dpy
, int *errorb
, int *event
);
84 Bool (*QueryVersion
)(Display
*dpy
, int *maj
, int *min
);
85 void (*SwapBuffers
)(Display
*dpy
, GLXDrawable drawable
);
86 void (*UseXFont
)(Font font
, int first
, int count
, int listBase
);
90 /*** GLX_VERSION_1_1 ***/
91 const char *(*GetClientString
)(Display
*dpy
, int name
);
92 const char *(*QueryExtensionsString
)(Display
*dpy
, int screen
);
93 const char *(*QueryServerString
)(Display
*dpy
, int screen
, int name
);
95 /*** GLX_VERSION_1_2 ***/
96 /*Display *(*GetCurrentDisplay)(void);*/
98 /*** GLX_VERSION_1_3 ***/
99 GLXFBConfig
*(*ChooseFBConfig
)(Display
*dpy
, int screen
, const int *attribList
, int *nitems
);
100 GLXContext (*CreateNewContext
)(Display
*dpy
, GLXFBConfig config
, int renderType
, GLXContext shareList
, Bool direct
);
101 GLXPbuffer (*CreatePbuffer
)(Display
*dpy
, GLXFBConfig config
, const int *attribList
);
102 GLXPixmap (*CreatePixmap
)(Display
*dpy
, GLXFBConfig config
, Pixmap pixmap
, const int *attribList
);
103 GLXWindow (*CreateWindow
)(Display
*dpy
, GLXFBConfig config
, Window win
, const int *attribList
);
104 void (*DestroyPbuffer
)(Display
*dpy
, GLXPbuffer pbuf
);
105 void (*DestroyPixmap
)(Display
*dpy
, GLXPixmap pixmap
);
106 void (*DestroyWindow
)(Display
*dpy
, GLXWindow window
);
107 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
108 int (*GetFBConfigAttrib
)(Display
*dpy
, GLXFBConfig config
, int attribute
, int *value
);
109 GLXFBConfig
*(*GetFBConfigs
)(Display
*dpy
, int screen
, int *nelements
);
110 void (*GetSelectedEvent
)(Display
*dpy
, GLXDrawable drawable
, unsigned long *mask
);
111 XVisualInfo
*(*GetVisualFromFBConfig
)(Display
*dpy
, GLXFBConfig config
);
112 Bool (*MakeContextCurrent
)(Display
*dpy
, GLXDrawable draw
, GLXDrawable read
, GLXContext ctx
);
113 int (*QueryContext
)(Display
*dpy
, GLXContext ctx
, int attribute
, int *value
);
114 void (*QueryDrawable
)(Display
*dpy
, GLXDrawable draw
, int attribute
, unsigned int *value
);
115 void (*SelectEvent
)(Display
*dpy
, GLXDrawable drawable
, unsigned long mask
);
117 /*** GLX_SGI_swap_control ***/
118 int (*SwapIntervalSGI
)(int);
120 /*** GLX_SGI_video_sync ***/
121 int (*GetVideoSyncSGI
)(unsigned int *count
);
122 int (*WaitVideoSyncSGI
)(int divisor
, int remainder
, unsigned int *count
);
124 /*** GLX_SGI_make_current_read ***/
125 Bool (*MakeCurrentReadSGI
)(Display
*, GLXDrawable
, GLXDrawable
, GLXContext
);
126 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
128 /*** GLX_SGIX_video_source (needs video library) ***/
130 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX
)(Display
*, int, VLServer
, VLPath
, int, VLNode
);
131 void (*DestroyGLXVideoSourceSGIX
)(Display
*, GLXVideoSourceSGIX
);
133 void *CreateGLXVideoSourceSGIX
;
134 void *DestroyGLXVideoSourceSGIX
;
137 /*** GLX_EXT_import_context ***/
138 void (*FreeContextEXT
)(Display
*dpy
, GLXContext context
);
139 GLXContextID (*GetContextIDEXT
)(const GLXContext context
);
140 /*Display *(*GetCurrentDisplayEXT)(void);*/
141 GLXContext (*ImportContextEXT
)(Display
*dpy
, GLXContextID contextID
);
142 int (*QueryContextInfoEXT
)(Display
*dpy
, GLXContext context
, int attribute
,int *value
);
144 /*** GLX_SGIX_fbconfig ***/
145 int (*GetFBConfigAttribSGIX
)(Display
*, GLXFBConfigSGIX
, int, int *);
146 GLXFBConfigSGIX
* (*ChooseFBConfigSGIX
)(Display
*, int, int *, int *);
147 GLXPixmap (*CreateGLXPixmapWithConfigSGIX
)(Display
*, GLXFBConfigSGIX
, Pixmap
);
148 GLXContext (*CreateContextWithConfigSGIX
)(Display
*, GLXFBConfigSGIX
, int, GLXContext
, Bool
);
149 XVisualInfo
* (*GetVisualFromFBConfigSGIX
)(Display
*, GLXFBConfigSGIX
);
150 GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX
)(Display
*, XVisualInfo
*);
152 /*** GLX_SGIX_pbuffer ***/
153 GLXPbufferSGIX (*CreateGLXPbufferSGIX
)(Display
*, GLXFBConfigSGIX
, unsigned int, unsigned int, int *);
154 void (*DestroyGLXPbufferSGIX
)(Display
*, GLXPbufferSGIX
);
155 int (*QueryGLXPbufferSGIX
)(Display
*, GLXPbufferSGIX
, int, unsigned int *);
156 void (*SelectEventSGIX
)(Display
*, GLXDrawable
, unsigned long);
157 void (*GetSelectedEventSGIX
)(Display
*, GLXDrawable
, unsigned long *);
159 /*** GLX_SGI_cushion ***/
160 void (*CushionSGI
)(Display
*, Window
, float);
162 /*** GLX_SGIX_video_resize ***/
163 int (*BindChannelToWindowSGIX
)(Display
*, int, int, Window
);
164 int (*ChannelRectSGIX
)(Display
*, int, int, int, int, int, int);
165 int (*QueryChannelRectSGIX
)(Display
*, int, int, int *, int *, int *, int *);
166 int (*QueryChannelDeltasSGIX
)(Display
*, int, int, int *, int *, int *, int *);
167 int (*ChannelRectSyncSGIX
)(Display
*, int, int, GLenum
);
169 /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
170 #if defined (_DM_BUFFER_H_)
171 Bool (*AssociateDMPbufferSGIX
)(Display
*, GLXPbufferSGIX
, DMparams
*, DMbuffer
);
173 void *AssociciateDMPbufferSGIX
;
176 /*** GLX_SGIX_swap_group ***/
177 void (*JoinSwapGroupSGIX
)(Display
*, GLXDrawable
, GLXDrawable
);
179 /*** GLX_SGIX_swap_barrier ***/
180 void (*BindSwapBarrierSGIX
)(Display
*, GLXDrawable
, int);
181 Bool (*QueryMaxSwapBarriersSGIX
)(Display
*, int, int *);
183 /*** GLX_SUN_get_transparent_index ***/
184 Status (*GetTransparentIndexSUN
)(Display
*, Window
, Window
, long *);
186 /*** GLX_MESA_copy_sub_buffer ***/
187 void (*CopySubBufferMESA
)(Display
*dpy
, GLXDrawable drawable
, int x
, int y
, int width
, int height
);
189 /*** GLX_MESA_release_buffers ***/
190 Bool (*ReleaseBuffersMESA
)(Display
*dpy
, Window w
);
192 /*** GLX_MESA_pixmap_colormap ***/
193 GLXPixmap (*CreateGLXPixmapMESA
)(Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
, Colormap cmap
);
195 /*** GLX_MESA_set_3dfx_mode ***/
196 Bool (*Set3DfxModeMESA
)(int mode
);
198 /*** GLX_NV_vertex_array_range ***/
199 void * (*AllocateMemoryNV
)( GLsizei size
,
200 GLfloat readFrequency
,
201 GLfloat writeFrequency
,
203 void (*FreeMemoryNV
)( GLvoid
*pointer
);
205 /*** GLX_MESA_agp_offset ***/
206 GLuint (*GetAGPOffsetMESA
)( const GLvoid
*pointer
);
208 /*** GLX_ARB_render_texture ***/
209 Bool (*BindTexImageARB
)(Display
*dpy
, GLXPbuffer pbuffer
, int buffer
);
210 Bool (*ReleaseTexImageARB
)(Display
*dpy
, GLXPbuffer pbuffer
, int buffer
);
211 Bool (*DrawableAttribARB
)(Display
*dpy
, GLXDrawable draw
, const int *attribList
);
217 _glxapi_get_version(void);
221 _glxapi_get_extensions(void);
225 _glxapi_get_dispatch_table_size(void);
229 _glxapi_set_no_op_table(struct _glxapi_table
*t
);
232 extern const GLvoid
*
233 _glxapi_get_proc_address(const char *funcName
);