9 #include "flutter/common/graphics/persistent_cache.h"
10 #include "flutter/fml/logging.h"
11 #import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
13 #include "third_party/skia/include/gpu/ganesh/GrContextOptions.h"
20 darwin_context_metal_ = fml::scoped_nsobject<FlutterDarwinContextMetalSkia>{
21 [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]};
27 return darwin_context_metal_;
35 return darwin_context_metal_.get().mainContext;
39 return darwin_context_metal_.get().resourceContext;
43 sk_sp<GrDirectContext> IOSContextMetalSkia::CreateResourceContext() {
44 return darwin_context_metal_.get().resourceContext;
48 std::unique_ptr<GLContextResult> IOSContextMetalSkia::MakeCurrent() {
50 return std::make_unique<GLContextDefaultResult>(
true);
54 std::unique_ptr<Texture> IOSContextMetalSkia::CreateExternalTexture(
56 fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
57 return std::make_unique<IOSExternalTextureMetal>(
58 fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>{
59 [darwin_context_metal_ createExternalTextureWithIdentifier:
texture_id texture:texture]});