aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/x11/glxapi.h
blob: 27d62d8fae153f85c0367f7d212bea039ebafeb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* $Id: glxapi.h,v 1.4 2000/02/27 18:26:54 brianp Exp $ */

/*
 * Mesa 3-D graphics library
 * Version:  3.3
 * 
 * Copyright (C) 1999  Brian Paul   All Rights Reserved.
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included
 * in all copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */


#ifndef _glxapi_h_
#define _glxapi_h_


#include "GL/glx.h"


#define _GLXAPI_VERSION_1_1  1
#define _GLXAPI_VERSION_1_2  1
#define _GLXAPI_VERSION_1_3  1

#define _GLXAPI_EXT_import_context  1
#define _GLXAPI_SGI_video_sync  1
#define _GLXAPI_MESA_copy_sub_buffer  1
#define _GLXAPI_MESA_release_buffers  1
#define _GLXAPI_MESA_pixmap_colormap  1
#define _GLXAPI_MESA_set_3dfx_mode  1


/*
 * Almost all the GLX API functions get routed through this dispatch table.
 * The exceptions are the glXGetCurrentXXX() functions.
 *
 * This dispatch table allows multiple GLX client-side modules to coexist.
 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
 * pseudo-GLX can be present at the same time.  The former being used on
 * GLX-enabled X servers and the later on non-GLX X servers.
 */
struct _glxapi_table {
   /* GLX 1.0 functions */
   XVisualInfo *(*ChooseVisual)(Display *dpy, int screen, int *list);
   void (*CopyContext)(Display *dpy, GLXContext src, GLXContext dst, unsigned long mask);
   GLXContext (*CreateContext)(Display *dpy, XVisualInfo *visinfo, GLXContext shareList, Bool direct);
   GLXPixmap (*CreateGLXPixmap)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap);
   void (*DestroyContext)(Display *dpy, GLXContext ctx);
   void (*DestroyGLXPixmap)(Display *dpy, GLXPixmap pixmap);
   int (*GetConfig)(Display *dpy, XVisualInfo *visinfo, int attrib, int *value);
   /*GLXContext (*GetCurrentContext)(void);*/
   /*GLXDrawable (*GetCurrentDrawable)(void);*/
   Bool (*IsDirect)(Display *dpy, GLXContext ctx);
   Bool (*MakeCurrent)(Display *dpy, GLXDrawable drawable, GLXContext ctx);
   Bool (*QueryExtension)(Display *dpy, int *errorb, int *event);
   Bool (*QueryVersion)(Display *dpy, int *maj, int *min);
   void (*SwapBuffers)(Display *dpy, GLXDrawable drawable);
   void (*UseXFont)(Font font, int first, int count, int listBase);
   void (*WaitGL)(void);
   void (*WaitX)(void);

#ifdef _GLXAPI_VERSION_1_1
   const char *(*GetClientString)(Display *dpy, int name);
   const char *(*QueryExtensionsString)(Display *dpy, int screen);
   const char *(*QueryServerString)(Display *dpy, int screen, int name);
#endif

#ifdef _GLXAPI_VERSION_1_2
   /*Display *(*GetCurrentDisplay)(void);*/
#endif

#ifdef _GLXAPI_VERSION_1_3
   GLXFBConfig (*ChooseFBConfig)(Display *dpy, int screen, const int *attribList, int *nitems);
   GLXContext (*CreateNewContext)(Display *dpy, GLXFBConfig config, int renderType, GLXContext shareList, Bool direct);
   GLXPbuffer (*CreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attribList);
   GLXPixmap (*CreatePixmap)(Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attribList);
   GLXWindow (*CreateWindow)(Display *dpy, GLXFBConfig config, Window win, const int *attribList);
   void (*DestroyPbuffer)(Display *dpy, GLXPbuffer pbuf);
   void (*DestroyPixmap)(Display *dpy, GLXPixmap pixmap);
   void (*DestroyWindow)(Display *dpy, GLXWindow window);
   /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
   int (*GetFBConfigAttrib)(Display *dpy, GLXFBConfig config, int attribute, int *value);
   void (*GetSelectedEvent)(Display *dpy, GLXDrawable drawable, unsigned long *mask);
   XVisualInfo *(*GetVisualFromFBConfig)(Display *dpy, GLXFBConfig config);
   Bool (*MakeContextCurrent)(Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
   int (*QueryContext)(Display *dpy, GLXContext ctx, int attribute, int *value);
   void (*QueryDrawable)(Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
   void (*SelectEvent)(Display *dpy, GLXDrawable drawable, unsigned long mask);
#endif

#ifdef _GLXAPI_EXT_import_context
   void (*FreeContextEXT)(Display *dpy, GLXContext context);
   GLXContextID (*GetContextIDEXT)(const GLXContext context);
   Display *(*GetCurrentDisplayEXT)(void);
   GLXContext (*ImportContextEXT)(Display *dpy, GLXContextID contextID);
   int (*QueryContextInfoEXT)(Display *dpy, GLXContext context, int attribute,int *value);
#endif

#ifdef _GLXAPI_SGI_video_sync
   int (*GetVideoSyncSGI)(unsigned int *count);
   int (*WaitVideoSyncSGI)(int divisor, int remainder, unsigned int *count);
#endif

   /*
    * XXX thesa Mesa-specific functions might not belong here
    */

#ifdef _GLXAPI_MESA_copy_sub_buffer
   void (*CopySubBufferMESA)(Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
#endif

#ifdef _GLXAPI_MESA_release_buffers
   Bool (*ReleaseBuffersMESA)(Display *dpy, Window w);
#endif

#ifdef _GLXAPI_MESA_pixmap_colormap
   GLXPixmap (*CreateGLXPixmapMESA)(Display *dpy, XVisualInfo *visinfo, Pixmap pixmap, Colormap cmap);
#endif

#ifdef _GLXAPI_MESA_set_3dfx_mode
   GLboolean (*Set3DfxModeMESA)(GLint mode);
#endif

};



extern const char *
_glxapi_get_version(void);


extern const char **
_glxapi_get_extensions(void);


extern GLuint
_glxapi_get_dispatch_table_size(void);


extern void
_glxapi_set_no_op_table(struct _glxapi_table *t);


extern const GLvoid *
_glxapi_get_proc_address(const char *funcName);


#endif