Ensure correct SkSurfce::MakeFromCAMetalLayer availability.

CAMetalLayer is available on iOS versions above 8.0. However, when using the
simulator, this version is bumped up to 13.0. This is done via a separate header
altogether and there is no provision to specify simulator versions in
API_AVAILABLE. SK_API_AVAILABLE_CA_METAL_LAYER must be used to signal correct
API availability in all versions of iOS including simulators.

Change-Id: I628e3062fd9531869400dc8a29d42f96afb11d82
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/284988
Reviewed-by: Jim Van Verth <jvanverth@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Auto-Submit: Chinmay Garde <chinmaygarde@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index af891d6..a1a80e4 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -319,7 +319,8 @@
                                                  SkColorType colorType,
                                                  sk_sp<SkColorSpace> colorSpace,
                                                  const SkSurfaceProps* surfaceProps,
-                                                 GrMTLHandle* drawable);
+                                                 GrMTLHandle* drawable)
+                                                 SK_API_AVAILABLE_CA_METAL_LAYER;
 
     /** Creates SkSurface from MTKView.
         Returned SkSurface takes a reference on the MTKView. The ref on the layer will be
diff --git a/include/gpu/mtl/GrMtlTypes.h b/include/gpu/mtl/GrMtlTypes.h
index 773ff9d..4acc9cf 100644
--- a/include/gpu/mtl/GrMtlTypes.h
+++ b/include/gpu/mtl/GrMtlTypes.h
@@ -20,6 +20,15 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef SK_METAL
+
+#include <TargetConditionals.h>
+
+#if TARGET_OS_SIMULATOR
+#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0))
+#else  // TARGET_OS_SIMULATOR
+#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0))
+#endif  // TARGET_OS_SIMULATOR
+
 /**
  * Types for interacting with Metal resources created externally to Skia.
  * This is used by GrBackendObjects.