Skip to content

Commit d8e45f9

Browse files
authored
Update the Metal backend selection to use iOS 10.0 and A7 as the version floor. (flutter#17162)
Fixes flutter#52356
1 parent b23138c commit d8e45f9

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎shell/platform/darwin/ios/rendering_api_selection.mm‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
#include <Foundation/Foundation.h>
88
#include <QuartzCore/CAEAGLLayer.h>
99
#include <QuartzCore/CAMetalLayer.h>
10+
#if FLUTTER_SHELL_ENABLE_METAL
11+
#include <Metal/Metal.h>
12+
#endif // FLUTTER_SHELL_ENABLE_METAL
1013

1114
#include "flutter/fml/logging.h"
1215

@@ -16,6 +19,7 @@ bool ShouldUseSoftwareRenderer() {
1619
return [[[NSProcessInfo processInfo] arguments] containsObject:@"--force-software"];
1720
}
1821

22+
#if FLUTTER_SHELL_ENABLE_METAL
1923
bool ShouldUseMetalRenderer() {
2024
// If there is a command line argument that says Metal should not be used, that takes precedence
2125
// over everything else. This allows disabling Metal on a per run basis to check for regressions
@@ -31,11 +35,13 @@ bool ShouldUseMetalRenderer() {
3135
return true;
3236
}
3337

34-
// This is just a version we picked that is easy to support and has all necessary Metal features.
38+
// Flutter supports Metal on all devices with Apple A7 SoC or above that have been update to or
39+
// past iOS 10.0. The processor was selected as it is the first version at which Metal was
40+
// supported. The iOS version floor was selected due to the availability of features used by Skia.
3541
bool ios_version_supports_metal = false;
36-
// TODO(52356): Update this to be the version selected for release.
37-
if (@available(iOS 11.0, *)) {
38-
ios_version_supports_metal = true;
42+
if (@available(iOS 10.0, *)) {
43+
auto device = MTLCreateSystemDefaultDevice();
44+
ios_version_supports_metal = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v3];
3945
}
4046

4147
// The application must opt-in by default to use Metal without command line flags.
@@ -44,6 +50,7 @@ bool ShouldUseMetalRenderer() {
4450

4551
return ios_version_supports_metal && application_opts_into_metal;
4652
}
53+
#endif // FLUTTER_SHELL_ENABLE_METAL
4754

4855
IOSRenderingAPI GetRenderingAPIForProcess() {
4956
#if TARGET_IPHONE_SIMULATOR

0 commit comments

Comments
 (0)