| 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.

80 {
81 FlutterRendererConfig config = {
82 .type = FlutterRendererType::kMetal,
83 .metal = {
84 .struct_size = sizeof(FlutterMetalRendererConfig),
85 .device = (__bridge FlutterMetalDeviceHandle)_device,
86 .present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
87 .get_next_drawable_callback =
88 reinterpret_cast<FlutterMetalTextureCallback>(OnGetNextDrawable),
89 .present_drawable_callback =
90 reinterpret_cast<FlutterMetalPresentCallback>(OnPresentDrawable),
91 .external_texture_frame_callback =
92 reinterpret_cast<FlutterMetalTextureFrameCallback>(OnAcquireExternalTexture),
93 }};
94 return config;
95 }
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.

59 :(nonnull FlutterEngine*)flutterEngine {
60 self = [super initWithDelegate:self engine:flutterEngine];
61 if (self) {
62 _device = SelectMetalDevice();
63 if (!_device) {
64 NSLog(@"Could not acquire Metal device.");
65 return nil;
66 }
67
68 _commandQueue = [_device newCommandQueue];
69 if (!_commandQueue) {
70 NSLog(@"Could not create Metal command queue.");
71 return nil;
72 }
73
74 _darwinMetalContext = [[FlutterDarwinContextMetalSkia alloc] initWithMTLDevice:_device
75 commandQueue:_commandQueue];
76 }
77 return self;
78 }
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
| readnonatomicassign

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
| readnonatomicassign

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