[Feat|Fix|Improvement] (All): Continue building the basic structure.

Feat: implement MG_Impl/Buffer
Feat: implement MG_State/ErrorState and integrate it into MG_State/GLContext
Feat: add buffer deletion management
Feat: introduce `INSERTION_POINT` (https://github.com/MobileGL-Dev/MobileGLCodeManager)
Feat: add tests about MG_Impl/Buffer and buffer deletion feature
Feat: add several converters
Fix: fix some compiling errors
Fix: fix some incorrect behaviors in MG_State/Buffer
Improvement: remove some current statements at the beginning of the source file, which will be added uniformly soon
Improvement: optimize some naming
This commit is contained in:
BZLZHH
2025-07-23 23:04:36 +08:00
parent 06804d94f8
commit e79a2fa809
37 changed files with 1377 additions and 118 deletions
@@ -0,0 +1,58 @@
#include "../../../Includes.h"
namespace MobileGL {
namespace MG_State {
namespace GLState {
void ErrorState::RecordError(ErrorCode code, SharedPtr<ErrorInfo> info) {
if (code == ErrorCode::NoError) {
MGLOG_E("Recording Non-OpenGL error:\n%s",
info->ToString().c_str());
m_nonGLErrors.push_back(Error{ code, info });
}
else {
MGLOG_E("Recording OpenGL error (%s):\n%s",
MG_Util::ConvertGLEnumToString(MG_Util::ConvertErrorCodeToGLEnum(code)).c_str(),
info->ToString().c_str());
m_errors.push_back(Error{ code, info });
}
}
bool ErrorState::HasNonGLError() const {
return !m_nonGLErrors.empty();
}
Optional<const Error> ErrorState::PeekNonGLError() const {
if (m_nonGLErrors.empty()) return Optional<const Error>{ };
return Optional<const Error>{m_nonGLErrors.front()};
}
Optional<Error> ErrorState::PopNonGLError() {
if (m_nonGLErrors.empty()) return Optional<const Error>{ };
auto error = Move(m_nonGLErrors.front());
m_nonGLErrors.erase(m_nonGLErrors.begin());
return Optional<const Error>{ error };
}
bool ErrorState::HasGLError() const {
return !m_errors.empty();
}
Optional<const Error> ErrorState::PeekGLError() const {
if (m_errors.empty()) return Optional<const Error>{ };
return Optional<const Error>{m_errors.front()};
}
Optional<Error> ErrorState::PopGLError() {
if (m_errors.empty()) return Optional<const Error>{ };
auto error = Move(m_errors.front());
m_errors.erase(m_errors.begin());
return Optional<const Error>{ error };
}
void ErrorState::Clear() {
m_errors.clear();
m_nonGLErrors.clear();
}
}
}
}