changed glXCopyContext() mask to unsigned long, per GLX spec
[mesa.git] / src / mesa / drivers / x11 / glxapi.h
1 /* $Id: glxapi.h,v 1.4 2000/02/27 18:26:54 brianp Exp $ */
2
3 /*
4 * Mesa 3-D graphics library
5 * Version: 3.3
6 *
7 * Copyright (C) 1999 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 #include "GL/glx.h"
33
34
35 #define _GLXAPI_VERSION_1_1 1
36 #define _GLXAPI_VERSION_1_2 1
37 #define _GLXAPI_VERSION_1_3 1
38
39 #define _GLXAPI_EXT_import_context 1
40 #define _GLXAPI_SGI_video_sync 1
41 #define _GLXAPI_MESA_copy_sub_buffer 1
42 #define _GLXAPI_MESA_release_buffers 1
43 #define _GLXAPI_MESA_pixmap_colormap 1
44 #define _GLXAPI_MESA_set_3dfx_mode 1
45
46
47 /*
48 * Almost all the GLX API functions get routed through this dispatch table.
49 * The exceptions are the glXGetCurrentXXX() functions.
50 *
51 * This dispatch table allows multiple GLX client-side modules to coexist.
52 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
53 * pseudo-GLX can be present at the same time. The former being used on
54 * GLX-enabled X servers and the later on non-GLX X servers.
55 */
56 struct _glxapi_table {
57 /* GLX 1.0 functions */
58 XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list);
59 void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
60 GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct);
61 GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap);
62 void (*DestroyContext)(Display *dpy, GLXContext ctx);
63 void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap);
64 int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value);
65 /*GLXContext (*GetCurrentContext)(void);*/
66 /*GLXDrawable (*GetCurrentDrawable)(void);*/
67 Bool (*IsDirect)(Display *dpy, GLXContext ctx);
68 Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
69 Bool (*QueryExtension)(Display *dpy, int *errorb, int *event);
70 Bool (*QueryVersion)(Display *dpy, int *maj, int *min);
71 void (*SwapBuffers)(Display *dpy, GLXDrawable drawable);
72 void (*UseXFont)(Font font, int first, int count, int listBase);
73 void (*WaitGL)(void);
74 void (*WaitX)(void);
75
76 #ifdef _GLXAPI_VERSION_1_1
77 const char *(*GetClientString)(Display *dpy, int name);
78 const char *(*QueryExtensionsString)(Display *dpy, int screen);
79 const char *(*QueryServerString)(Display *dpy, int screen, int name);
80 #endif
81
82 #ifdef _GLXAPI_VERSION_1_2
83 /*Display *(*GetCurrentDisplay)(void);*/
84 #endif
85
86 #ifdef _GLXAPI_VERSION_1_3
87 GLXFBConfig (*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
88 GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
89 GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
90 GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
91 GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
92 void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
93 void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
94 void (*DestroyWindow)(Display *dpy, GLXWindow window);
95 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
96 int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
97 void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
98 XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
99 Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
100 int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
101 void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
102 void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
103 #endif
104
105 #ifdef _GLXAPI_EXT_import_context
106 void (*FreeContextEXT)(Display *dpy, GLXContext context);
107 GLXContextID (*GetContextIDEXT)(const GLXContext context);
108 Display *(*GetCurrentDisplayEXT)(void);
109 GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
110 int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
111 #endif
112
113 #ifdef _GLXAPI_SGI_video_sync
114 int (*GetVideoSyncSGI)(unsigned int *count);
115 int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
116 #endif
117
118 /*
119 * XXX thesa Mesa-specific functions might not belong here
120 */
121
122 #ifdef _GLXAPI_MESA_copy_sub_buffer
123 void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
124 #endif
125
126 #ifdef _GLXAPI_MESA_release_buffers
127 Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
128 #endif
129
130 #ifdef _GLXAPI_MESA_pixmap_colormap
131 GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
132 #endif
133
134 #ifdef _GLXAPI_MESA_set_3dfx_mode
135 GLboolean (*Set3DfxModeMESA)(GLint mode);
136 #endif
137
138 };
139
140
141
142 extern const char *
143 _glxapi_get_version(void);
144
145
146 extern const char **
147 _glxapi_get_extensions(void);
148
149
150 extern GLuint
151 _glxapi_get_dispatch_table_size(void);
152
153
154 extern void
155 _glxapi_set_no_op_table(struct _glxapi_table *t);
156
157
158 extern const GLvoid *
159 _glxapi_get_proc_address(const char *funcName);
160
161
162 #endif