Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion impeller/entity/entity_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
16 changes: 0 additions & 16 deletions impeller/playground/playground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -437,22 +437,6 @@ std::shared_ptr<Texture> Playground::CreateTextureCubeForFixture(
return texture;
}

std::shared_ptr<RuntimeStage> Playground::LoadFixtureRuntimeStage(
const char* fixture_name) const {
if (fixture_name == nullptr) {
return nullptr;
}

auto runtime_stage =
std::make_shared<RuntimeStage>(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;
}
Expand Down
3 changes: 0 additions & 3 deletions impeller/playground/playground.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ class Playground {
std::shared_ptr<Texture> CreateTextureCubeForFixture(
std::array<const char*, 6> fixture_names) const;

std::shared_ptr<RuntimeStage> LoadFixtureRuntimeStage(
const char* fixture_name) const;

static bool SupportsBackend(PlaygroundBackend backend);

virtual std::unique_ptr<fml::Mapping> OpenAssetAsMapping(
Expand Down
13 changes: 13 additions & 0 deletions impeller/playground/playground_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ std::unique_ptr<fml::Mapping> PlaygroundTest::OpenAssetAsMapping(
return flutter::testing::OpenFixtureAsMapping(asset_name);
}

std::shared_ptr<RuntimeStage> 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<RuntimeStage>(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
Expand Down
3 changes: 3 additions & 0 deletions impeller/playground/playground_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class PlaygroundTest : public Playground,
std::unique_ptr<fml::Mapping> OpenAssetAsMapping(
std::string asset_name) const override;

std::shared_ptr<RuntimeStage> OpenAssetAsRuntimeStage(
const char* asset_name) const;

// |Playground|
std::string GetWindowTitle() const override;

Expand Down
13 changes: 0 additions & 13 deletions impeller/runtime_stage/runtime_stage_playground.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,6 @@ RuntimeStagePlayground::RuntimeStagePlayground() = default;

RuntimeStagePlayground::~RuntimeStagePlayground() = default;

std::unique_ptr<RuntimeStage> 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<RuntimeStage>(std::move(fixture));
if (!stage->IsValid()) {
return nullptr;
}
return stage;
}

bool RuntimeStagePlayground::RegisterStage(const RuntimeStage& stage) {
std::promise<bool> registration;
auto future = registration.get_future();
Expand Down
3 changes: 0 additions & 3 deletions impeller/runtime_stage/runtime_stage_playground.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ class RuntimeStagePlayground : public PlaygroundTest {

~RuntimeStagePlayground();

std::unique_ptr<RuntimeStage> CreateStageFromFixture(
const std::string& fixture_name) const;

bool RegisterStage(const RuntimeStage& stage);

private:
Expand Down
2 changes: 1 addition & 1 deletion impeller/runtime_stage/runtime_stage_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down