Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Instance Methods | Properties | List of all members
FlutterDarwinContextMetalImpeller Class Reference

#include <FlutterDarwinContextMetalImpeller.h>

Inheritance diagram for FlutterDarwinContextMetalImpeller:

Instance Methods

(instancetype) - init:
 
(FlutterDarwinExternalTextureMetal *) - createExternalTextureWithIdentifier:texture:
 

Properties

std::shared_ptr< impeller::ContextMTLcontext
 
fml::CFRef< CVMetalTextureCacheRef > textureCache
 

Detailed Description

Provides skia GrContexts that are shared between iOS and macOS embeddings.

Definition at line 23 of file FlutterDarwinContextMetalImpeller.h.

Method Documentation

◆ createExternalTextureWithIdentifier:texture:

- (FlutterDarwinExternalTextureMetal *) createExternalTextureWithIdentifier: (int64_t)  textureID
texture: (NSObject<FlutterTexture>*)  texture 

Creates an external texture with the specified ID and contents.

Definition at line 22 of file FlutterDarwinContextMetalImpeller.mm.

76 :(int64_t)textureID
77 texture:(NSObject<FlutterTexture>*)texture {
78 return [[FlutterDarwinExternalTextureMetal alloc] initWithTextureCache:_textureCache
79 textureID:textureID
81 enableImpeller:YES];
82}
FlTexture * texture

◆ init:

- (instancetype) init: (const std::shared_ptr<const fml::SyncSwitch>&)  is_gpu_disabled_sync_switch

Initializes a FlutterDarwinContextMetalImpeller.

Definition at line 22 of file FlutterDarwinContextMetalImpeller.mm.

48 :(const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch {
49 self = [super init];
50 if (self != nil) {
51 _context = CreateImpellerContext(is_gpu_disabled_sync_switch);
52 id<MTLDevice> device = _context->GetMTLDevice();
53 if (!device) {
54 FML_DLOG(ERROR) << "Could not acquire Metal device.";
55 return nil;
56 }
57
58 CVMetalTextureCacheRef textureCache;
59 CVReturn cvReturn = CVMetalTextureCacheCreate(kCFAllocatorDefault, // allocator
60 nil, // cache attributes (nil default)
61 device, // metal device
62 nil, // texture attributes (nil default)
63 &textureCache // [out] cache
64 );
65
66 if (cvReturn != kCVReturnSuccess) {
67 FML_DLOG(ERROR) << "Could not create Metal texture cache.";
68 return nil;
69 }
70 _textureCache.Reset(textureCache);
71 }
72 return self;
73}
static FLUTTER_ASSERT_ARC std::shared_ptr< impeller::ContextMTL > CreateImpellerContext(const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
VkDevice device
Definition main.cc:53
#define FML_DLOG(severity)
Definition logging.h:102
fml::CFRef< CVMetalTextureCacheRef > textureCache
#define ERROR(message)

Property Documentation

◆ context

- (shared_ptr<)impeller:
readnonatomicassign

Impeller context.

Definition at line 40 of file FlutterDarwinContextMetalImpeller.h.

◆ textureCache

- (CFRef<CVMetalTextureCacheRef>) FlutterDarwinContextMetalImpeller:
readnonatomicassign

Definition at line 45 of file FlutterDarwinContextMetalImpeller.h.


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