ea287473a6bf2b208516a968e339e7d58c7011d2
[mesa.git] / src / mesa / drivers / x11 / glxapi.h
1 /* $Id: glxapi.h,v 1.9 2001/05/24 19:06:21 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.5
6 *
7 * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a
10 * copy of this software and associated documentation files (the "Software"),
11 * to deal in the Software without restriction, including without limitation
12 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 * and/or sell copies of the Software, and to permit persons to whom the
14 * Software is furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
22 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
23 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 */
26
27
28 #ifndef _glxapi_h_
29 #define _glxapi_h_
30
31
32 #define GLX_GLXEXT_PROTOTYPES
33 #include "GL/glx.h"
34
35
36 #ifdef GLX_BUILD_IN_XLIB_MESA
37 /* The GLX API dispatcher is being built into XFree86's libGL */
38 #include "glxclient.h"
39 #else
40 /* The GLX API dispatcher is being built into stand-alone Mesa */
41 typedef struct __GLXcontextRec {
42 Display *currentDpy;
43 GLboolean isDirect;
44 GLXDrawable currentDrawable;
45 GLXDrawable currentReadable;
46 XID xid;
47 } __GLXcontext;
48 #endif
49
50
51 /*
52 * Almost all the GLX API functions get routed through this dispatch table.
53 * The exceptions are the glXGetCurrentXXX() functions.
54 *
55 * This dispatch table allows multiple GLX client-side modules to coexist.
56 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
57 * pseudo-GLX can be present at the same time. The former being used on
58 * GLX-enabled X servers and the later on non-GLX X servers.
59 *
60 * XXX Note that this hasn't actually been fully used yet in either Mesa or
61 * the DRI. Red Hat, however, has used it for their custom libGL.
62 */
63 struct _glxapi_table {
64 /* GLX 1.0 functions */
65 XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list);
66 void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
67 GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct);
68 GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap);
69 void (*DestroyContext)(Display *dpy, GLXContext ctx);
70 void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap);
71 int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value);
72 /*GLXContext (*GetCurrentContext)(void);*/
73 /*GLXDrawable (*GetCurrentDrawable)(void);*/
74 Bool (*IsDirect)(Display *dpy, GLXContext ctx);
75 Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
76 Bool (*QueryExtension)(Display *dpy, int *errorb, int *event);
77 Bool (*QueryVersion)(Display *dpy, int *maj, int *min);
78 void (*SwapBuffers)(Display *dpy, GLXDrawable drawable);
79 void (*UseXFont)(Font font, int first, int count, int listBase);
80 void (*WaitGL)(void);
81 void (*WaitX)(void);
82
83 #ifdef GLX_VERSION_1_1
84 const char *(*GetClientString)(Display *dpy, int name);
85 const char *(*QueryExtensionsString)(Display *dpy, int screen);
86 const char *(*QueryServerString)(Display *dpy, int screen, int name);
87 #endif
88
89 #ifdef GLX_VERSION_1_2
90 /*Display *(*GetCurrentDisplay)(void);*/
91 #endif
92
93 #ifdef GLX_VERSION_1_3
94 GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
95 GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
96 GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
97 GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
98 GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
99 void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
100 void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
101 void (*DestroyWindow)(Display *dpy, GLXWindow window);
102 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
103 int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
104 GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements);
105 void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
106 XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
107 Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
108 int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
109 void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
110 void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
111 #endif
112
113 #ifdef GLX_SGI_swap_control
114 int (*SwapIntervalSGI)(int);
115 #endif
116
117 #ifdef GLX_SGI_video_sync
118 int (*GetVideoSyncSGI)(unsigned int *count);
119 int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
120 #endif
121
122 #ifdef GLX_SGI_make_current_read
123 Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext);
124 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
125 #endif
126
127 #if defined(_VL_H) && defined(GLX_SGIX_video_source)
128 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode);
129 void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX);
130 #endif
131
132 #ifdef GLX_EXT_import_context
133 void (*FreeContextEXT)(Display *dpy, GLXContext context);
134 GLXContextID (*GetContextIDEXT)(const GLXContext context);
135 /*Display *(*GetCurrentDisplayEXT)(void);*/
136 GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
137 int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
138 #endif
139
140 #ifdef GLX_SGIX_fbconfig
141 int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *);
142 GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *);
143 GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap);
144 GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
145 XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX);
146 GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *);
147 #endif
148
149 #ifdef GLX_SGIX_pbuffer
150 GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
151 void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX);
152 int (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *);
153 void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long);
154 void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *);
155 #endif
156
157 #ifdef GLX_SGI_cushion
158 void (*CushionSGI)(Display *, Window, float);
159 #endif
160
161 #ifdef GLX_SGIX_video_resize
162 int (*BindChannelToWindowSGIX)(Display *, int, int, Window);
163 int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int);
164 int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *);
165 int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *);
166 int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum);
167 #endif
168
169 #if defined (_DM_BUFFER_H_) && defined(GLX_SGIX_dmbuffer)
170 Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
171 #endif
172
173 #ifdef GLX_SGIX_swap_group
174 void (*JoinSwapGroupSGIX)(Display *, GLXDrawable, GLXDrawable);
175 #endif
176
177 #ifdef GLX_SGIX_swap_barrier
178 void (*BindSwapBarrierSGIX)(Display *, GLXDrawable, int);
179 Bool (*QueryMaxSwapBarriersSGIX)(Display *, int, int *);
180 #endif
181
182 #ifdef GLX_SUN_get_transparent_index
183 Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *);
184 #endif
185
186 #ifdef GLX_MESA_copy_sub_buffer
187 void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
188 #endif
189
190 #ifdef GLX_MESA_release_buffers
191 Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
192 #endif
193
194 #ifdef GLX_MESA_pixmap_colormap
195 GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
196 #endif
197
198 #ifdef GLX_MESA_set_3dfx_mode
199 Bool (*Set3DfxModeMESA)(int mode);
200 #endif
201
202 };
203
204
205
206 extern const char *
207 _glxapi_get_version(void);
208
209
210 extern const char **
211 _glxapi_get_extensions(void);
212
213
214 extern GLuint
215 _glxapi_get_dispatch_table_size(void);
216
217
218 extern void
219 _glxapi_set_no_op_table(struct _glxapi_table *t);
220
221
222 extern const GLvoid *
223 _glxapi_get_proc_address(const char *funcName);
224
225
226 #endif