Flutter Engine
The Flutter Engine
ios_context_metal_skia.mm
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#if !SLIMPELLER
6
7#import "flutter/shell/platform/darwin/ios/ios_context_metal_skia.h"
8
9#include "flutter/common/graphics/persistent_cache.h"
10#include "flutter/fml/logging.h"
11#import "flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.h"
12#import "flutter/shell/platform/darwin/ios/ios_external_texture_metal.h"
14
16
17namespace flutter {
18
21 [[FlutterDarwinContextMetalSkia alloc] initWithDefaultMTLDevice]};
22}
23
25
27 return darwin_context_metal_;
28}
29
32}
33
35 return darwin_context_metal_.get().mainContext;
36}
37
39 return darwin_context_metal_.get().resourceContext;
40}
41
42// |IOSContext|
43sk_sp<GrDirectContext> IOSContextMetalSkia::CreateResourceContext() {
44 return darwin_context_metal_.get().resourceContext;
45}
46
47// |IOSContext|
48std::unique_ptr<GLContextResult> IOSContextMetalSkia::MakeCurrent() {
49 // This only makes sense for context that need to be bound to a specific thread.
50 return std::make_unique<GLContextDefaultResult>(true);
51}
52
53// |IOSContext|
54std::unique_ptr<Texture> IOSContextMetalSkia::CreateExternalTexture(
55 int64_t texture_id,
56 fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
57 return std::make_unique<IOSExternalTextureMetal>(
59 [darwin_context_metal_ createExternalTextureWithIdentifier:texture_id texture:texture]});
60}
61
62} // namespace flutter
63
64#endif // !SLIMPELLER
IOSRenderingBackend GetBackend() const override
Get the rendering backend used by this context.
sk_sp< GrDirectContext > GetResourceContext() const
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
fml::scoped_nsobject< FlutterDarwinContextMetalSkia > GetDarwinContext() const
T get() const __attribute((ns_returns_not_retained))
FlTexture * texture
int64_t texture_id