diff --git a/iphone/Maps/Classes/MapsAppDelegate.mm b/iphone/Maps/Classes/MapsAppDelegate.mm index 1662c07548..92a542b144 100644 --- a/iphone/Maps/Classes/MapsAppDelegate.mm +++ b/iphone/Maps/Classes/MapsAppDelegate.mm @@ -560,7 +560,7 @@ using namespace osm_auth_ios; auto & f = GetFramework(); // On some devices we have to free all belong-to-graphics memory // because of new OpenGL driver powered by Metal. - if ([AppInfo sharedInfo].isMetalDriver) + if ([AppInfo sharedInfo].openGLDriver == MWMOpenGLDriverMetalPre103) { f.SetRenderingDisabled(true); f.OnDestroyGLContext(); @@ -610,7 +610,7 @@ using namespace osm_auth_ios; f.SetRenderingEnabled(); // On some devices we have to free all belong-to-graphics memory // because of new OpenGL driver powered by Metal. - if ([AppInfo sharedInfo].isMetalDriver) + if ([AppInfo sharedInfo].openGLDriver == MWMOpenGLDriverMetalPre103) { m2::PointU const size = ((EAGLView *)self.mapViewController.view).pixelSize; f.OnRecoverGLContext(static_cast(size.x), static_cast(size.y)); diff --git a/iphone/Maps/Common/AppInfo.h b/iphone/Maps/Common/AppInfo.h index bfefbda6b7..61be8f3bef 100644 --- a/iphone/Maps/Common/AppInfo.h +++ b/iphone/Maps/Common/AppInfo.h @@ -1,5 +1,11 @@ #import +typedef NS_ENUM(NSInteger, MWMOpenGLDriver) { + MWMOpenGLDriverRegular, + MWMOpenGLDriverMetalPre103, // iOS 10..10.3 + MWMOpenGLDriverMetal +}; + @interface AppInfo : NSObject + (instancetype)sharedInfo; @@ -14,6 +20,6 @@ @property(nonatomic, readonly) NSString * twoLetterLanguageId; @property(nonatomic, readonly) NSDate * buildDate; @property(nonatomic, readonly) NSString * deviceName; -@property(nonatomic, readonly) BOOL isMetalDriver; +@property(nonatomic, readonly) MWMOpenGLDriver openGLDriver; @end diff --git a/iphone/Maps/Common/AppInfo.mm b/iphone/Maps/Common/AppInfo.mm index d55c34df8b..8c821c7aad 100644 --- a/iphone/Maps/Common/AppInfo.mm +++ b/iphone/Maps/Common/AppInfo.mm @@ -242,16 +242,21 @@ NSDictionary * const kDeviceNamesWithMetalDriver = @{ return _deviceName; } -- (BOOL)isMetalDriver +- (MWMOpenGLDriver)openGLDriver { struct utsname systemInfo; uname(&systemInfo); NSString * machine = @(systemInfo.machine); if (kDeviceNamesBeforeMetalDriver[machine] != nil) - return NO; + return MWMOpenGLDriverRegular; if (kDeviceNamesWithiOS10MetalDriver[machine] != nil) - return !isIOSVersionLessThan(10); - return YES; + { + if (isIOSVersionLessThan(10)) + return MWMOpenGLDriverRegular; + else if (isIOSVersionLessThan(@"10.3")) + return MWMOpenGLDriverMetalPre103; + } + return MWMOpenGLDriverMetal; } @end