-
Notifications
You must be signed in to change notification settings - Fork 6k
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] adds a plus
advanced blend for f16 pixel formats
#51589
Conversation
919cfa0
to
34112d7
Compare
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.
Plus should be an advanced blend only conditionally when we are in a colorspace that does not correctly clamp. There is a loss of performance and rendering fidelity when moving something to an advanced blend that should be avoided if possible.
I can resurrect the old |
If the maintainence cost of branching is too high then we shouldn't have added support for wide gamut imo. Given that we're always going to be an a world we don't know at runtime whether a not a particular device supports wide gamut this is just the cost we've chosen to bear. I don't think its a reasonable argument to say that doing it right isn't worth it. |
Fair point, in wide gamut's case though we are getting a lot of value for the effort. I'll add an agenda item to the next sync and we can decide as a team. There's no rush, this is hung up on the golden tests question anyway. |
If we decide to keep around the old blend, the EntityPass looks like the proper place to map --- a/impeller/entity/entity_pass.cc
+++ b/impeller/entity/entity_pass.cc
@@ -996,6 +996,14 @@ bool EntityPass::OnRender(
/// Setup advanced blends.
///
+ BlendMode adjusted_blend_mode = result.entity.GetBlendMode();
+ if (adjusted_blend_mode == BlendMode::kPlus &&
+ !IsAlphaClampedToOne(renderer.GetContext()
+ ->GetCapabilities()
+ ->GetDefaultColorFormat())) {
+ adjusted_blend_mode = BlendMode::kPlusAdvanced;
+ }
+
if (result.entity.GetBlendMode() > Entity::kLastPipelineBlendMode) {
if (renderer.GetDeviceCapabilities().SupportsFramebufferFetch()) {
auto src_contents = result.entity.GetContents(); |
That seems like a reasonable way to do it. I think instead of a separate capability state, you'd want a check of the onscreen/offscreen PixelFormat which tells you if you need the advanced blend. |
4603097
to
1cf1c7b
Compare
|
||
f16vec3 blend_result = AdvancedBlend(dst.rgb, src.rgb, int(blend_type)); | ||
if (nblend_type == /*BlendSelectValues::kPlusAdvanced*/ 14) { |
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 it would be OK to put this in its own shader.
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'm in the middle of still refactoring this. I'll ping you when it's ready to review =)
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 see benefits and disadvantages both ways. What we shouldn't have is the code duplicated in 2 different parts. I've unified them with a shared function since this comment was made.
plus
an advanced blendplus
advanced blend for f16 pixel formats
added test fixed screenshoter fix dl_test_surface limited the new blend to only wide gamut contexts tidy updated golden
Let's see now if the golden bot malfunctions this time. I haven't force pushed since the last full ci cycle. |
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. |
…145877) flutter/engine@c602abd...922c7b1 2024-03-28 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Lk8KBU-c97ROj-YHm... to uzI3wnbEGlZ_dtO0Z... (flutter/engine#51737) 2024-03-28 skia-flutter-autoroll@skia.org Roll Skia from b6160ffc0b96 to 66241be7c81c (16 revisions) (flutter/engine#51733) 2024-03-28 bdero@google.com [Impeller] Reland: Use the scissor to limit all draws by clip coverage. (flutter/engine#51731) 2024-03-27 30870216+gaaclarke@users.noreply.github.com [Impeller] adds a `plus` advanced blend for f16 pixel formats (flutter/engine#51589) 2024-03-27 maRci002@users.noreply.github.com Platform channel for predictive back in route transitions on android (flutter/engine#49093) 2024-03-27 jonahwilliams@google.com [Impeller] render empty filled paths without crashing. (flutter/engine#51713) 2024-03-27 jonahwilliams@google.com [Impeller] use optimal depth attachment, remove useless barrier. (flutter/engine#51723) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from Lk8KBU-c97RO to uzI3wnbEGlZ_ 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 jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
A reason for requesting a revert of flutter/engine/51589 could |
#51589)" (#51741) Reverts: #51589 Initiated by: jonahwilliams Reason for reverting: draw vertices devicelab test is crashing due to SIGABRT in blend contents ![image](https://github.com/flutter/engine/assets/8975114/8bfaec63-29e9-43c2-8954-181d0ad1c413) Original PR Author: gaaclarke Reviewed By: {jonahwilliams} This change reverts the following previous change: fixes flutter/flutter#142549 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
…isions) (#145877)" (#145901) Reverts: #145877 Initiated by: zanderso Reason for reverting: #145899 Original PR Author: engine-flutter-autoroll Reviewed By: {fluttergithubbot} This change reverts the following previous change: flutter/engine@c602abd...922c7b1 2024-03-28 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Lk8KBU-c97ROj-YHm... to uzI3wnbEGlZ_dtO0Z... (flutter/engine#51737) 2024-03-28 skia-flutter-autoroll@skia.org Roll Skia from b6160ffc0b96 to 66241be7c81c (16 revisions) (flutter/engine#51733) 2024-03-28 bdero@google.com [Impeller] Reland: Use the scissor to limit all draws by clip coverage. (flutter/engine#51731) 2024-03-27 30870216+gaaclarke@users.noreply.github.com [Impeller] adds a `plus` advanced blend for f16 pixel formats (flutter/engine#51589) 2024-03-27 maRci002@users.noreply.github.com Platform channel for predictive back in route transitions on android (flutter/engine#49093) 2024-03-27 jonahwilliams@google.com [Impeller] render empty filled paths without crashing. (flutter/engine#51713) 2024-03-27 jonahwilliams@google.com [Impeller] use optimal depth attachment, remove useless barrier. (flutter/engine#51723) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from Lk8KBU-c97RO to uzI3wnbEGlZ_ 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 jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Reverting due to: flutter/flutter#145899 |
…sions) (#145903) Manual roll requested by zra@google.com flutter/engine@c602abd...9df2d3a 2024-03-28 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Impeller] adds a `plus` advanced blend for f16 pixel formats (#51589)" (flutter/engine#51741) 2024-03-28 jonahwilliams@google.com [Impeller] correct multisample resolve/store configuration for Vulkan. (flutter/engine#51740) 2024-03-28 matanlurey@users.noreply.github.com Remove Impeller/OpenGLES from CI branch for Android e2e tests. (flutter/engine#51734) 2024-03-28 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Lk8KBU-c97ROj-YHm... to uzI3wnbEGlZ_dtO0Z... (flutter/engine#51737) 2024-03-28 skia-flutter-autoroll@skia.org Roll Skia from b6160ffc0b96 to 66241be7c81c (16 revisions) (flutter/engine#51733) 2024-03-28 bdero@google.com [Impeller] Reland: Use the scissor to limit all draws by clip coverage. (flutter/engine#51731) 2024-03-27 30870216+gaaclarke@users.noreply.github.com [Impeller] adds a `plus` advanced blend for f16 pixel formats (flutter/engine#51589) 2024-03-27 maRci002@users.noreply.github.com Platform channel for predictive back in route transitions on android (flutter/engine#49093) 2024-03-27 jonahwilliams@google.com [Impeller] render empty filled paths without crashing. (flutter/engine#51713) 2024-03-27 jonahwilliams@google.com [Impeller] use optimal depth attachment, remove useless barrier. (flutter/engine#51723) Also rolling transitive DEPS: fuchsia/sdk/core/linux-amd64 from Lk8KBU-c97RO to uzI3wnbEGlZ_ 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 jacksongardner@google.com,rmistry@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
There is extra state that is getting setup when switching the blend mode that the override isn't catching, namely |
The test failed to catch this because the test is going through the |
…l formats (flutter#51589)" (flutter#51741)" This reverts commit 9df2d3a.
…51756) Relands #51589 The fix is in 74397bc. I couldn't figure out how to get a test in the engine to cover it. The test is in the devicelab. Here's what I attempted: ```c++ TEST_P(AiksTest, BlendModePlusAlphaColorFilterAlphaWideGamut) { if (GetParam() != PlaygroundBackend::kMetal) { GTEST_SKIP_("This backend doesn't yet support wide gamut."); } EXPECT_EQ(GetContext()->GetCapabilities()->GetDefaultColorFormat(), PixelFormat::kR16G16B16A16Float); Canvas canvas; canvas.Scale(GetContentScale()); canvas.DrawPaint({.color = Color(0.1, 0.2, 0.1, 0.5)}); canvas.SaveLayer({ .color_filter = ColorFilter::MakeBlend(BlendMode::kPlus, Color(Vector4{1, 0, 0, 0.5})), }); Paint paint; paint.color = Color(1, 0, 0, 0.5); canvas.DrawRect(Rect::MakeXYWH(100, 100, 400, 400), paint); paint.color = Color::White(); canvas.Restore(); ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture())); } ``` ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide] and the [C++, Objective-C, Java style guides]. - [x] I listed at least one issue that this PR fixes in the description above. - [x] I added new tests to check the change I am making or feature I am adding, or the PR is [test-exempt]. See [testing the engine] for instructions on writing and running engine tests. - [x] I updated/added relevant documentation (doc comments with `///`). - [x] I signed the [CLA]. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/wiki/Tree-hygiene#overview [Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene [test-exempt]: https://github.com/flutter/flutter/wiki/Tree-hygiene#tests [Flutter Style Guide]: https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style [testing the engine]: https://github.com/flutter/flutter/wiki/Testing-the-engine [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/wiki/Chat
fixes flutter/flutter#142549
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.