mesa: Restore 78-column wrapping of license text in C-style comments.
[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 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * 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 /* The GLX API dispatcher (i.e. this code) is being built into stand-alone
36 * Mesa. We don't know anything about XFree86 or real GLX so we define a
37 * minimal __GLXContextRec here so some of the functions in this file can
38 * work properly.
39 */
40 typedef struct __GLXcontextRec {
41 Display *currentDpy;
42 GLboolean isDirect;
43 GLXDrawable currentDrawable;
44 GLXDrawable currentReadable;
45 XID xid;
46 } __GLXcontext;
47
48
49 /*
50 * Almost all the GLX API functions get routed through this dispatch table.
51 * The exceptions are the glXGetCurrentXXX() functions.
52 *
53 * This dispatch table allows multiple GLX client-side modules to coexist.
54 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
55 * pseudo-GLX can be present at the same time. The former being used on
56 * GLX-enabled X servers and the later on non-GLX X servers.
57 *
58 * Red Hat has been using this since Red Hat Linux 7.0 (I think).
59 * This'll be a standard feature in XFree86 4.3. It basically allows one
60 * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
61 * that lack the GLX extension.
62 */
63 struct _glxapi_table {
64 /*** GLX_VERSION_1_0 ***/
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 /*** 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
88 /*** GLX_VERSION_1_2 ***/
89 /*Display *(*GetCurrentDisplay)(void);*/
90
91 /*** GLX_VERSION_1_3 ***/
92 GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
93 GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
94 GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
95 GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
96 GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
97 void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
98 void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
99 void (*DestroyWindow)(Display *dpy, GLXWindow window);
100 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
101 int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
102 GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements);
103 void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
104 XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
105 Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
106 int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
107 void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
108 void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
109
110 /*** GLX_SGI_swap_control ***/
111 int (*SwapIntervalSGI)(int);
112
113 /*** GLX_SGI_video_sync ***/
114 int (*GetVideoSyncSGI)(unsigned int *count);
115 int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
116
117 /*** GLX_SGI_make_current_read ***/
118 Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext);
119 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
120
121 /*** GLX_SGIX_video_source (needs video library) ***/
122 #if defined(_VL_H_)
123 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode);
124 void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX);
125 #else
126 void *CreateGLXVideoSourceSGIX;
127 void *DestroyGLXVideoSourceSGIX;
128 #endif
129
130 /*** GLX_EXT_import_context ***/
131 void (*FreeContextEXT)(Display *dpy, GLXContext context);
132 GLXContextID (*GetContextIDEXT)(const GLXContext context);
133 /*Display *(*GetCurrentDisplayEXT)(void);*/
134 GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
135 int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
136
137 /*** GLX_SGIX_fbconfig ***/
138 int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *);
139 GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *);
140 GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap);
141 GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
142 XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX);
143 GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *);
144
145 /*** GLX_SGIX_pbuffer ***/
146 GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
147 void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX);
148 int (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *);
149 void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long);
150 void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *);
151
152 /*** GLX_SGI_cushion ***/
153 void (*CushionSGI)(Display *, Window, float);
154
155 /*** GLX_SGIX_video_resize ***/
156 int (*BindChannelToWindowSGIX)(Display *, int, int, Window);
157 int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int);
158 int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *);
159 int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *);
160 int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum);
161
162 /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
163 #if defined (_DM_BUFFER_H_)
164 Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
165 #else
166 void *AssociciateDMPbufferSGIX;
167 #endif
168
169 /*** GLX_SGIX_swap_group ***/
170 void (*JoinSwapGroupSGIX)(Display *, GLXDrawable, GLXDrawable);
171
172 /*** GLX_SGIX_swap_barrier ***/
173 void (*BindSwapBarrierSGIX)(Display *, GLXDrawable, int);
174 Bool (*QueryMaxSwapBarriersSGIX)(Display *, int, int *);
175
176 /*** GLX_SUN_get_transparent_index ***/
177 Status (*GetTransparentIndexSUN)(Display *, Window, Window, long *);
178
179 /*** GLX_MESA_copy_sub_buffer ***/
180 void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
181
182 /*** GLX_MESA_release_buffers ***/
183 Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
184
185 /*** GLX_MESA_pixmap_colormap ***/
186 GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
187
188 /*** GLX_MESA_set_3dfx_mode ***/
189 Bool (*Set3DfxModeMESA)(int mode);
190
191 /*** GLX_NV_vertex_array_range ***/
192 void * (*AllocateMemoryNV)( GLsizei size,
193 GLfloat readFrequency,
194 GLfloat writeFrequency,
195 GLfloat priority );
196 void (*FreeMemoryNV)( GLvoid *pointer );
197
198 /*** GLX_MESA_agp_offset ***/
199 GLuint (*GetAGPOffsetMESA)( const GLvoid *pointer );
200
201 /*** GLX_EXT_texture_from_pixmap ***/
202 void (*BindTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer,
203 const int *attrib_list);
204 void (*ReleaseTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer);
205 };
206
207
208
209 extern const char *
210 _glxapi_get_version(void);
211
212
213 extern const char **
214 _glxapi_get_extensions(void);
215
216
217 extern GLuint
218 _glxapi_get_dispatch_table_size(void);
219
220
221 extern void
222 _glxapi_set_no_op_table(struct _glxapi_table *t);
223
224
225 extern __GLXextFuncPtr
226 _glxapi_get_proc_address(const char *funcName);
227
228
229 #endif