Re-enable support for Metal on iOS 10
Change-Id: I16208249405d61af9ec2b974a1a676296cafba79
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417001
Commit-Queue: Jim Van Verth <jvanverth@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/mtl/GrMtlGpu.mm b/src/gpu/mtl/GrMtlGpu.mm
index 7a5b762..67261c1 100644
--- a/src/gpu/mtl/GrMtlGpu.mm
+++ b/src/gpu/mtl/GrMtlGpu.mm
@@ -109,12 +109,12 @@
if (!context.fDevice || !context.fQueue) {
return nullptr;
}
- if (@available(macOS 10.14, iOS 11.0, *)) {
+ if (@available(macOS 10.14, iOS 10.0, *)) {
// no warning needed
} else {
SkDebugf("*** Error ***: Skia's Metal backend no longer supports this OS version.\n");
#ifdef SK_BUILD_FOR_IOS
- SkDebugf("Minimum supported version is iOS 11.0.\n");
+ SkDebugf("Minimum supported version is iOS 10.0.\n");
#else
SkDebugf("Minimum supported version is MacOS 10.14.\n");
#endif
diff --git a/src/gpu/mtl/GrMtlUtil.mm b/src/gpu/mtl/GrMtlUtil.mm
index 60ebeb8..927a9c2 100644
--- a/src/gpu/mtl/GrMtlUtil.mm
+++ b/src/gpu/mtl/GrMtlUtil.mm
@@ -101,8 +101,12 @@
encoding:NSUTF8StringEncoding
freeWhenDone:NO];
MTLCompileOptions* options = [[MTLCompileOptions alloc] init];
+ // array<> is supported in MSL 2.0 on MacOS 10.13+ and iOS 11+,
+ // and in MSL 1.2 on iOS 10+ (but not MacOS).
if (@available(macOS 10.13, iOS 11.0, *)) {
options.languageVersion = MTLLanguageVersion2_0;
+ } else if (@available(ios 10.0, *)) {
+ options.languageVersion = MTLLanguageVersion1_2;
}
if (gpu->caps()->shaderCaps()->canUseFastMath()) {
options.fastMathEnabled = YES;