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