Flutter Engine
The Flutter Engine
Instance Methods | Properties | List of all members
SkiaMetalContext Class Reference
Inheritance diagram for SkiaMetalContext:
SkiaContext

Instance Methods

(instancetype) - init
 
(UIView *) - makeViewWithController:withFrame:
 
(SkiaViewController *) - getViewController:
 
(UIView *) - makeViewWithController:withFrame:
 
(SkiaViewController *) - getViewController:
 

Properties

id< MTLDevice > metalDevice
 
id< MTLCommandQueue > metalQueue
 

Detailed Description

Definition at line 73 of file SkiaMetalContext.mm.

Method Documentation

◆ getViewController:

- (SkiaViewController *) getViewController: (UIView*)  view

Reimplemented from SkiaContext.

Definition at line 75 of file SkiaMetalContext.mm.

115 :(UIView*)view {
116 return [view isKindOfClass:[SkiaMtkView class]] ? [(SkiaMtkView*)view controller] : nil;
117}

◆ init

- (instancetype) init
Initial value:

Definition at line 75 of file SkiaMetalContext.mm.

85 {
86 self = [super init];
87 [self setMetalDevice:MTLCreateSystemDefaultDevice()];
88 if(![self metalDevice]) {
89 NSLog(@"Metal is not supported on this device");
90 return nil;
91 }
92 [self setMetalQueue:[[self metalDevice] newCommandQueue]];
93 GrMtlBackendContext backendContext = {};
94 backendContext.fDevice.reset((__bridge void*)[self metalDevice]);
95 backendContext.fQueue.reset((__bridge void*)[self metalQueue]);
97
98 if (!fDContext) {
99 NSLog(@"GrDirectContexts::MakeMetal failed");
100 return nil;
101 }
102 return self;
103}
id< MTLCommandQueue > metalQueue
id< MTLDevice > metalDevice
SK_API sk_sp< GrDirectContext > MakeMetal(const GrMtlBackendContext &, const GrContextOptions &)
sk_cfp< GrMTLHandle > fDevice
sk_cfp< GrMTLHandle > fQueue

◆ makeViewWithController:withFrame:

- (UIView *) makeViewWithController: (SkiaViewController*)  vc
withFrame: (CGRect)  frame 

Reimplemented from SkiaContext.

Definition at line 75 of file SkiaMetalContext.mm.

105 :(SkiaViewController*)vc withFrame:(CGRect)frame {
106 SkiaMtkView* skiaView = [[SkiaMtkView alloc] initWithFrame:frame
107 device:[self metalDevice]
108 queue:[self metalQueue]
109 grDevice:fDContext.get()];
110 [skiaView setPreferredFramesPerSecond:30];
111 [skiaView setController:vc];
112 return skiaView;
113}
double frame
Definition: examples.cpp:31

Property Documentation

◆ metalDevice

- (id<MTLDevice>) metalDevice
readwriteatomicstrong

Definition at line 74 of file SkiaMetalContext.mm.

◆ metalQueue

- (id<MTLCommandQueue>) metalQueue
readwriteatomicstrong

Definition at line 75 of file SkiaMetalContext.mm.


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