Skip to content

Commit d599d3e

Browse files
committed
iOS: Remove software renderer/headless fallback
iOS is Impeller-only and requires iOS 15, so there is no software renderer. The `IOSRenderingAPI::kSoftware` path doesn't actually render in software: on a simulator whose host exposed no Metal device it selects a no-op context and surface that draw nothing. This removes that fallback and instead fails immediately when Metal is unavailable. This matches the existing runtime behaviour (which already `FML_CHECK`ed) and the macOS embedder, which refuses to start without a Metal device. The no-op path was added in flutter-team-archive/engine#54856 to stop Impeller-enabled simulators from exiting when no Metal context was available. That goes back way before we bumped the minimum supported iOS version to 15. Every device capable of running iOS 15 has a Metal-capable GPU, and a simulator requires a host with Metal support, so the fallback isn't necessary and a source of additonal complexity and possibly bugs from misconfigured environments. `GPUSurfaceNoop` is now unused and `IOSRenderingAPI` is down to just one enum value. I'l remove both in followups. Issue: flutter#190041
1 parent ebd8429 commit d599d3e

11 files changed

Lines changed: 10 additions & 236 deletions

‎engine/src/flutter/shell/platform/darwin/ios/BUILD.gn‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ source_set("flutter_framework_source") {
169169
"ios_context.mm",
170170
"ios_context_metal_impeller.h",
171171
"ios_context_metal_impeller.mm",
172-
"ios_context_noop.h",
173-
"ios_context_noop.mm",
174172
"ios_external_texture_metal.h",
175173
"ios_external_texture_metal.mm",
176174
"ios_external_view_embedder.h",
@@ -179,8 +177,6 @@ source_set("flutter_framework_source") {
179177
"ios_surface.mm",
180178
"ios_surface_metal_impeller.h",
181179
"ios_surface_metal_impeller.mm",
182-
"ios_surface_noop.h",
183-
"ios_surface_noop.mm",
184180
"platform_message_handler_ios.h",
185181
"platform_message_handler_ios.mm",
186182
"platform_view_ios.h",
@@ -328,8 +324,6 @@ if (enable_ios_unittests) {
328324
"framework/Source/VsyncWaiterIOSTest.mm",
329325
"framework/Source/accessibility_bridge_test.mm",
330326
"framework/Source/availability_version_check_test.mm",
331-
"ios_context_noop_unittests.mm",
332-
"ios_surface_noop_unittests.mm",
333327
"platform_message_handler_ios_test.mm",
334328
"platform_view_ios_test.mm",
335329
]

‎engine/src/flutter/shell/platform/darwin/ios/ios_context.mm‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "flutter/fml/logging.h"
1010
#import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
1111
#include "flutter/shell/platform/darwin/ios/ios_context_metal_impeller.h"
12-
#include "flutter/shell/platform/darwin/ios/ios_context_noop.h"
1312
#include "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
1413

1514
FLUTTER_ASSERT_ARC
@@ -25,13 +24,6 @@
2524
const std::shared_ptr<const fml::SyncSwitch>& is_gpu_disabled_sync_switch,
2625
const Settings& settings) {
2726
switch (api) {
28-
case IOSRenderingAPI::kSoftware:
29-
[FlutterLogger logImportant:@"Software rendering is incompatible with Impeller.\n"
30-
"Software rendering may have been automatically selected when "
31-
"running on a simulator in an environment that does not support "
32-
"Metal. Enabling GPU passthrough in your environment may fix "
33-
"this."];
34-
return std::make_unique<IOSContextNoop>();
3527
case IOSRenderingAPI::kMetal:
3628
return std::make_unique<IOSContextMetalImpeller>(settings, is_gpu_disabled_sync_switch);
3729
}

‎engine/src/flutter/shell/platform/darwin/ios/ios_context_noop.h‎

Lines changed: 0 additions & 32 deletions
This file was deleted.

‎engine/src/flutter/shell/platform/darwin/ios/ios_context_noop.mm‎

Lines changed: 0 additions & 31 deletions
This file was deleted.

‎engine/src/flutter/shell/platform/darwin/ios/ios_context_noop_unittests.mm‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎engine/src/flutter/shell/platform/darwin/ios/ios_surface.mm‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
#import "flutter/shell/platform/darwin/common/InternalFlutterSwiftCommon/InternalFlutterSwiftCommon.h"
1010
#import "flutter/shell/platform/darwin/ios/ios_surface_metal_impeller.h"
11-
#import "flutter/shell/platform/darwin/ios/ios_surface_noop.h"
1211
#include "flutter/shell/platform/darwin/ios/rendering_api_selection.h"
1312

1413
FLUTTER_ASSERT_ARC
@@ -28,7 +27,11 @@
2827
);
2928
}
3029
}
31-
return std::make_unique<IOSSurfaceNoop>(std::move(context));
30+
// The layer MUST be a CAMetalLayer or FlutterMetalLayer (which overrides
31+
// isKindOfClass to return true for the above check. Anything else means the
32+
// rendering surface was misconfigured.
33+
FML_CHECK(false) << "Expected a Metal-backed layer for iOS rendering.";
34+
return nullptr;
3235
}
3336

3437
IOSSurface::IOSSurface(std::shared_ptr<IOSContext> ios_context)

‎engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop.h‎

Lines changed: 0 additions & 43 deletions
This file was deleted.

‎engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop.mm‎

Lines changed: 0 additions & 35 deletions
This file was deleted.

‎engine/src/flutter/shell/platform/darwin/ios/ios_surface_noop_unittests.mm‎

Lines changed: 0 additions & 33 deletions
This file was deleted.

‎engine/src/flutter/shell/platform/darwin/ios/rendering_api_selection.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace flutter {
1313

1414
enum class IOSRenderingAPI {
15-
kSoftware,
1615
kMetal,
1716
};
1817

0 commit comments

Comments
 (0)