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