Flutter Engine
 
Loading...
Searching...
No Matches
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;
24@property CGSize drawableSize;
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_
CGColorSpaceRef colorspace
nullable id< CAMetalDrawable > nextDrawable()
MTLPixelFormat pixelFormat
id< MTLDevice > preferredDevice API_AVAILABLE(macos(10.15), ios(13.0), tvos(13.0)) API_UNAVAILABLE(watchos)
id< MTLDevice > device
const uintptr_t id
int BOOL