[Improvement] (...): Optimize code.

This commit is contained in:
BZLZHH
2025-08-10 23:18:01 +08:00
parent 0b13cb5714
commit 253e14f2c9
27 changed files with 72 additions and 72 deletions
@@ -2,7 +2,7 @@
namespace MobileGL { namespace MobileGL {
namespace MG_Impl::EGLImpl { namespace MG_Impl::EGLImpl {
// TODO: Implement complete EGL functionality // TODO: implement complete EGL functionality
EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window, EGLSurface CreateWindowSurface(EGLDisplay dpy, EGLConfig config, NativeWindowType window,
const EGLint* attrib_list) { const EGLint* attrib_list) {
+2 -2
View File
@@ -216,8 +216,8 @@ namespace MobileGL {
} }
void* MapBuffer_State(GLenum target, GLenum access) { void* MapBuffer_State(GLenum target, GLenum access) {
bool readable = access == GL_READ_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; Bool writable = access == GL_WRITE_ONLY || access == GL_READ_WRITE;
if (access != GL_READ_ONLY && 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( MG_State::pGLContext->RecordError(
ErrorCode::InvalidEnum, ErrorCode::InvalidEnum,
@@ -7,7 +7,7 @@
namespace MobileGL::MG_Impl::GLImpl { namespace MobileGL::MG_Impl::GLImpl {
namespace BufferImpl { namespace BufferImpl {
bool ValidateBufferTarget(BufferTarget target) { Bool ValidateBufferTarget(BufferTarget target) {
if (target == BufferTarget::Unknown) { if (target == BufferTarget::Unknown) {
using namespace MG_Util; using namespace MG_Util;
String bufferTargetStr = ConvertBufferTargetToString(target); String bufferTargetStr = ConvertBufferTargetToString(target);
@@ -31,8 +31,8 @@ namespace MobileGL::MG_Impl::GLImpl {
return true; return true;
} }
bool ValidateBufferName(Uint index) { Bool ValidateBufferName(Uint index) {
bool isValid = MG_State::pGLContext->ValidateBufferName(index); Bool isValid = MG_State::pGLContext->ValidateBufferName(index);
if (isValid) return true; if (isValid) return true;
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidOperation, ErrorCode::InvalidOperation,
@@ -41,7 +41,7 @@ namespace MobileGL::MG_Impl::GLImpl {
return false; return false;
} }
bool ValidateBufferUsage(BufferUsage usage) { Bool ValidateBufferUsage(BufferUsage usage) {
if (usage != BufferUsage::Unknown) { if (usage != BufferUsage::Unknown) {
return true; return true;
} }
@@ -56,7 +56,7 @@ namespace MobileGL::MG_Impl::GLImpl {
return false; return false;
} }
bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits) { Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits) {
if (accessBits == BufferMappingAccessBit::Null) { if (accessBits == BufferMappingAccessBit::Null) {
MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum, MG_State::pGLContext->RecordError(ErrorCode::InvalidEnum,
MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl", MakeShared<GenericErrorInfo>("MG_Impl/GLImpl/BufferImpl",
+4 -4
View File
@@ -4,9 +4,9 @@
namespace MobileGL::MG_Impl::GLImpl { namespace MobileGL::MG_Impl::GLImpl {
namespace BufferImpl { namespace BufferImpl {
bool ValidateBufferTarget(BufferTarget target); Bool ValidateBufferTarget(BufferTarget target);
bool ValidateBufferName(Uint index); Bool ValidateBufferName(Uint index);
bool ValidateBufferUsage(BufferUsage usage); Bool ValidateBufferUsage(BufferUsage usage);
bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits); Bool ValidateBufferMappingAccess(Flags<BufferMappingAccessBit> accessBits);
} // namespace BufferImpl } // namespace BufferImpl
} // namespace MobileGL::MG_Impl::GLImpl } // namespace MobileGL::MG_Impl::GLImpl
+3 -3
View File
@@ -78,7 +78,7 @@ namespace MobileGL {
} }
static Vector<String> extStrings; static Vector<String> extStrings;
static bool initialized = false; static Bool initialized = false;
if (!initialized) { if (!initialized) {
extStrings.reserve(exts.size()); extStrings.reserve(exts.size());
for (const auto& ext : exts) { for (const auto& ext : exts) {
@@ -93,7 +93,7 @@ namespace MobileGL {
void GetIntegerv(GLenum pname, GLint* params) { void GetIntegerv(GLenum pname, GLint* params) {
MGLOG_D("glGetIntegerv, pname: %s", MG_Util::ConvertGLEnumToString(pname).c_str()); MGLOG_D("glGetIntegerv, pname: %s", MG_Util::ConvertGLEnumToString(pname).c_str());
if (!params) { if (!params) {
// TODO: Report GL_INVALID_VALUE. // TODO: report GL_INVALID_VALUE.
return; return;
} }
@@ -122,7 +122,7 @@ namespace MobileGL {
// Others... // Others...
default: default:
MGLOG_E("glGetIntegerv: Invalid enum %s (0x%X)", MG_Util::ConvertGLEnumToString(pname).c_str(), pname); 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; break;
} }
} }
@@ -36,7 +36,7 @@ namespace MobileGL {
vao->EnableAttribute(index); 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) { void VertexAttribIPointer_State(GLuint index, GLint size, GLenum type, GLsizei stride, const void* pointer) {
if (!VertexArrayImpl::ValidateVertexAttributeIndex(index)) return; if (!VertexArrayImpl::ValidateVertexAttributeIndex(index)) return;
@@ -68,7 +68,7 @@ namespace MobileGL {
vao->BindAttributeBuffer(index, vbo); 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, void VertexAttribPointer_State(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride,
const void* pointer) { const void* pointer) {
if (!VertexArrayImpl::ValidateVertexAttributeIndex(index)) return; if (!VertexArrayImpl::ValidateVertexAttributeIndex(index)) return;
@@ -7,7 +7,7 @@
namespace MobileGL::MG_Impl::GLImpl { namespace MobileGL::MG_Impl::GLImpl {
namespace VertexArrayImpl { namespace VertexArrayImpl {
bool ValidateVertexArrayName(Uint index) { Bool ValidateVertexArrayName(Uint index) {
if (index == 0) { if (index == 0) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidValue, MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", "ValidateVertexArrayName", ErrorCode::InvalidValue, MakeShared<GenericErrorInfo>("MG_Impl/GLImpl", "ValidateVertexArrayName",
@@ -15,7 +15,7 @@ namespace MobileGL::MG_Impl::GLImpl {
return false; return false;
} }
bool isValid = MG_State::pGLContext->ValidateVertexArrayName(index); Bool isValid = MG_State::pGLContext->ValidateVertexArrayName(index);
if (!isValid) { if (!isValid) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidOperation, ErrorCode::InvalidOperation,
@@ -26,7 +26,7 @@ namespace MobileGL::MG_Impl::GLImpl {
return true; return true;
} }
bool ValidateVertexArrayObject(Uint index) { Bool ValidateVertexArrayObject(Uint index) {
if (!MG_State::pGLContext->ValidateVertexArrayObject(index)) { if (!MG_State::pGLContext->ValidateVertexArrayObject(index)) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidOperation, ErrorCode::InvalidOperation,
@@ -37,7 +37,7 @@ namespace MobileGL::MG_Impl::GLImpl {
return true; return true;
} }
bool ValidateVertexAttributeIndex(Uint index) { Bool ValidateVertexAttributeIndex(Uint index) {
if (index >= MG_State::GLState::VertexArrayObject::MAX_VERTEX_ATTRIBS) { if (index >= MG_State::GLState::VertexArrayObject::MAX_VERTEX_ATTRIBS) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidValue, ErrorCode::InvalidValue,
@@ -50,7 +50,7 @@ namespace MobileGL::MG_Impl::GLImpl {
return true; 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) { if (size < 1 || size > 4) {
MG_State::pGLContext->RecordError( MG_State::pGLContext->RecordError(
ErrorCode::InvalidValue, ErrorCode::InvalidValue,
@@ -4,9 +4,9 @@
namespace MobileGL::MG_Impl::GLImpl { namespace MobileGL::MG_Impl::GLImpl {
namespace VertexArrayImpl { namespace VertexArrayImpl {
bool ValidateVertexArrayName(Uint index); Bool ValidateVertexArrayName(Uint index);
bool ValidateVertexArrayObject(Uint index); Bool ValidateVertexArrayObject(Uint index);
bool ValidateVertexAttributeIndex(Uint index); Bool ValidateVertexAttributeIndex(Uint index);
bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride); Bool ValidateVertexAttribPointerParams(Uint index, SizeT size, DataType type, Int stride);
} // namespace VertexArrayImpl } // namespace VertexArrayImpl
} // namespace MobileGL::MG_Impl::GLImpl } // namespace MobileGL::MG_Impl::GLImpl
+1 -1
View File
@@ -1,7 +1,7 @@
#include "LookUp.h" #include "LookUp.h"
namespace MG_Impl::GLXImpl { namespace MG_Impl::GLXImpl {
// TODO: Implement complete GLX functionality // TODO: implement complete GLX functionality
void* GetProcAddress(const char* name) { void* GetProcAddress(const char* name) {
MGLOG_D("glXGetProcAddress(\"%s\")", name); MGLOG_D("glXGetProcAddress(\"%s\")", name);
@@ -82,7 +82,7 @@ namespace MobileGL {
Range1D m_dirtyRange; Range1D m_dirtyRange;
Range1D m_mappedRange; Range1D m_mappedRange;
std::vector<Uint8> m_stagingData; std::vector<Uint8> m_stagingData;
bool m_ownsStagingData; Bool m_ownsStagingData;
}; };
} // namespace GLState } // namespace GLState
} // namespace MG_State } // namespace MG_State
@@ -53,11 +53,11 @@ namespace MobileGL {
} }
} }
bool BufferState::ValidateName(Uint index) const { Bool BufferState::ValidateName(Uint index) const {
return m_indexGenerator.IsValid(index); return m_indexGenerator.IsValid(index);
} }
bool BufferState::ValidateBufferObject(Uint index) const { Bool BufferState::ValidateBufferObject(Uint index) const {
return m_bufferObjects.find(index) != m_bufferObjects.end(); return m_bufferObjects.find(index) != m_bufferObjects.end();
} }
} // namespace GLState } // namespace GLState
@@ -1,7 +1,7 @@
#pragma once #pragma once
#include <Includes.h> #include <Includes.h>
#include "BufferObject.h"
#include <MG_Util/Miscellany/IndexGenerator.h> #include <MG_Util/Miscellany/IndexGenerator.h>
#include "BufferObject.h"
namespace MobileGL { namespace MobileGL {
namespace MG_State { namespace MG_State {
@@ -21,8 +21,8 @@ namespace MobileGL {
SharedPtr<BufferObject> CreateBufferObject(Uint index); SharedPtr<BufferObject> CreateBufferObject(Uint index);
BindingSlot<BufferObject>& GetBindingSlot(BufferTarget target); BindingSlot<BufferObject>& GetBindingSlot(BufferTarget target);
void MarkBufferObjectForDeletion(Uint index); void MarkBufferObjectForDeletion(Uint index);
bool ValidateName(Uint index) const; Bool ValidateName(Uint index) const;
bool ValidateBufferObject(Uint index) const; Bool ValidateBufferObject(Uint index) const;
private: private:
UnorderedMap<Uint, SharedPtr<BufferObject>> m_bufferObjects; UnorderedMap<Uint, SharedPtr<BufferObject>> m_bufferObjects;
@@ -17,7 +17,7 @@ namespace MobileGL {
} }
} }
bool ErrorState::HasNonGLError() const { Bool ErrorState::HasNonGLError() const {
return !m_nonGLErrors.empty(); return !m_nonGLErrors.empty();
} }
@@ -33,7 +33,7 @@ namespace MobileGL {
return Optional<const Error>{error}; return Optional<const Error>{error};
} }
bool ErrorState::HasGLError() const { Bool ErrorState::HasGLError() const {
return !m_errors.empty(); return !m_errors.empty();
} }
+2 -2
View File
@@ -14,10 +14,10 @@ namespace MobileGL {
class ErrorState { class ErrorState {
public: public:
void RecordError(ErrorCode code, SharedPtr<ErrorInfo> info = nullptr); void RecordError(ErrorCode code, SharedPtr<ErrorInfo> info = nullptr);
bool HasNonGLError() const; Bool HasNonGLError() const;
Optional<const Error> PeekNonGLError() const; Optional<const Error> PeekNonGLError() const;
Optional<Error> PopNonGLError(); Optional<Error> PopNonGLError();
bool HasGLError() const; Bool HasGLError() const;
Optional<const Error> PeekGLError() const; Optional<const Error> PeekGLError() const;
Optional<Error> PopGLError(); Optional<Error> PopGLError();
void Clear(); void Clear();
@@ -16,9 +16,9 @@ namespace MobileGL {
// basically this contains SPIR-V in binary format // basically this contains SPIR-V in binary format
Vector<Vector<Uint>> m_programBinary; Vector<Vector<Uint>> m_programBinary;
String m_infoLog; String m_infoLog;
bool m_deleteStatus = false; Bool m_deleteStatus = false;
bool m_linkStatus = true; Bool m_linkStatus = true;
bool m_validateStatus = true; Bool m_validateStatus = true;
}; };
} // namespace GLState } // namespace GLState
} // namespace MG_State } // namespace MG_State
@@ -15,7 +15,7 @@ namespace MobileGL {
void DeleteProgram(Uint program); void DeleteProgram(Uint program);
private: private:
bool CheckIndexAvail(SizeT idx) { return idx < m_programObjects.size(); } Bool CheckIndexAvail(SizeT idx) { return idx < m_programObjects.size(); }
void EnsureIndexAvail(SizeT idx) { void EnsureIndexAvail(SizeT idx) {
if (CheckIndexAvail(idx)) return; if (CheckIndexAvail(idx)) return;
@@ -44,8 +44,8 @@ namespace MobileGL {
SharedPtr<glslang::TShader> m_shader; SharedPtr<glslang::TShader> m_shader;
std::string m_infoLog; std::string m_infoLog;
bool m_deleteStatus = false; Bool m_deleteStatus = false;
bool m_compileStatus = false; Bool m_compileStatus = false;
}; };
} // namespace GLState } // namespace GLState
} // namespace MG_State } // namespace MG_State
@@ -65,7 +65,7 @@ namespace MobileGL {
} }
} }
// TODO: Add other texture types as needed // TODO: add other texture types as needed
} // namespace GLState } // namespace GLState
} // namespace MG_State } // namespace MG_State
@@ -214,7 +214,7 @@ namespace MobileGL {
void SetMipmapImpl(const MipmapLevelInput& level) override; void SetMipmapImpl(const MipmapLevelInput& level) override;
}; };
// TODO: Add other texture types as needed // TODO: add other texture types as needed
} // namespace GLState } // namespace GLState
} // namespace MG_State } // namespace MG_State
@@ -25,13 +25,13 @@ namespace MobileGL {
m_attributes[index].Enabled = false; m_attributes[index].Enabled = false;
} }
bool VertexArrayObject::IsAttributeEnabled(Uint index) const { Bool VertexArrayObject::IsAttributeEnabled(Uint index) const {
if (index >= MAX_VERTEX_ATTRIBS) return false; if (index >= MAX_VERTEX_ATTRIBS) return false;
return m_attributes[index].Enabled; return m_attributes[index].Enabled;
} }
void VertexArrayObject::SetAttributeFormat(Uint index, int size, DataType type, bool normalized, int stride, void VertexArrayObject::SetAttributeFormat(Uint index, int size, DataType type, Bool normalized, int stride,
SizeT offset, bool isInteger) { SizeT offset, Bool isInteger) {
if (index >= MAX_VERTEX_ATTRIBS) return; if (index >= MAX_VERTEX_ATTRIBS) return;
if (size < 1 || size > 4) { if (size < 1 || size > 4) {
@@ -6,13 +6,13 @@ namespace MobileGL {
namespace MG_State { namespace MG_State {
namespace GLState { namespace GLState {
struct VertexAttribute { struct VertexAttribute {
bool Enabled = false; Bool Enabled = false;
int Size = 4; int Size = 4;
DataType Type = DataType::Float32; DataType Type = DataType::Float32;
bool Normalized = false; Bool Normalized = false;
int Stride = 0; int Stride = 0;
SizeT Offset = 0; SizeT Offset = 0;
bool IsInteger = false; Bool IsInteger = false;
SharedPtr<BufferObject> Buffer; SharedPtr<BufferObject> Buffer;
}; };
@@ -24,10 +24,10 @@ namespace MobileGL {
void EnableAttribute(Uint index); void EnableAttribute(Uint index);
void DisableAttribute(Uint index); void DisableAttribute(Uint index);
bool IsAttributeEnabled(Uint index) const; Bool IsAttributeEnabled(Uint index) const;
void SetAttributeFormat(Uint index, int size, DataType type, bool normalized, int stride, SizeT offset, void SetAttributeFormat(Uint index, int size, DataType type, Bool normalized, int stride, SizeT offset,
bool isInteger); Bool isInteger);
void BindAttributeBuffer(Uint index, const SharedPtr<BufferObject>& buffer); void BindAttributeBuffer(Uint index, const SharedPtr<BufferObject>& buffer);
@@ -54,11 +54,11 @@ namespace MobileGL {
// FIXME: report GL error here? // FIXME: report GL error here?
} }
bool VertexArrayState::ValidateName(Uint index) const { Bool VertexArrayState::ValidateName(Uint index) const {
return m_indexGenerator.IsValid(index); return m_indexGenerator.IsValid(index);
} }
bool VertexArrayState::ValidateVertexArrayObject(Uint index) const { Bool VertexArrayState::ValidateVertexArrayObject(Uint index) const {
return index < m_vertexArrays.size() && m_vertexArrays[index] != nullptr; return index < m_vertexArrays.size() && m_vertexArrays[index] != nullptr;
} }
@@ -15,8 +15,8 @@ namespace MobileGL {
void Bind(Uint index); void Bind(Uint index);
SharedPtr<VertexArrayObject> CreateVertexArrayObject(Uint index); SharedPtr<VertexArrayObject> CreateVertexArrayObject(Uint index);
void MarkVertexArrayForDeletion(Uint index); void MarkVertexArrayForDeletion(Uint index);
bool ValidateName(Uint index) const; Bool ValidateName(Uint index) const;
bool ValidateVertexArrayObject(Uint index) const; Bool ValidateVertexArrayObject(Uint index) const;
SharedPtr<VertexArrayObject> GetBoundVertexArray(); SharedPtr<VertexArrayObject> GetBoundVertexArray();
Vector<SharedPtr<VertexArrayObject>>& GetAllVertexArrays(); Vector<SharedPtr<VertexArrayObject>>& GetAllVertexArrays();
+2 -2
View File
@@ -29,8 +29,8 @@ namespace MobileGL {
return data[index]; return data[index];
} }
bool operator==(const VecBase& rhs) const { return data == rhs.data; } Bool operator==(const VecBase& rhs) const { return data == rhs.data; }
bool operator!=(const VecBase& rhs) const { return !(*this == rhs); } Bool operator!=(const VecBase& rhs) const { return !(*this == rhs); }
Derived operator+(const VecBase& rhs) const { Derived operator+(const VecBase& rhs) const {
Derived result; Derived result;
+2 -2
View File
@@ -46,7 +46,7 @@ namespace MobileGL {
} }
} }
bool IsValid(IndexType index) const { Bool IsValid(IndexType index) const {
SizeT word = index >> 6; SizeT word = index >> 6;
SizeT bit = index & 0x3F; SizeT bit = index & 0x3F;
return word < is_valid_.size() && (is_valid_[word] & (1ull << bit)); return word < is_valid_.size() && (is_valid_[word] & (1ull << bit));
@@ -56,7 +56,7 @@ namespace MobileGL {
SizeT ActiveCount() const { return next_index_ - freed_indices_.size(); } SizeT ActiveCount() const { return next_index_ - freed_indices_.size(); }
private: private:
inline void SetValid(IndexType index, bool valid) { inline void SetValid(IndexType index, Bool valid) {
SizeT word = index >> 6; SizeT word = index >> 6;
uint64_t mask = 1ull << (index & 0x3F); uint64_t mask = 1ull << (index & 0x3F);
+2 -2
View File
@@ -35,9 +35,9 @@ namespace MobileGL {
std::string name; std::string name;
uint32_t location; uint32_t location;
bool operator<(const InterfaceVariable& other) const { return location < other.location; } Bool operator<(const InterfaceVariable& other) const { return location < other.location; }
bool operator==(const InterfaceVariable& other) const { Bool operator==(const InterfaceVariable& other) const {
return location == other.location && name == other.name; return location == other.location && name == other.name;
} }
}; };
+8 -8
View File
@@ -22,7 +22,7 @@ namespace MobileGL {
using Uint = Uint32; using Uint = Uint32;
using Int64 = int64_t; using Int64 = int64_t;
using Uint64 = uint64_t; using Uint64 = uint64_t;
using Bool = bool; using Bool = Bool;
using Float = float; using Float = float;
using Double = double; using Double = double;
using StringView = std::string_view; using StringView = std::string_view;
@@ -46,7 +46,7 @@ namespace MobileGL {
template <typename T, SizeT N> template <typename T, SizeT N>
using Array = std::array<T, N>; using Array = std::array<T, N>;
template <typename Key, typename Value> template <typename Key, typename Value>
using UnorderedMap = std::unordered_map<Key, Value>; using UnorderedMap = ankerl::unordered_dense::map<Key, Value>;
template <typename T> template <typename T>
inline constexpr std::remove_reference_t<T>&& Move(T&& t) noexcept { inline constexpr std::remove_reference_t<T>&& Move(T&& t) noexcept {
return static_cast<std::remove_reference_t<T>&&>(t); return static_cast<std::remove_reference_t<T>&&>(t);
@@ -196,9 +196,9 @@ namespace MobileGL {
return *this; return *this;
} }
bool operator==(const Bit b) const { return flags == static_cast<typename Underlying::type>(b); } Bool operator==(const Bit b) const { return flags == static_cast<typename Underlying::type>(b); }
bool operator!=(const Bit b) const { return !(*this == b); } Bool operator!=(const Bit b) const { return !(*this == b); }
// Flags - Flags // Flags - Flags
Flags operator|(const Flags b) const { return Flags(flags | b.flags); } Flags operator|(const Flags b) const { return Flags(flags | b.flags); }
@@ -215,14 +215,14 @@ namespace MobileGL {
return *this; return *this;
} }
bool operator==(const Flags b) const { return flags == b.flags; } Bool operator==(const Flags b) const { return flags == b.flags; }
bool operator!=(const Flags b) const { return !(*this == b); } Bool operator!=(const Flags b) const { return !(*this == b); }
operator bool() const { return Any(); } operator Bool() const { return Any(); }
private: private:
bool Any() const { return static_cast<typename Underlying::type>(flags) != 0; } Bool Any() const { return static_cast<typename Underlying::type>(flags) != 0; }
typename Underlying::type flags = 0; typename Underlying::type flags = 0;
}; };