Flutter Engine
The 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
5#include "flutter/shell/platform/darwin/ios/ios_context.h"
6#include "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
7
8#include "flutter/fml/logging.h"
9#include "flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h"
10#include "flutter/shell/platform/darwin/ios/ios_context_metal_skia.h"
11#include "flutter/shell/platform/darwin/ios/ios_context_software.h"
12
14
15namespace flutter {
16
17IOSContext::IOSContext(MsaaSampleCount msaa_samples) : msaa_samples_(msaa_samples) {}
18
19IOSContext::~IOSContext() = default;
20
21std::unique_ptr<IOSContext> IOSContext::Create(
23 IOSRenderingBackend backend,
24 MsaaSampleCount msaa_samples,
25 const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch) {
26 switch (api) {
29 << "Software rendering is incompatible with Impeller.\n"
30 "Software rendering may have been automatically selected when running on a simulator "
31 "in an environment that does not support Metal. Enabling GPU pass through in your "
32 "environment may fix this. If that is not possible, then disable Impeller.";
33 return std::make_unique<IOSContextSoftware>();
35 switch (backend) {
37 return std::make_unique<IOSContextMetalSkia>(msaa_samples);
39 return std::make_unique<IOSContextMetalImpeller>(is_gpu_disabled_sync_switch);
40 }
41 default:
42 break;
43 }
44 FML_CHECK(false);
45 return nullptr;
46}
47
51
52std::shared_ptr<impeller::Context> IOSContext::GetImpellerContext() const {
53 return nullptr;
54}
55
56} // namespace flutter
const char * backend
virtual std::shared_ptr< impeller::Context > GetImpellerContext() const
virtual ~IOSContext()
Collects the context object. This must happen on the thread on which this object was created.
IOSContext(MsaaSampleCount msaa_samples)
virtual IOSRenderingBackend GetBackend() const
Get the rendering backend used by this context.
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 ...
#define FML_CHECK(condition)
Definition logging.h:85
MsaaSampleCount