egl_context.c
Go to the documentation of this file.
1 //========================================================================
2 // GLFW 3.3 EGL - www.glfw.org
3 //------------------------------------------------------------------------
4 // Copyright (c) 2002-2006 Marcus Geelnard
5 // Copyright (c) 2006-2016 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 
28 #include "internal.h"
29 
30 #include <stdio.h>
31 #include <string.h>
32 #include <stdlib.h>
33 #include <assert.h>
34 
35 
36 // Return a description of the specified EGL error
37 //
38 static const char* getEGLErrorString(EGLint error)
39 {
40  switch (error)
41  {
42  case EGL_SUCCESS:
43  return "Success";
45  return "EGL is not or could not be initialized";
46  case EGL_BAD_ACCESS:
47  return "EGL cannot access a requested resource";
48  case EGL_BAD_ALLOC:
49  return "EGL failed to allocate resources for the requested operation";
50  case EGL_BAD_ATTRIBUTE:
51  return "An unrecognized attribute or attribute value was passed in the attribute list";
52  case EGL_BAD_CONTEXT:
53  return "An EGLContext argument does not name a valid EGL rendering context";
54  case EGL_BAD_CONFIG:
55  return "An EGLConfig argument does not name a valid EGL frame buffer configuration";
57  return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid";
58  case EGL_BAD_DISPLAY:
59  return "An EGLDisplay argument does not name a valid EGL display connection";
60  case EGL_BAD_SURFACE:
61  return "An EGLSurface argument does not name a valid surface configured for GL rendering";
62  case EGL_BAD_MATCH:
63  return "Arguments are inconsistent";
64  case EGL_BAD_PARAMETER:
65  return "One or more argument values are invalid";
67  return "A NativePixmapType argument does not refer to a valid native pixmap";
69  return "A NativeWindowType argument does not refer to a valid native window";
70  case EGL_CONTEXT_LOST:
71  return "The application must destroy all contexts and reinitialise";
72  default:
73  return "ERROR: UNKNOWN EGL ERROR";
74  }
75 }
76 
77 // Returns the specified attribute of the specified EGLConfig
78 //
79 static int getEGLConfigAttrib(EGLConfig config, int attrib)
80 {
81  int value;
82  eglGetConfigAttrib(_glfw.egl.display, config, attrib, &value);
83  return value;
84 }
85 
86 // Return the EGLConfig most closely matching the specified hints
87 //
88 static GLFWbool chooseEGLConfig(const _GLFWctxconfig* ctxconfig,
89  const _GLFWfbconfig* desired,
90  EGLConfig* result)
91 {
92  EGLConfig* nativeConfigs;
93  _GLFWfbconfig* usableConfigs;
94  const _GLFWfbconfig* closest;
95  int i, nativeCount, usableCount;
96 
97  eglGetConfigs(_glfw.egl.display, NULL, 0, &nativeCount);
98  if (!nativeCount)
99  {
100  _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: No EGLConfigs returned");
101  return GLFW_FALSE;
102  }
103 
104  nativeConfigs = calloc(nativeCount, sizeof(EGLConfig));
105  eglGetConfigs(_glfw.egl.display, nativeConfigs, nativeCount, &nativeCount);
106 
107  usableConfigs = calloc(nativeCount, sizeof(_GLFWfbconfig));
108  usableCount = 0;
109 
110  for (i = 0; i < nativeCount; i++)
111  {
112  const EGLConfig n = nativeConfigs[i];
113  _GLFWfbconfig* u = usableConfigs + usableCount;
114 
115  // Only consider RGB(A) EGLConfigs
117  continue;
118 
119  // Only consider window EGLConfigs
121  continue;
122 
123 #if defined(_GLFW_X11)
124  XVisualInfo vi = {0};
125 
126  // Only consider EGLConfigs with associated Visuals
127  vi.visualid = getEGLConfigAttrib(n, EGL_NATIVE_VISUAL_ID);
128  if (!vi.visualid)
129  continue;
130 
131  if (desired->transparent)
132  {
133  int count;
134  XVisualInfo* vis = XGetVisualInfo(_glfw.x11.display,
135  VisualIDMask, &vi,
136  &count);
137  if (vis)
138  {
139  u->transparent = _glfwIsVisualTransparentX11(vis[0].visual);
140  XFree(vis);
141  }
142  }
143 #endif // _GLFW_X11
144 
145  if (ctxconfig->client == GLFW_OPENGL_ES_API)
146  {
147  if (ctxconfig->major == 1)
148  {
150  continue;
151  }
152  else
153  {
155  continue;
156  }
157  }
158  else if (ctxconfig->client == GLFW_OPENGL_API)
159  {
161  continue;
162  }
163 
167 
171 
173  u->doublebuffer = GLFW_TRUE;
174 
175  u->handle = (uintptr_t) n;
176  usableCount++;
177  }
178 
179  closest = _glfwChooseFBConfig(desired, usableConfigs, usableCount);
180  if (closest)
181  *result = (EGLConfig) closest->handle;
182 
183  free(nativeConfigs);
184  free(usableConfigs);
185 
186  return closest != NULL;
187 }
188 
189 static void makeContextCurrentEGL(_GLFWwindow* window)
190 {
191  if (window)
192  {
193  if (!eglMakeCurrent(_glfw.egl.display,
194  window->context.egl.surface,
195  window->context.egl.surface,
196  window->context.egl.handle))
197  {
199  "EGL: Failed to make context current: %s",
201  return;
202  }
203  }
204  else
205  {
206  if (!eglMakeCurrent(_glfw.egl.display,
210  {
212  "EGL: Failed to clear current context: %s",
214  return;
215  }
216  }
217 
219 }
220 
221 static void swapBuffersEGL(_GLFWwindow* window)
222 {
223  if (window != _glfwPlatformGetTls(&_glfw.contextSlot))
224  {
226  "EGL: The context must be current on the calling thread when swapping buffers");
227  return;
228  }
229 
230  eglSwapBuffers(_glfw.egl.display, window->context.egl.surface);
231 }
232 
233 static void swapIntervalEGL(int interval)
234 {
235  eglSwapInterval(_glfw.egl.display, interval);
236 }
237 
238 static int extensionSupportedEGL(const char* extension)
239 {
240  const char* extensions = eglQueryString(_glfw.egl.display, EGL_EXTENSIONS);
241  if (extensions)
242  {
244  return GLFW_TRUE;
245  }
246 
247  return GLFW_FALSE;
248 }
249 
250 static GLFWglproc getProcAddressEGL(const char* procname)
251 {
253 
254  if (window->context.egl.client)
255  {
256  GLFWglproc proc = (GLFWglproc) _glfw_dlsym(window->context.egl.client,
257  procname);
258  if (proc)
259  return proc;
260  }
261 
262  return eglGetProcAddress(procname);
263 }
264 
265 static void destroyContextEGL(_GLFWwindow* window)
266 {
267 #if defined(_GLFW_X11)
268  // NOTE: Do not unload libGL.so.1 while the X11 display is still open,
269  // as it will make XCloseDisplay segfault
270  if (window->context.client != GLFW_OPENGL_API)
271 #endif // _GLFW_X11
272  {
273  if (window->context.egl.client)
274  {
275  _glfw_dlclose(window->context.egl.client);
276  window->context.egl.client = NULL;
277  }
278  }
279 
280  if (window->context.egl.surface)
281  {
282  eglDestroySurface(_glfw.egl.display, window->context.egl.surface);
283  window->context.egl.surface = EGL_NO_SURFACE;
284  }
285 
286  if (window->context.egl.handle)
287  {
288  eglDestroyContext(_glfw.egl.display, window->context.egl.handle);
289  window->context.egl.handle = EGL_NO_CONTEXT;
290  }
291 }
292 
293 
297 
298 // Initialize EGL
299 //
301 {
302  int i;
303  const char* sonames[] =
304  {
305 #if defined(_GLFW_EGL_LIBRARY)
306  _GLFW_EGL_LIBRARY,
307 #elif defined(_GLFW_WIN32)
308  "libEGL.dll",
309  "EGL.dll",
310 #elif defined(_GLFW_COCOA)
311  "libEGL.dylib",
312 #elif defined(__CYGWIN__)
313  "libEGL-1.so",
314 #else
315  "libEGL.so.1",
316 #endif
317  NULL
318  };
319 
320  if (_glfw.egl.handle)
321  return GLFW_TRUE;
322 
323  for (i = 0; sonames[i]; i++)
324  {
325  _glfw.egl.handle = _glfw_dlopen(sonames[i]);
326  if (_glfw.egl.handle)
327  break;
328  }
329 
330  if (!_glfw.egl.handle)
331  {
332  _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: Library not found");
333  return GLFW_FALSE;
334  }
335 
336  _glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0);
337 
338  _glfw.egl.GetConfigAttrib = (PFN_eglGetConfigAttrib)
339  _glfw_dlsym(_glfw.egl.handle, "eglGetConfigAttrib");
340  _glfw.egl.GetConfigs = (PFN_eglGetConfigs)
341  _glfw_dlsym(_glfw.egl.handle, "eglGetConfigs");
342  _glfw.egl.GetDisplay = (PFN_eglGetDisplay)
343  _glfw_dlsym(_glfw.egl.handle, "eglGetDisplay");
344  _glfw.egl.GetError = (PFN_eglGetError)
345  _glfw_dlsym(_glfw.egl.handle, "eglGetError");
346  _glfw.egl.Initialize = (PFN_eglInitialize)
347  _glfw_dlsym(_glfw.egl.handle, "eglInitialize");
348  _glfw.egl.Terminate = (PFN_eglTerminate)
349  _glfw_dlsym(_glfw.egl.handle, "eglTerminate");
350  _glfw.egl.BindAPI = (PFN_eglBindAPI)
351  _glfw_dlsym(_glfw.egl.handle, "eglBindAPI");
352  _glfw.egl.CreateContext = (PFN_eglCreateContext)
353  _glfw_dlsym(_glfw.egl.handle, "eglCreateContext");
354  _glfw.egl.DestroySurface = (PFN_eglDestroySurface)
355  _glfw_dlsym(_glfw.egl.handle, "eglDestroySurface");
356  _glfw.egl.DestroyContext = (PFN_eglDestroyContext)
357  _glfw_dlsym(_glfw.egl.handle, "eglDestroyContext");
358  _glfw.egl.CreateWindowSurface = (PFN_eglCreateWindowSurface)
359  _glfw_dlsym(_glfw.egl.handle, "eglCreateWindowSurface");
360  _glfw.egl.MakeCurrent = (PFN_eglMakeCurrent)
361  _glfw_dlsym(_glfw.egl.handle, "eglMakeCurrent");
362  _glfw.egl.SwapBuffers = (PFN_eglSwapBuffers)
363  _glfw_dlsym(_glfw.egl.handle, "eglSwapBuffers");
364  _glfw.egl.SwapInterval = (PFN_eglSwapInterval)
365  _glfw_dlsym(_glfw.egl.handle, "eglSwapInterval");
366  _glfw.egl.QueryString = (PFN_eglQueryString)
367  _glfw_dlsym(_glfw.egl.handle, "eglQueryString");
368  _glfw.egl.GetProcAddress = (PFN_eglGetProcAddress)
369  _glfw_dlsym(_glfw.egl.handle, "eglGetProcAddress");
370 
371  if (!_glfw.egl.GetConfigAttrib ||
372  !_glfw.egl.GetConfigs ||
373  !_glfw.egl.GetDisplay ||
374  !_glfw.egl.GetError ||
375  !_glfw.egl.Initialize ||
376  !_glfw.egl.Terminate ||
377  !_glfw.egl.BindAPI ||
378  !_glfw.egl.CreateContext ||
379  !_glfw.egl.DestroySurface ||
380  !_glfw.egl.DestroyContext ||
381  !_glfw.egl.CreateWindowSurface ||
382  !_glfw.egl.MakeCurrent ||
383  !_glfw.egl.SwapBuffers ||
384  !_glfw.egl.SwapInterval ||
385  !_glfw.egl.QueryString ||
386  !_glfw.egl.GetProcAddress)
387  {
389  "EGL: Failed to load required entry points");
390 
392  return GLFW_FALSE;
393  }
394 
396  if (_glfw.egl.display == EGL_NO_DISPLAY)
397  {
399  "EGL: Failed to get EGL display: %s",
401 
403  return GLFW_FALSE;
404  }
405 
406  if (!eglInitialize(_glfw.egl.display, &_glfw.egl.major, &_glfw.egl.minor))
407  {
409  "EGL: Failed to initialize EGL: %s",
411 
413  return GLFW_FALSE;
414  }
415 
416  _glfw.egl.KHR_create_context =
417  extensionSupportedEGL("EGL_KHR_create_context");
418  _glfw.egl.KHR_create_context_no_error =
419  extensionSupportedEGL("EGL_KHR_create_context_no_error");
420  _glfw.egl.KHR_gl_colorspace =
421  extensionSupportedEGL("EGL_KHR_gl_colorspace");
422  _glfw.egl.KHR_get_all_proc_addresses =
423  extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
424  _glfw.egl.KHR_context_flush_control =
425  extensionSupportedEGL("EGL_KHR_context_flush_control");
426 
427  return GLFW_TRUE;
428 }
429 
430 // Terminate EGL
431 //
433 {
434  if (_glfw.egl.display)
435  {
436  eglTerminate(_glfw.egl.display);
437  _glfw.egl.display = EGL_NO_DISPLAY;
438  }
439 
440  if (_glfw.egl.handle)
441  {
443  _glfw.egl.handle = NULL;
444  }
445 }
446 
447 #define setAttrib(a, v) \
448 { \
449  assert((size_t) (index + 1) < sizeof(attribs) / sizeof(attribs[0])); \
450  attribs[index++] = a; \
451  attribs[index++] = v; \
452 }
453 
454 // Create the OpenGL or OpenGL ES context
455 //
457  const _GLFWctxconfig* ctxconfig,
458  const _GLFWfbconfig* fbconfig)
459 {
460  EGLint attribs[40];
462  EGLContext share = NULL;
463  int index = 0;
464 
465  if (!_glfw.egl.display)
466  {
467  _glfwInputError(GLFW_API_UNAVAILABLE, "EGL: API not available");
468  return GLFW_FALSE;
469  }
470 
471  if (ctxconfig->share)
472  share = ctxconfig->share->context.egl.handle;
473 
474  if (!chooseEGLConfig(ctxconfig, fbconfig, &config))
475  {
477  "EGL: Failed to find a suitable EGLConfig");
478  return GLFW_FALSE;
479  }
480 
481  if (ctxconfig->client == GLFW_OPENGL_ES_API)
482  {
484  {
486  "EGL: Failed to bind OpenGL ES: %s",
488  return GLFW_FALSE;
489  }
490  }
491  else
492  {
494  {
496  "EGL: Failed to bind OpenGL: %s",
498  return GLFW_FALSE;
499  }
500  }
501 
502  if (_glfw.egl.KHR_create_context)
503  {
504  int mask = 0, flags = 0;
505 
506  if (ctxconfig->client == GLFW_OPENGL_API)
507  {
508  if (ctxconfig->forward)
510 
511  if (ctxconfig->profile == GLFW_OPENGL_CORE_PROFILE)
513  else if (ctxconfig->profile == GLFW_OPENGL_COMPAT_PROFILE)
515  }
516 
517  if (ctxconfig->debug)
519 
520  if (ctxconfig->robustness)
521  {
522  if (ctxconfig->robustness == GLFW_NO_RESET_NOTIFICATION)
523  {
526  }
527  else if (ctxconfig->robustness == GLFW_LOSE_CONTEXT_ON_RESET)
528  {
531  }
532 
534  }
535 
536  if (ctxconfig->noerror)
537  {
538  if (_glfw.egl.KHR_create_context_no_error)
540  }
541 
542  if (ctxconfig->major != 1 || ctxconfig->minor != 0)
543  {
546  }
547 
548  if (mask)
550 
551  if (flags)
553  }
554  else
555  {
556  if (ctxconfig->client == GLFW_OPENGL_ES_API)
558  }
559 
560  if (_glfw.egl.KHR_context_flush_control)
561  {
562  if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_NONE)
563  {
566  }
567  else if (ctxconfig->release == GLFW_RELEASE_BEHAVIOR_FLUSH)
568  {
571  }
572  }
573 
575 
576  window->context.egl.handle = eglCreateContext(_glfw.egl.display,
577  config, share, attribs);
578 
579  if (window->context.egl.handle == EGL_NO_CONTEXT)
580  {
582  "EGL: Failed to create context: %s",
584  return GLFW_FALSE;
585  }
586 
587  // Set up attributes for surface creation
588  {
589  int index = 0;
590 
591  if (fbconfig->sRGB)
592  {
593  if (_glfw.egl.KHR_gl_colorspace)
595  }
596 
598  }
599 
600  window->context.egl.surface =
601  eglCreateWindowSurface(_glfw.egl.display,
602  config,
604  attribs);
605  if (window->context.egl.surface == EGL_NO_SURFACE)
606  {
608  "EGL: Failed to create window surface: %s",
610  return GLFW_FALSE;
611  }
612 
613  window->context.egl.config = config;
614 
615  // Load the appropriate client library
616  if (!_glfw.egl.KHR_get_all_proc_addresses)
617  {
618  int i;
619  const char** sonames;
620  const char* es1sonames[] =
621  {
622 #if defined(_GLFW_GLESV1_LIBRARY)
623  _GLFW_GLESV1_LIBRARY,
624 #elif defined(_GLFW_WIN32)
625  "GLESv1_CM.dll",
626  "libGLES_CM.dll",
627 #elif defined(_GLFW_COCOA)
628  "libGLESv1_CM.dylib",
629 #else
630  "libGLESv1_CM.so.1",
631  "libGLES_CM.so.1",
632 #endif
633  NULL
634  };
635  const char* es2sonames[] =
636  {
637 #if defined(_GLFW_GLESV2_LIBRARY)
638  _GLFW_GLESV2_LIBRARY,
639 #elif defined(_GLFW_WIN32)
640  "GLESv2.dll",
641  "libGLESv2.dll",
642 #elif defined(_GLFW_COCOA)
643  "libGLESv2.dylib",
644 #elif defined(__CYGWIN__)
645  "libGLESv2-2.so",
646 #else
647  "libGLESv2.so.2",
648 #endif
649  NULL
650  };
651  const char* glsonames[] =
652  {
653 #if defined(_GLFW_OPENGL_LIBRARY)
654  _GLFW_OPENGL_LIBRARY,
655 #elif defined(_GLFW_WIN32)
656 #elif defined(_GLFW_COCOA)
657 #else
658  "libGL.so.1",
659 #endif
660  NULL
661  };
662 
663  if (ctxconfig->client == GLFW_OPENGL_ES_API)
664  {
665  if (ctxconfig->major == 1)
666  sonames = es1sonames;
667  else
668  sonames = es2sonames;
669  }
670  else
671  sonames = glsonames;
672 
673  for (i = 0; sonames[i]; i++)
674  {
675  // HACK: Match presence of lib prefix to increase chance of finding
676  // a matching pair in the jungle that is Win32 EGL/GLES
677  if (_glfw.egl.prefix != (strncmp(sonames[i], "lib", 3) == 0))
678  continue;
679 
680  window->context.egl.client = _glfw_dlopen(sonames[i]);
681  if (window->context.egl.client)
682  break;
683  }
684 
685  if (!window->context.egl.client)
686  {
688  "EGL: Failed to load client library");
689  return GLFW_FALSE;
690  }
691  }
692 
699 
700  return GLFW_TRUE;
701 }
702 
703 #undef setAttrib
704 
705 // Returns the Visual and depth of the chosen EGLConfig
706 //
707 #if defined(_GLFW_X11)
709  const _GLFWctxconfig* ctxconfig,
710  const _GLFWfbconfig* fbconfig,
711  Visual** visual, int* depth)
712 {
713  XVisualInfo* result;
714  XVisualInfo desired;
715  EGLConfig native;
716  EGLint visualID = 0, count = 0;
717  const long vimask = VisualScreenMask | VisualIDMask;
718 
719  if (!chooseEGLConfig(ctxconfig, fbconfig, &native))
720  {
722  "EGL: Failed to find a suitable EGLConfig");
723  return GLFW_FALSE;
724  }
725 
726  eglGetConfigAttrib(_glfw.egl.display, native,
727  EGL_NATIVE_VISUAL_ID, &visualID);
728 
729  desired.screen = _glfw.x11.screen;
730  desired.visualid = visualID;
731 
732  result = XGetVisualInfo(_glfw.x11.display, vimask, &desired, &count);
733  if (!result)
734  {
736  "EGL: Failed to retrieve Visual for EGLConfig");
737  return GLFW_FALSE;
738  }
739 
740  *visual = result->visual;
741  *depth = result->depth;
742 
743  XFree(result);
744  return GLFW_TRUE;
745 }
746 #endif // _GLFW_X11
747 
748 
752 
754 {
756  return _glfw.egl.display;
757 }
758 
760 {
761  _GLFWwindow* window = (_GLFWwindow*) handle;
763 
764  if (window->context.client == GLFW_NO_API)
765  {
767  return EGL_NO_CONTEXT;
768  }
769 
770  return window->context.egl.handle;
771 }
772 
774 {
775  _GLFWwindow* window = (_GLFWwindow*) handle;
777 
778  if (window->context.client == GLFW_NO_API)
779  {
781  return EGL_NO_SURFACE;
782  }
783 
784  return window->context.egl.surface;
785 }
786 
_glfw_dlsym
#define _glfw_dlsym(handle, name)
Definition: cocoa_platform.h:57
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR
Definition: egl_context.h:98
_GLFWfbconfig::transparent
GLFWbool transparent
Definition: internal.h:329
EGL_GL_COLORSPACE_SRGB_KHR
#define EGL_GL_COLORSPACE_SRGB_KHR
Definition: egl_context.h:105
eglGetError
#define eglGetError
Definition: egl_context.h:138
swapBuffersEGL
static void swapBuffersEGL(_GLFWwindow *window)
Definition: egl_context.c:221
_glfwTerminateEGL
void _glfwTerminateEGL(void)
Definition: egl_context.c:432
PFN_eglTerminate
EGLBoolean(EGLAPIENTRY * PFN_eglTerminate)(EGLDisplay)
Definition: egl_context.h:124
EGL_BAD_CURRENT_SURFACE
#define EGL_BAD_CURRENT_SURFACE
Definition: egl_context.h:57
EGL_BAD_NATIVE_PIXMAP
#define EGL_BAD_NATIVE_PIXMAP
Definition: egl_context.h:60
_GLFWcontext::extensionSupported
_GLFWextensionsupportedfun extensionSupported
Definition: internal.h:352
EGL_CONTEXT_MAJOR_VERSION_KHR
#define EGL_CONTEXT_MAJOR_VERSION_KHR
Definition: egl_context.h:99
NULL
#define NULL
PFN_eglDestroySurface
EGLBoolean(EGLAPIENTRY * PFN_eglDestroySurface)(EGLDisplay, EGLSurface)
Definition: egl_context.h:127
EGLDisplay
void * EGLDisplay
Definition: egl_context.h:115
EGL_NATIVE_VISUAL_ID
#define EGL_NATIVE_VISUAL_ID
Definition: egl_context.h:85
glfwGetEGLContext
GLFWAPI EGLContext glfwGetEGLContext(GLFWwindow *handle)
Definition: egl_context.c:759
_GLFWcontext::makeCurrent
_GLFWmakecontextcurrentfun makeCurrent
Definition: internal.h:349
_GLFWctxconfig::forward
GLFWbool forward
Definition: internal.h:292
_GLFWctxconfig::profile
int profile
Definition: internal.h:295
GLFW_RELEASE_BEHAVIOR_NONE
#define GLFW_RELEASE_BEHAVIOR_NONE
Definition: glfw3.h:1012
EGL_BAD_CONTEXT
#define EGL_BAD_CONTEXT
Definition: egl_context.h:56
EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR
Definition: egl_context.h:93
extensionSupportedEGL
static int extensionSupportedEGL(const char *extension)
Definition: egl_context.c:238
EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR
#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR
Definition: egl_context.h:107
EGL_BAD_ATTRIBUTE
#define EGL_BAD_ATTRIBUTE
Definition: egl_context.h:54
GLFW_OPENGL_API
#define GLFW_OPENGL_API
Definition: glfw3.h:990
PFN_eglGetConfigs
EGLBoolean(EGLAPIENTRY * PFN_eglGetConfigs)(EGLDisplay, EGLConfig *, EGLint, EGLint *)
Definition: egl_context.h:120
_GLFW_EGL_NATIVE_WINDOW
#define _GLFW_EGL_NATIVE_WINDOW
Definition: cocoa_platform.h:59
GLFW_FORMAT_UNAVAILABLE
#define GLFW_FORMAT_UNAVAILABLE
The requested format is not supported or available.
Definition: glfw3.h:745
GLFWwindow
struct GLFWwindow GLFWwindow
Opaque window object.
Definition: glfw3.h:1137
EGL_BAD_SURFACE
#define EGL_BAD_SURFACE
Definition: egl_context.h:63
GLFWAPI
#define GLFWAPI
Definition: glfw3.h:240
conf.extensions
list extensions
Definition: conf.py:60
EGL_NO_SURFACE
#define EGL_NO_SURFACE
Definition: egl_context.h:86
_GLFWctxconfig::release
int release
Definition: internal.h:297
EGL_OPENGL_ES_API
#define EGL_OPENGL_ES_API
Definition: egl_context.h:80
EGL_DEPTH_SIZE
#define EGL_DEPTH_SIZE
Definition: egl_context.h:77
_glfwChooseVisualEGL
GLFWbool _glfwChooseVisualEGL(const _GLFWwndconfig *wndconfig, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig, Visual **visual, int *depth)
Definition: egl_context.c:708
_glfwPlatformSetTls
void _glfwPlatformSetTls(_GLFWtls *tls, void *value)
Definition: posix_thread.c:66
EGLSurface
void * EGLSurface
Definition: egl_context.h:116
EGL_RGB_BUFFER
#define EGL_RGB_BUFFER
Definition: egl_context.h:66
sajson::error
error
Error code indicating why parse failed.
Definition: sajson.h:643
EGL_CONTEXT_CLIENT_VERSION
#define EGL_CONTEXT_CLIENT_VERSION
Definition: egl_context.h:84
_glfwInputError
void _glfwInputError(int code, const char *format,...)
Definition: init.c:153
_GLFWlibrary::handle
void * handle
Definition: internal.h:548
makeContextCurrentEGL
static void makeContextCurrentEGL(_GLFWwindow *window)
Definition: egl_context.c:189
EGL_OPENGL_BIT
#define EGL_OPENGL_BIT
Definition: egl_context.h:72
EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
Definition: egl_context.h:94
getProcAddressEGL
static GLFWglproc getProcAddressEGL(const char *procname)
Definition: egl_context.c:250
_GLFWctxconfig::client
int client
Definition: internal.h:288
GLFW_VERSION_UNAVAILABLE
#define GLFW_VERSION_UNAVAILABLE
The requested OpenGL or OpenGL ES version is not available.
Definition: glfw3.h:715
GLFW_LOSE_CONTEXT_ON_RESET
#define GLFW_LOSE_CONTEXT_ON_RESET
Definition: glfw3.h:995
_GLFWcontext::destroy
_GLFWdestroycontextfun destroy
Definition: internal.h:354
GLFW_NO_WINDOW_CONTEXT
#define GLFW_NO_WINDOW_CONTEXT
The specified window does not have an OpenGL or OpenGL ES context.
Definition: glfw3.h:753
PFN_eglInitialize
EGLBoolean(EGLAPIENTRY * PFN_eglInitialize)(EGLDisplay, EGLint *, EGLint *)
Definition: egl_context.h:123
EGL_CONTEXT_FLAGS_KHR
#define EGL_CONTEXT_FLAGS_KHR
Definition: egl_context.h:102
EGL_BAD_DISPLAY
#define EGL_BAD_DISPLAY
Definition: egl_context.h:58
chooseEGLConfig
static GLFWbool chooseEGLConfig(const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *desired, EGLConfig *result)
Definition: egl_context.c:88
GLFW_API_UNAVAILABLE
#define GLFW_API_UNAVAILABLE
GLFW could not find support for the requested API on the system.
Definition: glfw3.h:698
_GLFWwindow
Definition: internal.h:366
GLFWglproc
void(* GLFWglproc)(void)
Client API function pointer type.
Definition: glfw3.h:1099
EGL_OPENGL_ES2_BIT
#define EGL_OPENGL_ES2_BIT
Definition: egl_context.h:71
setAttrib
#define setAttrib(a, v)
Definition: egl_context.c:447
_GLFWctxconfig
Definition: internal.h:286
GLFW_OPENGL_COMPAT_PROFILE
#define GLFW_OPENGL_COMPAT_PROFILE
Definition: glfw3.h:999
EGL_LOSE_CONTEXT_ON_RESET_KHR
#define EGL_LOSE_CONTEXT_ON_RESET_KHR
Definition: egl_context.h:97
eglInitialize
#define eglInitialize
Definition: egl_context.h:139
_glfw_dlopen
#define _glfw_dlopen(name)
Definition: cocoa_platform.h:55
GLFW_FALSE
#define GLFW_FALSE
Zero.
Definition: glfw3.h:287
PFN_eglGetError
EGLint(EGLAPIENTRY * PFN_eglGetError)(void)
Definition: egl_context.h:122
EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR
#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR
Definition: egl_context.h:108
EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR
Definition: egl_context.h:92
_GLFWfbconfig::alphaBits
int alphaBits
Definition: internal.h:317
EGL_RENDERABLE_TYPE
#define EGL_RENDERABLE_TYPE
Definition: egl_context.h:69
GLFW_NO_RESET_NOTIFICATION
#define GLFW_NO_RESET_NOTIFICATION
Definition: glfw3.h:994
GLFW_TRUE
#define GLFW_TRUE
One.
Definition: glfw3.h:279
_GLFWcontext::client
int client
Definition: internal.h:337
eglGetConfigs
#define eglGetConfigs
Definition: egl_context.h:136
eglSwapInterval
#define eglSwapInterval
Definition: egl_context.h:148
_glfwPlatformGetTls
void * _glfwPlatformGetTls(_GLFWtls *tls)
Definition: posix_thread.c:60
_GLFWfbconfig::handle
uintptr_t handle
Definition: internal.h:330
EGL_CONTEXT_MINOR_VERSION_KHR
#define EGL_CONTEXT_MINOR_VERSION_KHR
Definition: egl_context.h:100
EGL_COLOR_BUFFER_TYPE
#define EGL_COLOR_BUFFER_TYPE
Definition: egl_context.h:65
_GLFWfbconfig::sRGB
GLFWbool sRGB
Definition: internal.h:327
_GLFWwindow::context
_GLFWcontext context
Definition: internal.h:395
EGL_GREEN_SIZE
#define EGL_GREEN_SIZE
Definition: egl_context.h:75
_glfwCreateContextEGL
GLFWbool _glfwCreateContextEGL(_GLFWwindow *window, const _GLFWctxconfig *ctxconfig, const _GLFWfbconfig *fbconfig)
Definition: egl_context.c:456
EGL_BAD_PARAMETER
#define EGL_BAD_PARAMETER
Definition: egl_context.h:62
EGL_STENCIL_SIZE
#define EGL_STENCIL_SIZE
Definition: egl_context.h:78
glfwGetEGLDisplay
GLFWAPI EGLDisplay glfwGetEGLDisplay(void)
Definition: egl_context.c:753
_GLFW_REQUIRE_INIT_OR_RETURN
#define _GLFW_REQUIRE_INIT_OR_RETURN(x)
Definition: internal.h:211
PFN_eglSwapInterval
EGLBoolean(EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay, EGLint)
Definition: egl_context.h:132
_glfwChooseFBConfig
const _GLFWfbconfig * _glfwChooseFBConfig(const _GLFWfbconfig *desired, const _GLFWfbconfig *alternatives, unsigned int count)
Definition: context.c:176
_GLFWfbconfig::blueBits
int blueBits
Definition: internal.h:316
_glfwIsVisualTransparentX11
GLFWbool _glfwIsVisualTransparentX11(Visual *visual)
Definition: x11_window.c:1885
EGL_EXTENSIONS
#define EGL_EXTENSIONS
Definition: egl_context.h:83
EGL_BAD_ACCESS
#define EGL_BAD_ACCESS
Definition: egl_context.h:52
GLFW_OPENGL_ES_API
#define GLFW_OPENGL_ES_API
Definition: glfw3.h:991
GLFW_NO_API
#define GLFW_NO_API
Definition: glfw3.h:989
getEGLConfigAttrib
static int getEGLConfigAttrib(EGLConfig config, int attrib)
Definition: egl_context.c:79
EGL_CONTEXT_RELEASE_BEHAVIOR_KHR
#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR
Definition: egl_context.h:106
PFN_eglCreateContext
EGLContext(EGLAPIENTRY * PFN_eglCreateContext)(EGLDisplay, EGLConfig, EGLContext, const EGLint *)
Definition: egl_context.h:126
eglQueryString
#define eglQueryString
Definition: egl_context.h:149
PFN_eglCreateWindowSurface
EGLSurface(EGLAPIENTRY * PFN_eglCreateWindowSurface)(EGLDisplay, EGLConfig, EGLNativeWindowType, const EGLint *)
Definition: egl_context.h:129
eglCreateContext
#define eglCreateContext
Definition: egl_context.h:142
_glfwStringInExtensionString
GLFWbool _glfwStringInExtensionString(const char *string, const char *extensions)
Definition: context.c:580
PFN_eglGetConfigAttrib
EGLBoolean(EGLAPIENTRY * PFN_eglGetConfigAttrib)(EGLDisplay, EGLConfig, EGLint, EGLint *)
Definition: egl_context.h:119
glfwGetEGLSurface
GLFWAPI EGLSurface glfwGetEGLSurface(GLFWwindow *handle)
Definition: egl_context.c:773
EGL_OPENGL_ES_BIT
#define EGL_OPENGL_ES_BIT
Definition: egl_context.h:70
_GLFWlibrary::contextSlot
_GLFWtls contextSlot
Definition: internal.h:537
EGL_SAMPLES
#define EGL_SAMPLES
Definition: egl_context.h:79
_GLFWwndconfig
Definition: internal.h:255
eglTerminate
#define eglTerminate
Definition: egl_context.h:140
_GLFWctxconfig::robustness
int robustness
Definition: internal.h:296
eglDestroyContext
#define eglDestroyContext
Definition: egl_context.h:144
_GLFWfbconfig::redBits
int redBits
Definition: internal.h:314
_GLFW_EGL_NATIVE_DISPLAY
#define _GLFW_EGL_NATIVE_DISPLAY
Definition: cocoa_platform.h:60
getEGLErrorString
static const char * getEGLErrorString(EGLint error)
Definition: egl_context.c:38
EGLConfig
void * EGLConfig
Definition: egl_context.h:113
EGL_CONTEXT_OPENGL_NO_ERROR_KHR
#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR
Definition: egl_context.h:103
eglGetDisplay
#define eglGetDisplay
Definition: egl_context.h:137
swapIntervalEGL
static void swapIntervalEGL(int interval)
Definition: egl_context.c:233
EGL_BAD_NATIVE_WINDOW
#define EGL_BAD_NATIVE_WINDOW
Definition: egl_context.h:61
EGL_GL_COLORSPACE_KHR
#define EGL_GL_COLORSPACE_KHR
Definition: egl_context.h:104
internal.h
EGL_ALPHA_SIZE
#define EGL_ALPHA_SIZE
Definition: egl_context.h:73
PFN_eglSwapBuffers
EGLBoolean(EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay, EGLSurface)
Definition: egl_context.h:131
_glfw
_GLFWlibrary _glfw
Definition: init.c:44
eglCreateWindowSurface
#define eglCreateWindowSurface
Definition: egl_context.h:145
EGL_NO_DISPLAY
#define EGL_NO_DISPLAY
Definition: egl_context.h:87
EGL_BAD_MATCH
#define EGL_BAD_MATCH
Definition: egl_context.h:59
_GLFWfbconfig
Definition: internal.h:312
PFN_eglMakeCurrent
EGLBoolean(EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay, EGLSurface, EGLSurface, EGLContext)
Definition: egl_context.h:130
EGL_OPENGL_API
#define EGL_OPENGL_API
Definition: egl_context.h:81
eglMakeCurrent
#define eglMakeCurrent
Definition: egl_context.h:146
_GLFWctxconfig::minor
int minor
Definition: internal.h:291
EGL_NOT_INITIALIZED
#define EGL_NOT_INITIALIZED
Definition: egl_context.h:51
eglBindAPI
#define eglBindAPI
Definition: egl_context.h:141
GLFW_PLATFORM_ERROR
#define GLFW_PLATFORM_ERROR
A platform-specific error occurred that does not match any of the more specific categories.
Definition: glfw3.h:726
EGL_NO_RESET_NOTIFICATION_KHR
#define EGL_NO_RESET_NOTIFICATION_KHR
Definition: egl_context.h:96
destroyContextEGL
static void destroyContextEGL(_GLFWwindow *window)
Definition: egl_context.c:265
_glfwInitEGL
GLFWbool _glfwInitEGL(void)
Definition: egl_context.c:300
eglDestroySurface
#define eglDestroySurface
Definition: egl_context.h:143
EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR
Definition: egl_context.h:91
PFN_eglQueryString
const typedef char *EGLAPIENTRY * PFN_eglQueryString(EGLDisplay, EGLint)
_glfw_dlclose
#define _glfw_dlclose(handle)
Definition: cocoa_platform.h:56
EGL_WINDOW_BIT
#define EGL_WINDOW_BIT
Definition: egl_context.h:68
EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR
Definition: egl_context.h:95
EGL_RED_SIZE
#define EGL_RED_SIZE
Definition: egl_context.h:76
_GLFWfbconfig::samples
int samples
Definition: internal.h:326
_GLFWfbconfig::doublebuffer
GLFWbool doublebuffer
Definition: internal.h:328
_GLFWcontext::swapBuffers
_GLFWswapbuffersfun swapBuffers
Definition: internal.h:350
EGL_CONTEXT_LOST
#define EGL_CONTEXT_LOST
Definition: egl_context.h:64
EGL_BAD_CONFIG
#define EGL_BAD_CONFIG
Definition: egl_context.h:55
EGL_NONE
#define EGL_NONE
Definition: egl_context.h:82
EGLContext
void * EGLContext
Definition: egl_context.h:114
PFN_eglDestroyContext
EGLBoolean(EGLAPIENTRY * PFN_eglDestroyContext)(EGLDisplay, EGLContext)
Definition: egl_context.h:128
EGLint
int EGLint
Definition: egl_context.h:110
EGL_SUCCESS
#define EGL_SUCCESS
Definition: egl_context.h:50
_GLFWctxconfig::debug
GLFWbool debug
Definition: internal.h:293
GLFW_RELEASE_BEHAVIOR_FLUSH
#define GLFW_RELEASE_BEHAVIOR_FLUSH
Definition: glfw3.h:1011
EGL_BAD_ALLOC
#define EGL_BAD_ALLOC
Definition: egl_context.h:53
assert.h
EGL_SURFACE_TYPE
#define EGL_SURFACE_TYPE
Definition: egl_context.h:67
GLFW_OPENGL_CORE_PROFILE
#define GLFW_OPENGL_CORE_PROFILE
Definition: glfw3.h:998
EGL_BLUE_SIZE
#define EGL_BLUE_SIZE
Definition: egl_context.h:74
PFN_eglGetProcAddress
GLFWglproc(EGLAPIENTRY * PFN_eglGetProcAddress)(const char *)
Definition: egl_context.h:134
eglGetProcAddress
#define eglGetProcAddress
Definition: egl_context.h:150
_GLFWctxconfig::share
_GLFWwindow * share
Definition: internal.h:298
config
config
_GLFWcontext::getProcAddress
_GLFWgetprocaddressfun getProcAddress
Definition: internal.h:353
GLFWbool
int GLFWbool
Definition: internal.h:62
eglSwapBuffers
#define eglSwapBuffers
Definition: egl_context.h:147
_GLFWfbconfig::depthBits
int depthBits
Definition: internal.h:318
EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR
Definition: egl_context.h:101
eglGetConfigAttrib
#define eglGetConfigAttrib
Definition: egl_context.h:135
PFN_eglBindAPI
EGLBoolean(EGLAPIENTRY * PFN_eglBindAPI)(EGLenum)
Definition: egl_context.h:125
_GLFWfbconfig::greenBits
int greenBits
Definition: internal.h:315
_GLFWctxconfig::noerror
GLFWbool noerror
Definition: internal.h:294
_GLFWfbconfig::stencilBits
int stencilBits
Definition: internal.h:319
PFN_eglGetDisplay
EGLDisplay(EGLAPIENTRY * PFN_eglGetDisplay)(EGLNativeDisplayType)
Definition: egl_context.h:121
_GLFWctxconfig::major
int major
Definition: internal.h:290
EGL_NO_CONTEXT
#define EGL_NO_CONTEXT
Definition: egl_context.h:88
_GLFWcontext::swapInterval
_GLFWswapintervalfun swapInterval
Definition: internal.h:351


mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:07