From 2060de5ed09524299b1a4f45453cd59a876432ae Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Wed, 20 Jul 2016 13:11:08 +0200 Subject: [PATCH] Match presence of lib prefix on EGL/GLES binaries --- src/egl_context.c | 7 +++++++ src/egl_context.h | 1 + 2 files changed, 8 insertions(+) diff --git a/src/egl_context.c b/src/egl_context.c index 7583fac9..cda73dce 100644 --- a/src/egl_context.c +++ b/src/egl_context.c @@ -309,6 +309,8 @@ GLFWbool _glfwInitEGL(void) if (!_glfw.egl.handle) return GLFW_FALSE; + _glfw.egl.prefix = (strncmp(sonames[i], "lib", 3) == 0); + _glfw.egl.GetConfigAttrib = (PFNEGLGETCONFIGATTRIBPROC) _glfw_dlsym(_glfw.egl.handle, "eglGetConfigAttrib"); _glfw.egl.GetConfigs = (PFNEGLGETCONFIGSPROC) @@ -627,6 +629,11 @@ GLFWbool _glfwCreateContextEGL(_GLFWwindow* window, for (i = 0; sonames[i]; i++) { + // HACK: Match presence of lib prefix to increase chance of finding + // a matching pair in the jungle that is Win32 EGL/GLES + if (_glfw.egl.prefix != (strncmp(sonames[i], "lib", 3) == 0)) + continue; + window->context.egl.client = _glfw_dlopen(sonames[i]); if (window->context.egl.client) break; diff --git a/src/egl_context.h b/src/egl_context.h index b0cb09d5..9bd8bb40 100644 --- a/src/egl_context.h +++ b/src/egl_context.h @@ -171,6 +171,7 @@ typedef struct _GLFWlibraryEGL { EGLDisplay display; EGLint major, minor; + GLFWbool prefix; GLFWbool KHR_create_context; GLFWbool KHR_create_context_no_error;