1 /* $Id: glxapi.h,v 1.15 2003/01/14 04:49:07 brianp Exp $ */
4 * Mesa 3-D graphics library
7 * Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
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:
16 * The above copyright notice and this permission notice shall be included
17 * in all copies or substantial portions of the Software.
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.
32 #define GLX_GLXEXT_PROTOTYPES
36 #ifdef GLX_BUILT_IN_XMESA
37 /* The GLX API dispatcher (i.e. this code) is being built into XFree86's
38 * libGL so we'll use the __GLXContextRec defined in xc/lib/GL/glx/glxclient.h
40 #include "glxclient.h"
42 /* The GLX API dispatcher (i.e. this code) is being built into stand-alone
43 * Mesa. We don't know anything about XFree86 or real GLX so we define a
44 * minimal __GLXContextRec here so some of the functions in this file can
47 typedef struct __GLXcontextRec
{
50 GLXDrawable currentDrawable
;
51 GLXDrawable currentReadable
;
58 * Almost all the GLX API functions get routed through this dispatch table.
59 * The exceptions are the glXGetCurrentXXX() functions.
61 * This dispatch table allows multiple GLX client-side modules to coexist.
62 * Specifically, a real GLX library (like SGI's or the Utah GLX) and Mesa's
63 * pseudo-GLX can be present at the same time. The former being used on
64 * GLX-enabled X servers and the later on non-GLX X servers.
66 * Red Hat has been using this since Red Hat Linux 7.0 (I think).
67 * This'll be a standard feature in XFree86 4.3. It basically allows one
68 * libGL to do both DRI-rendering and "fake GLX" rendering to X displays
69 * that lack the GLX extension.
71 struct _glxapi_table
{
72 /*** GLX_VERSION_1_0 ***/
73 XVisualInfo
*(*ChooseVisual
)(Display
*dpy
, int screen
, int *list
);
74 void (*CopyContext
)(Display
*dpy
, GLXContext src
, GLXContext dst
, unsigned long mask
);
75 GLXContext (*CreateContext
)(Display
*dpy
, XVisualInfo
*visinfo
, GLXContext shareList
, Bool direct
);
76 GLXPixmap (*CreateGLXPixmap
)(Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
);
77 void (*DestroyContext
)(Display
*dpy
, GLXContext ctx
);
78 void (*DestroyGLXPixmap
)(Display
*dpy
, GLXPixmap pixmap
);
79 int (*GetConfig
)(Display
*dpy
, XVisualInfo
*visinfo
, int attrib
, int *value
);
80 /*GLXContext (*GetCurrentContext)(void);*/
81 /*GLXDrawable (*GetCurrentDrawable)(void);*/
82 Bool (*IsDirect
)(Display
*dpy
, GLXContext ctx
);
83 Bool (*MakeCurrent
)(Display
*dpy
, GLXDrawable drawable
, GLXContext ctx
);
84 Bool (*QueryExtension
)(Display
*dpy
, int *errorb
, int *event
);
85 Bool (*QueryVersion
)(Display
*dpy
, int *maj
, int *min
);
86 void (*SwapBuffers
)(Display
*dpy
, GLXDrawable drawable
);
87 void (*UseXFont
)(Font font
, int first
, int count
, int listBase
);
91 /*** GLX_VERSION_1_1 ***/
92 const char *(*GetClientString
)(Display
*dpy
, int name
);
93 const char *(*QueryExtensionsString
)(Display
*dpy
, int screen
);
94 const char *(*QueryServerString
)(Display
*dpy
, int screen
, int name
);
96 /*** GLX_VERSION_1_2 ***/
97 /*Display *(*GetCurrentDisplay)(void);*/
99 /*** GLX_VERSION_1_3 ***/
100 GLXFBConfig
*(*ChooseFBConfig
)(Display
*dpy
, int screen
, const int *attribList
, int *nitems
);
101 GLXContext (*CreateNewContext
)(Display
*dpy
, GLXFBConfig config
, int renderType
, GLXContext shareList
, Bool direct
);
102 GLXPbuffer (*CreatePbuffer
)(Display
*dpy
, GLXFBConfig config
, const int *attribList
);
103 GLXPixmap (*CreatePixmap
)(Display
*dpy
, GLXFBConfig config
, Pixmap pixmap
, const int *attribList
);
104 GLXWindow (*CreateWindow
)(Display
*dpy
, GLXFBConfig config
, Window win
, const int *attribList
);
105 void (*DestroyPbuffer
)(Display
*dpy
, GLXPbuffer pbuf
);
106 void (*DestroyPixmap
)(Display
*dpy
, GLXPixmap pixmap
);
107 void (*DestroyWindow
)(Display
*dpy
, GLXWindow window
);
108 /*GLXDrawable (*GetCurrentReadDrawable)(void);*/
109 int (*GetFBConfigAttrib
)(Display
*dpy
, GLXFBConfig config
, int attribute
, int *value
);
110 GLXFBConfig
*(*GetFBConfigs
)(Display
*dpy
, int screen
, int *nelements
);
111 void (*GetSelectedEvent
)(Display
*dpy
, GLXDrawable drawable
, unsigned long *mask
);
112 XVisualInfo
*(*GetVisualFromFBConfig
)(Display
*dpy
, GLXFBConfig config
);
113 Bool (*MakeContextCurrent
)(Display
*dpy
, GLXDrawable draw
, GLXDrawable read
, GLXContext ctx
);
114 int (*QueryContext
)(Display
*dpy
, GLXContext ctx
, int attribute
, int *value
);
115 void (*QueryDrawable
)(Display
*dpy
, GLXDrawable draw
, int attribute
, unsigned int *value
);
116 void (*SelectEvent
)(Display
*dpy
, GLXDrawable drawable
, unsigned long mask
);
118 /*** GLX_SGI_swap_control ***/
119 int (*SwapIntervalSGI
)(int);
121 /*** GLX_SGI_video_sync ***/
122 int (*GetVideoSyncSGI
)(unsigned int *count
);
123 int (*WaitVideoSyncSGI
)(int divisor
, int remainder
, unsigned int *count
);
125 /*** GLX_SGI_make_current_read ***/
126 Bool (*MakeCurrentReadSGI
)(Display
*, GLXDrawable
, GLXDrawable
, GLXContext
);
127 /*GLXDrawable (*GetCurrentReadDrawableSGI)(void);*/
129 /*** GLX_SGIX_video_source (needs video library) ***/
131 GLXVideoSourceSGIX (*CreateGLXVideoSourceSGIX
)(Display
*, int, VLServer
, VLPath
, int, VLNode
);
132 void (*DestroyGLXVideoSourceSGIX
)(Display
*, GLXVideoSourceSGIX
);
134 void *CreateGLXVideoSourceSGIX
;
135 void *DestroyGLXVideoSourceSGIX
;
138 /*** GLX_EXT_import_context ***/
139 void (*FreeContextEXT
)(Display
*dpy
, GLXContext context
);
140 GLXContextID (*GetContextIDEXT
)(const GLXContext context
);
141 /*Display *(*GetCurrentDisplayEXT)(void);*/
142 GLXContext (*ImportContextEXT
)(Display
*dpy
, GLXContextID contextID
);
143 int (*QueryContextInfoEXT
)(Display
*dpy
, GLXContext context
, int attribute
,int *value
);
145 /*** GLX_SGIX_fbconfig ***/
146 int (*GetFBConfigAttribSGIX
)(Display
*, GLXFBConfigSGIX
, int, int *);
147 GLXFBConfigSGIX
* (*ChooseFBConfigSGIX
)(Display
*, int, int *, int *);
148 GLXPixmap (*CreateGLXPixmapWithConfigSGIX
)(Display
*, GLXFBConfigSGIX
, Pixmap
);
149 GLXContext (*CreateContextWithConfigSGIX
)(Display
*, GLXFBConfigSGIX
, int, GLXContext
, Bool
);
150 XVisualInfo
* (*GetVisualFromFBConfigSGIX
)(Display
*, GLXFBConfigSGIX
);
151 GLXFBConfigSGIX (*GetFBConfigFromVisualSGIX
)(Display
*, XVisualInfo
*);
153 /*** GLX_SGIX_pbuffer ***/
154 GLXPbufferSGIX (*CreateGLXPbufferSGIX
)(Display
*, GLXFBConfigSGIX
, unsigned int, unsigned int, int *);
155 void (*DestroyGLXPbufferSGIX
)(Display
*, GLXPbufferSGIX
);
156 int (*QueryGLXPbufferSGIX
)(Display
*, GLXPbufferSGIX
, int, unsigned int *);
157 void (*SelectEventSGIX
)(Display
*, GLXDrawable
, unsigned long);
158 void (*GetSelectedEventSGIX
)(Display
*, GLXDrawable
, unsigned long *);
160 /*** GLX_SGI_cushion ***/
161 void (*CushionSGI
)(Display
*, Window
, float);
163 /*** GLX_SGIX_video_resize ***/
164 int (*BindChannelToWindowSGIX
)(Display
*, int, int, Window
);
165 int (*ChannelRectSGIX
)(Display
*, int, int, int, int, int, int);
166 int (*QueryChannelRectSGIX
)(Display
*, int, int, int *, int *, int *, int *);
167 int (*QueryChannelDeltasSGIX
)(Display
*, int, int, int *, int *, int *, int *);
168 int (*ChannelRectSyncSGIX
)(Display
*, int, int, GLenum
);
170 /*** GLX_SGIX_dmbuffer (needs dmedia library) ***/
171 #if defined (_DM_BUFFER_H_)
172 Bool (*AssociateDMPbufferSGIX
)(Display
*, GLXPbufferSGIX
, DMparams
*, DMbuffer
);
174 void *AssociciateDMPbufferSGIX
;
177 /*** GLX_SGIX_swap_group ***/
178 void (*JoinSwapGroupSGIX
)(Display
*, GLXDrawable
, GLXDrawable
);
180 /*** GLX_SGIX_swap_barrier ***/
181 void (*BindSwapBarrierSGIX
)(Display
*, GLXDrawable
, int);
182 Bool (*QueryMaxSwapBarriersSGIX
)(Display
*, int, int *);
184 /*** GLX_SUN_get_transparent_index ***/
185 Status (*GetTransparentIndexSUN
)(Display
*, Window
, Window
, long *);
187 /*** GLX_MESA_copy_sub_buffer ***/
188 void (*CopySubBufferMESA
)(Display
*dpy
, GLXDrawable drawable
, int x
, int y
, int width
, int height
);
190 /*** GLX_MESA_release_buffers ***/
191 Bool (*ReleaseBuffersMESA
)(Display
*dpy
, Window w
);
193 /*** GLX_MESA_pixmap_colormap ***/
194 GLXPixmap (*CreateGLXPixmapMESA
)(Display
*dpy
, XVisualInfo
*visinfo
, Pixmap pixmap
, Colormap cmap
);
196 /*** GLX_MESA_set_3dfx_mode ***/
197 Bool (*Set3DfxModeMESA
)(int mode
);
199 /*** GLX_NV_vertex_array_range ***/
200 void * (*AllocateMemoryNV
)( GLsizei size
,
201 GLfloat readFrequency
,
202 GLfloat writeFrequency
,
204 void (*FreeMemoryNV
)( GLvoid
*pointer
);
206 /*** GLX_MESA_agp_offset ***/
207 GLuint (*GetAGPOffsetMESA
)( const GLvoid
*pointer
);
209 /*** GLX_ARB_render_texture ***/
210 Bool (*BindTexImageARB
)(Display
*dpy
, GLXPbuffer pbuffer
, int buffer
);
211 Bool (*ReleaseTexImageARB
)(Display
*dpy
, GLXPbuffer pbuffer
, int buffer
);
212 Bool (*DrawableAttribARB
)(Display
*dpy
, GLXDrawable draw
, const int *attribList
);
218 _glxapi_get_version(void);
222 _glxapi_get_extensions(void);
226 _glxapi_get_dispatch_table_size(void);
230 _glxapi_set_no_op_table(struct _glxapi_table
*t
);
233 extern const GLvoid
*
234 _glxapi_get_proc_address(const char *funcName
);