mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +09:00
[Fix] (MG_Backend/DirectGLES, MG_Util/BackendLoader): stop treating partial EGL/GLES symbol load as fatal
This commit is contained in:
@@ -34,18 +34,11 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
||||
}
|
||||
|
||||
void BackendObject_DirectGLES::Initialize() {
|
||||
if (!MG_Util::BackendLoader::AcquireEGLFunctions(m_EGLFunctions)) {
|
||||
MGLOG_E("Failed to acquire EGL functions for DirectGLES backend");
|
||||
return;
|
||||
}
|
||||
if (!MG_Util::BackendLoader::AcquireGLESFunctions(m_GLESFunctions, m_EGLFunctions.eglGetProcAddress)) {
|
||||
MGLOG_E("Failed to acquire GLES functions for DirectGLES backend");
|
||||
return;
|
||||
}
|
||||
m_initialized = true;
|
||||
|
||||
MG_Util::BackendLoader::AcquireEGLFunctions(m_EGLFunctions);
|
||||
MG_Util::BackendLoader::AcquireGLESFunctions(m_GLESFunctions, m_EGLFunctions.eglGetProcAddress);
|
||||
DirectGLES::SetEGLFuncsTable(m_EGLFunctions);
|
||||
DirectGLES::SetGLESFuncsTable(m_GLESFunctions);
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
Bool BackendObject_DirectGLES::InitCapabilities() {
|
||||
|
||||
@@ -41,21 +41,18 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
#endif
|
||||
}
|
||||
|
||||
Bool AcquireGLESFunctions(MG_External::GLESFunctionsTable& funcs,
|
||||
void AcquireGLESFunctions(MG_External::GLESFunctionsTable& funcs,
|
||||
MG_External::EGL::eglGetProcAddress_PTR procAddress) {
|
||||
if (!procAddress) {
|
||||
MGLOG_E("eglGetProcAddress is nullptr, cannot load GLES functions");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
Bool allRequiredLoaded = true;
|
||||
|
||||
#define INIT_GLES_FUNC(name) \
|
||||
do { \
|
||||
funcs.name = (MG_External::GLES::name##_PTR)procAddress(#name); \
|
||||
if (!funcs.name) { \
|
||||
MGLOG_E("Failed to load GLES function: %s", #name); \
|
||||
allRequiredLoaded = false; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
@@ -433,25 +430,21 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
INIT_GLES_FUNC(glMultiDrawElementsIndirectEXT)
|
||||
INIT_GLES_FUNC(glMultiDrawElementsBaseVertexEXT)
|
||||
}
|
||||
return allRequiredLoaded;
|
||||
}
|
||||
|
||||
Bool AcquireEGLFunctions(MG_External::EGLFunctionsTable& funcs) {
|
||||
void AcquireEGLFunctions(MG_External::EGLFunctionsTable& funcs) {
|
||||
static const Vector<String> EGLLibNames = {"libEGL.so"};
|
||||
void* eglLib = OpenLib(EGLLibNames);
|
||||
if (!eglLib) {
|
||||
MGLOG_E("Failed to open libEGL.so");
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
Bool allRequiredLoaded = true;
|
||||
|
||||
#define INIT_EGL_FUNC(name) \
|
||||
do { \
|
||||
funcs.name = (MG_External::EGL::name##_PTR)ProcAddress(eglLib, #name); \
|
||||
if (!funcs.name) { \
|
||||
MGLOG_E("Failed to load EGL function: %s", #name); \
|
||||
allRequiredLoaded = false; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
@@ -504,7 +497,6 @@ namespace MobileGL::MG_Util::BackendLoader {
|
||||
INIT_EGL_FUNC(eglGetPlatformDisplay)
|
||||
INIT_EGL_FUNC(eglWaitSync)
|
||||
}
|
||||
return allRequiredLoaded;
|
||||
}
|
||||
|
||||
Bool FillInGLESCapabilities(MG_External::GLESCapabilities& caps, const MG_External::GLESFunctionsTable& glesFuncs) {
|
||||
|
||||
@@ -1070,9 +1070,9 @@ namespace MobileGL {
|
||||
} // namespace MG_External
|
||||
|
||||
namespace MG_Util::BackendLoader {
|
||||
Bool AcquireGLESFunctions(MG_External::GLESFunctionsTable& funcs,
|
||||
void AcquireGLESFunctions(MG_External::GLESFunctionsTable& funcs,
|
||||
MG_External::EGL::eglGetProcAddress_PTR procAddress);
|
||||
Bool AcquireEGLFunctions(MG_External::EGLFunctionsTable& funcs);
|
||||
void AcquireEGLFunctions(MG_External::EGLFunctionsTable& funcs);
|
||||
Bool FillInGLESCapabilities(MG_External::GLESCapabilities& caps,
|
||||
const MG_External::GLESFunctionsTable& glesFuncs);
|
||||
} // namespace MG_Util::BackendLoader
|
||||
|
||||
Reference in New Issue
Block a user