| 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
5 #import "flutter/shell/platform/darwin/ios/ios_context.h"
6
7 #include "flutter/fml/logging.h"
8 #import "flutter/shell/platform/darwin/ios/ios_context_software.h"
9
10 #if SHELL_ENABLE_METAL
11 #import "flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h"
12 #import "flutter/shell/platform/darwin/ios/ios_context_metal_skia.h"
13 #endif // SHELL_ENABLE_METAL
14
15 namespace flutter {
16
17 IOSContext::IOSContext(MsaaSampleCount msaa_samples) : msaa_samples_(msaa_samples) {}
18
19 IOSContext::~IOSContext() = default;
20
21 std::unique_ptr<IOSContext> IOSContext::Create(
22 IOSRenderingAPI api,
23 IOSRenderingBackend backend,
24 MsaaSampleCount msaa_samples,
25 std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch) {
26 switch (api) {
27 case IOSRenderingAPI::kSoftware:
28 return std::make_unique<IOSContextSoftware>();
29 #if SHELL_ENABLE_METAL
30 case IOSRenderingAPI::kMetal:
31 switch (backend) {
32 case IOSRenderingBackend::kSkia:
33 return std::make_unique<IOSContextMetalSkia>(msaa_samples);
34 case IOSRenderingBackend::kImpeller:
35 return std::make_unique<IOSContextMetalImpeller>(std::move(is_gpu_disabled_sync_switch));
36 }
37 #endif // SHELL_ENABLE_METAL
38 default:
39 break;
40 }
41 FML_CHECK(false);
42 return nullptr;
43 }
44
45 IOSRenderingBackend IOSContext::GetBackend() const {
46 return IOSRenderingBackend::kSkia;
47 }
48
49 std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {
50 return nullptr;
51 }
52
53 } // 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:17
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::Create
static std::unique_ptr< IOSContext > Create(IOSRenderingAPI api, IOSRenderingBackend backend, MsaaSampleCount msaa_samples, 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::GetBackend
virtual IOSRenderingBackend GetBackend() const
Get the rendering backend used by this context.
Definition: ios_context.mm:45
flutter::IOSRenderingAPI::kMetal
@ kMetal
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:49