Flutter Engine
The Flutter Engine
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:
 
(BOOL- populateTextureWithIdentifier:metalTexture: [implementation]
 
(FlutterExternalTexture *) - onRegisterTexture: [implementation]
 

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.

62 {
63 FlutterRendererConfig config = {
65 .metal = {
66 .struct_size = sizeof(FlutterMetalRendererConfig),
67 .device = (__bridge FlutterMetalDeviceHandle)_device,
68 .present_command_queue = (__bridge FlutterMetalCommandQueueHandle)_commandQueue,
69 .get_next_drawable_callback =
71 .present_drawable_callback =
73 .external_texture_frame_callback =
75 }};
76 return config;
77}
static bool OnAcquireExternalTexture(void *user_data, int64_t textureIdentifier, size_t width, size_t height, FlutterMetalExternalTexture *metalTexture)
static FlutterMetalTexture OnGetNextDrawable(void *user_data, const FlutterFrameInfo *frameInfo)
static bool OnPresentDrawable(void *user_data, const FlutterMetalTexture *texture)
bool(* FlutterMetalPresentCallback)(void *, const FlutterMetalTexture *)
Definition: embedder.h:679
const void * FlutterMetalDeviceHandle
Alias for id<MTLDevice>.
Definition: embedder.h:596
@ kMetal
Definition: embedder.h:85
bool(* FlutterMetalTextureFrameCallback)(void *, int64_t, size_t, size_t, FlutterMetalExternalTexture *)
Definition: embedder.h:642
const void * FlutterMetalCommandQueueHandle
Alias for id<MTLCommandQueue>.
Definition: embedder.h:599
FlutterMetalTexture(* FlutterMetalTextureCallback)(void *, const FlutterFrameInfo *)
Callback for when a metal texture is requested.
Definition: embedder.h:672
FlutterTextureRegistrarDelegate id< MTLDevice > device
FlutterRendererType type
Definition: embedder.h:827

◆ initWithFlutterEngine:

- (instancetype) initWithFlutterEngine: (nonnull FlutterEngine*)  flutterEngine
Initial value:

Intializes the renderer with the given FlutterEngine.

Definition at line 25 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}

◆ onRegisterTexture:

- (FlutterExternalTexture *) onRegisterTexture: (id<FlutterTexture>)  texture
implementation

Definition at line 25 of file FlutterRenderer.mm.

89 :(id<FlutterTexture>)texture {
90 return [[FlutterExternalTexture alloc] initWithFlutterTexture:texture
91 darwinMetalContext:_darwinMetalContext];
92}
FlTexture * texture

◆ populateTextureWithIdentifier:metalTexture: [1/2]

- (BOOL) populateTextureWithIdentifier: (int64_t)  textureID
metalTexture: (FlutterMetalExternalTexture*)  textureOut 
implementation

Definition at line 25 of file FlutterRenderer.mm.

81 :(int64_t)textureID
82 metalTexture:(FlutterMetalExternalTexture*)textureOut {
83 FlutterExternalTexture* texture = [self getTextureWithID:textureID];
84 return [texture populateTexture:textureOut];
85}
BOOL populateTexture:(nonnull FlutterMetalExternalTexture *metalTexture)

◆ populateTextureWithIdentifier:metalTexture: [2/2]

- (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: