Flutter iOS Embedder
ios_context.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 <memory>
8 
9 #include "flutter/fml/logging.h"
14 
16 
17 namespace flutter {
18 
19 IOSContext::IOSContext() = default;
20 
21 IOSContext::~IOSContext() = default;
22 
23 std::unique_ptr<IOSContext> IOSContext::Create(
24  IOSRenderingAPI api,
25  IOSRenderingBackend backend,
26  const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
27  switch (api) {
29  if (backend == IOSRenderingBackend::kImpeller) {
30  FML_LOG(IMPORTANT)
31  << "Software rendering is incompatible with Impeller.\n"
32  "Software rendering may have been automatically selected when running on a "
33  "simulator "
34  "in an environment that does not support Metal. Enabling GPU passthrough in your "
35  "environment may fix this.";
36  return std::make_unique<IOSContextNoop>();
37  }
38  return std::make_unique<IOSContextSoftware>();
40  switch (backend) {
42 #if !SLIMPELLER
43  return std::make_unique<IOSContextMetalSkia>();
44 #else // !SLIMPELLER
45  FML_LOG(FATAL) << "Impeller opt-out unavailable.";
46  return nullptr;
47 #endif // !SLIMPELLER
49  return std::make_unique<IOSContextMetalImpeller>(is_gpu_disabled_sync_switch);
50  }
51  default:
52  break;
53  }
54  FML_CHECK(false);
55  return nullptr;
56 }
57 
60 }
61 
62 std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {
63  return nullptr;
64 }
65 
66 std::shared_ptr<impeller::AiksContext> IOSContext::GetAiksContext() const {
67  return nullptr;
68 }
69 
70 } // namespace flutter
flutter::IOSRenderingBackend::kSkia
@ kSkia
flutter::IOSContext::~IOSContext
virtual ~IOSContext()
Collects the context object. This must happen on the thread on which this object was created.
ios_context_noop.h
ios_context_metal_impeller.h
ios_context_metal_skia.h
flutter::IOSRenderingBackend
IOSRenderingBackend
Definition: rendering_api_selection.h:19
flutter::IOSContext::GetAiksContext
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const
Definition: ios_context.mm:66
flutter::IOSRenderingBackend::kImpeller
@ kImpeller
flutter
Definition: accessibility_bridge.h:28
flutter::IOSRenderingAPI
IOSRenderingAPI
Definition: rendering_api_selection.h:14
flutter::IOSContext::GetBackend
virtual IOSRenderingBackend GetBackend() const
Get the rendering backend used by this context.
Definition: ios_context.mm:58
flutter::IOSRenderingAPI::kMetal
@ kMetal
rendering_api_selection.h
ios_context_software.h
flutter::IOSContext::IOSContext
IOSContext()
ios_context.h
flutter::IOSRenderingAPI::kSoftware
@ kSoftware
FLUTTER_ASSERT_ARC
Definition: FlutterChannelKeyResponder.mm:13
flutter::IOSContext::Create
static std::unique_ptr< IOSContext > Create(IOSRenderingAPI api, IOSRenderingBackend backend, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch)
Create an iOS context object capable of creating the on-screen and off-screen GPU context for use by ...
Definition: ios_context.mm:23
flutter::IOSContext::GetImpellerContext
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
Definition: ios_context.mm:62