Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
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.

65 :(int64_t)textureID
66 texture:(NSObject<FlutterTexture>*)texture {
67 return [[FlutterDarwinExternalTextureMetal alloc] initWithTextureCache:_textureCache
68 textureID:textureID
70 enableImpeller:YES];
71}
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 if (flags.use_sdfs) {
43 FML_LOG(IMPORTANT) << "Using the Impeller rendering backend (MetalSDF).";
44 } else {
45 FML_LOG(IMPORTANT) << "Using the Impeller rendering backend (Metal).";
46 }
47 id<MTLDevice> device = _context->GetMTLDevice();
48 FML_CHECK(device) << "Could not acquire Metal device.";
49
50 CVMetalTextureCacheRef textureCache;
51 CVReturn cvReturn = CVMetalTextureCacheCreate(kCFAllocatorDefault, // allocator
52 nil, // cache attributes (nil default)
53 device, // metal device
54 nil, // texture attributes (nil default)
55 &textureCache // [out] cache
56 );
57
58 FML_CHECK(cvReturn == kCVReturnSuccess) << "Could not acquire Metal device.";
59 _textureCache.Reset(textureCache);
60 }
61 return self;
62}
static std::shared_ptr< impeller::ContextMTL > CreateImpellerContext()
VkDevice device
Definition main.cc:69
#define FML_LOG(severity)
Definition logging.h:101
#define FML_CHECK(condition)
Definition logging.h:104
fml::CFRef< CVMetalTextureCacheRef > textureCache
id< FlutterKeyboardManagerEventContext > _context
Definition ref_ptr.h:261
bool use_sdfs
Use SDFs for rendering.
Definition flags.h:13

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: