Commit b47f6868 by James Darpinian Committed by Commit Bot

Don't use CGL in Mac Catalyst on Apple Silicon

This change was made downstream in WebKit: https://bugs.webkit.org/show_bug.cgi?id=218303 It turns out we must use EAGL in macCatalyst on Apple Silicon in all cases, not just in-process in iOS apps (the problem is not just about coexistence of the two GLs, but actually about our ability to load the accelerated renderer /at all/ in macCatalyst processes). I left the runtime switching in place, because there is a future in which we /can/ use CGL in non-iOS-app processes, but that future is not now. Bug: angleproject:5369 Change-Id: I9a523d038eeeeef81efa3b97771443db857e97c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2548316Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com> Reviewed-by: 's avatarKenneth Russell <kbr@chromium.org> Commit-Queue: James Darpinian <jdarpinian@chromium.org>
parent 006c53ba
...@@ -67,9 +67,8 @@ struct SystemInfo ...@@ -67,9 +67,8 @@ struct SystemInfo
bool isAMDSwitchable = false; bool isAMDSwitchable = false;
// Only true on dual-GPU Mac laptops. // Only true on dual-GPU Mac laptops.
bool isMacSwitchable = false; bool isMacSwitchable = false;
// Only true on Apple Silicon Macs when running iOS binaries. // Only true on Apple Silicon Macs when running in macCatalyst.
// See https://developer.apple.com/documentation/foundation/nsprocessinfo/3608556-iosapponmac bool needsEAGLOnMac = false;
bool isiOSAppOnMac = false;
// Only available on Android // Only available on Android
std::string machineManufacturer; std::string machineManufacturer;
......
...@@ -19,25 +19,7 @@ namespace angle ...@@ -19,25 +19,7 @@ namespace angle
bool GetSystemInfo(SystemInfo *info) bool GetSystemInfo(SystemInfo *info)
{ {
# if defined(ANGLE_PLATFORM_MACCATALYST) && defined(ANGLE_CPU_ARM64) # if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
static bool isiOSAppOnMac = false;
static dispatch_once_t once;
dispatch_once(&once, ^{
isiOSAppOnMac = [[NSProcessInfo processInfo] isiOSAppOnMac];
});
if (isiOSAppOnMac)
{
GetSystemInfo_ios(info);
if (info)
{
info->isiOSAppOnMac = true;
}
return info;
}
return GetSystemInfo_mac(info);
# elif defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
return GetSystemInfo_mac(info); return GetSystemInfo_mac(info);
# else # else
return GetSystemInfo_ios(info); return GetSystemInfo_ios(info);
......
...@@ -322,6 +322,10 @@ bool GetSystemInfo_mac(SystemInfo *info) ...@@ -322,6 +322,10 @@ bool GetSystemInfo_mac(SystemInfo *info)
info->isMacSwitchable = true; info->isMacSwitchable = true;
} }
# if defined(ANGLE_PLATFORM_MACCATALYST) && defined(ANGLE_CPU_ARM64)
info->needsEAGLOnMac = true;
# endif
return true; return true;
} }
......
...@@ -1034,7 +1034,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() ...@@ -1034,7 +1034,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap()
angle::SystemInfo info; angle::SystemInfo info;
if (angle::GetSystemInfo(&info)) if (angle::GetSystemInfo(&info))
{ {
if (info.isiOSAppOnMac) if (info.needsEAGLOnMac)
{ {
// Using OpenGLES.framework. // Using OpenGLES.framework.
AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, RequireES<2, 0>, NeverSupported, NeverSupported); AddRGBAFormat(&map, GL_BGRA_EXT, false, 8, 8, 8, 8, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, RequireES<2, 0>, NeverSupported, NeverSupported);
......
...@@ -37,7 +37,7 @@ DisplayImpl *CreateDisplayCGLOrEAGL(const egl::DisplayState &state) ...@@ -37,7 +37,7 @@ DisplayImpl *CreateDisplayCGLOrEAGL(const egl::DisplayState &state)
break; break;
} }
if (info.isiOSAppOnMac) if (info.needsEAGLOnMac)
{ {
return new rx::DisplayEAGL(state); return new rx::DisplayEAGL(state);
} }
......
...@@ -1358,7 +1358,7 @@ void GenerateCaps(const FunctionsGL *functions, ...@@ -1358,7 +1358,7 @@ void GenerateCaps(const FunctionsGL *functions,
#if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST) #if defined(ANGLE_PLATFORM_MACOS) || defined(ANGLE_PLATFORM_MACCATALYST)
angle::SystemInfo info; angle::SystemInfo info;
if (angle::GetSystemInfo(&info) && !info.isiOSAppOnMac) if (angle::GetSystemInfo(&info) && !info.needsEAGLOnMac)
{ {
VendorID vendor = GetVendorID(functions); VendorID vendor = GetVendorID(functions);
if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0)) if ((IsAMD(vendor) || IsIntel(vendor)) && *maxSupportedESVersion >= gl::Version(3, 0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment