From 074e81f78f4daa1c1da739a7ae0b0ef507ec06ee Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 9 Jul 2022 22:49:15 +0200 Subject: [PATCH] Stop dlopening libGL(ESv2).so GLX/EGL are supposed to abstract exactly this away, this is a bad hack at best and might totally break stuff at worst. --- source/Irrlicht/CEGLManager.cpp | 16 ++-------------- source/Irrlicht/CEGLManager.h | 2 -- source/Irrlicht/CGLXManager.cpp | 15 ++------------- source/Irrlicht/CGLXManager.h | 1 - 4 files changed, 4 insertions(+), 30 deletions(-) diff --git a/source/Irrlicht/CEGLManager.cpp b/source/Irrlicht/CEGLManager.cpp index dc854c03..abf2a1dc 100755 --- a/source/Irrlicht/CEGLManager.cpp +++ b/source/Irrlicht/CEGLManager.cpp @@ -9,7 +9,6 @@ #include "irrString.h" #include "irrArray.h" #include "os.h" -#include #if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) #include @@ -21,7 +20,7 @@ namespace video { CEGLManager::CEGLManager() : IContextManager(), EglWindow(0), EglDisplay(EGL_NO_DISPLAY), - EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), MajorVersion(0), MinorVersion(0), libHandle(NULL) + EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), MajorVersion(0), MinorVersion(0) { #ifdef _DEBUG setDebugName("CEGLManager"); @@ -110,9 +109,6 @@ void CEGLManager::terminate() MajorVersion = 0; MinorVersion = 0; - - if (libHandle) - dlclose(libHandle); } bool CEGLManager::generateSurface() @@ -596,15 +592,7 @@ const SExposedVideoData& CEGLManager::getContext() const void* CEGLManager::getProcAddress(const std::string &procName) { - void* proc = NULL; - proc = (void*)eglGetProcAddress(procName.c_str()); - if (!proc) { // fallback - if (!libHandle) - libHandle = dlopen("libGLESv2.so", RTLD_LAZY); - if (libHandle) - proc = dlsym(libHandle, procName.c_str()); - } - return proc; + return (void*)eglGetProcAddress(procName.c_str()); } bool CEGLManager::swapBuffers() diff --git a/source/Irrlicht/CEGLManager.h b/source/Irrlicht/CEGLManager.h index 06954f02..d256e63d 100755 --- a/source/Irrlicht/CEGLManager.h +++ b/source/Irrlicht/CEGLManager.h @@ -111,8 +111,6 @@ namespace video EGLint MajorVersion; EGLint MinorVersion; - - void* libHandle; }; } } diff --git a/source/Irrlicht/CGLXManager.cpp b/source/Irrlicht/CGLXManager.cpp index 8b6c66fb..9a66420e 100644 --- a/source/Irrlicht/CGLXManager.cpp +++ b/source/Irrlicht/CGLXManager.cpp @@ -7,7 +7,6 @@ #ifdef _IRR_COMPILE_WITH_GLX_MANAGER_ #include "os.h" -#include #if defined(_IRR_OPENGL_USE_EXTPOINTER_) #define GL_GLEXT_LEGACY 1 @@ -29,7 +28,7 @@ namespace video { CGLXManager::CGLXManager(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata, int screennr) - : Params(params), PrimaryContext(videodata), VisualInfo(0), glxFBConfig(0), GlxWin(0), libHandle(NULL) + : Params(params), PrimaryContext(videodata), VisualInfo(0), glxFBConfig(0), GlxWin(0) { #ifdef _DEBUG setDebugName("CGLXManager"); @@ -280,8 +279,6 @@ bool CGLXManager::initialize(const SIrrlichtCreationParameters& params, const SE void CGLXManager::terminate() { - if (libHandle) - dlclose(libHandle); memset((void*)&CurrentContext, 0, sizeof(CurrentContext)); } @@ -469,15 +466,7 @@ void CGLXManager::destroyContext() void* CGLXManager::getProcAddress(const std::string &procName) { - void* proc = NULL; - proc = (void*)glXGetProcAddressARB(reinterpret_cast(procName.c_str())); - if (!proc) { - if (!libHandle) - libHandle = dlopen("libGL.so", RTLD_LAZY); - if (libHandle) - proc = dlsym(libHandle, procName.c_str()); - } - return proc; + return (void*)glXGetProcAddressARB(reinterpret_cast(procName.c_str())); } bool CGLXManager::swapBuffers() diff --git a/source/Irrlicht/CGLXManager.h b/source/Irrlicht/CGLXManager.h index d3cb9ad5..28d394e8 100644 --- a/source/Irrlicht/CGLXManager.h +++ b/source/Irrlicht/CGLXManager.h @@ -72,7 +72,6 @@ namespace video XVisualInfo* VisualInfo; void* glxFBConfig; // GLXFBConfig XID GlxWin; // GLXWindow - void* libHandle; // handle to libGL.so }; } }