[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:
2026-05-03 19:52:29 +08:00
parent c1ebd01a70
commit 212309083a
2 changed files with 13 additions and 26 deletions
+13 -24
View File
@@ -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,
-2
View File
@@ -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);