Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] Implement RuntimeEffectContents #36866

Merged
merged 10 commits into from
Oct 19, 2022
Merged

Conversation

bdero
Copy link
Member

@bdero bdero commented Oct 19, 2022

This gets Runtime Effects with uniform buffer bindings running in Impeller.

Part of flutter/flutter#102853.

Up next:

Copy link
Member

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (but not to CI)

@@ -426,7 +430,26 @@ void DisplayListDispatcher::setColorSource(
return;
}
case flutter::DlColorSourceType::kConicalGradient:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this still be UNIMPLEMENTED?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, fixed.

auto uniform_data_sk = runtime_effect_color_source->uniform_data();

paint_.color_source = [runtime_stage, uniform_data_sk]() {
// TODO(bdero): Get rid of the allocation + copy for uniform data.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file an issue for this TODO.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::promise<bool> promise;
auto future = promise.get_future();

library->RegisterFunction(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be doing this immediately after reading the shader in from the asset?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but I'd like to defer figuring out the threading and g3 dependency situation to a later patch. I assume we're already building all of Impeller though, so maybe g3 isn't as much a concern.
Added an issue: flutter/flutter#113719


size_t buffer_index = 0;
for (auto uniform : runtime_stage_->GetUniforms()) {
// TODO(bdero): Populate this metadata once GLES is able to handle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please file (or update) an issue for this TODO

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// vec3 col = 0.5 + 0.5*cos(t + uv.xyx + vec3(0,1,4));
// fragColor = vec4(col,1.0);
// }
auto runtime_stage = LoadFixtureRuntimeStage("example.frag.metal.iplr");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't need to be checked in. It can be generated by the build. We do that for ink_sparkle here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call, done.

@bdero bdero requested a review from zanderso October 19, 2022 18:41
Copy link
Member

@zanderso zanderso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm when tests pass.

@bdero bdero force-pushed the bdero/runtime-effect branch from f5a1cb4 to 3310ce8 Compare October 19, 2022 19:53
@bdero
Copy link
Member Author

bdero commented Oct 19, 2022

Video of the example app in Impeller:

PXL_20221019_225320731.mp4

There's some weirdness happening with the Skia backend where it seems to stop redrawing and flips back and forth between two frames on iOS unless a redraw is triggered through alternative means. This only happens on iOS and this behavior predates my patches:

PXL_20221019_230419973.mp4

@bdero bdero merged commit d079196 into flutter:main Oct 19, 2022
zanderso added a commit that referenced this pull request Oct 20, 2022
zanderso added a commit that referenced this pull request Oct 20, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Oct 20, 2022
zanderso pushed a commit to flutter/flutter that referenced this pull request Oct 20, 2022
…113766)

* 7d18d7007 [Impeller] Support external textures on iOS (flutter/engine#36498)

* d07919654 [Impeller] Implement RuntimeEffectContents (flutter/engine#36866)

* 119e839ef Revert "[Impeller] Implement RuntimeEffectContents (#36866)" (flutter/engine#36883)

* bcd83df4e [Impeller] Reland RuntimeEffectContents (flutter/engine#36884)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants