Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / src / mesa / drivers / x11 / glxapi.h
1 /*
2 * Mesa 3-D graphics library
3 *
4 * Copyright (C) 1999-2004 Brian Paul All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 * 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 /* The GLX API dispatcher (i.e. this code) is being built into stand-alone
35 * Mesa. We don't know anything about XFree86 or real GLX so we define a
36 * minimal __GLXContextRec here so some of the functions in this file can
37 * work properly.
38 */
39 typedef struct __GLXcontextRec {
40 GLboolean isDirect;
41 GLXDrawable currentDrawable;
42 GLXDrawable currentReadable;
43 XID xid;
44 } __GLXcontext;
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 * Red Hat has been using this since Red Hat Linux 7.0 (I think).
57 * This'll be a standard feature in XFree86 4.3. It basically allows one
58 * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
59 * that lack the GLX extension.
60 */
61 struct _glxapi_table {
62 /*** GLX_VERSION_1_0 ***/
63 XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list);
64 void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
65 GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct);
66 GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap);
67 void (*DestroyContext)(Display *dpy, GLXContext ctx);
68 void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap);
69 int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value);
70 GLXContext (*GetCurrentContext)(void);
71 /*GLXDrawable (*GetCurrentDrawable)(void);*/
72 Bool (*IsDirect)(Display *dpy, GLXContext ctx);
73 Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
74 Bool (*QueryExtension)(Display *dpy, int *errorb, int *event);
75 Bool (*QueryVersion)(Display *dpy, int *maj, int *min);
76 void (*SwapBuffers)(Display *dpy, GLXDrawable drawable);
77 void (*UseXFont)(Font font, int first, int count, int listBase);
78 void (*WaitGL)(void);
79 void (*WaitX)(void);
80
81 /*** GLX_VERSION_1_1 ***/
82 const char *(*GetClientString)(Display *dpy, int name);
83 const char *(*QueryExtensionsString)(Display *dpy, int screen);
84 const char *(*QueryServerString)(Display *dpy, int screen, int name);
85
86 /*** GLX_VERSION_1_2 ***/
87 /*Display *(*GetCurrentDisplay)(void);*/
88
89 /*** GLX_VERSION_1_3 ***/
90 GLXFBConfig *(*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
91 GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
92 GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
93 GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
94 GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
95 void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
96 void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
97 void (*DestroyWindow)(Display *dpy, GLXWindow window);
98 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
99 int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
100 GLXFBConfig *(*GetFBConfigs)(Display *dpy, int screen, int *nelements);
101 void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
102 XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
103 Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
104 int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
105 void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
106 void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
107
108 /*** GLX_SGI_swap_control ***/
109 int (*SwapIntervalSGI)(int);
110
111 /*** GLX_SGI_video_sync ***/
112 int (*GetVideoSyncSGI)(unsigned int *count);
113 int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
114
115 /*** GLX_SGI_make_current_read ***/
116 Bool (*MakeCurrentReadSGI)(Display *, GLXDrawable, GLXDrawable, GLXContext);
117 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
118
119 /*** GLX_SGIX_video_source (needs video library) ***/
120 #if defined(_VL_H_)
121 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX)(Display *, int, VLServer, VLPath, int, VLNode);
122 void (*DestroyGLXVideoSourceSGIX)(Display *, GLXVideoSourceSGIX);
123 #else
124 void *CreateGLXVideoSourceSGIX;
125 void *DestroyGLXVideoSourceSGIX;
126 #endif
127
128 /*** GLX_EXT_import_context ***/
129 void (*FreeContextEXT)(Display *dpy, GLXContext context);
130 GLXContextID (*GetContextIDEXT)(const GLXContext context);
131 /*Display *(*GetCurrentDisplayEXT)(void);*/
132 GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
133 int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
134
135 /*** GLX_SGIX_fbconfig ***/
136 int (*GetFBConfigAttribSGIX)(Display *, GLXFBConfigSGIX, int, int *);
137 GLXFBConfigSGIX * (*ChooseFBConfigSGIX)(Display *, int, int *, int *);
138 GLXPixmap (*CreateGLXPixmapWithConfigSGIX)(Display *, GLXFBConfigSGIX, Pixmap);
139 GLXContext (*CreateContextWithConfigSGIX)(Display *, GLXFBConfigSGIX, int, GLXContext, Bool);
140 XVisualInfo * (*GetVisualFromFBConfigSGIX)(Display *, GLXFBConfigSGIX);
141 GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX)(Display *, XVisualInfo *);
142
143 /*** GLX_SGIX_pbuffer ***/
144 GLXPbufferSGIX (*CreateGLXPbufferSGIX)(Display *, GLXFBConfigSGIX, unsigned int, unsigned int, int *);
145 void (*DestroyGLXPbufferSGIX)(Display *, GLXPbufferSGIX);
146 void (*QueryGLXPbufferSGIX)(Display *, GLXPbufferSGIX, int, unsigned int *);
147 void (*SelectEventSGIX)(Display *, GLXDrawable, unsigned long);
148 void (*GetSelectedEventSGIX)(Display *, GLXDrawable, unsigned long *);
149
150 /*** GLX_SGI_cushion ***/
151 void (*CushionSGI)(Display *, Window, float);
152
153 /*** GLX_SGIX_video_resize ***/
154 int (*BindChannelToWindowSGIX)(Display *, int, int, Window);
155 int (*ChannelRectSGIX)(Display *, int, int, int, int, int, int);
156 int (*QueryChannelRectSGIX)(Display *, int, int, int *, int *, int *, int *);
157 int (*QueryChannelDeltasSGIX)(Display *, int, int, int *, int *, int *, int *);
158 int (*ChannelRectSyncSGIX)(Display *, int, int, GLenum);
159
160 /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
161 #if defined (_DM_BUFFER_H_)
162 Bool (*AssociateDMPbufferSGIX)(Display *, GLXPbufferSGIX, DMparams *, DMbuffer);
163 #else
164 void *AssociciateDMPbufferSGIX;
165 #endif
166
167 /*** GLX_SUN_get_transparent_index ***/
168 Status (*GetTransparentIndexSUN)(Display *, Window, Window, unsigned long *);
169
170 /*** GLX_MESA_copy_sub_buffer ***/
171 void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
172
173 /*** GLX_MESA_release_buffers ***/
174 Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
175
176 /*** GLX_MESA_pixmap_colormap ***/
177 GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
178
179 /*** GLX_EXT_texture_from_pixmap ***/
180 void (*BindTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer,
181 const int *attrib_list);
182 void (*ReleaseTexImageEXT)(Display *dpy, GLXDrawable drawable, int buffer);
183
184 /*** GLX_ARB_create_context ***/
185 GLXContext (*CreateContextAttribs)(Display *dpy, GLXFBConfig config,
186 GLXContext share_context, Bool direct,
187 const int *attrib_list);
188 };
189
190
191
192 extern const char *
193 _glxapi_get_version(void);
194
195
196 extern const char **
197 _glxapi_get_extensions(void);
198
199
200 extern GLuint
201 _glxapi_get_dispatch_table_size(void);
202
203
204 extern void
205 _glxapi_set_no_op_table(struct _glxapi_table *t);
206
207
208 extern __GLXextFuncPtr
209 _glxapi_get_proc_address(const char *funcName);
210
211
212 #endif