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 
7 
8 #include "flutter/fml/logging.h"
12 
14 
15 namespace flutter {
16 
17 IOSContext::IOSContext() = default;
18 
19 IOSContext::~IOSContext() = default;
20 
21 std::unique_ptr<IOSContext> IOSContext::Create(
22  IOSRenderingAPI api,
23  IOSRenderingBackend backend,
24  const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
25  switch (api) {
27  FML_CHECK(backend != IOSRenderingBackend::kImpeller)
28  << "Software rendering is incompatible with Impeller.\n"
29  "Software rendering may have been automatically selected when running on a simulator "
30  "in an environment that does not support Metal. Enabling GPU pass through in your "
31  "environment may fix this. If that is not possible, then disable Impeller.";
32  return std::make_unique<IOSContextSoftware>();
34  switch (backend) {
36 #if !SLIMPELLER
37  return std::make_unique<IOSContextMetalSkia>();
38 #else // !SLIMPELLER
39  FML_LOG(FATAL) << "Impeller opt-out unavailable.";
40  return nullptr;
41 #endif // !SLIMPELLER
43  return std::make_unique<IOSContextMetalImpeller>(is_gpu_disabled_sync_switch);
44  }
45  default:
46  break;
47  }
48  FML_CHECK(false);
49  return nullptr;
50 }
51 
54 }
55 
56 std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {
57  return nullptr;
58 }
59 
60 } // 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_metal_impeller.h
ios_context_metal_skia.h
flutter::IOSRenderingBackend
IOSRenderingBackend
Definition: rendering_api_selection.h:19
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:52
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:21
flutter::IOSContext::GetImpellerContext
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
Definition: ios_context.mm:56