From eeb045c59f866e8dac5daaf491b4ed91d1615b82 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Tue, 16 Mar 2021 14:10:35 +0100 Subject: [PATCH] internal/gl: use dlsym(3) to load ES 3 symbols There was a special case for optional symbols for macOS/iOS. It turns out dlsym(3) works as expected, so this change deletes the special case. The change is required to make Gio work with ANGLE, which emulates OpenGL ES on top of Metal. Signed-off-by: Elias Naur --- internal/gl/gl_unix.go | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/internal/gl/gl_unix.go b/internal/gl/gl_unix.go index ab33e90e..c76b2af2 100644 --- a/internal/gl/gl_unix.go +++ b/internal/gl/gl_unix.go @@ -25,6 +25,8 @@ import ( #cgo darwin,ios LDFLAGS: -framework OpenGLES #include +#define __USE_GNU +#include #ifdef __APPLE__ #include "TargetConditionals.h" @@ -34,8 +36,6 @@ import ( #include #endif #else -#define __USE_GNU -#include #include #include #endif @@ -144,23 +144,9 @@ __attribute__ ((visibility ("hidden"))) void gio_glBlitFramebuffer(GLint srcX0, } __attribute__((constructor)) static void gio_loadGLFunctions() { -#ifdef __APPLE__ - #if TARGET_OS_IPHONE - _glInvalidateFramebuffer = glInvalidateFramebuffer; - _glBeginQuery = glBeginQuery; - _glDeleteQueries = glDeleteQueries; - _glEndQuery = glEndQuery; - _glGenQueries = glGenQueries; - _glGetQueryObjectuiv = glGetQueryObjectuiv; - _glTexStorage2D = glTexStorage2D; - #endif - _glBindBufferBase = glBindBufferBase; - _glGetUniformBlockIndex = glGetUniformBlockIndex; - _glUniformBlockBinding = glUniformBlockBinding; - _glGetStringi = glGetStringi; -#else // Load libGLESv3 if available. dlopen("libGLESv3.so", RTLD_NOW | RTLD_GLOBAL); + _glBindBufferBase = dlsym(RTLD_DEFAULT, "glBindBufferBase"); _glGetUniformBlockIndex = dlsym(RTLD_DEFAULT, "glGetUniformBlockIndex"); _glUniformBlockBinding = dlsym(RTLD_DEFAULT, "glUniformBlockBinding"); @@ -194,7 +180,6 @@ __attribute__((constructor)) static void gio_loadGLFunctions() { _glBindImageTexture = dlsym(RTLD_DEFAULT, "glBindImageTexture"); _glTexStorage2D = dlsym(RTLD_DEFAULT, "glTexStorage2D"); _glBlitFramebuffer = dlsym(RTLD_DEFAULT, "glBlitFramebuffer"); -#endif } */ import "C"