7 #include <Foundation/Foundation.h>
8 #include <Metal/Metal.h>
9 #include <QuartzCore/CAEAGLLayer.h>
10 #import <QuartzCore/CAMetalLayer.h>
11 #import <TargetConditionals.h>
13 #include "flutter/fml/logging.h"
14 #import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
23 bool IsMetalAvailable() {
24 bool ios_version_supports_metal =
false;
26 id<MTLDevice> device = MTLCreateSystemDefaultDevice();
27 ios_version_supports_metal = [device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v3];
29 return ios_version_supports_metal;
35 static bool metal_available = IsMetalAvailable();
36 FML_CHECK(metal_available)
37 <<
"Metal is unavailable. On a simulator this means the host environment "
38 "does not expose a Metal device; enabling GPU passthrough may fix this.";
45 return [CAMetalLayer
class];
47 FML_CHECK(
false) <<
"Metal availability should already have been checked";
48 return [CALayer
class];
Class GetCoreAnimationLayerClass()
#define METAL_IOS_VERSION_BASELINE