5#import "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
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"
15#import "flutter/shell/platform/darwin/common/framework/Headers/FlutterMacros.h"
16#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterMetalLayer.h"
23 bool ios_version_supports_metal =
false;
25 id<MTLDevice>
device = MTLCreateSystemDefaultDevice();
26 ios_version_supports_metal = [
device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v3];
28 return ios_version_supports_metal;
32#if TARGET_OS_SIMULATOR
38 FML_LOG(WARNING) <<
"The --enable-software-rendering is only supported on Simulator targets "
39 "and will be ignored.";
44 if (should_use_metal) {
51#if TARGET_OS_SIMULATOR
54 FML_CHECK(
false) <<
"Metal may only be unavailable on simulators";
60 switch (rendering_api) {
62 return [CALayer
class];
68 return [CAMetalLayer
class];
71 FML_CHECK(
false) <<
"Metal availability should already have been checked";
76 FML_CHECK(
false) <<
"Unknown client rendering API";
77 return [CALayer
class];
#define FML_LOG(severity)
#define FML_CHECK(condition)
bool ShouldUseMetalRenderer()
IOSRenderingAPI GetRenderingAPIForProcess(bool force_software)
Class GetCoreAnimationLayerClassForRenderingAPI(IOSRenderingAPI rendering_api)
#define METAL_IOS_VERSION_BASELINE