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"
10 
11 #if SHELL_ENABLE_METAL
14 #endif // SHELL_ENABLE_METAL
15 
16 namespace flutter {
17 
18 IOSContext::IOSContext(MsaaSampleCount msaa_samples) : msaa_samples_(msaa_samples) {}
19 
20 IOSContext::~IOSContext() = default;
21 
22 std::unique_ptr<IOSContext> IOSContext::Create(
23  IOSRenderingAPI api,
24  IOSRenderingBackend backend,
25  MsaaSampleCount msaa_samples,
26  const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
27  switch (api) {
29  FML_CHECK(backend != IOSRenderingBackend::kImpeller)
30  << "Software rendering is incompatible with Impeller.\n"
31  "Software rendering may have been automatically selected when running on a simulator "
32  "in an environment that does not support Metal. Enabling GPU pass through in your "
33  "environment may fix this. If that is not possible, then disable Impeller.";
34  return std::make_unique<IOSContextSoftware>();
35 #if SHELL_ENABLE_METAL
37  switch (backend) {
39  return std::make_unique<IOSContextMetalSkia>(msaa_samples);
41  return std::make_unique<IOSContextMetalImpeller>(is_gpu_disabled_sync_switch);
42  }
43 #endif // SHELL_ENABLE_METAL
44  default:
45  break;
46  }
47  FML_CHECK(false);
48  return nullptr;
49 }
50 
53 }
54 
55 std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {
56  return nullptr;
57 }
58 
59 } // 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
flutter::IOSContext::IOSContext
IOSContext(MsaaSampleCount msaa_samples)
Definition: ios_context.mm:18
flutter::IOSContext::Create
static std::unique_ptr< IOSContext > Create(IOSRenderingAPI api, IOSRenderingBackend backend, MsaaSampleCount msaa_samples, 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:22
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:51
flutter::IOSRenderingAPI::kMetal
@ kMetal
rendering_api_selection.h
ios_context_software.h
ios_context.h
flutter::IOSRenderingAPI::kSoftware
@ kSoftware
flutter::IOSContext::GetImpellerContext
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
Definition: ios_context.mm:55