未验证 提交 d8e45f9c 编写于 作者: C Chinmay Garde 提交者: GitHub

Update the Metal backend selection to use iOS 10.0 and A7 as the version floor. (#17162)

Fixes https://github.com/flutter/flutter/issues/52356
上级 b23138c3
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
#include <Foundation/Foundation.h> #include <Foundation/Foundation.h>
#include <QuartzCore/CAEAGLLayer.h> #include <QuartzCore/CAEAGLLayer.h>
#include <QuartzCore/CAMetalLayer.h> #include <QuartzCore/CAMetalLayer.h>
#if FLUTTER_SHELL_ENABLE_METAL
#include <Metal/Metal.h>
#endif // FLUTTER_SHELL_ENABLE_METAL
#include "flutter/fml/logging.h" #include "flutter/fml/logging.h"
...@@ -16,6 +19,7 @@ bool ShouldUseSoftwareRenderer() { ...@@ -16,6 +19,7 @@ bool ShouldUseSoftwareRenderer() {
return [[[NSProcessInfo processInfo] arguments] containsObject:@"--force-software"]; return [[[NSProcessInfo processInfo] arguments] containsObject:@"--force-software"];
} }
#if FLUTTER_SHELL_ENABLE_METAL
bool ShouldUseMetalRenderer() { bool ShouldUseMetalRenderer() {
// If there is a command line argument that says Metal should not be used, that takes precedence // If there is a command line argument that says Metal should not be used, that takes precedence
// over everything else. This allows disabling Metal on a per run basis to check for regressions // over everything else. This allows disabling Metal on a per run basis to check for regressions
...@@ -31,11 +35,13 @@ bool ShouldUseMetalRenderer() { ...@@ -31,11 +35,13 @@ bool ShouldUseMetalRenderer() {
return true; return true;
} }
// This is just a version we picked that is easy to support and has all necessary Metal features. // Flutter supports Metal on all devices with Apple A7 SoC or above that have been update to or
// past iOS 10.0. The processor was selected as it is the first version at which Metal was
// supported. The iOS version floor was selected due to the availability of features used by Skia.
bool ios_version_supports_metal = false; bool ios_version_supports_metal = false;
// TODO(52356): Update this to be the version selected for release. if (@available(iOS 10.0, *)) {
if (@available(iOS 11.0, *)) { auto device = MTLCreateSystemDefaultDevice();
ios_version_supports_metal = true; ios_version_supports_metal = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v3];
} }
// The application must opt-in by default to use Metal without command line flags. // The application must opt-in by default to use Metal without command line flags.
...@@ -44,6 +50,7 @@ bool ShouldUseMetalRenderer() { ...@@ -44,6 +50,7 @@ bool ShouldUseMetalRenderer() {
return ios_version_supports_metal && application_opts_into_metal; return ios_version_supports_metal && application_opts_into_metal;
} }
#endif // FLUTTER_SHELL_ENABLE_METAL
IOSRenderingAPI GetRenderingAPIForProcess() { IOSRenderingAPI GetRenderingAPIForProcess() {
#if TARGET_IPHONE_SIMULATOR #if TARGET_IPHONE_SIMULATOR
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册