diff --git a/impeller/entity/entity_unittests.cc b/impeller/entity/entity_unittests.cc index 3420166cad10f..fad3f0dab4a12 100644 --- a/impeller/entity/entity_unittests.cc +++ b/impeller/entity/entity_unittests.cc @@ -2086,7 +2086,7 @@ TEST_P(EntityTest, RuntimeEffect) { contents->SetGeometry(Geometry::MakeCover()); auto runtime_stage = - LoadFixtureRuntimeStage("runtime_stage_example.frag.iplr"); + OpenAssetAsRuntimeStage("runtime_stage_example.frag.iplr"); contents->SetRuntimeStage(runtime_stage); struct FragUniforms { diff --git a/impeller/playground/playground.cc b/impeller/playground/playground.cc index adfce380cc838..07fb4280c34b3 100644 --- a/impeller/playground/playground.cc +++ b/impeller/playground/playground.cc @@ -437,22 +437,6 @@ std::shared_ptr Playground::CreateTextureCubeForFixture( return texture; } -std::shared_ptr Playground::LoadFixtureRuntimeStage( - const char* fixture_name) const { - if (fixture_name == nullptr) { - return nullptr; - } - - auto runtime_stage = - std::make_shared(OpenAssetAsMapping(fixture_name)); - - if (!runtime_stage->IsValid()) { - VALIDATION_LOG << "Could not load valid runtime stage."; - return nullptr; - } - return runtime_stage; -} - void Playground::SetWindowSize(ISize size) { window_size_ = size; } diff --git a/impeller/playground/playground.h b/impeller/playground/playground.h index 255c87d7b4784..82e1edf2946eb 100644 --- a/impeller/playground/playground.h +++ b/impeller/playground/playground.h @@ -64,9 +64,6 @@ class Playground { std::shared_ptr CreateTextureCubeForFixture( std::array fixture_names) const; - std::shared_ptr LoadFixtureRuntimeStage( - const char* fixture_name) const; - static bool SupportsBackend(PlaygroundBackend backend); virtual std::unique_ptr OpenAssetAsMapping( diff --git a/impeller/playground/playground_test.cc b/impeller/playground/playground_test.cc index 1627cf9a711f5..024c4d52174df 100644 --- a/impeller/playground/playground_test.cc +++ b/impeller/playground/playground_test.cc @@ -34,6 +34,19 @@ std::unique_ptr PlaygroundTest::OpenAssetAsMapping( return flutter::testing::OpenFixtureAsMapping(asset_name); } +std::shared_ptr PlaygroundTest::OpenAssetAsRuntimeStage( + const char* asset_name) const { + auto fixture = flutter::testing::OpenFixtureAsMapping(asset_name); + if (!fixture || fixture->GetSize() == 0) { + return nullptr; + } + auto stage = std::make_unique(std::move(fixture)); + if (!stage->IsValid()) { + return nullptr; + } + return stage; +} + static std::string FormatWindowTitle(const std::string& test_name) { std::stringstream stream; stream << "Impeller Playground for '" << test_name diff --git a/impeller/playground/playground_test.h b/impeller/playground/playground_test.h index 2e10faebffcd6..351cbc0c9545f 100644 --- a/impeller/playground/playground_test.h +++ b/impeller/playground/playground_test.h @@ -27,6 +27,9 @@ class PlaygroundTest : public Playground, std::unique_ptr OpenAssetAsMapping( std::string asset_name) const override; + std::shared_ptr OpenAssetAsRuntimeStage( + const char* asset_name) const; + // |Playground| std::string GetWindowTitle() const override; diff --git a/impeller/runtime_stage/runtime_stage_playground.cc b/impeller/runtime_stage/runtime_stage_playground.cc index 096030843315a..de0d3cf66f99e 100644 --- a/impeller/runtime_stage/runtime_stage_playground.cc +++ b/impeller/runtime_stage/runtime_stage_playground.cc @@ -17,19 +17,6 @@ RuntimeStagePlayground::RuntimeStagePlayground() = default; RuntimeStagePlayground::~RuntimeStagePlayground() = default; -std::unique_ptr RuntimeStagePlayground::CreateStageFromFixture( - const std::string& fixture_name) const { - auto fixture = flutter::testing::OpenFixtureAsMapping(fixture_name); - if (!fixture || fixture->GetSize() == 0) { - return nullptr; - } - auto stage = std::make_unique(std::move(fixture)); - if (!stage->IsValid()) { - return nullptr; - } - return stage; -} - bool RuntimeStagePlayground::RegisterStage(const RuntimeStage& stage) { std::promise registration; auto future = registration.get_future(); diff --git a/impeller/runtime_stage/runtime_stage_playground.h b/impeller/runtime_stage/runtime_stage_playground.h index 0b4168b2220c0..3a1821006c7f0 100644 --- a/impeller/runtime_stage/runtime_stage_playground.h +++ b/impeller/runtime_stage/runtime_stage_playground.h @@ -16,9 +16,6 @@ class RuntimeStagePlayground : public PlaygroundTest { ~RuntimeStagePlayground(); - std::unique_ptr CreateStageFromFixture( - const std::string& fixture_name) const; - bool RegisterStage(const RuntimeStage& stage); private: diff --git a/impeller/runtime_stage/runtime_stage_unittests.cc b/impeller/runtime_stage/runtime_stage_unittests.cc index b3aa6208e1cda..242735e65e3a1 100644 --- a/impeller/runtime_stage/runtime_stage_unittests.cc +++ b/impeller/runtime_stage/runtime_stage_unittests.cc @@ -216,7 +216,7 @@ TEST_P(RuntimeStageTest, CanCreatePipelineFromRuntimeStage) { if (GetParam() != PlaygroundBackend::kMetal) { GTEST_SKIP_("Skipped: https://github.com/flutter/flutter/issues/105538"); } - auto stage = CreateStageFromFixture("ink_sparkle.frag.iplr"); + auto stage = OpenAssetAsRuntimeStage("ink_sparkle.frag.iplr"); ASSERT_NE(stage, nullptr); ASSERT_TRUE(RegisterStage(*stage)); auto library = GetContext()->GetShaderLibrary();