egl: Make GLESv1 and v2 shared objects optional

This commit is contained in:
Cameron Cawley
2026-02-02 20:26:43 +00:00
committed by Sam Lantinga
parent 8c0ac97b0d
commit 12f97dbc97

View File

@@ -66,11 +66,13 @@
#ifdef SDL_VIDEO_DRIVER_RPI #ifdef SDL_VIDEO_DRIVER_RPI
// Raspbian places the OpenGL ES/EGL binaries in a non standard path // Raspbian places the OpenGL ES/EGL binaries in a non standard path
#define DEFAULT_EGL (vc4 ? "libEGL.so.1" : "libbrcmEGL.so") #define DEFAULT_EGL (vc4 ? "libEGL.so.1" : "libbrcmEGL.so")
#define DEFAULT_OGL_ES2 (vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so")
#define ALT_EGL "libEGL.so" #define ALT_EGL "libEGL.so"
#define DEFAULT_OGL_ES2 (vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so")
#define ALT_OGL_ES2 "libGLESv2.so" #define ALT_OGL_ES2 "libGLESv2.so"
// The GLESv2 library also contains GLESv1 exports when using the dispmanx implementation
#define DEFAULT_OGL_ES_PVR (vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so") #define DEFAULT_OGL_ES_PVR (vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so")
#define DEFAULT_OGL_ES (vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so") #define DEFAULT_OGL_ES (vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so")
#define ALT_OGL_ES "libGLESv2.so"
#elif defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_VIVANTE) #elif defined(SDL_VIDEO_DRIVER_ANDROID) || defined(SDL_VIDEO_DRIVER_VIVANTE)
// Android // Android
@@ -106,8 +108,6 @@
// QNX // QNX
#define DEFAULT_EGL "libEGL.so.1" #define DEFAULT_EGL "libEGL.so.1"
#define DEFAULT_OGL_ES2 "libGLESv2.so.1" #define DEFAULT_OGL_ES2 "libGLESv2.so.1"
#define DEFAULT_OGL_ES_PVR "libGLESv2.so.1"
#define DEFAULT_OGL_ES "libGLESv2.so.1"
#else #else
// Desktop Linux/Unix-like // Desktop Linux/Unix-like
@@ -388,34 +388,45 @@ static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_
if (!opengl_dll_handle) { if (!opengl_dll_handle) {
if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) {
if (_this->gl_config.major_version > 1) { if (_this->gl_config.major_version > 1) {
path = DEFAULT_OGL_ES2; #ifdef DEFAULT_OGL_ES2
opengl_dll_handle = SDL_LoadObject(path); if (!opengl_dll_handle) {
path = DEFAULT_OGL_ES2;
opengl_dll_handle = SDL_LoadObject(path);
}
#endif
#ifdef ALT_OGL_ES2 #ifdef ALT_OGL_ES2
if (!opengl_dll_handle && !vc4) { if (!opengl_dll_handle && !vc4) {
path = ALT_OGL_ES2; path = ALT_OGL_ES2;
opengl_dll_handle = SDL_LoadObject(path); opengl_dll_handle = SDL_LoadObject(path);
} }
#endif #endif
} else { } else {
path = DEFAULT_OGL_ES; #ifdef DEFAULT_OGL_ES
opengl_dll_handle = SDL_LoadObject(path); if (!opengl_dll_handle) {
path = DEFAULT_OGL_ES;
opengl_dll_handle = SDL_LoadObject(path);
}
#endif
#ifdef DEFAULT_OGL_ES_PVR
if (!opengl_dll_handle) { if (!opengl_dll_handle) {
path = DEFAULT_OGL_ES_PVR; path = DEFAULT_OGL_ES_PVR;
opengl_dll_handle = SDL_LoadObject(path); opengl_dll_handle = SDL_LoadObject(path);
} }
#ifdef ALT_OGL_ES2 #endif
#ifdef ALT_OGL_ES
if (!opengl_dll_handle && !vc4) { if (!opengl_dll_handle && !vc4) {
path = ALT_OGL_ES2; path = ALT_OGL_ES;
opengl_dll_handle = SDL_LoadObject(path); opengl_dll_handle = SDL_LoadObject(path);
} }
#endif #endif
} }
} } else {
#ifdef DEFAULT_OGL #ifdef DEFAULT_OGL
else { if (!opengl_dll_handle) {
path = DEFAULT_OGL; path = DEFAULT_OGL;
opengl_dll_handle = SDL_LoadObject(path); opengl_dll_handle = SDL_LoadObject(path);
}
#endif
#ifdef ALT_OGL #ifdef ALT_OGL
if (!opengl_dll_handle) { if (!opengl_dll_handle) {
path = ALT_OGL; path = ALT_OGL;
@@ -423,7 +434,6 @@ static bool SDL_EGL_LoadLibraryInternal(SDL_VideoDevice *_this, const char *egl_
} }
#endif #endif
} }
#endif
} }
_this->egl_data->opengl_dll_handle = opengl_dll_handle; _this->egl_data->opengl_dll_handle = opengl_dll_handle;