mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
[Fix] (MG_Util): Skip GLES initializing if the libs do not exist.
This commit is contained in:
@@ -19,7 +19,6 @@ namespace MobileGL {
|
|||||||
MGLOG_I("Initializing MobileGL...");
|
MGLOG_I("Initializing MobileGL...");
|
||||||
MG_State::Init();
|
MG_State::Init();
|
||||||
MGLOG_D("MobileGL State initialized");
|
MGLOG_D("MobileGL State initialized");
|
||||||
// return;
|
|
||||||
MG_Backend::Init();
|
MG_Backend::Init();
|
||||||
MGLOG_D("MobileGL Backend initialized");
|
MGLOG_D("MobileGL Backend initialized");
|
||||||
MG_Impl::Init();
|
MG_Impl::Init();
|
||||||
|
|||||||
@@ -40,16 +40,19 @@ namespace MobileGL {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSpecificBackendLibs() {
|
Bool InitSpecificBackendLibs() {
|
||||||
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_DILIGENT
|
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_DILIGENT
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
MGLOG_D("Diligent Engine backend loaded");
|
MGLOG_D("Diligent Engine backend loaded");
|
||||||
|
return true;
|
||||||
#elif MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
|
#elif MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
|
||||||
MG_Util::BackendLoader::GLES::Init();
|
Bool result = MG_Util::BackendLoader::GLES::Init();
|
||||||
MGLOG_D("DirectGLES backend loaded, GLES version: %d.%d", MG_External::GLES::g_glesCaps.version.Major,
|
MGLOG_D("DirectGLES backend loaded, GLES version: %d.%d", MG_External::GLES::g_glesCaps.version.Major,
|
||||||
MG_External::GLES::g_glesCaps.version.Minor);
|
MG_External::GLES::g_glesCaps.version.Minor);
|
||||||
|
return result;
|
||||||
#else
|
#else
|
||||||
MGLOG_W("Unknown backend, skipping backend initialization");
|
MGLOG_W("Unknown backend, skipping backend initialization");
|
||||||
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +76,11 @@ namespace MobileGL {
|
|||||||
MG_Config::RendererInfoPtr = MakeUnique<RendererInfo>(Unknown::RendererInfoUnknown);
|
MG_Config::RendererInfoPtr = MakeUnique<RendererInfo>(Unknown::RendererInfoUnknown);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InitSpecificBackendLibs();
|
Bool result = InitSpecificBackendLibs();
|
||||||
|
if (!result) {
|
||||||
|
MGLOG_W("Failed to initialize MobileGL backend libraries");
|
||||||
|
return;
|
||||||
|
}
|
||||||
LogBackendInfo();
|
LogBackendInfo();
|
||||||
}
|
}
|
||||||
} // namespace MG_Backend
|
} // namespace MG_Backend
|
||||||
|
|||||||
@@ -433,11 +433,16 @@ namespace MobileGL {
|
|||||||
|
|
||||||
namespace MG_Util {
|
namespace MG_Util {
|
||||||
namespace BackendLoader::GLES {
|
namespace BackendLoader::GLES {
|
||||||
void Init() {
|
Bool Init() {
|
||||||
LoadLibs();
|
LoadLibs();
|
||||||
|
if (libGLES == nullptr || libEGL == nullptr ||
|
||||||
|
(glGetError_PTR)ProcAddress(libGLES, "glGetError") == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
InitEGL();
|
InitEGL();
|
||||||
InitGLES();
|
InitGLES();
|
||||||
DestroyTempEGLCtx();
|
DestroyTempEGLCtx();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *libGLES = nullptr, *libEGL = nullptr;
|
void *libGLES = nullptr, *libEGL = nullptr;
|
||||||
|
|||||||
@@ -940,7 +940,7 @@ namespace MobileGL {
|
|||||||
namespace MG_Util {
|
namespace MG_Util {
|
||||||
namespace BackendLoader {
|
namespace BackendLoader {
|
||||||
namespace GLES {
|
namespace GLES {
|
||||||
void Init();
|
Bool Init();
|
||||||
extern void *libGLES, *libEGL;
|
extern void *libGLES, *libEGL;
|
||||||
|
|
||||||
void* ProcAddress(void* lib, const char* name);
|
void* ProcAddress(void* lib, const char* name);
|
||||||
|
|||||||
Reference in New Issue
Block a user