Wise&mystical  1.0
Project about Europe
Loading...
Searching...
No Matches
glx_context.c
Go to the documentation of this file.
1//========================================================================
2// GLFW 3.4 GLX - www.glfw.org
3//------------------------------------------------------------------------
4// Copyright (c) 2002-2006 Marcus Geelnard
5// Copyright (c) 2006-2019 Camilla Löwy <elmindreda@glfw.org>
6//
7// This software is provided 'as-is', without any express or implied
8// warranty. In no event will the authors be held liable for any damages
9// arising from the use of this software.
10//
11// Permission is granted to anyone to use this software for any purpose,
12// including commercial applications, and to alter it and redistribute it
13// freely, subject to the following restrictions:
14//
15// 1. The origin of this software must not be misrepresented; you must not
16// claim that you wrote the original software. If you use this software
17// in a product, an acknowledgment in the product documentation would
18// be appreciated but is not required.
19//
20// 2. Altered source versions must be plainly marked as such, and must not
21// be misrepresented as being the original software.
22//
23// 3. This notice may not be removed or altered from any source
24// distribution.
25//
26//========================================================================
27// It is fine to use C99 in this file because it will not be built with VS
28//========================================================================
29
30#include "internal.h"
31
32#include <string.h>
33#include <stdlib.h>
34#include <assert.h>
35
36#ifndef GLXBadProfileARB
37 #define GLXBadProfileARB 13
38#endif
39
40
41// Returns the specified attribute of the specified GLXFBConfig
42//
43static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
44{
45 int value;
46 glXGetFBConfigAttrib(_glfw.x11.display, fbconfig, attrib, &value);
47 return value;
48}
49
50// Return the GLXFBConfig most closely matching the specified hints
51//
52static GLFWbool chooseGLXFBConfig(const _GLFWfbconfig* desired,
53 GLXFBConfig* result)
54{
55 GLXFBConfig* nativeConfigs;
56 _GLFWfbconfig* usableConfigs;
57 const _GLFWfbconfig* closest;
58 int i, nativeCount, usableCount;
59 const char* vendor;
60 GLFWbool trustWindowBit = GLFW_TRUE;
61
62 // HACK: This is a (hopefully temporary) workaround for Chromium
63 // (VirtualBox GL) not setting the window bit on any GLXFBConfigs
64 vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
65 if (vendor && strcmp(vendor, "Chromium") == 0)
66 trustWindowBit = GLFW_FALSE;
67
68 nativeConfigs =
69 glXGetFBConfigs(_glfw.x11.display, _glfw.x11.screen, &nativeCount);
70 if (!nativeConfigs || !nativeCount)
71 {
72 _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
73 return GLFW_FALSE;
74 }
75
76 usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
77 usableCount = 0;
78
79 for (i = 0; i < nativeCount; i++)
80 {
81 const GLXFBConfig n = nativeConfigs[i];
82 _GLFWfbconfig* u = usableConfigs + usableCount;
83
84 // Only consider RGBA GLXFBConfigs
85 if (!(getGLXFBConfigAttrib(n, GLX_RENDER_TYPE) & GLX_RGBA_BIT))
86 continue;
87
88 // Only consider window GLXFBConfigs
89 if (!(getGLXFBConfigAttrib(n, GLX_DRAWABLE_TYPE) & GLX_WINDOW_BIT))
90 {
91 if (trustWindowBit)
92 continue;
93 }
94
95 if (getGLXFBConfigAttrib(n, GLX_DOUBLEBUFFER) != desired->doublebuffer)
96 continue;
97
98 if (desired->transparent)
99 {
100 XVisualInfo* vi = glXGetVisualFromFBConfig(_glfw.x11.display, n);
101 if (vi)
102 {
104 XFree(vi);
105 }
106 }
107
108 u->redBits = getGLXFBConfigAttrib(n, GLX_RED_SIZE);
109 u->greenBits = getGLXFBConfigAttrib(n, GLX_GREEN_SIZE);
110 u->blueBits = getGLXFBConfigAttrib(n, GLX_BLUE_SIZE);
111
112 u->alphaBits = getGLXFBConfigAttrib(n, GLX_ALPHA_SIZE);
113 u->depthBits = getGLXFBConfigAttrib(n, GLX_DEPTH_SIZE);
114 u->stencilBits = getGLXFBConfigAttrib(n, GLX_STENCIL_SIZE);
115
116 u->accumRedBits = getGLXFBConfigAttrib(n, GLX_ACCUM_RED_SIZE);
117 u->accumGreenBits = getGLXFBConfigAttrib(n, GLX_ACCUM_GREEN_SIZE);
118 u->accumBlueBits = getGLXFBConfigAttrib(n, GLX_ACCUM_BLUE_SIZE);
119 u->accumAlphaBits = getGLXFBConfigAttrib(n, GLX_ACCUM_ALPHA_SIZE);
120
121 u->auxBuffers = getGLXFBConfigAttrib(n, GLX_AUX_BUFFERS);
122
123 if (getGLXFBConfigAttrib(n, GLX_STEREO))
124 u->stereo = GLFW_TRUE;
125
126 if (_glfw.glx.ARB_multisample)
127 u->samples = getGLXFBConfigAttrib(n, GLX_SAMPLES);
128
129 if (_glfw.glx.ARB_framebuffer_sRGB || _glfw.glx.EXT_framebuffer_sRGB)
130 u->sRGB = getGLXFBConfigAttrib(n, GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB);
131
132 u->handle = (uintptr_t) n;
133 usableCount++;
134 }
135
136 closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
137 if (closest)
138 *result = (GLXFBConfig) closest->handle;
139
140 XFree(nativeConfigs);
141 free(usableConfigs);
142
143 return closest != NULL;
144}
145
146// Create the OpenGL context using legacy API
147//
148static GLXContext createLegacyContextGLX(_GLFWwindow* window,
149 GLXFBConfig fbconfig,
150 GLXContext share)
151{
152 return glXCreateNewContext(_glfw.x11.display,
153 fbconfig,
155 share,
156 True);
157}
158
159static void makeContextCurrentGLX(_GLFWwindow* window)
160{
161 if (window)
162 {
163 if (!glXMakeCurrent(_glfw.x11.display,
164 window->context.glx.window,
165 window->context.glx.handle))
166 {
168 "GLX: Failed to make context current");
169 return;
170 }
171 }
172 else
173 {
174 if (!glXMakeCurrent(_glfw.x11.display, None, NULL))
175 {
177 "GLX: Failed to clear current context");
178 return;
179 }
180 }
181
183}
184
185static void swapBuffersGLX(_GLFWwindow* window)
186{
187 glXSwapBuffers(_glfw.x11.display, window->context.glx.window);
188}
189
190static void swapIntervalGLX(int interval)
191{
193
194 if (_glfw.glx.EXT_swap_control)
195 {
196 _glfw.glx.SwapIntervalEXT(_glfw.x11.display,
197 window->context.glx.window,
198 interval);
199 }
200 else if (_glfw.glx.MESA_swap_control)
201 _glfw.glx.SwapIntervalMESA(interval);
202 else if (_glfw.glx.SGI_swap_control)
203 {
204 if (interval > 0)
205 _glfw.glx.SwapIntervalSGI(interval);
206 }
207}
208
209static int extensionSupportedGLX(const char* extension)
210{
211 const char* extensions =
212 glXQueryExtensionsString(_glfw.x11.display, _glfw.x11.screen);
213 if (extensions)
214 {
215 if (_glfwStringInExtensionString(extension, extensions))
216 return GLFW_TRUE;
217 }
218
219 return GLFW_FALSE;
220}
221
222static GLFWglproc getProcAddressGLX(const char* procname)
223{
224 if (_glfw.glx.GetProcAddress)
225 return _glfw.glx.GetProcAddress((const GLubyte*) procname);
226 else if (_glfw.glx.GetProcAddressARB)
227 return _glfw.glx.GetProcAddressARB((const GLubyte*) procname);
228 else
229 return _glfw_dlsym(_glfw.glx.handle, procname);
230}
231
232static void destroyContextGLX(_GLFWwindow* window)
233{
234 if (window->context.glx.window)
235 {
236 glXDestroyWindow(_glfw.x11.display, window->context.glx.window);
237 window->context.glx.window = None;
238 }
239
240 if (window->context.glx.handle)
241 {
242 glXDestroyContext(_glfw.x11.display, window->context.glx.handle);
243 window->context.glx.handle = NULL;
244 }
245}
246
247
251
252// Initialize GLX
253//
255{
256 int i;
257 const char* sonames[] =
258 {
259#if defined(_GLFW_GLX_LIBRARY)
260 _GLFW_GLX_LIBRARY,
261#elif defined(__CYGWIN__)
262 "libGL-1.so",
263#else
264 "libGL.so.1",
265 "libGL.so",
266#endif
267 NULL
268 };
269
270 if (_glfw.glx.handle)
271 return GLFW_TRUE;
272
273 for (i = 0; sonames[i]; i++)
274 {
275 _glfw.glx.handle = _glfw_dlopen(sonames[i]);
276 if (_glfw.glx.handle)
277 break;
278 }
279
280 if (!_glfw.glx.handle)
281 {
282 _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: Failed to load GLX");
283 return GLFW_FALSE;
284 }
285
286 _glfw.glx.GetFBConfigs =
287 _glfw_dlsym(_glfw.glx.handle, "glXGetFBConfigs");
288 _glfw.glx.GetFBConfigAttrib =
289 _glfw_dlsym(_glfw.glx.handle, "glXGetFBConfigAttrib");
290 _glfw.glx.GetClientString =
291 _glfw_dlsym(_glfw.glx.handle, "glXGetClientString");
292 _glfw.glx.QueryExtension =
293 _glfw_dlsym(_glfw.glx.handle, "glXQueryExtension");
294 _glfw.glx.QueryVersion =
295 _glfw_dlsym(_glfw.glx.handle, "glXQueryVersion");
296 _glfw.glx.DestroyContext =
297 _glfw_dlsym(_glfw.glx.handle, "glXDestroyContext");
298 _glfw.glx.MakeCurrent =
299 _glfw_dlsym(_glfw.glx.handle, "glXMakeCurrent");
300 _glfw.glx.SwapBuffers =
301 _glfw_dlsym(_glfw.glx.handle, "glXSwapBuffers");
302 _glfw.glx.QueryExtensionsString =
303 _glfw_dlsym(_glfw.glx.handle, "glXQueryExtensionsString");
304 _glfw.glx.CreateNewContext =
305 _glfw_dlsym(_glfw.glx.handle, "glXCreateNewContext");
306 _glfw.glx.CreateWindow =
307 _glfw_dlsym(_glfw.glx.handle, "glXCreateWindow");
308 _glfw.glx.DestroyWindow =
309 _glfw_dlsym(_glfw.glx.handle, "glXDestroyWindow");
310 _glfw.glx.GetProcAddress =
311 _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddress");
312 _glfw.glx.GetProcAddressARB =
313 _glfw_dlsym(_glfw.glx.handle, "glXGetProcAddressARB");
314 _glfw.glx.GetVisualFromFBConfig =
315 _glfw_dlsym(_glfw.glx.handle, "glXGetVisualFromFBConfig");
316
317 if (!_glfw.glx.GetFBConfigs ||
318 !_glfw.glx.GetFBConfigAttrib ||
319 !_glfw.glx.GetClientString ||
320 !_glfw.glx.QueryExtension ||
321 !_glfw.glx.QueryVersion ||
322 !_glfw.glx.DestroyContext ||
323 !_glfw.glx.MakeCurrent ||
324 !_glfw.glx.SwapBuffers ||
325 !_glfw.glx.QueryExtensionsString ||
326 !_glfw.glx.CreateNewContext ||
327 !_glfw.glx.CreateWindow ||
328 !_glfw.glx.DestroyWindow ||
329 !_glfw.glx.GetProcAddress ||
330 !_glfw.glx.GetProcAddressARB ||
331 !_glfw.glx.GetVisualFromFBConfig)
332 {
334 "GLX: Failed to load required entry points");
335 return GLFW_FALSE;
336 }
337
338 if (!glXQueryExtension(_glfw.x11.display,
339 &_glfw.glx.errorBase,
340 &_glfw.glx.eventBase))
341 {
342 _glfwInputError(GLFW_API_UNAVAILABLE, "GLX: GLX extension not found");
343 return GLFW_FALSE;
344 }
345
346 if (!glXQueryVersion(_glfw.x11.display, &_glfw.glx.major, &_glfw.glx.minor))
347 {
349 "GLX: Failed to query GLX version");
350 return GLFW_FALSE;
351 }
352
353 if (_glfw.glx.major == 1 && _glfw.glx.minor < 3)
354 {
356 "GLX: GLX version 1.3 is required");
357 return GLFW_FALSE;
358 }
359
360 if (extensionSupportedGLX("GLX_EXT_swap_control"))
361 {
362 _glfw.glx.SwapIntervalEXT = (PFNGLXSWAPINTERVALEXTPROC)
363 getProcAddressGLX("glXSwapIntervalEXT");
364
365 if (_glfw.glx.SwapIntervalEXT)
366 _glfw.glx.EXT_swap_control = GLFW_TRUE;
367 }
368
369 if (extensionSupportedGLX("GLX_SGI_swap_control"))
370 {
371 _glfw.glx.SwapIntervalSGI = (PFNGLXSWAPINTERVALSGIPROC)
372 getProcAddressGLX("glXSwapIntervalSGI");
373
374 if (_glfw.glx.SwapIntervalSGI)
375 _glfw.glx.SGI_swap_control = GLFW_TRUE;
376 }
377
378 if (extensionSupportedGLX("GLX_MESA_swap_control"))
379 {
380 _glfw.glx.SwapIntervalMESA = (PFNGLXSWAPINTERVALMESAPROC)
381 getProcAddressGLX("glXSwapIntervalMESA");
382
383 if (_glfw.glx.SwapIntervalMESA)
384 _glfw.glx.MESA_swap_control = GLFW_TRUE;
385 }
386
387 if (extensionSupportedGLX("GLX_ARB_multisample"))
388 _glfw.glx.ARB_multisample = GLFW_TRUE;
389
390 if (extensionSupportedGLX("GLX_ARB_framebuffer_sRGB"))
391 _glfw.glx.ARB_framebuffer_sRGB = GLFW_TRUE;
392
393 if (extensionSupportedGLX("GLX_EXT_framebuffer_sRGB"))
394 _glfw.glx.EXT_framebuffer_sRGB = GLFW_TRUE;
395
396 if (extensionSupportedGLX("GLX_ARB_create_context"))
397 {
398 _glfw.glx.CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
399 getProcAddressGLX("glXCreateContextAttribsARB");
400
401 if (_glfw.glx.CreateContextAttribsARB)
402 _glfw.glx.ARB_create_context = GLFW_TRUE;
403 }
404
405 if (extensionSupportedGLX("GLX_ARB_create_context_robustness"))
406 _glfw.glx.ARB_create_context_robustness = GLFW_TRUE;
407
408 if (extensionSupportedGLX("GLX_ARB_create_context_profile"))
409 _glfw.glx.ARB_create_context_profile = GLFW_TRUE;
410
411 if (extensionSupportedGLX("GLX_EXT_create_context_es2_profile"))
412 _glfw.glx.EXT_create_context_es2_profile = GLFW_TRUE;
413
414 if (extensionSupportedGLX("GLX_ARB_create_context_no_error"))
415 _glfw.glx.ARB_create_context_no_error = GLFW_TRUE;
416
417 if (extensionSupportedGLX("GLX_ARB_context_flush_control"))
418 _glfw.glx.ARB_context_flush_control = GLFW_TRUE;
419
420 return GLFW_TRUE;
421}
422
423// Terminate GLX
424//
426{
427 // NOTE: This function must not call any X11 functions, as it is called
428 // after XCloseDisplay (see _glfwPlatformTerminate for details)
429
430 if (_glfw.glx.handle)
431 {
433 _glfw.glx.handle = NULL;
434 }
435}
436
437#define setAttrib(a, v) \
438{ \
439 assert(((size_t) index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
440 attribs[index++] = a; \
441 attribs[index++] = v; \
442}
443
444// Create the OpenGL or OpenGL ES context
445//
447 const _GLFWctxconfig* ctxconfig,
448 const _GLFWfbconfig* fbconfig)
449{
450 int attribs[40];
451 GLXFBConfig native = NULL;
452 GLXContext share = NULL;
453
454 if (ctxconfig->share)
455 share = ctxconfig->share->context.glx.handle;
456
457 if (!chooseGLXFBConfig(fbconfig, &native))
458 {
460 "GLX: Failed to find a suitable GLXFBConfig");
461 return GLFW_FALSE;
462 }
463
464 if (ctxconfig->client == GLFW_OPENGL_ES_API)
465 {
466 if (!_glfw.glx.ARB_create_context ||
467 !_glfw.glx.ARB_create_context_profile ||
468 !_glfw.glx.EXT_create_context_es2_profile)
469 {
471 "GLX: OpenGL ES requested but GLX_EXT_create_context_es2_profile is unavailable");
472 return GLFW_FALSE;
473 }
474 }
475
476 if (ctxconfig->forward)
477 {
478 if (!_glfw.glx.ARB_create_context)
479 {
481 "GLX: Forward compatibility requested but GLX_ARB_create_context_profile is unavailable");
482 return GLFW_FALSE;
483 }
484 }
485
486 if (ctxconfig->profile)
487 {
488 if (!_glfw.glx.ARB_create_context ||
489 !_glfw.glx.ARB_create_context_profile)
490 {
492 "GLX: An OpenGL profile requested but GLX_ARB_create_context_profile is unavailable");
493 return GLFW_FALSE;
494 }
495 }
496
498
499 if (_glfw.glx.ARB_create_context)
500 {
501 int index = 0, mask = 0, flags = 0;
502
503 if (ctxconfig->client == GLFW_OPENGL_API)
504 {
505 if (ctxconfig->forward)
507
508 if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
510 else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
512 }
513 else
515
516 if (ctxconfig->debug)
518
519 if (ctxconfig->robustness)
520 {
521 if (_glfw.glx.ARB_create_context_robustness)
522 {
523 if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
524 {
527 }
528 else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
529 {
532 }
533
535 }
536 }
537
538 if (ctxconfig->release)
539 {
540 if (_glfw.glx.ARB_context_flush_control)
541 {
542 if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
543 {
546 }
547 else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
548 {
551 }
552 }
553 }
554
555 if (ctxconfig->noerror)
556 {
557 if (_glfw.glx.ARB_create_context_no_error)
559 }
560
561 // NOTE: Only request an explicitly versioned context when necessary, as
562 // explicitly requesting version 1.0 does not always return the
563 // highest version supported by the driver
564 if (ctxconfig->major != 1 || ctxconfig->minor != 0)
565 {
568 }
569
570 if (mask)
572
573 if (flags)
575
576 setAttrib(None, None);
577
578 window->context.glx.handle =
579 _glfw.glx.CreateContextAttribsARB(_glfw.x11.display,
580 native,
581 share,
582 True,
583 attribs);
584
585 // HACK: This is a fallback for broken versions of the Mesa
586 // implementation of GLX_ARB_create_context_profile that fail
587 // default 1.0 context creation with a GLXBadProfileARB error in
588 // violation of the extension spec
589 if (!window->context.glx.handle)
590 {
591 if (_glfw.x11.errorCode == _glfw.glx.errorBase + GLXBadProfileARB &&
592 ctxconfig->client == GLFW_OPENGL_API &&
593 ctxconfig->profile == GLFW_OPENGL_ANY_PROFILE &&
594 ctxconfig->forward == GLFW_FALSE)
595 {
596 window->context.glx.handle =
597 createLegacyContextGLX(window, native, share);
598 }
599 }
600 }
601 else
602 {
603 window->context.glx.handle =
604 createLegacyContextGLX(window, native, share);
605 }
606
608
609 if (!window->context.glx.handle)
610 {
611 _glfwInputErrorX11(GLFW_VERSION_UNAVAILABLE, "GLX: Failed to create context");
612 return GLFW_FALSE;
613 }
614
615 window->context.glx.window =
616 glXCreateWindow(_glfw.x11.display, native, window->x11.handle, NULL);
617 if (!window->context.glx.window)
618 {
619 _glfwInputError(GLFW_PLATFORM_ERROR, "GLX: Failed to create window");
620 return GLFW_FALSE;
621 }
622
623 window->context.makeCurrent = makeContextCurrentGLX;
624 window->context.swapBuffers = swapBuffersGLX;
625 window->context.swapInterval = swapIntervalGLX;
626 window->context.extensionSupported = extensionSupportedGLX;
627 window->context.getProcAddress = getProcAddressGLX;
628 window->context.destroy = destroyContextGLX;
629
630 return GLFW_TRUE;
631}
632
633#undef setAttrib
634
635// Returns the Visual and depth of the chosen GLXFBConfig
636//
638 const _GLFWctxconfig* ctxconfig,
639 const _GLFWfbconfig* fbconfig,
640 Visual** visual, int* depth)
641{
642 GLXFBConfig native;
643 XVisualInfo* result;
644
645 if (!chooseGLXFBConfig(fbconfig, &native))
646 {
648 "GLX: Failed to find a suitable GLXFBConfig");
649 return GLFW_FALSE;
650 }
651
652 result = glXGetVisualFromFBConfig(_glfw.x11.display, native);
653 if (!result)
654 {
656 "GLX: Failed to retrieve Visual for GLXFBConfig");
657 return GLFW_FALSE;
658 }
659
660 *visual = result->visual;
661 *depth = result->depth;
662
663 XFree(result);
664 return GLFW_TRUE;
665}
666
667
671
673{
674 _GLFWwindow* window = (_GLFWwindow*) handle;
676
677 if (window->context.client == GLFW_NO_API)
678 {
680 return NULL;
681 }
682
683 return window->context.glx.handle;
684}
685
687{
688 _GLFWwindow* window = (_GLFWwindow*) handle;
690
691 if (window->context.client == GLFW_NO_API)
692 {
694 return None;
695 }
696
697 return window->context.glx.window;
698}
699
#define _glfw_dlopen(name)
#define _glfw_dlsym(handle, name)
#define _glfw_dlclose(handle)
GLFWbool _glfwStringInExtensionString(const char *string, const char *extensions)
Definition: context.c:578
const _GLFWfbconfig * _glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig *alternatives, unsigned int count)
Definition: context.c:178
khronos_uint8_t GLubyte
Definition: glad.h:2308
#define GLFW_OPENGL_API
Definition: glfw3.h:1087
#define GLFW_OPENGL_ES_API
Definition: glfw3.h:1088
#define GLFWAPI
Definition: glfw3.h:269
#define GLFW_NO_API
Definition: glfw3.h:1086
#define GLFW_RELEASE_BEHAVIOR_FLUSH
Definition: glfw3.h:1109
#define GLFW_OPENGL_COMPAT_PROFILE
Definition: glfw3.h:1096
#define GLFW_OPENGL_ANY_PROFILE
Definition: glfw3.h:1094
#define GLFW_LOSE_CONTEXT_ON_RESET
Definition: glfw3.h:1092
#define GLFW_NO_RESET_NOTIFICATION
Definition: glfw3.h:1091
#define GLFW_OPENGL_CORE_PROFILE
Definition: glfw3.h:1095
#define GLFW_RELEASE_BEHAVIOR_NONE
Definition: glfw3.h:1110
GLFWbool _glfwCreateContextGLX(_GLFWwindow *window, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig)
Definition: glx_context.c:446
void _glfwTerminateGLX(void)
Definition: glx_context.c:425
GLFWbool _glfwChooseVisualGLX(const _GLFWwndconfig *wndconfig, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig, Visual **visual, int *depth)
Definition: glx_context.c:637
GLFWAPI GLXContext glfwGetGLXContext(GLFWwindow *handle)
Definition: glx_context.c:672
GLFWAPI GLXWindow glfwGetGLXWindow(GLFWwindow *handle)
Definition: glx_context.c:686
#define setAttrib(a, v)
Definition: glx_context.c:437
#define GLXBadProfileARB
Definition: glx_context.c:37
GLFWbool _glfwInitGLX(void)
Definition: glx_context.c:254
#define GLX_NO_RESET_NOTIFICATION_ARB
Definition: glx_context.h:63
#define GLX_CONTEXT_DEBUG_BIT_ARB
Definition: glx_context.h:51
#define GLX_DRAWABLE_TYPE
Definition: glx_context.h:31
GLXContext(* PFNGLXCREATECONTEXTATTRIBSARBPROC)(Display *, GLXFBConfig, GLXContext, Bool, const int *)
Definition: glx_context.h:93
#define glXGetClientString
Definition: glx_context.h:98
#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB
Definition: glx_context.h:52
#define GLX_RGBA_TYPE
Definition: glx_context.h:33
#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB
Definition: glx_context.h:55
#define GLX_VENDOR
Definition: glx_context.h:28
#define GLX_ACCUM_BLUE_SIZE
Definition: glx_context.h:45
struct __GLXcontext * GLXContext
Definition: glx_context.h:72
#define GLX_DOUBLEBUFFER
Definition: glx_context.h:34
#define GLX_RENDER_TYPE
Definition: glx_context.h:32
#define GLX_CONTEXT_MINOR_VERSION_ARB
Definition: glx_context.h:57
#define GLX_BLUE_SIZE
Definition: glx_context.h:39
#define GLX_RGBA_BIT
Definition: glx_context.h:29
#define glXQueryExtension
Definition: glx_context.h:99
#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB
Definition: glx_context.h:67
XID GLXWindow
Definition: glx_context.h:69
#define GLX_ACCUM_ALPHA_SIZE
Definition: glx_context.h:46
#define GLX_RED_SIZE
Definition: glx_context.h:37
#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB
Definition: glx_context.h:60
#define glXGetVisualFromFBConfig
Definition: glx_context.h:106
#define GLX_AUX_BUFFERS
Definition: glx_context.h:36
struct __GLXFBConfig * GLXFBConfig
Definition: glx_context.h:71
#define GLX_CONTEXT_FLAGS_ARB
Definition: glx_context.h:58
#define GLX_ALPHA_SIZE
Definition: glx_context.h:40
#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB
Definition: glx_context.h:64
#define GLX_SAMPLES
Definition: glx_context.h:47
int(* PFNGLXSWAPINTERVALMESAPROC)(int)
Definition: glx_context.h:91
#define glXCreateNewContext
Definition: glx_context.h:105
#define glXGetFBConfigs
Definition: glx_context.h:96
#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB
Definition: glx_context.h:65
#define GLX_DEPTH_SIZE
Definition: glx_context.h:41
#define GLX_CONTEXT_PROFILE_MASK_ARB
Definition: glx_context.h:54
int(* PFNGLXSWAPINTERVALSGIPROC)(int)
Definition: glx_context.h:92
void(* PFNGLXSWAPINTERVALEXTPROC)(Display *, GLXDrawable, int)
Definition: glx_context.h:86
#define GLX_ACCUM_GREEN_SIZE
Definition: glx_context.h:44
#define GLX_CONTEXT_MAJOR_VERSION_ARB
Definition: glx_context.h:56
#define glXMakeCurrent
Definition: glx_context.h:102
#define glXQueryExtensionsString
Definition: glx_context.h:104
#define GLX_STEREO
Definition: glx_context.h:35
#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB
Definition: glx_context.h:62
#define GLX_STENCIL_SIZE
Definition: glx_context.h:42
#define glXQueryVersion
Definition: glx_context.h:100
#define glXDestroyWindow
Definition: glx_context.h:108
#define GLX_WINDOW_BIT
Definition: glx_context.h:30
#define GLX_ACCUM_RED_SIZE
Definition: glx_context.h:43
#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB
Definition: glx_context.h:53
#define glXGetFBConfigAttrib
Definition: glx_context.h:97
#define glXSwapBuffers
Definition: glx_context.h:103
#define GLX_GREEN_SIZE
Definition: glx_context.h:38
#define glXCreateWindow
Definition: glx_context.h:107
#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT
Definition: glx_context.h:59
#define glXDestroyContext
Definition: glx_context.h:101
#define GLX_LOSE_CONTEXT_ON_RESET_ARB
Definition: glx_context.h:61
#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB
Definition: glx_context.h:50
#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB
Definition: glx_context.h:66
void(* GLFWglproc)(void)
GLFW API types.
Definition: glfw3.h:1281
#define GLFW_FORMAT_UNAVAILABLE
The requested format is not supported or available.
Definition: glfw3.h:777
#define GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.
Definition: glfw3.h:730
#define GLFW_NO_WINDOW_CONTEXT
The specified window does not have an OpenGL or OpenGL ES context.
Definition: glfw3.h:785
#define GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version is not available.
Definition: glfw3.h:747
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
Definition: glfw3.h:758
#define GLFW_TRUE
One.
Definition: glfw3.h:310
#define GLFW_FALSE
Zero.
Definition: glfw3.h:319
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1319
_GLFWlibrary _glfw
Definition: init.c:46
void _glfwInputError(int code, const char *format,...)
Definition: init.c:160
void _glfwPlatformSetTls(_GLFWtls *tls, void *value)
Definition: posix_thread.c:68
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
Definition: internal.h:214
void * _glfwPlatformGetTls(_GLFWtls *tls)
Definition: posix_thread.c:62
int GLFWbool
Definition: internal.h:61
#define NULL
Definition: miniaudio.h:3718
_W64 unsigned int uintptr_t
Definition: stdint.h:119
_GLFWswapintervalfun swapInterval
Definition: internal.h:362
_GLFWswapbuffersfun swapBuffers
Definition: internal.h:361
_GLFWdestroycontextfun destroy
Definition: internal.h:365
_GLFWmakecontextcurrentfun makeCurrent
Definition: internal.h:360
_GLFWextensionsupportedfun extensionSupported
Definition: internal.h:363
_GLFWgetprocaddressfun getProcAddress
Definition: internal.h:364
GLFWbool debug
Definition: internal.h:304
GLFWbool noerror
Definition: internal.h:305
_GLFWwindow * share
Definition: internal.h:309
GLFWbool forward
Definition: internal.h:303
int accumBlueBits
Definition: internal.h:333
int auxBuffers
Definition: internal.h:335
int stencilBits
Definition: internal.h:330
GLFWbool stereo
Definition: internal.h:336
int accumGreenBits
Definition: internal.h:332
GLFWbool transparent
Definition: internal.h:340
uintptr_t handle
Definition: internal.h:341
int accumAlphaBits
Definition: internal.h:334
int accumRedBits
Definition: internal.h:331
GLFWbool sRGB
Definition: internal.h:338
GLFWbool doublebuffer
Definition: internal.h:339
void * handle
Definition: internal.h:563
_GLFWtls contextSlot
Definition: internal.h:552
_GLFWcontext context
Definition: internal.h:409
void _glfwInputErrorX11(int error, const char *message)
Definition: x11_init.c:1062
void _glfwReleaseErrorHandlerX11(void)
Definition: x11_init.c:1053
void _glfwGrabErrorHandlerX11(void)
Definition: x11_init.c:1045
GLFWbool _glfwIsVisualTransparentX11(Visual *visual)
Definition: x11_window.c:1879
#define XFree
Definition: x11_platform.h:182