6f09a68fe0841ea5ae014531ec4a24ca10ff3732
[mesa.git] / src / mesa / drivers / x11 / glxapi.h
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 #ifndef _glxapi_h_
28 #define _glxapi_h_
29
30
31 #define GLX_GLXEXT_PROTOTYPES
32 #include "GL/glx.h"
33
34
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
38 */
39 #include "glxclient.h"
40 #else
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
44 * work properly.
45 */
46 typedef struct __GLXcontextRec {
47 Display *currentDpy;
48 GLboolean isDirect;
49 GLXDrawable currentDrawable;
50 GLXDrawable currentReadable;
51 XID xid;
52 } __GLXcontext;
53 #endif
54
55
56 /*
57 * Almost all the GLX API functions get routed through this dispatch table.
58 * The exceptions are the glXGetCurrentXXX() functions.
59 *
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.
64 *
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.
69 */
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);
87 void (*WaitGL)(void);
88 void (*WaitX)(void);
89
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);
94
95 /*** GLX_VERSION_1_2 ***/
96 /*Display *(*GetCurrentDisplay)(void);*/
97
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);
116
117 /*** GLX_SGI_swap_control ***/
118 int (*SwapIntervalSGI)(int);
119
120 /*** GLX_SGI_video_sync ***/
121 int (*GetVideoSyncSGI)(unsigned int *count);
122 int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
123
124 /*** GLX_SGI_make_current_read ***/
125 Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext);
126 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
127
128 /*** GLX_SGIX_video_source (needs video library) ***/
129 #if defined(_VL_H_)
130 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode);
131 void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX);
132 #else
133 void *CreateGLXVideoSourceSGIX;
134 void *DestroyGLXVideoSourceSGIX;
135 #endif
136
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);
143
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 *);
151
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 *);
158
159 /*** GLX_SGI_cushion ***/
160 void (*CushionSGI)(Display *, Window, float);
161
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);
168
169 /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
170 #if defined (_DM_BUFFER_H_)
171 Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
172 #else
173 void *AssociciateDMPbufferSGIX;
174 #endif
175
176 /*** GLX_SGIX_swap_group ***/
177 void (*JoinSwapGroupSGIX)(Display *, GLXDrawable, GLXDrawable);
178
179 /*** GLX_SGIX_swap_barrier ***/
180 void (*BindSwapBarrierSGIX)(Display *, GLXDrawable, int);
181 Bool (*QueryMaxSwapBarriersSGIX)(Display *, int, int *);
182
183 /*** GLX_SUN_get_transparent_index ***/
184 Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *);
185
186 /*** GLX_MESA_copy_sub_buffer ***/
187 void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
188
189 /*** GLX_MESA_release_buffers ***/
190 Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
191
192 /*** GLX_MESA_pixmap_colormap ***/
193 GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
194
195 /*** GLX_MESA_set_3dfx_mode ***/
196 Bool (*Set3DfxModeMESA)(int mode);
197
198 /*** GLX_NV_vertex_array_range ***/
199 void * (*AllocateMemoryNV)( GLsizei size,
200 GLfloat readFrequency,
201 GLfloat writeFrequency,
202 GLfloat priority );
203 void (*FreeMemoryNV)( GLvoid *pointer );
204
205 /*** GLX_MESA_agp_offset ***/
206 GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer );
207
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);
212 };
213
214
215
216 extern const char *
217 _glxapi_get_version(void);
218
219
220 extern const char **
221 _glxapi_get_extensions(void);
222
223
224 extern GLuint
225 _glxapi_get_dispatch_table_size(void);
226
227
228 extern void
229 _glxapi_set_no_op_table(struct _glxapi_table *t);
230
231
232 extern const GLvoid *
233 _glxapi_get_proc_address(const char *funcName);
234
235
236 #endif