This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree
shell/platform/darwin/ios/framework/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99#include < syslog.h>
1010
11+ #import < Metal/Metal.h>
1112#include < sstream>
1213#include < string>
1314
2223#import " flutter/shell/platform/darwin/common/command_line.h"
2324#import " flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
2425
26+ FLUTTER_ASSERT_NOT_ARC
27+
2528extern " C" {
2629#if FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG
2730// Used for debugging dart:* sources.
3235
3336static const char * kApplicationKernelSnapshotFileName = " kernel_blob.bin" ;
3437
38+ static BOOL DoesHardwareSupportsWideGamut () {
39+ id <MTLDevice > device = MTLCreateSystemDefaultDevice ();
40+ BOOL result;
41+ if (@available (iOS 13.0 , *)) {
42+ // MTLGPUFamilyApple2 = A9/A10
43+ result = [device supportsFamily: MTLGPUFamilyApple2 ];
44+ } else {
45+ // A9/A10 on iOS 10+
46+ result = [device supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v2];
47+ }
48+ [device release ];
49+ return result;
50+ }
51+
3552flutter::Settings FLTDefaultSettingsForBundle (NSBundle * bundle, NSProcessInfo * processInfoOrNil) {
3653 auto command_line = flutter::CommandLineFromNSProcessInfo (processInfoOrNil);
3754
155172 settings.enable_wide_gamut = false ;
156173#else
157174 NSNumber * nsEnableWideGamut = [mainBundle objectForInfoDictionaryKey: @" FLTEnableWideGamut" ];
158- BOOL enableWideGamut = nsEnableWideGamut ? nsEnableWideGamut.boolValue : YES ;
175+ BOOL enableWideGamut =
176+ (nsEnableWideGamut ? nsEnableWideGamut.boolValue : YES ) && DoesHardwareSupportsWideGamut ();
159177 settings.enable_wide_gamut = enableWideGamut;
160178#endif
161179
You can’t perform that action at this time.
0 commit comments