Add epoxy_has_egl()

Similar to `epoxy_has_glx()`, but for the EGL windowing system API.
macos/v1.5.9
Emmanuele Bassi 8 years ago
parent d94b9c28b5
commit 075172f485
  1. 1
      include/epoxy/egl.h
  2. 21
      src/dispatch_egl.c

@ -47,6 +47,7 @@ EPOXY_BEGIN_DECLS
EPOXY_PUBLIC bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension);
EPOXY_PUBLIC int epoxy_egl_version(EGLDisplay dpy);
EPOXY_PUBLIC bool epoxy_has_egl(void);
EPOXY_END_DECLS

@ -92,3 +92,24 @@ epoxy_has_egl_extension(EGLDisplay dpy, const char *ext)
{
return epoxy_extension_in_string(eglQueryString(dpy, EGL_EXTENSIONS), ext) || epoxy_extension_in_string(eglQueryString(NULL, EGL_EXTENSIONS), ext);
}
/**
* @brief Checks whether EGL is available.
*
* @return `true` if EGL is available
*/
bool
epoxy_has_egl(void)
{
#if !PLATFORM_HAS_EGL
return false;
#else
EGLDisplay* (* pf_eglGetCurrentDisplay) (void);
pf_eglGetCurrentDisplay = epoxy_conservative_egl_dlsym("eglGetCurrentDisplay", false);
if (pf_eglGetCurrentDisplay)
return true;
return false;
#endif /* PLATFORM_HAS_EGL */
}

Loading…
Cancel
Save