Flutter Engine
The Flutter Engine
ios_context_metal_impeller.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#import "flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h"
6#include "flutter/impeller/entity/mtl/entity_shaders.h"
7#import "flutter/shell/platform/darwin/ios/ios_external_texture_metal.h"
8
10
11namespace flutter {
12
14 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
15 : darwin_context_metal_impeller_(fml::scoped_nsobject<FlutterDarwinContextMetalImpeller>{
16 [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]}) {}
17
18IOSContextMetalImpeller::~IOSContextMetalImpeller() = default;
19
20IOSRenderingBackend IOSContextMetalImpeller::GetBackend() const {
21 return IOSRenderingBackend::kImpeller;
22}
23
24sk_sp<GrDirectContext> IOSContextMetalImpeller::GetMainContext() const {
25 return nullptr;
26}
27
28sk_sp<GrDirectContext> IOSContextMetalImpeller::GetResourceContext() const {
29 return nullptr;
30}
31
32// |IOSContext|
33sk_sp<GrDirectContext> IOSContextMetalImpeller::CreateResourceContext() {
34 return nullptr;
35}
36
37// |IOSContext|
38std::shared_ptr<impeller::Context> IOSContextMetalImpeller::GetImpellerContext() const {
39 return darwin_context_metal_impeller_.get().context;
40}
41
42// |IOSContext|
43std::unique_ptr<GLContextResult> IOSContextMetalImpeller::MakeCurrent() {
44 // This only makes sense for contexts that need to be bound to a specific thread.
45 return std::make_unique<GLContextDefaultResult>(true);
46}
47
48// |IOSContext|
49std::unique_ptr<Texture> IOSContextMetalImpeller::CreateExternalTexture(
50 int64_t texture_id,
51 fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
52 return std::make_unique<IOSExternalTextureMetal>(
54 createExternalTextureWithIdentifier:texture_id
56}
57
58} // namespace flutter
IOSContextMetalImpeller(const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
T * get() const
Definition: SkRefCnt.h:303
FlTexture * texture
static bool init()
Definition: ascii_trie.cc:9
int64_t texture_id