mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
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
This commit is contained in:
parent
b23138c359
commit
d8e45f9c14
@ -7,6 +7,9 @@
|
||||
#include <Foundation/Foundation.h>
|
||||
#include <QuartzCore/CAEAGLLayer.h>
|
||||
#include <QuartzCore/CAMetalLayer.h>
|
||||
#if FLUTTER_SHELL_ENABLE_METAL
|
||||
#include <Metal/Metal.h>
|
||||
#endif // FLUTTER_SHELL_ENABLE_METAL
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
|
||||
@ -16,6 +19,7 @@ bool ShouldUseSoftwareRenderer() {
|
||||
return [[[NSProcessInfo processInfo] arguments] containsObject:@"--force-software"];
|
||||
}
|
||||
|
||||
#if FLUTTER_SHELL_ENABLE_METAL
|
||||
bool ShouldUseMetalRenderer() {
|
||||
// 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
|
||||
@ -31,11 +35,13 @@ bool ShouldUseMetalRenderer() {
|
||||
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;
|
||||
// TODO(52356): Update this to be the version selected for release.
|
||||
if (@available(iOS 11.0, *)) {
|
||||
ios_version_supports_metal = true;
|
||||
if (@available(iOS 10.0, *)) {
|
||||
auto device = MTLCreateSystemDefaultDevice();
|
||||
ios_version_supports_metal = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v3];
|
||||
}
|
||||
|
||||
// The application must opt-in by default to use Metal without command line flags.
|
||||
@ -44,6 +50,7 @@ bool ShouldUseMetalRenderer() {
|
||||
|
||||
return ios_version_supports_metal && application_opts_into_metal;
|
||||
}
|
||||
#endif // FLUTTER_SHELL_ENABLE_METAL
|
||||
|
||||
IOSRenderingAPI GetRenderingAPIForProcess() {
|
||||
#if TARGET_IPHONE_SIMULATOR
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user