mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 13:48:30 +09:00
[Refactor] (...): Optimize code file structure.
This commit is contained in:
+23
-24
@@ -25,25 +25,35 @@ find_library(GLSLANG_LIB glslang PATHS ${CMAKE_SOURCE_DIR}/libraries/arm64-v8a/)
|
|||||||
add_library(${CMAKE_PROJECT_NAME} SHARED
|
add_library(${CMAKE_PROJECT_NAME} SHARED
|
||||||
MG/Init.cpp
|
MG/Init.cpp
|
||||||
|
|
||||||
# MG_GL/GL
|
# MG_GL/Implementations/GL
|
||||||
MG/MG_GL/GL/Getter/GL_Getter.cpp
|
MG/MG_GL/Implementations/GL/GLFuncsDefinitions/GLFuncsDefinitions.cpp
|
||||||
MG/MG_GL/GL/Getter/BackendInfo.cpp
|
|
||||||
|
|
||||||
MG/MG_GL/GL/Framebuffer/GL_Framebuffer.cpp
|
MG/MG_GL/Implementations/GL/Getter/GL_Getter.cpp
|
||||||
|
MG/MG_GL/Implementations/GL/Getter/BackendInfo.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/Common/GL_Common.cpp
|
MG/MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/Buffer/GL_Buffer.cpp
|
MG/MG_GL/Implementations/GL/Common/GL_Common.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/Drawing/GL_Drawing.cpp
|
MG/MG_GL/Implementations/GL/Buffer/GL_Buffer.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/Program/GL_Program.cpp
|
MG/MG_GL/Implementations/GL/Drawing/GL_Drawing.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/Shader/GL_Shader.cpp
|
MG/MG_GL/Implementations/GL/Program/GL_Program.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/Texture/GL_Texture.cpp
|
MG/MG_GL/Implementations/GL/Shader/GL_Shader.cpp
|
||||||
|
|
||||||
MG/MG_GL/GL/VertexArray/GL_VertexArray.cpp
|
MG/MG_GL/Implementations/GL/Texture/GL_Texture.cpp
|
||||||
|
|
||||||
|
MG/MG_GL/Implementations/GL/VertexArray/GL_VertexArray.cpp
|
||||||
|
|
||||||
|
# MG_GL/Implementations/GLX
|
||||||
|
MG/MG_GL/Implementations/GLX/LookUp/LookUp.cpp
|
||||||
|
|
||||||
|
# MG_GL/Implementations/EGL
|
||||||
|
MG/MG_GL/Implementations/EGL/VK/EGL_EMU.cpp
|
||||||
|
|
||||||
|
MG/MG_GL/Implementations/EGL/GLES/EGL_WRAP.cpp
|
||||||
|
|
||||||
# MG_GL/State
|
# MG_GL/State
|
||||||
MG/MG_GL/State/Core/GLState.cpp
|
MG/MG_GL/State/Core/GLState.cpp
|
||||||
@@ -52,23 +62,12 @@ add_library(${CMAKE_PROJECT_NAME} SHARED
|
|||||||
|
|
||||||
MG/MG_GL/State/Texture/TextureState.cpp
|
MG/MG_GL/State/Texture/TextureState.cpp
|
||||||
|
|
||||||
# MG_GL/GLX
|
# MG_GL/BackendLoader
|
||||||
MG/MG_GL/GLX/LookUp/LookUp.cpp
|
MG/MG_GL/BackendLoader/GLES/Loader.cpp
|
||||||
|
|
||||||
# MG_GL/GL_Def
|
|
||||||
MG/MG_GL/GL_Def/GL_Def.cpp
|
|
||||||
|
|
||||||
# MG_UTIL/Debug
|
# MG_UTIL/Debug
|
||||||
MG/MG_UTIL/Debug/Debug.cpp
|
MG/MG_UTIL/Debug/Debug.cpp
|
||||||
|
|
||||||
# MG_GL/EGL
|
|
||||||
MG/MG_GL/EGL/VK/EGL_EMU.cpp
|
|
||||||
|
|
||||||
MG/MG_GL/EGL/GLES/EGL_WRAP.cpp
|
|
||||||
|
|
||||||
# MG_GL/BackendLoader
|
|
||||||
MG/MG_GL/BackendLoader/GLES/Loader.cpp
|
|
||||||
|
|
||||||
# MG_RHI/GLES
|
# MG_RHI/GLES
|
||||||
MG/MG_RHI/GLES/Test/TestDrawing.cpp
|
MG/MG_RHI/GLES/Test/TestDrawing.cpp
|
||||||
)
|
)
|
||||||
|
|||||||
+1
-1
@@ -27,7 +27,7 @@ namespace MG_Global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Common {
|
namespace Common {
|
||||||
inline const int LogLevel = MG_Constants::Common::LOG_LEVEL_DEBUG;
|
inline const int LogLevel = MG_Constants::Common::LOG_LEVEL_INFO;
|
||||||
|
|
||||||
#ifdef __ANDROID__
|
#ifdef __ANDROID__
|
||||||
inline const char* LOG_FILE_PATH = "/sdcard/MG/latest.log";
|
inline const char* LOG_FILE_PATH = "/sdcard/MG/latest.log";
|
||||||
|
|||||||
+14
-14
@@ -9,31 +9,31 @@
|
|||||||
#include "MG_GL/BackendLoader/GLES/Loader.h"
|
#include "MG_GL/BackendLoader/GLES/Loader.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_FRAMEBUFFER_H
|
#ifndef MOBILEGL_GL_FRAMEBUFFER_H
|
||||||
#include "MG_GL/GL/Framebuffer/GL_Framebuffer.h"
|
#include "MG_GL/Implementations/GL/Framebuffer/GL_Framebuffer.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_GETTER_H
|
#ifndef MOBILEGL_GL_GETTER_H
|
||||||
#include "MG_GL/GL/Getter/GL_Getter.h"
|
#include "MG_GL/Implementations/GL/Getter/GL_Getter.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_BACKENDINFO_H
|
#ifndef MOBILEGL_BACKENDINFO_H
|
||||||
#include "MG_GL/GL/Getter/BackendInfo.h"
|
#include "MG_GL/Implementations/GL/Getter/BackendInfo.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_BUFFER_H
|
#ifndef MOBILEGL_GL_BUFFER_H
|
||||||
#include "MG_GL/GL/Buffer/GL_Buffer.h"
|
#include "MG_GL/Implementations/GL/Buffer/GL_Buffer.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_DRAWING_H
|
#ifndef MOBILEGL_GL_DRAWING_H
|
||||||
#include "MG_GL/GL/Drawing/GL_Drawing.h"
|
#include "MG_GL/Implementations/GL/Drawing/GL_Drawing.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_PROGRAM_H
|
#ifndef MOBILEGL_GL_PROGRAM_H
|
||||||
#include "MG_GL/GL/Program/GL_Program.h"
|
#include "MG_GL/Implementations/GL/Program/GL_Program.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_SHADER_H
|
#ifndef MOBILEGL_GL_SHADER_H
|
||||||
#include "MG_GL/GL/Shader/GL_Shader.h"
|
#include "MG_GL/Implementations/GL/Shader/GL_Shader.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_TEXTURE_H
|
#ifndef MOBILEGL_GL_TEXTURE_H
|
||||||
#include "MG_GL/GL/Texture/GL_Texture.h"
|
#include "MG_GL/Implementations/GL/Texture/GL_Texture.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_VERTEXARRAY_H
|
#ifndef MOBILEGL_GL_VERTEXARRAY_H
|
||||||
#include "MG_GL/GL/VertexArray/GL_VertexArray.h"
|
#include "MG_GL/Implementations/GL/VertexArray/GL_VertexArray.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GLSTATE_H
|
#ifndef MOBILEGL_GLSTATE_H
|
||||||
#include "MG_GL/State/Core/GLState.h"
|
#include "MG_GL/State/Core/GLState.h"
|
||||||
@@ -45,19 +45,19 @@
|
|||||||
#include "MG_GL/State/Texture/TextureState.h"
|
#include "MG_GL/State/Texture/TextureState.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_LOOKUP_H
|
#ifndef MOBILEGL_LOOKUP_H
|
||||||
#include "MG_GL/GLX/LookUp/LookUp.h"
|
#include "MG_GL/Implementations/GLX/LookUp/LookUp.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_DEBUG_H
|
#ifndef MOBILEGL_DEBUG_H
|
||||||
#include "MG_UTIL/Debug/Debug.h"
|
#include "MG_UTIL/Debug/Debug.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_GL_DEPTH_H
|
#ifndef MOBILEGL_GL_COMMON_H
|
||||||
#include "MG_GL/GL/Common/GL_Common.h"
|
#include "MG_GL/Implementations/GL/Common/GL_Common.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_EGL_VK_EMU_H
|
#ifndef MOBILEGL_EGL_VK_EMU_H
|
||||||
#include "MG_GL/EGL/VK/EGL_EMU.h"
|
#include "MG_GL/Implementations/EGL/VK/EGL_EMU.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_EGL_GLES_EGL_WRAP_H
|
#ifndef MOBILEGL_EGL_GLES_EGL_WRAP_H
|
||||||
#include "MG_GL/EGL/GLES/EGL_WRAP.h"
|
#include "MG_GL/Implementations/EGL/GLES/EGL_WRAP.h"
|
||||||
#endif
|
#endif
|
||||||
#ifndef MOBILEGL_TESTDRAWING_H
|
#ifndef MOBILEGL_TESTDRAWING_H
|
||||||
#include "MG_RHI/GLES/Test/TestDrawing.h"
|
#include "MG_RHI/GLES/Test/TestDrawing.h"
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#if BACKEND_TYPE == BACKEND_GLES
|
#if BACKEND_TYPE == BACKEND_GLES
|
||||||
|
|
||||||
|
// TODO: Take this code file apart into multiple files.
|
||||||
|
|
||||||
#define GL_FUNC_DECL(name) \
|
#define GL_FUNC_DECL(name) \
|
||||||
name##_PTR name;
|
name##_PTR name;
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
//
|
|
||||||
// Created by BZLZHH on 2025/3/15.
|
|
||||||
//
|
|
||||||
|
|
||||||
#ifndef MOBILEGL_GL_DEF_H
|
|
||||||
#define MOBILEGL_GL_DEF_H
|
|
||||||
|
|
||||||
#include "../../Includes.h"
|
|
||||||
|
|
||||||
#endif //MOBILEGL_GL_DEF_H
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_EGL_GLES_EGL_WRAP_H
|
#ifndef MOBILEGL_EGL_GLES_EGL_WRAP_H
|
||||||
#define MOBILEGL_EGL_GLES_EGL_WRAP_H
|
#define MOBILEGL_EGL_GLES_EGL_WRAP_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
#if BACKEND_TYPE == BACKEND_GLES
|
#if BACKEND_TYPE == BACKEND_GLES
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_EGL_VK_EMU_H
|
#ifndef MOBILEGL_EGL_VK_EMU_H
|
||||||
#define MOBILEGL_EGL_VK_EMU_H
|
#define MOBILEGL_EGL_VK_EMU_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
#if BACKEND_TYPE == BACKEND_VULKAN
|
#if BACKEND_TYPE == BACKEND_VULKAN
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_BUFFER_H
|
#ifndef MOBILEGL_GL_BUFFER_H
|
||||||
#define MOBILEGL_GL_BUFFER_H
|
#define MOBILEGL_GL_BUFFER_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_COMMON_H
|
#ifndef MOBILEGL_GL_COMMON_H
|
||||||
#define MOBILEGL_GL_COMMON_H
|
#define MOBILEGL_GL_COMMON_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
void ClearDepth(::GLdouble depth);
|
void ClearDepth(::GLdouble depth);
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_DRAWING_H
|
#ifndef MOBILEGL_GL_DRAWING_H
|
||||||
#define MOBILEGL_GL_DRAWING_H
|
#define MOBILEGL_GL_DRAWING_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
void DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
|
void DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices);
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_FRAMEBUFFER_H
|
#ifndef MOBILEGL_GL_FRAMEBUFFER_H
|
||||||
#define MOBILEGL_GL_FRAMEBUFFER_H
|
#define MOBILEGL_GL_FRAMEBUFFER_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
GLenum CheckFramebufferStatus(GLenum target);
|
GLenum CheckFramebufferStatus(GLenum target);
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
// Created by BZLZHH on 2025/3/15.
|
// Created by BZLZHH on 2025/3/15.
|
||||||
//
|
//
|
||||||
|
|
||||||
#include "GL_Def.h"
|
#include "GLFuncsDefinitions.h"
|
||||||
|
|
||||||
#define DECLARE_GL_FUNCTION_STUB_HEAD(type,name,...) \
|
#define DECLARE_GL_FUNCTION_STUB_HEAD(type,name,...) \
|
||||||
MG_EXPORT type gl##name(__VA_ARGS__) {
|
MG_EXPORT type gl##name(__VA_ARGS__) {
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
//
|
||||||
|
// Created by BZLZHH on 2025/3/15.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef MOBILEGL_GL_FUNCS_DEFINITIONS_H
|
||||||
|
#define MOBILEGL_GL_FUNCS_DEFINITIONS_H
|
||||||
|
|
||||||
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
|
#endif //MOBILEGL_GL_FUNCS_DEFINITIONS_H
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_BACKENDINFO_H
|
#ifndef MOBILEGL_BACKENDINFO_H
|
||||||
#define MOBILEGL_BACKENDINFO_H
|
#define MOBILEGL_BACKENDINFO_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::Getter {
|
namespace MG_GL::Getter {
|
||||||
const std::string GetBackendName();
|
const std::string GetBackendName();
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_GETTER_H
|
#ifndef MOBILEGL_GL_GETTER_H
|
||||||
#define MOBILEGL_GL_GETTER_H
|
#define MOBILEGL_GL_GETTER_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
const ::GLubyte* GetString(GLenum name);
|
const ::GLubyte* GetString(GLenum name);
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_PROGRAM_H
|
#ifndef MOBILEGL_GL_PROGRAM_H
|
||||||
#define MOBILEGL_GL_PROGRAM_H
|
#define MOBILEGL_GL_PROGRAM_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
void GetProgramiv(GLuint program, GLenum pname, GLint *params);
|
void GetProgramiv(GLuint program, GLenum pname, GLint *params);
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_SHADER_H
|
#ifndef MOBILEGL_GL_SHADER_H
|
||||||
#define MOBILEGL_GL_SHADER_H
|
#define MOBILEGL_GL_SHADER_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
void GetShaderiv(GLuint shader, GLenum pname, GLint *params);
|
void GetShaderiv(GLuint shader, GLenum pname, GLint *params);
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_TEXTURE_H
|
#ifndef MOBILEGL_GL_TEXTURE_H
|
||||||
#define MOBILEGL_GL_TEXTURE_H
|
#define MOBILEGL_GL_TEXTURE_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
void ActiveTexture(GLenum texture);
|
void ActiveTexture(GLenum texture);
|
||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
#ifndef MOBILEGL_GL_VERTEXARRAY_H
|
#ifndef MOBILEGL_GL_VERTEXARRAY_H
|
||||||
#define MOBILEGL_GL_VERTEXARRAY_H
|
#define MOBILEGL_GL_VERTEXARRAY_H
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
namespace MG_GL::GL {
|
namespace MG_GL::GL {
|
||||||
|
|
||||||
@@ -4,9 +4,7 @@
|
|||||||
|
|
||||||
#include "LookUp.h"
|
#include "LookUp.h"
|
||||||
|
|
||||||
#include "../../../Includes.h"
|
#include "../../../../Includes.h"
|
||||||
|
|
||||||
#define DEBUG 0
|
|
||||||
|
|
||||||
namespace MG_GL::GLX {
|
namespace MG_GL::GLX {
|
||||||
void* GetProcAddress(const char *name) {
|
void* GetProcAddress(const char *name) {
|
||||||
@@ -37,6 +37,7 @@ namespace MG_RHI::GLES::Test {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Use the textures state from MG_RHI(another state?) rather than directly from MG_State
|
||||||
void DrawAllTextures() {
|
void DrawAllTextures() {
|
||||||
::GLES::glClearColor(1,1,1,1);
|
::GLES::glClearColor(1,1,1,1);
|
||||||
::GLES::glClear(GL_COLOR_BUFFER_BIT);
|
::GLES::glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|||||||
Reference in New Issue
Block a user