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