Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 : IOSContext(MsaaSampleCount::kFour),
16 darwin_context_metal_impeller_(fml::scoped_nsobject<FlutterDarwinContextMetalImpeller>{
17 [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]}) {}
18
19IOSContextMetalImpeller::~IOSContextMetalImpeller() = default;
20
21IOSRenderingBackend IOSContextMetalImpeller::GetBackend() const {
22 return IOSRenderingBackend::kImpeller;
23}
24
25sk_sp<GrDirectContext> IOSContextMetalImpeller::GetMainContext() const {
26 return nullptr;
27}
28
29sk_sp<GrDirectContext> IOSContextMetalImpeller::GetResourceContext() const {
30 return nullptr;
31}
32
33// |IOSContext|
34sk_sp<GrDirectContext> IOSContextMetalImpeller::CreateResourceContext() {
35 return nullptr;
36}
37
38// |IOSContext|
39std::shared_ptr<impeller::Context> IOSContextMetalImpeller::GetImpellerContext() const {
40 return darwin_context_metal_impeller_.get().context;
41}
42
43// |IOSContext|
44std::unique_ptr<GLContextResult> IOSContextMetalImpeller::MakeCurrent() {
45 // This only makes sense for contexts that need to be bound to a specific thread.
46 return std::make_unique<GLContextDefaultResult>(true);
47}
48
49// |IOSContext|
50std::unique_ptr<Texture> IOSContextMetalImpeller::CreateExternalTexture(
51 int64_t texture_id,
52 fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
53 return std::make_unique<IOSExternalTextureMetal>(
55 createExternalTextureWithIdentifier:texture_id
57}
58
59} // namespace flutter
IOSContextMetalImpeller(const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
T * get() const
Definition SkRefCnt.h:303
FlTexture * texture
MsaaSampleCount
init(device_serial, adb_binary)
Definition _adb_path.py:12
int64_t texture_id