Skip to content

Commit

Permalink
chris feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke committed Sep 19, 2023
1 parent 702f23b commit 83eadca
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,20 @@

static const char* kApplicationKernelSnapshotFileName = "kernel_blob.bin";

static BOOL DoesHardwareSupportsWideGamut() {
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
BOOL result;
if (@available(iOS 13.0, *)) {
// MTLGPUFamilyApple2 = A9/A10
result = [device supportsFamily:MTLGPUFamilyApple2];
} else {
// A9/A10 on iOS 10+
result = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v2];
}
[device release];
static BOOL DoesHardwareSupportWideGamut() {
static BOOL result = NO;
static dispatch_once_t once_token = 0;
dispatch_once(&once_token, ^{
id<MTLDevice> device = MTLCreateSystemDefaultDevice();
if (@available(iOS 13.0, *)) {
// MTLGPUFamilyApple2 = A9/A10
result = [device supportsFamily:MTLGPUFamilyApple2];
} else {
// A9/A10 on iOS 10+
result = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v2];
}
[device release];
});
return result;
}

Expand Down Expand Up @@ -173,7 +176,7 @@ static BOOL DoesHardwareSupportsWideGamut() {
#else
NSNumber* nsEnableWideGamut = [mainBundle objectForInfoDictionaryKey:@"FLTEnableWideGamut"];
BOOL enableWideGamut =
(nsEnableWideGamut ? nsEnableWideGamut.boolValue : YES) && DoesHardwareSupportsWideGamut();
(nsEnableWideGamut ? nsEnableWideGamut.boolValue : YES) && DoesHardwareSupportWideGamut();
settings.enable_wide_gamut = enableWideGamut;
#endif

Expand Down

0 comments on commit 83eadca

Please sign in to comment.