jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 3 | * |
Brian Paul | 9305cba | 2006-03-31 17:31:22 +0000 | [diff] [blame] | 4 | * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 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 |
Kenneth Graunke | 3d8d5b2 | 2013-04-21 13:46:48 -0700 | [diff] [blame] | 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. |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 23 | */ |
| 24 | |
| 25 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 26 | #ifndef GLX_H |
| 27 | #define GLX_H |
| 28 | |
| 29 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 30 | #include <X11/Xlib.h> |
| 31 | #include <X11/Xutil.h> |
Brian Paul | 23b1503 | 2000-12-08 18:08:15 +0000 | [diff] [blame] | 32 | #include <GL/gl.h> |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 33 | |
| 34 | |
| 35 | #if defined(USE_MGL_NAMESPACE) |
Brian Paul | 4f1e370 | 2004-09-27 22:40:22 +0000 | [diff] [blame] | 36 | #include "glx_mangle.h" |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 37 | #endif |
| 38 | |
| 39 | |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
| 44 | |
| 45 | #define GLX_VERSION_1_1 1 |
Brian Paul | bf3f9bd | 1999-11-22 21:51:53 +0000 | [diff] [blame] | 46 | #define GLX_VERSION_1_2 1 |
Brian Paul | 07b220a | 2000-06-08 22:50:24 +0000 | [diff] [blame] | 47 | #define GLX_VERSION_1_3 1 |
Brian Paul | ba57e52 | 2001-09-14 02:43:03 +0000 | [diff] [blame] | 48 | #define GLX_VERSION_1_4 1 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 49 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 50 | #define GLX_EXTENSION_NAME "GLX" |
| 51 | |
| 52 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 53 | |
| 54 | /* |
| 55 | * Tokens for glXChooseVisual and glXGetConfig: |
| 56 | */ |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 57 | #define GLX_USE_GL 1 |
| 58 | #define GLX_BUFFER_SIZE 2 |
| 59 | #define GLX_LEVEL 3 |
| 60 | #define GLX_RGBA 4 |
| 61 | #define GLX_DOUBLEBUFFER 5 |
| 62 | #define GLX_STEREO 6 |
| 63 | #define GLX_AUX_BUFFERS 7 |
| 64 | #define GLX_RED_SIZE 8 |
| 65 | #define GLX_GREEN_SIZE 9 |
| 66 | #define GLX_BLUE_SIZE 10 |
| 67 | #define GLX_ALPHA_SIZE 11 |
| 68 | #define GLX_DEPTH_SIZE 12 |
| 69 | #define GLX_STENCIL_SIZE 13 |
| 70 | #define GLX_ACCUM_RED_SIZE 14 |
| 71 | #define GLX_ACCUM_GREEN_SIZE 15 |
| 72 | #define GLX_ACCUM_BLUE_SIZE 16 |
| 73 | #define GLX_ACCUM_ALPHA_SIZE 17 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 74 | |
Brian Paul | fbd8f21 | 1999-11-11 01:22:25 +0000 | [diff] [blame] | 75 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 76 | /* |
| 77 | * Error codes returned by glXGetConfig: |
| 78 | */ |
| 79 | #define GLX_BAD_SCREEN 1 |
| 80 | #define GLX_BAD_ATTRIBUTE 2 |
| 81 | #define GLX_NO_EXTENSION 3 |
| 82 | #define GLX_BAD_VISUAL 4 |
| 83 | #define GLX_BAD_CONTEXT 5 |
| 84 | #define GLX_BAD_VALUE 6 |
| 85 | #define GLX_BAD_ENUM 7 |
| 86 | |
| 87 | |
| 88 | /* |
| 89 | * GLX 1.1 and later: |
| 90 | */ |
| 91 | #define GLX_VENDOR 1 |
| 92 | #define GLX_VERSION 2 |
| 93 | #define GLX_EXTENSIONS 3 |
| 94 | |
| 95 | |
| 96 | /* |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 97 | * GLX 1.3 and later: |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 98 | */ |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 99 | #define GLX_CONFIG_CAVEAT 0x20 |
| 100 | #define GLX_DONT_CARE 0xFFFFFFFF |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 101 | #define GLX_X_VISUAL_TYPE 0x22 |
| 102 | #define GLX_TRANSPARENT_TYPE 0x23 |
| 103 | #define GLX_TRANSPARENT_INDEX_VALUE 0x24 |
| 104 | #define GLX_TRANSPARENT_RED_VALUE 0x25 |
| 105 | #define GLX_TRANSPARENT_GREEN_VALUE 0x26 |
| 106 | #define GLX_TRANSPARENT_BLUE_VALUE 0x27 |
| 107 | #define GLX_TRANSPARENT_ALPHA_VALUE 0x28 |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 108 | #define GLX_WINDOW_BIT 0x00000001 |
| 109 | #define GLX_PIXMAP_BIT 0x00000002 |
| 110 | #define GLX_PBUFFER_BIT 0x00000004 |
| 111 | #define GLX_AUX_BUFFERS_BIT 0x00000010 |
| 112 | #define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001 |
| 113 | #define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002 |
| 114 | #define GLX_BACK_LEFT_BUFFER_BIT 0x00000004 |
| 115 | #define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008 |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 116 | #define GLX_DEPTH_BUFFER_BIT 0x00000020 |
| 117 | #define GLX_STENCIL_BUFFER_BIT 0x00000040 |
| 118 | #define GLX_ACCUM_BUFFER_BIT 0x00000080 |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 119 | #define GLX_NONE 0x8000 |
Brian Paul | 27eb8fa | 2004-05-21 15:51:13 +0000 | [diff] [blame] | 120 | #define GLX_SLOW_CONFIG 0x8001 |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 121 | #define GLX_TRUE_COLOR 0x8002 |
| 122 | #define GLX_DIRECT_COLOR 0x8003 |
| 123 | #define GLX_PSEUDO_COLOR 0x8004 |
| 124 | #define GLX_STATIC_COLOR 0x8005 |
| 125 | #define GLX_GRAY_SCALE 0x8006 |
| 126 | #define GLX_STATIC_GRAY 0x8007 |
Brian Paul | cb4253a | 2002-10-14 13:52:27 +0000 | [diff] [blame] | 127 | #define GLX_TRANSPARENT_RGB 0x8008 |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 128 | #define GLX_TRANSPARENT_INDEX 0x8009 |
Brian Paul | 27eb8fa | 2004-05-21 15:51:13 +0000 | [diff] [blame] | 129 | #define GLX_VISUAL_ID 0x800B |
| 130 | #define GLX_SCREEN 0x800C |
| 131 | #define GLX_NON_CONFORMANT_CONFIG 0x800D |
| 132 | #define GLX_DRAWABLE_TYPE 0x8010 |
| 133 | #define GLX_RENDER_TYPE 0x8011 |
| 134 | #define GLX_X_RENDERABLE 0x8012 |
| 135 | #define GLX_FBCONFIG_ID 0x8013 |
Brian Paul | 7e975ba | 2001-09-01 20:17:16 +0000 | [diff] [blame] | 136 | #define GLX_RGBA_TYPE 0x8014 |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 137 | #define GLX_COLOR_INDEX_TYPE 0x8015 |
Brian Paul | 27eb8fa | 2004-05-21 15:51:13 +0000 | [diff] [blame] | 138 | #define GLX_MAX_PBUFFER_WIDTH 0x8016 |
| 139 | #define GLX_MAX_PBUFFER_HEIGHT 0x8017 |
| 140 | #define GLX_MAX_PBUFFER_PIXELS 0x8018 |
| 141 | #define GLX_PRESERVED_CONTENTS 0x801B |
| 142 | #define GLX_LARGEST_PBUFFER 0x801C |
| 143 | #define GLX_WIDTH 0x801D |
| 144 | #define GLX_HEIGHT 0x801E |
| 145 | #define GLX_EVENT_MASK 0x801F |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 146 | #define GLX_DAMAGED 0x8020 |
| 147 | #define GLX_SAVED 0x8021 |
| 148 | #define GLX_WINDOW 0x8022 |
Brian Paul | 6865666 | 2000-11-25 18:52:58 +0000 | [diff] [blame] | 149 | #define GLX_PBUFFER 0x8023 |
Brian Paul | 657323b | 2001-06-25 15:29:11 +0000 | [diff] [blame] | 150 | #define GLX_PBUFFER_HEIGHT 0x8040 |
| 151 | #define GLX_PBUFFER_WIDTH 0x8041 |
Brian Paul | 27eb8fa | 2004-05-21 15:51:13 +0000 | [diff] [blame] | 152 | #define GLX_RGBA_BIT 0x00000001 |
| 153 | #define GLX_COLOR_INDEX_BIT 0x00000002 |
| 154 | #define GLX_PBUFFER_CLOBBER_MASK 0x08000000 |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 155 | |
| 156 | |
Brian Paul | ba57e52 | 2001-09-14 02:43:03 +0000 | [diff] [blame] | 157 | /* |
| 158 | * GLX 1.4 and later: |
| 159 | */ |
Brian Paul | b70f5c2 | 2001-12-14 03:18:08 +0000 | [diff] [blame] | 160 | #define GLX_SAMPLE_BUFFERS 0x186a0 /*100000*/ |
Brian Paul | eaf0eac | 2001-12-14 03:19:06 +0000 | [diff] [blame] | 161 | #define GLX_SAMPLES 0x186a1 /*100001*/ |
Brian Paul | ba57e52 | 2001-09-14 02:43:03 +0000 | [diff] [blame] | 162 | |
| 163 | |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 164 | |
Brian Paul | e203c9c | 2001-05-24 19:07:14 +0000 | [diff] [blame] | 165 | typedef struct __GLXcontextRec *GLXContext; |
Brian Paul | 07b220a | 2000-06-08 22:50:24 +0000 | [diff] [blame] | 166 | typedef XID GLXPixmap; |
| 167 | typedef XID GLXDrawable; |
| 168 | /* GLX 1.3 and later */ |
Brian Paul | e203c9c | 2001-05-24 19:07:14 +0000 | [diff] [blame] | 169 | typedef struct __GLXFBConfigRec *GLXFBConfig; |
Brian Paul | 07b220a | 2000-06-08 22:50:24 +0000 | [diff] [blame] | 170 | typedef XID GLXFBConfigID; |
Kenneth Graunke | f425d56 | 2013-12-29 23:19:36 -0800 | [diff] [blame] | 171 | typedef XID GLXContextID; |
Brian Paul | 07b220a | 2000-06-08 22:50:24 +0000 | [diff] [blame] | 172 | typedef XID GLXWindow; |
| 173 | typedef XID GLXPbuffer; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 174 | |
| 175 | |
Jesse Barnes | 7f17057 | 2009-11-12 16:48:07 +0000 | [diff] [blame] | 176 | /* |
| 177 | ** Events. |
| 178 | ** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX |
| 179 | ** event - this helps initialization if the server supports the pbuffer |
| 180 | ** extension and the client doesn't. |
| 181 | */ |
| 182 | #define GLX_PbufferClobber 0 |
| 183 | #define GLX_BufferSwapComplete 1 |
| 184 | |
| 185 | #define __GLX_NUMBER_EVENTS 17 |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 186 | |
| 187 | extern XVisualInfo* glXChooseVisual( Display *dpy, int screen, |
| 188 | int *attribList ); |
| 189 | |
| 190 | extern GLXContext glXCreateContext( Display *dpy, XVisualInfo *vis, |
| 191 | GLXContext shareList, Bool direct ); |
| 192 | |
| 193 | extern void glXDestroyContext( Display *dpy, GLXContext ctx ); |
| 194 | |
| 195 | extern Bool glXMakeCurrent( Display *dpy, GLXDrawable drawable, |
| 196 | GLXContext ctx); |
| 197 | |
| 198 | extern void glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, |
Brian Paul | 3994b77 | 2000-02-27 18:26:54 +0000 | [diff] [blame] | 199 | unsigned long mask ); |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 200 | |
| 201 | extern void glXSwapBuffers( Display *dpy, GLXDrawable drawable ); |
| 202 | |
| 203 | extern GLXPixmap glXCreateGLXPixmap( Display *dpy, XVisualInfo *visual, |
| 204 | Pixmap pixmap ); |
| 205 | |
| 206 | extern void glXDestroyGLXPixmap( Display *dpy, GLXPixmap pixmap ); |
| 207 | |
| 208 | extern Bool glXQueryExtension( Display *dpy, int *errorb, int *event ); |
| 209 | |
| 210 | extern Bool glXQueryVersion( Display *dpy, int *maj, int *min ); |
| 211 | |
| 212 | extern Bool glXIsDirect( Display *dpy, GLXContext ctx ); |
| 213 | |
| 214 | extern int glXGetConfig( Display *dpy, XVisualInfo *visual, |
| 215 | int attrib, int *value ); |
| 216 | |
| 217 | extern GLXContext glXGetCurrentContext( void ); |
| 218 | |
| 219 | extern GLXDrawable glXGetCurrentDrawable( void ); |
| 220 | |
| 221 | extern void glXWaitGL( void ); |
| 222 | |
| 223 | extern void glXWaitX( void ); |
| 224 | |
| 225 | extern void glXUseXFont( Font font, int first, int count, int list ); |
| 226 | |
| 227 | |
| 228 | |
| 229 | /* GLX 1.1 and later */ |
| 230 | extern const char *glXQueryExtensionsString( Display *dpy, int screen ); |
| 231 | |
| 232 | extern const char *glXQueryServerString( Display *dpy, int screen, int name ); |
| 233 | |
| 234 | extern const char *glXGetClientString( Display *dpy, int name ); |
| 235 | |
| 236 | |
Brian Paul | bf3f9bd | 1999-11-22 21:51:53 +0000 | [diff] [blame] | 237 | /* GLX 1.2 and later */ |
Brian Paul | bf3f9bd | 1999-11-22 21:51:53 +0000 | [diff] [blame] | 238 | extern Display *glXGetCurrentDisplay( void ); |
| 239 | |
| 240 | |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 241 | /* GLX 1.3 and later */ |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 242 | extern GLXFBConfig *glXChooseFBConfig( Display *dpy, int screen, |
| 243 | const int *attribList, int *nitems ); |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 244 | |
| 245 | extern int glXGetFBConfigAttrib( Display *dpy, GLXFBConfig config, |
| 246 | int attribute, int *value ); |
| 247 | |
Brian Paul | 47e719f | 2000-04-10 21:12:20 +0000 | [diff] [blame] | 248 | extern GLXFBConfig *glXGetFBConfigs( Display *dpy, int screen, |
| 249 | int *nelements ); |
| 250 | |
Brian Paul | 664a1f8 | 1999-11-23 19:54:53 +0000 | [diff] [blame] | 251 | extern XVisualInfo *glXGetVisualFromFBConfig( Display *dpy, |
| 252 | GLXFBConfig config ); |
| 253 | |
| 254 | extern GLXWindow glXCreateWindow( Display *dpy, GLXFBConfig config, |
| 255 | Window win, const int *attribList ); |
| 256 | |
| 257 | extern void glXDestroyWindow( Display *dpy, GLXWindow window ); |
| 258 | |
| 259 | extern GLXPixmap glXCreatePixmap( Display *dpy, GLXFBConfig config, |
| 260 | Pixmap pixmap, const int *attribList ); |
| 261 | |
| 262 | extern void glXDestroyPixmap( Display *dpy, GLXPixmap pixmap ); |
| 263 | |
| 264 | extern GLXPbuffer glXCreatePbuffer( Display *dpy, GLXFBConfig config, |
| 265 | const int *attribList ); |
| 266 | |
| 267 | extern void glXDestroyPbuffer( Display *dpy, GLXPbuffer pbuf ); |
| 268 | |
| 269 | extern void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, |
| 270 | unsigned int *value ); |
| 271 | |
| 272 | extern GLXContext glXCreateNewContext( Display *dpy, GLXFBConfig config, |
| 273 | int renderType, GLXContext shareList, |
| 274 | Bool direct ); |
| 275 | |
| 276 | extern Bool glXMakeContextCurrent( Display *dpy, GLXDrawable draw, |
| 277 | GLXDrawable read, GLXContext ctx ); |
| 278 | |
| 279 | extern GLXDrawable glXGetCurrentReadDrawable( void ); |
| 280 | |
| 281 | extern int glXQueryContext( Display *dpy, GLXContext ctx, int attribute, |
| 282 | int *value ); |
| 283 | |
| 284 | extern void glXSelectEvent( Display *dpy, GLXDrawable drawable, |
| 285 | unsigned long mask ); |
| 286 | |
| 287 | extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable, |
| 288 | unsigned long *mask ); |
| 289 | |
Brian Paul | 239ce22 | 2008-10-29 15:49:19 -0600 | [diff] [blame] | 290 | /* GLX 1.3 function pointer typedefs */ |
| 291 | typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements); |
| 292 | typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); |
| 293 | typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value); |
| 294 | typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config); |
| 295 | typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list); |
| 296 | typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win); |
| 297 | typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list); |
| 298 | typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap); |
| 299 | typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list); |
| 300 | typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf); |
| 301 | typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value); |
| 302 | typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct); |
| 303 | typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx); |
| 304 | typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void); |
| 305 | typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) (void); |
| 306 | typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value); |
| 307 | typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask); |
| 308 | typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask); |
Brian Paul | 43c9c2c | 1999-09-16 15:52:51 +0000 | [diff] [blame] | 309 | |
Brian Paul | 07b220a | 2000-06-08 22:50:24 +0000 | [diff] [blame] | 310 | |
Brian Paul | 401fc93 | 2000-06-23 17:39:18 +0000 | [diff] [blame] | 311 | /* |
| 312 | * ARB 2. GLX_ARB_get_proc_address |
| 313 | */ |
| 314 | #ifndef GLX_ARB_get_proc_address |
| 315 | #define GLX_ARB_get_proc_address 1 |
| 316 | |
Brian Paul | 3e9c099 | 2005-11-08 14:44:07 +0000 | [diff] [blame] | 317 | typedef void (*__GLXextFuncPtr)(void); |
| 318 | extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *); |
Brian Paul | 401fc93 | 2000-06-23 17:39:18 +0000 | [diff] [blame] | 319 | |
| 320 | #endif /* GLX_ARB_get_proc_address */ |
| 321 | |
| 322 | |
| 323 | |
Brian Paul | 239ce22 | 2008-10-29 15:49:19 -0600 | [diff] [blame] | 324 | /* GLX 1.4 and later */ |
| 325 | extern void (*glXGetProcAddress(const GLubyte *procname))( void ); |
| 326 | |
| 327 | /* GLX 1.4 function pointer typedefs */ |
| 328 | typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName); |
| 329 | |
| 330 | |
| 331 | #ifndef GLX_GLXEXT_LEGACY |
| 332 | |
| 333 | #include <GL/glxext.h> |
| 334 | |
Brian Paul | 23b1503 | 2000-12-08 18:08:15 +0000 | [diff] [blame] | 335 | #endif /* GLX_GLXEXT_LEGACY */ |
Brian Paul | 07b220a | 2000-06-08 22:50:24 +0000 | [diff] [blame] | 336 | |
Brian Paul | ff06c83 | 1999-12-11 09:54:33 +0000 | [diff] [blame] | 337 | |
Brian Paul | 8455203 | 2002-10-08 22:47:53 +0000 | [diff] [blame] | 338 | /** |
| 339 | ** The following aren't in glxext.h yet. |
| 340 | **/ |
| 341 | |
| 342 | |
| 343 | /* |
| 344 | * ???. GLX_NV_vertex_array_range |
| 345 | */ |
| 346 | #ifndef GLX_NV_vertex_array_range |
| 347 | #define GLX_NV_vertex_array_range |
| 348 | |
| 349 | extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); |
| 350 | extern void glXFreeMemoryNV(GLvoid *pointer); |
| 351 | typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority); |
| 352 | typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer); |
| 353 | |
| 354 | #endif /* GLX_NV_vertex_array_range */ |
| 355 | |
| 356 | |
Brian Paul | e58286c | 2003-01-14 04:49:31 +0000 | [diff] [blame] | 357 | /* |
| 358 | * ARB ?. GLX_ARB_render_texture |
Brian Paul | 3e9c099 | 2005-11-08 14:44:07 +0000 | [diff] [blame] | 359 | * XXX This was never finalized! |
Brian Paul | e58286c | 2003-01-14 04:49:31 +0000 | [diff] [blame] | 360 | */ |
| 361 | #ifndef GLX_ARB_render_texture |
| 362 | #define GLX_ARB_render_texture 1 |
| 363 | |
| 364 | extern Bool glXBindTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer); |
| 365 | extern Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer); |
| 366 | extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attribList); |
| 367 | |
| 368 | #endif /* GLX_ARB_render_texture */ |
| 369 | |
| 370 | |
Brian Paul | 85edffd | 2005-01-04 14:48:14 +0000 | [diff] [blame] | 371 | /* |
Brian Paul | 9c32af5 | 2006-03-09 16:27:35 +0000 | [diff] [blame] | 372 | * #?. GLX_MESA_swap_frame_usage |
| 373 | */ |
| 374 | #ifndef GLX_MESA_swap_frame_usage |
| 375 | #define GLX_MESA_swap_frame_usage 1 |
| 376 | |
| 377 | extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage); |
| 378 | extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable); |
| 379 | extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable); |
| 380 | extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage); |
| 381 | |
| 382 | typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage); |
Brian Paul | 4cbd16e | 2006-03-26 05:09:03 +0000 | [diff] [blame] | 383 | typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable); |
| 384 | typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable); |
| 385 | typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage); |
Brian Paul | 9c32af5 | 2006-03-09 16:27:35 +0000 | [diff] [blame] | 386 | |
| 387 | #endif /* GLX_MESA_swap_frame_usage */ |
| 388 | |
| 389 | |
| 390 | |
| 391 | /* |
| 392 | * #?. GLX_MESA_swap_control |
| 393 | */ |
| 394 | #ifndef GLX_MESA_swap_control |
| 395 | #define GLX_MESA_swap_control 1 |
| 396 | |
| 397 | extern int glXSwapIntervalMESA(unsigned int interval); |
| 398 | extern int glXGetSwapIntervalMESA(void); |
| 399 | |
Brian Paul | 4cbd16e | 2006-03-26 05:09:03 +0000 | [diff] [blame] | 400 | typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval); |
| 401 | typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void); |
Brian Paul | 9c32af5 | 2006-03-09 16:27:35 +0000 | [diff] [blame] | 402 | |
| 403 | #endif /* GLX_MESA_swap_control */ |
| 404 | |
| 405 | |
Dave Airlie | 9bfd958 | 2005-02-26 03:55:44 +0000 | [diff] [blame] | 406 | /*** Should these go here, or in another header? */ |
| 407 | /* |
| 408 | ** GLX Events |
| 409 | */ |
| 410 | typedef struct { |
| 411 | int event_type; /* GLX_DAMAGED or GLX_SAVED */ |
| 412 | int draw_type; /* GLX_WINDOW or GLX_PBUFFER */ |
| 413 | unsigned long serial; /* # of last request processed by server */ |
| 414 | Bool send_event; /* true if this came for SendEvent request */ |
| 415 | Display *display; /* display the event was read from */ |
| 416 | GLXDrawable drawable; /* XID of Drawable */ |
| 417 | unsigned int buffer_mask; /* mask indicating which buffers are affected */ |
| 418 | unsigned int aux_buffer; /* which aux buffer was affected */ |
| 419 | int x, y; |
| 420 | int width, height; |
| 421 | int count; /* if nonzero, at least this many more */ |
| 422 | } GLXPbufferClobberEvent; |
| 423 | |
Jesse Barnes | 7f17057 | 2009-11-12 16:48:07 +0000 | [diff] [blame] | 424 | typedef struct { |
Robert Bragg | 7a9329b | 2010-01-20 03:01:14 +0000 | [diff] [blame] | 425 | int type; |
| 426 | unsigned long serial; /* # of last request processed by server */ |
| 427 | Bool send_event; /* true if this came from a SendEvent request */ |
| 428 | Display *display; /* Display the event was read from */ |
Jasper St. Pierre | b4dcf87 | 2014-06-24 13:43:53 -0400 | [diff] [blame] | 429 | Drawable drawable; /* drawable on which event was requested in event mask */ |
Jesse Barnes | 7f17057 | 2009-11-12 16:48:07 +0000 | [diff] [blame] | 430 | int event_type; |
Jesse Barnes | 7f17057 | 2009-11-12 16:48:07 +0000 | [diff] [blame] | 431 | int64_t ust; |
| 432 | int64_t msc; |
| 433 | int64_t sbc; |
| 434 | } GLXBufferSwapComplete; |
| 435 | |
Dave Airlie | 9bfd958 | 2005-02-26 03:55:44 +0000 | [diff] [blame] | 436 | typedef union __GLXEvent { |
| 437 | GLXPbufferClobberEvent glxpbufferclobber; |
Jesse Barnes | 7f17057 | 2009-11-12 16:48:07 +0000 | [diff] [blame] | 438 | GLXBufferSwapComplete glxbufferswapcomplete; |
Dave Airlie | 9bfd958 | 2005-02-26 03:55:44 +0000 | [diff] [blame] | 439 | long pad[24]; |
| 440 | } GLXEvent; |
jtg | afb833d | 1999-08-19 00:55:39 +0000 | [diff] [blame] | 441 | |
| 442 | #ifdef __cplusplus |
| 443 | } |
| 444 | #endif |
| 445 | |
| 446 | #endif |