Flutter Engine
 
Loading...
Searching...
No Matches
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
7#include <memory>
8
10#import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
14
16
17namespace flutter {
18
19IOSContext::IOSContext() = default;
20
21IOSContext::~IOSContext() = default;
22
23std::unique_ptr<IOSContext> IOSContext::Create(
25 IOSRenderingBackend backend,
26 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch,
27 const Settings& settings) {
28 switch (api) {
30 [FlutterLogger logImportant:@"Software rendering is incompatible with Impeller.\n"
31 "Software rendering may have been automatically selected when "
32 "running on a simulator in an environment that does not support "
33 "Metal. Enabling GPU passthrough in your environment may fix "
34 "this."];
35 return std::make_unique<IOSContextNoop>();
37 switch (backend) {
39 [FlutterLogger logFatal:@"Impeller opt-out unavailable."];
40 return nullptr;
42 return std::make_unique<IOSContextMetalImpeller>(settings, is_gpu_disabled_sync_switch);
43 }
44 default:
45 break;
46 }
47 FML_CHECK(false);
48 return nullptr;
49}
50
52 // Overridden by Impeller subclasses.
54}
55
56std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {
57 return nullptr;
58}
59
60std::shared_ptr<impeller::AiksContext> IOSContext::GetAiksContext() const {
61 return nullptr;
62}
63
64} // namespace flutter
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
static std::unique_ptr< IOSContext > Create(IOSRenderingAPI api, IOSRenderingBackend backend, const std::shared_ptr< const fml::SyncSwitch > &is_gpu_disabled_sync_switch, const Settings &settings)
Create an iOS context object capable of creating the on-screen and off-screen GPU context for use by ...
virtual ~IOSContext()
Collects the context object. This must happen on the thread on which this object was created.
virtual IOSRenderingBackend GetBackend() const
Get the rendering backend used by this context.
virtual std::shared_ptr< impeller::AiksContext > GetAiksContext() const
#define FML_CHECK(condition)
Definition logging.h:104