Flutter Engine
 
Loading...
Searching...
No Matches
FlutterDarwinContextMetalImpeller Class Reference

#include <FlutterDarwinContextMetalImpeller.h>

Inheritance diagram for FlutterDarwinContextMetalImpeller:

Instance Methods

(instancetype) - init:gpuDisabledSyncSwitch:
 
(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 18 of file FlutterDarwinContextMetalImpeller.mm.

60 :(int64_t)textureID
61 texture:(NSObject<FlutterTexture>*)texture {
62 return [[FlutterDarwinExternalTextureMetal alloc] initWithTextureCache:_textureCache
63 textureID:textureID
65 enableImpeller:YES];
66}
FlTexture * texture

References impeller::ContextMTL::Create().

◆ init:gpuDisabledSyncSwitch:

- (instancetype) init: (const impeller::Flags&)  flags
gpuDisabledSyncSwitch: (const std::shared_ptr<const fml::SyncSwitch>&)  is_gpu_disabled_sync_switch 

Initializes a FlutterDarwinContextMetalImpeller.

Definition at line 18 of file FlutterDarwinContextMetalImpeller.mm.

35 :(const impeller::Flags&)flags
36 gpuDisabledSyncSwitch:
37 (const std::shared_ptr<const fml::SyncSwitch>&)is_gpu_disabled_sync_switch {
38 self = [super init];
39 if (self != nil) {
40 _context = CreateImpellerContext(flags, is_gpu_disabled_sync_switch);
41 FML_CHECK(_context) << "Could not create Metal Impeller Context.";
42 id<MTLDevice> device = _context->GetMTLDevice();
43 FML_CHECK(device) << "Could not acquire Metal device.";
44
45 CVMetalTextureCacheRef textureCache;
46 CVReturn cvReturn = CVMetalTextureCacheCreate(kCFAllocatorDefault, // allocator
47 nil, // cache attributes (nil default)
48 device, // metal device
49 nil, // texture attributes (nil default)
50 &textureCache // [out] cache
51 );
52
53 FML_CHECK(cvReturn == kCVReturnSuccess) << "Could not acquire Metal device.";
54 _textureCache.Reset(textureCache);
55 }
56 return self;
57}
static std::shared_ptr< impeller::ContextMTL > CreateImpellerContext()
VkDevice device
Definition main.cc:69
#define FML_CHECK(condition)
Definition logging.h:104
fml::CFRef< CVMetalTextureCacheRef > textureCache
id< FlutterKeyboardManagerEventContext > _context
Definition ref_ptr.h:261

Property Documentation

◆ context

- (shared_ptr<)impeller:
readnonatomicassign

◆ textureCache

- (CFRef<CVMetalTextureCacheRef>) FlutterDarwinContextMetalImpeller:
readnonatomicassign

Definition at line 47 of file FlutterDarwinContextMetalImpeller.h.


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