1 From d010922282580a32dfebcda12ee1c307b3ef6005 Mon Sep 17 00:00:00 2001
2 From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
3 Date: Mon, 18 Jan 2016 09:49:55 -0800
4 Subject: [PATCH 4/4] darwin: Use GLX instead of OpenGL.framework if it is the
7 Also makes a stab at similar support for Win32
11 Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
12 Fetched from pull #81 on github for libepoxy:
13 https://github.com/anholt/libepoxy/pull/81/commits
14 Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
16 src/dispatch_common.c | 29 ++++++++++++++++-------------
17 1 file changed, 16 insertions(+), 13 deletions(-)
19 diff --git a/src/dispatch_common.c b/src/dispatch_common.c
20 index 163d348..cb9f76a 100644
21 --- a/src/dispatch_common.c
22 +++ b/src/dispatch_common.c
23 @@ -482,16 +482,20 @@ epoxy_glx_dlsym(const char *name)
25 epoxy_gl_dlsym(const char *name)
28 +#if defined(_WIN32) || defined(__APPLE__)
29 +if (!epoxy_current_context_is_glx()) {
31 return do_dlsym(&api.gl_handle, "OPENGL32", name, true);
32 -#elif defined(__APPLE__)
33 +# elif defined(__APPLE__)
34 return do_dlsym(&api.gl_handle,
35 "/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL",
42 /* There's no library for desktop GL support independent of GLX. */
43 return epoxy_glx_dlsym(name);
48 @@ -615,7 +619,7 @@ epoxy_get_bootstrap_proc_address(const char *name)
51 if (api.glx_handle && glXGetCurrentContext())
52 - return epoxy_gl_dlsym(name);
53 + return epoxy_glx_dlsym(name);
56 /* If epoxy hasn't loaded any API-specific library yet, try to
57 @@ -644,22 +648,17 @@ epoxy_get_bootstrap_proc_address(const char *name)
59 #endif /* PLATFORM_HAS_EGL */
61 - /* Fall back to GLX */
62 + /* Fall back to the platform default */
63 return epoxy_gl_dlsym(name);
67 epoxy_get_proc_address(const char *name)
70 - return wglGetProcAddress(name);
71 -#elif defined(__APPLE__)
72 - return epoxy_gl_dlsym(name);
75 if (epoxy_current_context_is_glx()) {
76 return glXGetProcAddressARB((const GLubyte *)name);
79 #endif /* PLATFORM_HAS_GLX */
82 @@ -674,8 +673,12 @@ epoxy_get_proc_address(const char *name)
85 #endif /* PLATFORM_HAS_EGL */
87 + return wglGetProcAddress(name);
88 +#elif defined(__APPLE__)
89 + return epoxy_gl_dlsym(name);
91 errx(1, "Couldn't find current GLX or EGL context.\n");
92 -#endif /* _WIN32 | __APPLE__*/
95 WRAPPER_VISIBILITY (void)