20 id<MTLDevice>
device = MTLCreateSystemDefaultDevice();
24- (instancetype)initWithMTLDevice:(
id<MTLDevice>)device
25 commandQueue:(
id<MTLCommandQueue>)commandQueue {
42 [_commandQueue setLabel:@"Flutter Main Queue"];
44 CVReturn cvReturn = CVMetalTextureCacheCreate(kCFAllocatorDefault,
50 if (cvReturn != kCVReturnSuccess) {
58 _mainContext = [
self createGrContext];
59 _resourceContext = [
self createGrContext];
61 if (!_mainContext || !_resourceContext) {
66 FML_LOG(IMPORTANT) <<
"Using the Skia rendering backend (Metal).";
68 _resourceContext->setResourceCacheLimit(0u);
74 const auto contextOptions =
76 id<MTLDevice>
device = _device;
82 commandQueue:(
id<MTLCommandQueue>)commandQueue {
83 const auto contextOptions =
88 backendContext.
fDevice.reset((__bridge_retained
void*)
device);
95 CFRelease(_textureCache);
100 createExternalTextureWithIdentifier:(int64_t)textureID
SK_API sk_sp< GrDirectContext > MakeMetal(const GrMtlBackendContext &, const GrContextOptions &)
sk_cfp< GrMTLHandle > fDevice
sk_cfp< GrMTLHandle > fQueue