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