Flutter iOS Embedder
FlutterMetalLayer.h
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERMETALLAYER_H_
6 #define FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERMETALLAYER_H_
7 
8 #import <QuartzCore/QuartzCore.h>
9 
10 /// Drop-in replacement (as far as Flutter is concerned) for CAMetalLayer
11 /// that can present with transaction from a background thread.
12 @interface FlutterMetalLayer : CALayer
13 
14 @property(nullable, retain) id<MTLDevice> device;
15 @property(nullable, readonly) id<MTLDevice> preferredDevice;
16 @property MTLPixelFormat pixelFormat;
17 @property BOOL framebufferOnly;
18 @property CGSize drawableSize;
19 @property BOOL presentsWithTransaction;
20 @property(nullable) CGColorSpaceRef colorspace;
22 
23 - (nullable id<CAMetalDrawable>)nextDrawable;
24 
25 /// Returns whether the Metal layer is enabled.
26 /// This is controlled by FLTUseFlutterMetalLayer value in Info.plist.
27 + (BOOL)enabled;
28 
29 @end
30 
31 @protocol MTLCommandBuffer;
32 
33 @protocol FlutterMetalDrawable <CAMetalDrawable>
34 
35 /// In order for FlutterMetalLayer to provide back pressure it must have access
36 /// to the command buffer that is used to render into the drawable to schedule
37 /// a completion handler.
38 /// This method must be called before the command buffer is committed.
39 - (void)flutterPrepareForPresent:(nonnull id<MTLCommandBuffer>)commandBuffer;
40 
41 @end
42 
43 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERMETALLAYER_H_
FlutterMetalLayer::wantsExtendedDynamicRangeContent
BOOL wantsExtendedDynamicRangeContent
Definition: FlutterMetalLayer.h:21
+[FlutterMetalLayer enabled]
BOOL enabled()
Definition: FlutterMetalLayer.mm:423
FlutterMetalLayer::framebufferOnly
BOOL framebufferOnly
Definition: FlutterMetalLayer.h:17
FlutterMetalLayer::colorspace
CGColorSpaceRef colorspace
Definition: FlutterMetalLayer.h:20
FlutterMetalDrawable-p
Definition: FlutterMetalLayer.h:33
FlutterMetalLayer::preferredDevice
id< MTLDevice > preferredDevice
Definition: FlutterMetalLayer.h:15
FlutterMetalLayer::presentsWithTransaction
BOOL presentsWithTransaction
Definition: FlutterMetalLayer.h:19
FlutterMetalLayer::device
id< MTLDevice > device
Definition: FlutterMetalLayer.h:14
-[FlutterMetalLayer nextDrawable]
nullable id< CAMetalDrawable > nextDrawable()
Definition: FlutterMetalLayer.mm:369
FlutterMetalLayer::pixelFormat
MTLPixelFormat pixelFormat
Definition: FlutterMetalLayer.h:16
FlutterMetalLayer::drawableSize
CGSize drawableSize
Definition: FlutterMetalLayer.h:18
FlutterMetalLayer
Definition: FlutterMetalLayer.h:12