mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 05:38:31 +09:00
[Improvement] (...): Optimize code.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace MobileGL {
|
||||
namespace MG_Impl::EGLImpl {
|
||||
// TODO: Implement complete EGL functionality
|
||||
// TODO: implement complete EGL functionality
|
||||
|
||||
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
|
||||
const EGLint* attrib_list) {
|
||||
|
||||
@@ -216,8 +216,8 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
void* MapBuffer_State(GLenum target, GLenum access) {
|
||||
bool readable = access == GL_READ_ONLY || access == GL_READ_WRITE;
|
||||
bool writable = access == GL_WRITE_ONLY || access == GL_READ_WRITE;
|
||||
Bool readable = access == GL_READ_ONLY || access == GL_READ_WRITE;
|
||||
Bool writable = access == GL_WRITE_ONLY || access == GL_READ_WRITE;
|
||||
if (access != GL_READ_ONLY && access != GL_WRITE_ONLY && access != GL_READ_WRITE) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidEnum,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace BufferImpl {
|
||||
bool ValidateBufferTarget(BufferTarget target) {
|
||||
Bool ValidateBufferTarget(BufferTarget target) {
|
||||
if (target == BufferTarget::Unknown) {
|
||||
using namespace MG_Util;
|
||||
String bufferTargetStr = ConvertBufferTargetToString(target);
|
||||
@@ -31,8 +31,8 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateBufferName(Uint index) {
|
||||
bool isValid = MG_State::pGLContext->ValidateBufferName(index);
|
||||
Bool ValidateBufferName(Uint index) {
|
||||
Bool isValid = MG_State::pGLContext->ValidateBufferName(index);
|
||||
if (isValid) return true;
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidOperation,
|
||||
@@ -41,7 +41,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ValidateBufferUsage(BufferUsage usage) {
|
||||
Bool ValidateBufferUsage(BufferUsage usage) {
|
||||
if (usage != BufferUsage::Unknown) {
|
||||
return true;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits) {
|
||||
Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits) {
|
||||
if (accessBits == BufferMappingAccessBit::Null) {
|
||||
MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum,
|
||||
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl",
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace BufferImpl {
|
||||
bool ValidateBufferTarget(BufferTarget target);
|
||||
bool ValidateBufferName(Uint index);
|
||||
bool ValidateBufferUsage(BufferUsage usage);
|
||||
bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits);
|
||||
Bool ValidateBufferTarget(BufferTarget target);
|
||||
Bool ValidateBufferName(Uint index);
|
||||
Bool ValidateBufferUsage(BufferUsage usage);
|
||||
Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits);
|
||||
} // namespace BufferImpl
|
||||
} // namespace MobileGL::MG_Impl::GLImpl
|
||||
@@ -78,7 +78,7 @@ namespace MobileGL {
|
||||
}
|
||||
|
||||
static Vector<String> extStrings;
|
||||
static bool initialized = false;
|
||||
static Bool initialized = false;
|
||||
if (!initialized) {
|
||||
extStrings.reserve(exts.size());
|
||||
for (const auto& ext : exts) {
|
||||
@@ -93,7 +93,7 @@ namespace MobileGL {
|
||||
void GetIntegerv(GLenum pname, GLint* params) {
|
||||
MGLOG_D("glGetIntegerv, pname: %s", MG_Util::ConvertGLEnumToString(pname).c_str());
|
||||
if (!params) {
|
||||
// TODO: Report GL_INVALID_VALUE.
|
||||
// TODO: report GL_INVALID_VALUE.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace MobileGL {
|
||||
// Others...
|
||||
default:
|
||||
MGLOG_E("glGetIntegerv: Invalid enum %s (0x%X)", MG_Util::ConvertGLEnumToString(pname).c_str(), pname);
|
||||
// TODO: Report GL_INVALID_ENUM.
|
||||
// TODO: report GL_INVALID_ENUM.
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace MobileGL {
|
||||
vao->EnableAttribute(index);
|
||||
}
|
||||
|
||||
// TODO: Implement GL_BGRA support
|
||||
// TODO: implement GL_BGRA support
|
||||
void VertexAttribIPointer_State(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer) {
|
||||
if (!VertexArrayImpl::ValidateVertexAttributeIndex(index)) return;
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace MobileGL {
|
||||
vao->BindAttributeBuffer(index, vbo);
|
||||
}
|
||||
|
||||
// TODO: Implement GL_BGRA support
|
||||
// TODO: implement GL_BGRA support
|
||||
void VertexAttribPointer_State(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
|
||||
const void* pointer) {
|
||||
if (!VertexArrayImpl::ValidateVertexAttributeIndex(index)) return;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace VertexArrayImpl {
|
||||
|
||||
bool ValidateVertexArrayName(Uint index) {
|
||||
Bool ValidateVertexArrayName(Uint index) {
|
||||
if (index == 0) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidValue, MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", "ValidateVertexArrayName",
|
||||
@@ -15,7 +15,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isValid = MG_State::pGLContext->ValidateVertexArrayName(index);
|
||||
Bool isValid = MG_State::pGLContext->ValidateVertexArrayName(index);
|
||||
if (!isValid) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidOperation,
|
||||
@@ -26,7 +26,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateVertexArrayObject(Uint index) {
|
||||
Bool ValidateVertexArrayObject(Uint index) {
|
||||
if (!MG_State::pGLContext->ValidateVertexArrayObject(index)) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidOperation,
|
||||
@@ -37,7 +37,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateVertexAttributeIndex(Uint index) {
|
||||
Bool ValidateVertexAttributeIndex(Uint index) {
|
||||
if (index >= MG_State::GLState::VertexArrayObject::MAX_VERTEX_ATTRIBS) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidValue,
|
||||
@@ -50,7 +50,7 @@ namespace MobileGL::MG_Impl::GLImpl {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride) {
|
||||
Bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride) {
|
||||
if (size < 1 || size > 4) {
|
||||
MG_State::pGLContext->RecordError(
|
||||
ErrorCode::InvalidValue,
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
|
||||
namespace MobileGL::MG_Impl::GLImpl {
|
||||
namespace VertexArrayImpl {
|
||||
bool ValidateVertexArrayName(Uint index);
|
||||
bool ValidateVertexArrayObject(Uint index);
|
||||
bool ValidateVertexAttributeIndex(Uint index);
|
||||
bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride);
|
||||
Bool ValidateVertexArrayName(Uint index);
|
||||
Bool ValidateVertexArrayObject(Uint index);
|
||||
Bool ValidateVertexAttributeIndex(Uint index);
|
||||
Bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride);
|
||||
} // namespace VertexArrayImpl
|
||||
} // namespace MobileGL::MG_Impl::GLImpl
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "LookUp.h"
|
||||
|
||||
namespace MG_Impl::GLXImpl {
|
||||
// TODO: Implement complete GLX functionality
|
||||
// TODO: implement complete GLX functionality
|
||||
|
||||
void* GetProcAddress(const char* name) {
|
||||
MGLOG_D("glXGetProcAddress(\"%s\")", name);
|
||||
|
||||
Reference in New Issue
Block a user