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