Flutter iOS Embedder
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 
6 #include "flutter/impeller/entity/mtl/entity_shaders.h"
8 
9 namespace flutter {
10 
12  const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch)
13  : IOSContext(MsaaSampleCount::kFour),
14  darwin_context_metal_impeller_(fml::scoped_nsobject<FlutterDarwinContextMetalImpeller>{
15  [[FlutterDarwinContextMetalImpeller alloc] init:is_gpu_disabled_sync_switch]}) {}
16 
18 
19 fml::scoped_nsobject<FlutterDarwinContextMetalSkia> IOSContextMetalImpeller::GetDarwinContext()
20  const {
21  return fml::scoped_nsobject<FlutterDarwinContextMetalSkia>{};
22 }
23 
26 }
27 
28 sk_sp<GrDirectContext> IOSContextMetalImpeller::GetMainContext() const {
29  return nullptr;
30 }
31 
32 sk_sp<GrDirectContext> IOSContextMetalImpeller::GetResourceContext() const {
33  return nullptr;
34 }
35 
36 // |IOSContext|
37 sk_sp<GrDirectContext> IOSContextMetalImpeller::CreateResourceContext() {
38  return nullptr;
39 }
40 
41 // |IOSContext|
42 std::shared_ptr<impeller::Context> IOSContextMetalImpeller::GetImpellerContext() const {
43  return darwin_context_metal_impeller_.get().context;
44 }
45 
46 // |IOSContext|
47 std::unique_ptr<GLContextResult> IOSContextMetalImpeller::MakeCurrent() {
48  // This only makes sense for contexts that need to be bound to a specific thread.
49  return std::make_unique<GLContextDefaultResult>(true);
50 }
51 
52 // |IOSContext|
53 std::unique_ptr<Texture> IOSContextMetalImpeller::CreateExternalTexture(
54  int64_t texture_id,
55  fml::scoped_nsobject<NSObject<FlutterTexture>> texture) {
56  return std::make_unique<IOSExternalTextureMetal>(
57  fml::scoped_nsobject<FlutterDarwinExternalTextureMetal>{
58  [[darwin_context_metal_impeller_ createExternalTextureWithIdentifier:texture_id
59  texture:texture] retain]});
60 }
61 
62 } // namespace flutter
flutter::IOSContextMetalImpeller::~IOSContextMetalImpeller
~IOSContextMetalImpeller()
ios_context_metal_impeller.h
flutter::IOSContextMetalImpeller::GetResourceContext
sk_sp< GrDirectContext > GetResourceContext() const
flutter::IOSContextMetalImpeller::GetMainContext
sk_sp< GrDirectContext > GetMainContext() const override
Accessor for the Skia context associated with IOSSurfaces and the raster thread.
flutter::IOSContextMetalImpeller::GetDarwinContext
fml::scoped_nsobject< FlutterDarwinContextMetalSkia > GetDarwinContext() const
flutter::IOSRenderingBackend
IOSRenderingBackend
Definition: rendering_api_selection.h:19
flutter::IOSRenderingBackend::kImpeller
@ kImpeller
flutter
Definition: accessibility_bridge.h:28
ios_external_texture_metal.h
flutter::IOSContextMetalImpeller::IOSContextMetalImpeller
IOSContextMetalImpeller(const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
texture_id
int64_t texture_id
Definition: texture_registrar_unittests.cc:24
flutter::IOSContextMetalImpeller::GetBackend
IOSRenderingBackend GetBackend() const override
Get the rendering backend used by this context.