-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Impeller] force render pass construction on all backends to ensure image layout is transitioned/render pass state setup. #50539
[Impeller] force render pass construction on all backends to ensure image layout is transitioned/render pass state setup. #50539
Conversation
Golden file changes have been found for this pull request. Click here to view and triage (e.g. because this is an intentional change). If you are still iterating on this change and are not ready to resolve the images on the Flutter Gold dashboard, consider marking this PR as a draft pull request above. You will still be able to view image results on the dashboard, commenting will be silenced, and the check will not try to resolve itself until marked ready for review. |
@@ -30,21 +30,17 @@ | |||
import xvfb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The formatter told me to do this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird
@@ -30,21 +30,17 @@ | |||
import xvfb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird
Ahh shoot, I lost my big comment. I hit submit before hitting the "Add comment" button. |
impeller/entity/entity_pass.cc
Outdated
if (!collapsed_parent_pass && (GetClearColor(clear_color_size).has_value() || | ||
renderer.GetContext()->GetBackendType() == | ||
Context::BackendType::kVulkan)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What my big comment here said was that I'm wary of adding branches in the crossplatform code since I think it can lead to an unclear abstraction and code that's hard to follow. I think we should turn this to a different abstraction pass_context.GetRenderPass(pass_depth, GetClearColor(clear_color_size))
. Inside that function it can check to see if the color has value and also call onto the renderpass something like pass_->SetImageLayout()
which is only implemented for RenderPassVK. That way there will be no branch, but just SetImageLayout() that does nothing except on vulkan. Maybe we could even use more generic name. PrepareRenderPass
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the concern about branches but adding a virtual method that is only implemented in one backend is roughly equivalent to a branch, no?.
I could definitely make this clearer by pulling the condition out to a helper method though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(If you don't like this one, you're gonna hate the next PR I send you)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the concern about branches but adding a virtual method that is only implemented in one backend is roughly equivalent to a branch, no?.
There is a subtle difference that when you make a virtual method. You are contributing to an interface which collectively defines the abstraction. If you add branching statements there is no single place that defines or enforces the interface.
Imagine we wanted to add a directx backend, if we had the branch we wouldn't know that we need to make a decision about wether we need to setup the renderpass regardless, like we do in vulkan.
Also, when we expand the abstraction, people can read through that interface and understand the system hierarchically. With branches the interface exists but it is implicit and spread around multiple locations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think exposing ImageLayout is the right way to do that though, that requires tons of Vulkan only internal state to be exposed to entity pass.
Imagine we wanted to add a directx backend,
I mean, we can handle that if/when we do DirectX.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think exposing ImageLayout is the right way to do that though, that requires tons of Vulkan only internal state to be exposed to entity pass.
It won't be tons of state, it will just be a hook like PrepareRenderPass()
. You understand how branching on the backend type compromises the abstraction, right?
Would you like me to take a stab at proposing an alternative that expands the interface? If this comes up in a later PR it could potentially serve as a template there too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the abstraction being intentionally leaky (as its private API) is valuable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you wanna take a crack at it, have at it, I'm not in a rush :)
…ngine into force_create_render_pass
FYI I'm seeing a magenta square (error color) on the metal invocation of the new test. It looks fine in the golden image test. |
oh interesting. i wonder if this is actually a problem on Metal too? |
What if we just made this unconditional? |
That fixes the error for me and avoids the discussion about the branching. |
Golden file changes are available for triage from new commit, Click here to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, can you file an issue against the golden test runner for the fact that it succeeded here where local testing would fail?
Done: flutter/flutter#143324 |
Thanks for being thorough as always @gaaclarke 😄 |
…o ensure image layout is transitioned/render pass state setup. (flutter/engine#50539)
…o ensure image layout is transitioned/render pass state setup. (flutter/engine#50539)
…sions) (#143380) Manual roll Flutter Engine from 1c3ecee77350 to 920874bf2c1a (34 revisions) Manual roll requested by jonahwilliams@google.com Cannot build log URL because revision "920874bf2c1a" is invalid: Luci builds of "Linux Fuchsia FEMU" for 920874bf2c1a9ba2e9b7260b79ede8f1e26ea4f0 was FAILURE 2024-02-13 dnfield@google.com Do not use AChoreographer on 32 bit devices (flutter/engine#50586) 2024-02-13 zanderso@users.noreply.github.com Move libpng to //flutter/third_party/libpng (flutter/engine#50571) 2024-02-13 skia-flutter-autoroll@skia.org Roll Skia from b150107d536d to aaed347b2dbb (2 revisions) (flutter/engine#50595) 2024-02-13 skia-flutter-autoroll@skia.org Roll Dart SDK from 8d3a8d85c883 to 105312b80125 (2 revisions) (flutter/engine#50593) 2024-02-13 skia-flutter-autoroll@skia.org Roll Skia from d503bc9c6e46 to b150107d536d (1 revision) (flutter/engine#50591) 2024-02-13 skia-flutter-autoroll@skia.org Roll Skia from a1d9b83034ac to d503bc9c6e46 (3 revisions) (flutter/engine#50587) 2024-02-13 30870216+gaaclarke@users.noreply.github.com [Impeller] cleaned up and removed golden test exceptions (flutter/engine#50572) 2024-02-13 skia-flutter-autoroll@skia.org Roll Skia from 17d00f9241b3 to a1d9b83034ac (2 revisions) (flutter/engine#50582) 2024-02-13 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from RVHAIKU50ogkiV-Lj... to l6mWjvlO1xJg5ZFKK... (flutter/engine#50579) 2024-02-13 skia-flutter-autoroll@skia.org Roll Dart SDK from 94f7dec34cef to 8d3a8d85c883 (1 revision) (flutter/engine#50577) 2024-02-13 matanlurey@users.noreply.github.com Add Impeller runtime options to Android `scenario_app` (flutter/engine#50487) 2024-02-13 skia-flutter-autoroll@skia.org Roll Skia from c464143dfaab to 17d00f9241b3 (1 revision) (flutter/engine#50576) 2024-02-13 skia-flutter-autoroll@skia.org Roll Skia from ecf2f622d0b3 to c464143dfaab (2 revisions) (flutter/engine#50574) 2024-02-12 jonahwilliams@google.com [Impeller] CommandPoolVK recycles command buffers too. (flutter/engine#50468) 2024-02-12 matanlurey@users.noreply.github.com Make `dart:ui#Paint` `final` to allow changes/disallow implementing. (flutter/engine#50557) 2024-02-12 robert.ancell@canonical.com Replace usage of an integer for GdkModifierType (flutter/engine#50481) 2024-02-12 robert.ancell@canonical.com Remove FlKeyEvent.dispose_origin and use GdkEvent type for origin (flutter/engine#50483) 2024-02-12 zanderso@users.noreply.github.com Move Linux impeller_unittests to linux_unopt (flutter/engine#50558) 2024-02-12 chinmaygarde@google.com [Impeller] Don't suppress outdated validation error. (flutter/engine#50568) 2024-02-12 chinmaygarde@google.com [Impeller] Remove references to moved impeller/image from README. (flutter/engine#50513) 2024-02-12 skia-flutter-autoroll@skia.org Roll Dart SDK from dca13675e65e to 94f7dec34cef (1 revision) (flutter/engine#50567) 2024-02-12 skia-flutter-autoroll@skia.org Roll Skia from f88eeb658358 to ecf2f622d0b3 (1 revision) (flutter/engine#50566) 2024-02-12 skia-flutter-autoroll@skia.org Roll Skia from 867c1e8390e2 to f88eeb658358 (5 revisions) (flutter/engine#50564) 2024-02-12 jason-simmons@users.noreply.github.com Roll vulkan-deps to 014f44e134a1de387791bffacc32ff9d8db71176 (flutter/engine#50515) 2024-02-12 skia-flutter-autoroll@skia.org Roll Skia from 4081496b7693 to 867c1e8390e2 (20 revisions) (flutter/engine#50562) 2024-02-12 jonahwilliams@google.com [Impeller] force render pass construction on all backends to ensure image layout is transitioned/render pass state setup. (flutter/engine#50539) 2024-02-12 737941+loic-sharma@users.noreply.github.com [Windows] Make the view own its EGL surface (flutter/engine#50421) 2024-02-12 skia-flutter-autoroll@skia.org Roll Dart SDK from 5c9e79e66364 to dca13675e65e (1 revision) (flutter/engine#50559) 2024-02-12 1889916+miguelfrde@users.noreply.github.com [fuchsia] Update Inspect library usage (flutter/engine#50467) 2024-02-12 zanderso@users.noreply.github.com Initializes RBE in the build config runner (flutter/engine#50543) 2024-02-12 tugorez@users.noreply.github.com Rename [ViewFocusDirection.backwards] to [ViewFocusDirection.backward] (flutter/engine#50533) 2024-02-12 dnfield@google.com Refactor NDK helpers some more, add methods for SurfaceControl/Transaction, tests (flutter/engine#50540) 2024-02-12 30870216+gaaclarke@users.noreply.github.com [Impeller] deleted the old blur (flutter/engine#50470) 2024-02-12 kjlubick@users.noreply.github.com Update codec defines for Skia (flutter/engine#50554) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from RVHAIKU50ogk to l6mWjvlO1xJg If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jonahwilliams@google.com,jsimmons@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. ...
This was fixed in #50539
Fixes flutter/flutter#142358
We rely on the render pass encoding to transition image textures from undefined to shader read layout. If an empty pass is created with no clear color, we still need to create the pass on the Vulkan backend.