| Flutter macOS Embedder |

Instance Methods | Protected Attributes | Properties | List of all members
FlutterRenderer Class Reference

`#import <FlutterRenderer.h>`

## Instance Methods
(nullable instancetype) | - initWithFlutterEngine:
(FlutterRendererConfig) | - createRendererConfig
(BOOL) | - populateTextureWithIdentifier:metalTexture:

## Protected Attributes
| __pad0__: FlutterTextureRegistrar <FlutterTextureRegistry

## Properties
FlutterTextureRegistrarDelegate id< MTLDevice > | device
id< MTLCommandQueue > | commandQueue

## Detailed Description

Rendering backend agnostic FlutterRendererConfig provider to be used by the embedder API.

Definition at line 18 of file FlutterRenderer.h.

## Method Documentation

## ◆ createRendererConfig

- (FlutterRendererConfig) createRendererConfig |  |  |

Creates a FlutterRendererConfig that renders using the appropriate backend.

Definition at line 25 of file FlutterRenderer.mm.

78 {
79 FlutterRendererConfig config = {
80 .type = FlutterRendererType::kMetal,
81 .metal = {
82 .struct_size = sizeof(FlutterMetalRendererConfig),
83 .device = (__bridge FlutterMetalDeviceHandle)_device,
84 .present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
85 .get_next_drawable_callback =
86 reinterpret_cast<FlutterMetalTextureCallback>(OnGetNextDrawable),
87 .present_drawable_callback =
88 reinterpret_cast<FlutterMetalPresentCallback>(OnPresentDrawable),
89 .external_texture_frame_callback =
90 reinterpret_cast<FlutterMetalTextureFrameCallback>(OnAcquireExternalTexture),
91 }};
92 return config;
93 }
OnAcquireExternalTexture
static bool OnAcquireExternalTexture(void *user_data, int64_t textureIdentifier, size_t width, size_t height, FlutterMetalExternalTexture *metalTexture)
Definition: FlutterRenderer.mm:25
OnGetNextDrawable
static FlutterMetalTexture OnGetNextDrawable(void *user_data, const FlutterFrameInfo *frameInfo)
Definition: FlutterRenderer.mm:15
OnPresentDrawable
static bool OnPresentDrawable(void *user_data, const FlutterMetalTexture *texture)
Definition: FlutterRenderer.mm:20
FlutterRenderer::device
FlutterTextureRegistrarDelegate id< MTLDevice > device
Definition: FlutterRenderer.h:24

References user_data.

## ◆ initWithFlutterEngine:

- (instancetype) initWithFlutterEngine: |  | (nonnull FlutterEngine*) | flutterEngine |

Intializes the renderer with the given FlutterEngine.

Definition at line 25 of file FlutterRenderer.mm.

57 :(nonnull FlutterEngine*)flutterEngine {
58 self = [super initWithDelegate:self engine:flutterEngine];
59 if (self) {
60 _device = SelectMetalDevice();
61 if (!_device) {
62 NSLog(@"Could not acquire Metal device.");
63 return nil;
64 }
65
66 _commandQueue = [_device newCommandQueue];
67 if (!_commandQueue) {
68 NSLog(@"Could not create Metal command queue.");
69 return nil;
70 }
71
72 _darwinMetalContext = [[FlutterDarwinContextMetalSkia alloc] initWithMTLDevice:_device
73 commandQueue:_commandQueue];
74 }
75 return self;
76 }
FlutterEngine
Definition: FlutterEngine.h:32

## ◆ populateTextureWithIdentifier:metalTexture:

- (BOOL) populateTextureWithIdentifier: |  | (int64_t) | textureID
metalTexture: |  | (nonnull FlutterMetalExternalTexture *) | metalTexture

Populates the texture registry with the provided metalTexture.

## Member Data Documentation

## ◆ __pad0__

- __pad0__
| protected

Definition at line 1 of file FlutterRenderer.h.

## Property Documentation

## ◆ commandQueue

- (id<MTLCommandQueue>) commandQueue
| read nonatomic assign

Used to get the command buffers for the MTLDevice to render to.

Definition at line 29 of file FlutterRenderer.h.

## ◆ device

- (FlutterTextureRegistrarDelegate id<MTLDevice>) device
| read nonatomic assign

Interface to the system GPU. Used to issue all the rendering commands.

Definition at line 24 of file FlutterRenderer.h.

The documentation for this class was generated from the following files:

- shell/platform/darwin/macos/framework/Source/FlutterRenderer.h
- shell/platform/darwin/macos/framework/Source/FlutterRenderer.mm