[Feat] (Core): Add env config loader and refactor initialization entrypoints.

This commit is contained in:
BZLZHH
2026-02-21 22:08:55 +08:00
parent 7ccf858181
commit 9e90d9508b
10 changed files with 110 additions and 34 deletions
+11 -10
View File
@@ -8,28 +8,29 @@
#include "Init.h"
#include "Config.h"
#include <MG_Impl/Init.h>
#include <MG_Backend/BackendObjects.h>
#include <MG_State/GLState/Core.h>
#include <MG_Impl/GLImpl/Texture/ProxyTexture.h>
#include <MG_Impl/GLImpl/Framebuffer/GL_Framebuffer.h>
namespace MobileGL {
void MG_Initialize() {
void Initialize() {
MG_Util::Debug::InitFile();
MGLOG_I("Initializing MobileGL...");
MG_ConfigLoader::Init();
MGLOG_I("Config loaded");
MG_State::Init();
MGLOG_D("MobileGL State initialized");
MGLOG_D("MG_State initialized");
MG_Backend::Init();
MGLOG_D("MobileGL Backend initialized");
MGLOG_D("MG_Backend initialized");
MG_Impl::Init();
MGLOG_D("MobileGL Implementation initialized");
MGLOG_D("MG_Impl initialized");
glslang::InitializeProcess();
MGLOG_D("glslang initialized");
MGLOG_I("MobileGL initialized");
}
void MG_Destroy() {
void Destroy() {
MGLOG_I("MobileGL closing...");
glslang::FinalizeProcess();
delete MG_State::pGLContext;
@@ -42,11 +43,11 @@ namespace MobileGL {
#if defined(__linux__) || defined(__APPLE__)
__attribute__((constructor)) static void AutoInit() {
MG_Initialize();
Initialize();
}
__attribute__((destructor)) static void AutoDestroy() {
MG_Destroy();
Destroy();
}
#endif
@@ -54,11 +55,11 @@ namespace MobileGL {
BOOL WINAPI DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
MG_Initialize();
Initialize();
break;
case DLL_PROCESS_DETACH:
MG_Destroy();
Destroy();
break;
}
return TRUE;