7#include "flutter/fml/build_config.h"
8#include "flutter/fml/logging.h"
19 if (@available(
ios 13.0,
tvos 13.0, macos 10.15, *)) {
20 return [
device supportsFamily:MTLGPUFamilyApple2];
26 return [
device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v1];
38 if (@available(
ios 13.0,
tvos 13.0, macOS 10.15, *)) {
39 return [
device hasUnifiedMemory];
59 if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
60 if ([
device supportsFamily:MTLGPUFamilyApple3] ||
61 [
device supportsFamily:MTLGPUFamilyMacCatalyst1] ||
62 [
device supportsFamily:MTLGPUFamilyMac1]) {
63 return {16384, 16384};
68 if ([
device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1] ||
69 [
device supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) {
70 return {16384, 16384};
74 return {16384, 16384};
81#ifdef FML_OS_IOS_SIMULATOR
84 if (@available(macOS 10.15, iOS 13, tvOS 13, *)) {
85 return [
device supportsFamily:MTLGPUFamilyApple8];
92 : device_(
device), allocator_label_(
std::move(label)) {
104AllocatorMTL::~AllocatorMTL() =
default;
106bool AllocatorMTL::IsValid()
const {
111 bool supports_memoryless_targets,
114 case StorageMode::kHostVisible:
116 return MTLResourceStorageModeShared;
119 return MTLResourceStorageModeShared;
121 return MTLResourceStorageModeManaged;
124 case StorageMode::kDevicePrivate:
125 return MTLResourceStorageModePrivate;
126 case StorageMode::kDeviceTransient:
127 if (supports_memoryless_targets) {
129 if (@available(macOS 11.0, *)) {
130 return MTLResourceStorageModeMemoryless;
132 return MTLResourceStorageModePrivate;
135 return MTLResourceStorageModePrivate;
143 bool supports_memoryless_targets,
146 case StorageMode::kHostVisible:
148 return MTLStorageModeShared;
151 return MTLStorageModeShared;
153 return MTLStorageModeManaged;
156 case StorageMode::kDevicePrivate:
157 return MTLStorageModePrivate;
158 case StorageMode::kDeviceTransient:
159 if (supports_memoryless_targets) {
161 if (@available(macOS 11.0, *)) {
162 return MTLStorageModeMemoryless;
164 return MTLStorageModePrivate;
167 return MTLStorageModePrivate;
174std::shared_ptr<DeviceBuffer> AllocatorMTL::OnCreateBuffer(
175 const DeviceBufferDescriptor&
desc) {
177 desc.storage_mode, supports_memoryless_targets_, supports_uma_);
179 desc.storage_mode, supports_memoryless_targets_, supports_uma_);
181 auto buffer = [device_ newBufferWithLength:
desc.size
186 return std::shared_ptr<DeviceBufferMTL>(
new DeviceBufferMTL(
desc,
192std::shared_ptr<Texture> AllocatorMTL::OnCreateTexture(
193 const TextureDescriptor&
desc) {
200 if (!mtl_texture_desc) {
206 desc.storage_mode, supports_memoryless_targets_, supports_uma_);
208 if (@available(macOS 12.5,
ios 15.0, *)) {
209 if (
desc.compression_type == CompressionType::kLossy &&
211 mtl_texture_desc.compressionType = MTLTextureCompressionTypeLossy;
215 auto texture = [device_ newTextureWithDescriptor:mtl_texture_desc];
223 return static_cast<uint16_t
>([device_
227ISize AllocatorMTL::GetMaxTextureSizeSupported()
const {
228 return max_texture_supported_;
static sk_sp< Effect > Create()
uint32_t uint32_t * format
#define FML_UNREACHABLE()
SK_API sk_sp< SkSurface > ios(9.0)
SK_API sk_sp< SkSurface > tvos(9.0))
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static MTLStorageMode ToMTLStorageMode(StorageMode mode, bool supports_memoryless_targets, bool supports_uma)
static bool DeviceHasUnifiedMemoryArchitecture(id< MTLDevice > device)
StorageMode
Specified where the allocation resides and how it is used.
static bool SupportsLossyTextureCompression(id< MTLDevice > device)
PixelFormat
The Pixel formats supported by Impeller. The naming convention denotes the usage of the component,...
static MTLResourceOptions ToMTLResourceOptions(StorageMode type, bool supports_memoryless_targets, bool supports_uma)
static bool DeviceSupportsDeviceTransientTargets(id< MTLDevice > device)
constexpr MTLPixelFormat ToMTLPixelFormat(PixelFormat format)
MTLTextureDescriptor * ToMTLTextureDescriptor(const TextureDescriptor &desc)
static ISize DeviceMaxTextureSizeSupported(id< MTLDevice > device)