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

Reland: [Impeller] adds a plus advanced blend for f16 pixel formats #51756

Merged
merged 2 commits into from
Mar 28, 2024

Conversation

gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Mar 28, 2024

Relands #51589

Notice: This will adversely effect the performance of benchmarks that use the plus blend.

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:

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

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • 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.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@gaaclarke
Copy link
Member Author

@jonahwilliams please take a look. I know you would like to see us use a different pixel format. I think that sounds promising but it will be a bit of work to test and get 100% hooked up. That's work we should evaluate against the body of other work we need to do. It may not be worth pursuing immediately for just the plus blend. Let me know if you want to try it sort it out over gvc if that doesn't sound good.

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.

I do not think this is the correct approach. MTLPixelFormatBGRA10_XR should full solve the problem and only requires an update to skia's image codecs, instead of us maintaning a separate and slower blend mode implementation for wide gamut.

It also fixes alpha problems we haven't found yet.

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

Discussed offline, summary:

  • we're pretty sure this fixes plus, while the extended range fixed point needs more investigation. We may need clamping in shaders anyway with wide gamut wrt other color channels.

@gaaclarke
Copy link
Member Author

Hmm the golden bot didn't issue any notice, did the approvals from the first landing follow over? We can't blame force push this time.

@gaaclarke
Copy link
Member Author

@gaaclarke
Copy link
Member Author

I guess reverting prs should technically revoke golden approvals.

@gaaclarke gaaclarke merged commit b50789f into flutter:main Mar 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 28, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 28, 2024
…145938)

flutter/engine@c176d11...b917b24

2024-03-28 [email protected] Test that `clangd --check` works at HEAD. (flutter/engine#50901)
2024-03-28 [email protected] Remove `--verbose` from clang_tidy execution on CI. (flutter/engine#51760)
2024-03-28 [email protected] Remove Android API v33 tests from CI. (flutter/engine#51751)
2024-03-28 [email protected] Reland: [Impeller] adds a plus advanced blend for f16 pixel formats (flutter/engine#51756)

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 [email protected],[email protected],[email protected] 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
gaaclarke added a commit that referenced this pull request Apr 2, 2024
…sts (#51787)

#51756 had a bug in it when src
alpha was not 1. There was no test coverage for this. I've added the fix
and test coverage for all the blends.

## 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].
- [ ] 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
gaaclarke added a commit to gaaclarke/engine that referenced this pull request Apr 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants