mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-07 19:58:32 +09:00
[Fix] (MG_State/EGLState): fix compilation error on 32-bit arch where EGLAttrib & EGLint are the same type and collides
This commit is contained in:
@@ -14,6 +14,19 @@ namespace MobileGL {
|
||||
namespace {
|
||||
constexpr EGLint EGL_DISPLAY_MAJOR_VERSION = 1;
|
||||
constexpr EGLint EGL_DISPLAY_MINOR_VERSION = 5;
|
||||
|
||||
template <typename AttrType>
|
||||
Optional<AttrType> ParseAttribValue(const AttrType* attribList, EGLint attrib) {
|
||||
if (!attribList) {
|
||||
return Nullopt;
|
||||
}
|
||||
for (SizeT i = 0; attribList[i] != EGL_NONE; i += 2) {
|
||||
if (attribList[i] == static_cast<AttrType>(attrib)) {
|
||||
return attribList[i + 1];
|
||||
}
|
||||
}
|
||||
return Nullopt;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
Bool EGLContext::DisplayLookupKey::operator==(const DisplayLookupKey& rhs) const {
|
||||
@@ -65,30 +78,6 @@ namespace MobileGL {
|
||||
return apiIt->second;
|
||||
}
|
||||
|
||||
Optional<EGLint> EGLContext::ParseAttribValue(const EGLint* attribList, EGLint attrib) {
|
||||
if (!attribList) {
|
||||
return Nullopt;
|
||||
}
|
||||
for (SizeT i = 0; attribList[i] != EGL_NONE; i += 2) {
|
||||
if (attribList[i] == attrib) {
|
||||
return attribList[i + 1];
|
||||
}
|
||||
}
|
||||
return Nullopt;
|
||||
}
|
||||
|
||||
Optional<EGLAttrib> EGLContext::ParseAttribValue(const EGLAttrib* attribList, EGLint attrib) {
|
||||
if (!attribList) {
|
||||
return Nullopt;
|
||||
}
|
||||
for (SizeT i = 0; attribList[i] != EGL_NONE; i += 2) {
|
||||
if (attribList[i] == static_cast<EGLAttrib>(attrib)) {
|
||||
return attribList[i + 1];
|
||||
}
|
||||
}
|
||||
return Nullopt;
|
||||
}
|
||||
|
||||
EGLContext::EGLDisplayHandle EGLContext::GetOrCreateDisplay(Uint64 nativeDisplayKey, EGLenum platform) {
|
||||
const DisplayLookupKey key = {
|
||||
.NativeDisplayKey = nativeDisplayKey,
|
||||
|
||||
@@ -210,8 +210,6 @@ namespace MobileGL {
|
||||
}
|
||||
}
|
||||
|
||||
static Optional<EGLint> ParseAttribValue(const EGLint* attribList, EGLint attrib);
|
||||
static Optional<EGLAttrib> ParseAttribValue(const EGLAttrib* attribList, EGLint attrib);
|
||||
static std::thread::id CurrentThreadKey();
|
||||
|
||||
EGLDisplayHandle GetOrCreateDisplay(Uint64 nativeDisplayKey, EGLenum platform);
|
||||
|
||||
Reference in New Issue
Block a user