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.
This commit is contained in:
sfan5 2022-07-09 22:49:15 +02:00
parent 25ae156944
commit 074e81f78f
4 changed files with 4 additions and 30 deletions

@ -9,7 +9,6 @@
#include "irrString.h" #include "irrString.h"
#include "irrArray.h" #include "irrArray.h"
#include "os.h" #include "os.h"
#include <dlfcn.h>
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) #if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
#include <android/native_activity.h> #include <android/native_activity.h>
@ -21,7 +20,7 @@ namespace video
{ {
CEGLManager::CEGLManager() : IContextManager(), EglWindow(0), EglDisplay(EGL_NO_DISPLAY), 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 #ifdef _DEBUG
setDebugName("CEGLManager"); setDebugName("CEGLManager");
@ -110,9 +109,6 @@ void CEGLManager::terminate()
MajorVersion = 0; MajorVersion = 0;
MinorVersion = 0; MinorVersion = 0;
if (libHandle)
dlclose(libHandle);
} }
bool CEGLManager::generateSurface() bool CEGLManager::generateSurface()
@ -596,15 +592,7 @@ const SExposedVideoData& CEGLManager::getContext() const
void* CEGLManager::getProcAddress(const std::string &procName) void* CEGLManager::getProcAddress(const std::string &procName)
{ {
void* proc = NULL; return (void*)eglGetProcAddress(procName.c_str());
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;
} }
bool CEGLManager::swapBuffers() bool CEGLManager::swapBuffers()

@ -111,8 +111,6 @@ namespace video
EGLint MajorVersion; EGLint MajorVersion;
EGLint MinorVersion; EGLint MinorVersion;
void* libHandle;
}; };
} }
} }

@ -7,7 +7,6 @@
#ifdef _IRR_COMPILE_WITH_GLX_MANAGER_ #ifdef _IRR_COMPILE_WITH_GLX_MANAGER_
#include "os.h" #include "os.h"
#include <dlfcn.h>
#if defined(_IRR_OPENGL_USE_EXTPOINTER_) #if defined(_IRR_OPENGL_USE_EXTPOINTER_)
#define GL_GLEXT_LEGACY 1 #define GL_GLEXT_LEGACY 1
@ -29,7 +28,7 @@ namespace video
{ {
CGLXManager::CGLXManager(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata, int screennr) 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 #ifdef _DEBUG
setDebugName("CGLXManager"); setDebugName("CGLXManager");
@ -280,8 +279,6 @@ bool CGLXManager::initialize(const SIrrlichtCreationParameters& params, const SE
void CGLXManager::terminate() void CGLXManager::terminate()
{ {
if (libHandle)
dlclose(libHandle);
memset((void*)&CurrentContext, 0, sizeof(CurrentContext)); memset((void*)&CurrentContext, 0, sizeof(CurrentContext));
} }
@ -469,15 +466,7 @@ void CGLXManager::destroyContext()
void* CGLXManager::getProcAddress(const std::string &procName) void* CGLXManager::getProcAddress(const std::string &procName)
{ {
void* proc = NULL; return (void*)glXGetProcAddressARB(reinterpret_cast<const GLubyte*>(procName.c_str()));
proc = (void*)glXGetProcAddressARB(reinterpret_cast<const GLubyte*>(procName.c_str()));
if (!proc) {
if (!libHandle)
libHandle = dlopen("libGL.so", RTLD_LAZY);
if (libHandle)
proc = dlsym(libHandle, procName.c_str());
}
return proc;
} }
bool CGLXManager::swapBuffers() bool CGLXManager::swapBuffers()

@ -72,7 +72,6 @@ namespace video
XVisualInfo* VisualInfo; XVisualInfo* VisualInfo;
void* glxFBConfig; // GLXFBConfig void* glxFBConfig; // GLXFBConfig
XID GlxWin; // GLXWindow XID GlxWin; // GLXWindow
void* libHandle; // handle to libGL.so
}; };
} }
} }