Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: EGL updates #300

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/dispatch_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -781,12 +781,16 @@ epoxy_get_core_proc_address(const char *name, int core_version)
static EGLenum
epoxy_egl_get_current_gl_context_api(void)
{
EGLDisplay *egl_display = eglGetCurrentDisplay();
EGLContext *egl_context = eglGetCurrentContext();
EGLint curapi;

if (!api.egl_handle)
return EGL_NONE;

if (eglQueryContext(eglGetCurrentDisplay(), eglGetCurrentContext(),
if (egl_display == EGL_NO_DISPLAY ||
eglQueryContext(egl_display,
egl_context,
EGL_CONTEXT_CLIENT_TYPE, &curapi) == EGL_FALSE) {
(void)eglGetError();
return EGL_NONE;
Expand Down Expand Up @@ -817,6 +821,11 @@ epoxy_get_bootstrap_proc_address(const char *name)
return epoxy_gl_dlsym(name);
#endif

#ifdef _WIN32
if (api.gl_handle && wglGetCurrentContext())
return epoxy_gl_dlsym(name);
#endif

/* If epoxy hasn't loaded any API-specific library yet, try to
* figure out what API the context is using and use that library,
* since future calls will also use that API (this prevents a
Expand All @@ -830,8 +839,13 @@ epoxy_get_bootstrap_proc_address(const char *name)
case EGL_OPENGL_API:
return epoxy_gl_dlsym(name);
case EGL_OPENGL_ES_API:
if (eglQueryContext(eglGetCurrentDisplay(),
eglGetCurrentContext(),
{
EGLDisplay *egl_display = eglGetCurrentDisplay();
EGLContext *egl_context = eglGetCurrentContext();

if (egl_display != EGL_NO_DISPLAY &&
eglQueryContext(egl_display,
egl_context,
EGL_CONTEXT_CLIENT_VERSION,
&version)) {
if (version >= 2)
Expand All @@ -840,6 +854,7 @@ epoxy_get_bootstrap_proc_address(const char *name)
return epoxy_gles1_dlsym(name);
}
}
}
}
#endif /* PLATFORM_HAS_EGL */

Expand Down
Loading