[Feat] (MG_Backend/DirectGLES): Implement basic stuff for DirectGLES backend.

This commit is contained in:
BZLZHH
2025-10-19 11:47:44 +08:00
parent ef2221659a
commit 93a0bbaed8
19 changed files with 1574 additions and 24 deletions
+30 -7
View File
@@ -2,25 +2,48 @@
#include <Config.h>
#include <MG_State/GLState/Core.h>
#include <MG_Util/BackendLoaders/OpenGL/Loader.h>
#include <MG_Backend/DirectGLES/DirectGLES.h>
namespace MobileGL {
namespace MG_Impl::GLImpl {
void Clear_Backend(GLbitfield mask) {
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
auto clearColor = MG_State::pGLContext->GetClearColor();
MG_External::GLES::glClearColor(clearColor.r(), clearColor.g(), clearColor.b(), clearColor.a());
auto clearDepth = MG_State::pGLContext->GetClearDepth();
MG_External::GLES::glClearDepthf(clearDepth);
MG_External::GLES::glClear(mask);
MG_Backend::DirectGLES::Clear(mask);
#endif
}
void DrawElements_Backend(GLenum mode, GLsizei count, GLenum type, const void* indices) {
// TODO
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
MG_Backend::DirectGLES::DrawElements(mode, count, type, indices);
#endif
}
void MultiDrawElements_Backend(GLenum mode, const GLsizei* count, GLenum type, const void* const* indices,
GLsizei drawcount) {
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
MG_Backend::DirectGLES::MultiDrawElements(mode, count, type, indices, drawcount);
#endif
}
void MultiDrawElementsBaseVertex_Backend(GLenum mode, const GLsizei* count, GLenum type,
const void* const* indices, GLsizei drawcount,
const GLint* basevertex) {
#if MOBILEGL_BACKEND == MOBILEGL_BACKEND_TYPE_DIRECT_GLES
MG_Backend::DirectGLES::MultiDrawElementsBaseVertex(mode, count, type, indices, drawcount, basevertex);
#endif
}
/* @INSERTION_POINT:FUNCTION_IMPLEMENTATION@ */
void MultiDrawElements(GLenum mode, const GLsizei* count, GLenum type, const void* const* indices,
GLsizei drawcount) {
MultiDrawElements_Backend(mode, count, type, indices, drawcount);
}
void MultiDrawElementsBaseVertex(GLenum mode, const GLsizei* count, GLenum type, const void* const* indices,
GLsizei drawcount, const GLint* basevertex) {
MultiDrawElementsBaseVertex_Backend(mode, count, type, indices, drawcount, basevertex);
}
void Clear(GLbitfield mask) {
Clear_Backend(mask);
}