| 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 62 of file FlutterRenderer.mm.

62 {
63 FlutterRendererConfig config = {
64 .type = FlutterRendererType::kMetal,
65 .metal = {
66 .struct_size = sizeof(FlutterMetalRendererConfig),
67 .device = (__bridge FlutterMetalDeviceHandle)_device,
68 .present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
69 .get_next_drawable_callback =
70 reinterpret_cast<FlutterMetalTextureCallback>(OnGetNextDrawable),
71 .present_drawable_callback =
72 reinterpret_cast<FlutterMetalPresentCallback>(OnPresentDrawable),
73 .external_texture_frame_callback =
74 reinterpret_cast<FlutterMetalTextureFrameCallback>(OnAcquireExternalTexture),
75 }};
76 return config;
77 }

References OnAcquireExternalTexture(), OnGetNextDrawable(), and OnPresentDrawable().

## ◆ initWithFlutterEngine:

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

Initial value:
{
FlutterDarwinContextMetalSkia* _darwinMetalContext

Intializes the renderer with the given FlutterEngine.

Definition at line 41 of file FlutterRenderer.mm.

41 :(nonnull FlutterEngine*)flutterEngine {
42 self = [super initWithDelegate:self engine:flutterEngine];
43 if (self) {
44 _device = MTLCreateSystemDefaultDevice();
45 if (!_device) {
46 NSLog(@"Could not acquire Metal device.");
47 return nil;
48 }
49
50 _commandQueue = [_device newCommandQueue];
51 if (!_commandQueue) {
52 NSLog(@"Could not create Metal command queue.");
53 return nil;
54 }
55
56 _darwinMetalContext = [[FlutterDarwinContextMetalSkia alloc] initWithMTLDevice:_device
57 commandQueue:_commandQueue];
58 }
59 return self;
60 }

## ◆ 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 19 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

FlutterEngine
Definition: FlutterEngine.h:30
FlutterRenderer::device
FlutterTextureRegistrarDelegate id< MTLDevice > device
Definition: FlutterRenderer.h:24
OnPresentDrawable
static bool OnPresentDrawable(FlutterEngine *engine, const FlutterMetalTexture *texture)
Definition: FlutterRenderer.mm:21
OnAcquireExternalTexture
static bool OnAcquireExternalTexture(FlutterEngine *engine, int64_t textureIdentifier, size_t width, size_t height, FlutterMetalExternalTexture *metalTexture)
Definition: FlutterRenderer.mm:26
OnGetNextDrawable
static FlutterMetalTexture OnGetNextDrawable(FlutterEngine *engine, const FlutterFrameInfo *frameInfo)
Definition: FlutterRenderer.mm:15