| 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 15 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.struct_size = sizeof(FlutterMetalRendererConfig),
66 .metal.device = (__bridge FlutterMetalDeviceHandle)_device,
67 .metal.present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
68 .metal.get_next_drawable_callback =
69 reinterpret_cast<FlutterMetalTextureCallback>(OnGetNextDrawable),
70 .metal.present_drawable_callback =
71 reinterpret_cast<FlutterMetalPresentCallback>(OnPresentDrawable),
72 .metal.external_texture_frame_callback =
73 reinterpret_cast<FlutterMetalTextureFrameCallback>(OnAcquireExternalTexture),
74 };
75 return config;
76 }

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 16 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 26 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 21 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
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