| 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 ///
13 /// Properties and method declarations must exactly match those in the
14 /// CAMetalLayer interface declaration.
15 @interface FlutterMetalLayer : CALayer
16
17 @property(nullable, retain) id<MTLDevice> device;
18 @property(nullable, readonly)
19 id<MTLDevice> preferredDevice API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0))
20 API_UNAVAILABLE(watchos);
21 @property MTLPixelFormat pixelFormat;
22 @property BOOL framebufferOnly;
23 @property CGSize drawableSize;
24 @property BOOL presentsWithTransaction;
25 @property(nullable) CGColorSpaceRef colorspace;
26
27 - (nullable id<CAMetalDrawable>)nextDrawable;
28
29 /// Returns whether the Metal layer is enabled.
30 /// This is controlled by FLTUseFlutterMetalLayer value in Info.plist.
31 + (BOOL)enabled;
32
33 @end
34
35 @protocol MTLCommandBuffer;
36
37 @protocol FlutterMetalDrawable <CAMetalDrawable>
38
39 /// In order for FlutterMetalLayer to provide back pressure it must have access
40 /// to the command buffer that is used to render into the drawable to schedule
41 /// a completion handler.
42 /// This method must be called before the command buffer is committed.
43 - (void)flutterPrepareForPresent:(nonnull id<MTLCommandBuffer>)commandBuffer;
44
45 @end
46
47 #endif // FLUTTER_SHELL_PLATFORM_DARWIN_IOS_FRAMEWORK_SOURCE_FLUTTERMETALLAYER_H_
FlutterMetalLayer
Definition: FlutterMetalLayer.h:16
+[FlutterMetalLayer enabled]
BOOL enabled()
Definition: FlutterMetalLayer.mm:443
FlutterMetalLayer::framebufferOnly
BOOL framebufferOnly
Definition: FlutterMetalLayer.h:22
FlutterMetalLayer::colorspace
CGColorSpaceRef colorspace
Definition: FlutterMetalLayer.h:25
-[FlutterMetalLayer API_AVAILABLE]
id< MTLDevice > preferredDevice API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos)
FlutterMetalLayer::presentsWithTransaction
BOOL presentsWithTransaction
Definition: FlutterMetalLayer.h:24
-[FlutterMetalLayer nextDrawable]
nullable id< CAMetalDrawable > nextDrawable()
Definition: FlutterMetalLayer.mm:389
FlutterMetalLayer::pixelFormat
MTLPixelFormat pixelFormat
Definition: FlutterMetalLayer.h:21
FlutterMetalLayer::drawableSize
CGSize drawableSize
Definition: FlutterMetalLayer.h:23
FlutterMetalLayer::device
id< MTLDevice > device
Definition: FlutterMetalLayer.h:17
FlutterMetalDrawable-p
Definition: FlutterMetalLayer.h:37