Reverts "[Impeller] Disable layer tree screenshots." (flutter/engine#47356)

Reverts flutter/engine#46171
Initiated by: jonahwilliams
This change reverts the following previous change:
Original Description:
The "rasterizer screenshot" VM service API uses the Skia software backend, even when running with impeller. At best, this leads to confusing half working screenshots that are missing images.

See https://github.com/flutter/flutter/issues/135052

We should disable this functionality when running with impeller. Perhaps this could be reworked to use picture toImage instead of the offscreen so that it uses the "real" backend regardless of the platform it is running on.

Fixes https://github.com/flutter/flutter/issues/135052
This commit is contained in:
auto-submit[bot]
2023-10-26 20:34:17 +00:00
committed by GitHub
parent f06b89215e
commit 24debb363e
2 changed files with 0 additions and 56 deletions

View File

@@ -876,11 +876,6 @@ Rasterizer::Screenshot Rasterizer::ScreenshotLastLayerTree(
return {};
}
// Impeller does not support this screenshot type.
if (surface_->GetAiksContext()) {
return {};
}
sk_sp<SkData> data = nullptr;
std::string format;

View File

@@ -2207,57 +2207,6 @@ TEST_F(ShellTest, Screenshot) {
DestroyShell(std::move(shell));
}
// Only supported on macOS hosts as a real metal surface needs to be created.
#if defined(FML_OS_MACOSX)
TEST_F(ShellTest, ScreenshotImpeller) {
auto settings = CreateSettingsForFixture();
settings.enable_impeller = true;
fml::AutoResetWaitableEvent firstFrameLatch;
settings.frame_rasterized_callback =
[&firstFrameLatch](const FrameTiming& t) { firstFrameLatch.Signal(); };
std::unique_ptr<Shell> shell = CreateShell({
.settings = settings,
.platform_view_create_callback = ShellTestPlatformViewBuilder({
.rendering_backend =
ShellTestPlatformView::BackendType::kMetalBackend,
}),
});
// Create the surface needed by rasterizer
PlatformViewNotifyCreated(shell.get());
auto configuration = RunConfiguration::InferFromSettings(settings);
configuration.SetEntrypoint("emptyMain");
RunEngine(shell.get(), std::move(configuration));
LayerTreeBuilder builder = [&](const std::shared_ptr<ContainerLayer>& root) {
auto display_list_layer = std::make_shared<DisplayListLayer>(
SkPoint::Make(10, 10), MakeSizedDisplayList(80, 80), false, false);
root->Add(display_list_layer);
};
PumpOneFrame(shell.get(), 100, 100, builder);
firstFrameLatch.Wait();
std::promise<Rasterizer::Screenshot> screenshot_promise;
auto screenshot_future = screenshot_promise.get_future();
fml::TaskRunner::RunNowOrPostTask(
shell->GetTaskRunners().GetRasterTaskRunner(),
[&screenshot_promise, &shell]() {
auto rasterizer = shell->GetRasterizer();
screenshot_promise.set_value(rasterizer->ScreenshotLastLayerTree(
Rasterizer::ScreenshotType::CompressedImage, false));
});
ASSERT_EQ(screenshot_future.get().data, nullptr);
DestroyShell(std::move(shell));
}
#endif
TEST_F(ShellTest, CanConvertToAndFromMappings) {
const size_t buffer_size = 2 << 20;