Skip to content
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] Add golden for clipped+transformed blur. #48886

Merged
merged 4 commits into from
Dec 14, 2023

Conversation

bdero
Copy link
Member

@bdero bdero commented Dec 11, 2023

This is a simple golden intended to smoketest potential issues when applying the coverage hint in the blur. Expected results:
Screenshot 2023-12-11 at 12 03 50 PM

@bdero bdero requested a review from gaaclarke December 11, 2023 20:08
@bdero bdero self-assigned this Dec 11, 2023
@bdero bdero marked this pull request as ready for review December 11, 2023 20:08
@@ -4368,5 +4368,28 @@ TEST_P(AiksTest, GaussianBlurAtPeripheryHorizontal) {
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
Copy link
Member

Choose a reason for hiding this comment

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

Can you make this test be more obvious while testing the same thing? For example, rotate the picture of boston 90 degrees and clip off the left and right sides equally so that we get the square just in the middle? That way it is easier to validate that it is correct.

Copy link
Member Author

@bdero bdero Dec 11, 2023

Choose a reason for hiding this comment

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

In order to be a good smoke test for the coverage hint:

  • the image should be drawn with a non-aligned basis (weird rotation or skew),
  • the clip should unevenly clip the surface (some sides should be clipped more than the others),
  • both the blurred source rectangle and the coverage hint should be non-square rectangles of different size.

I think if the before/after comparison shows obvious differences from the current golden, that'd be enough to be suitably useful and spark investigation?

Copy link
Member

Choose a reason for hiding this comment

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

I think that's good when we talk about making sure current behavior is maintained. The problem is that it's hard to know if this is correct behavior. I can't read the test and look at the image and pretty confidently know that is the correct rendering.

I think this would be a bit easier to follow if you rotated around the center of the texture. Rotating around an anchor that isn't the centroid or one of the corners is already hard to calculate in your head.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alrighty, I changed it so the center of the clip is the center of the blurred image and added some notes about the expected output to a comment before the test:

image

Copy link
Member

Choose a reason for hiding this comment

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

This is what I had in mind. I think this tests everything you want and is imo way more simple. I can easily communicate what it should look like:

TEST_P(AiksTest, GaussianBlurRotatedAndClipped) {
  Canvas canvas;
  std::shared_ptr<Texture> boston = CreateTextureForFixture("boston.jpg");
  Rect bounds =
      Rect::MakeXYWH(0, 0, boston->GetSize().width, boston->GetSize().height);
  Vector2 image_center = Vector2(bounds.GetSize() / 2);
  Paint paint = {.image_filter =
                     ImageFilter::MakeBlur(Sigma(20.0), Sigma(20.0),
                                           FilterContents::BlurStyle::kNormal,
                                           Entity::TileMode::kDecal)};
  Vector2 clip_size = {200, 100};
  canvas.Scale(GetContentScale());
  canvas.ClipRect(Rect::MakeLTRB(512, 384, 512, 384).Expand(clip_size));
  canvas.Translate({512, 384, 0});
  canvas.Scale({0.5, 0.5, 1});
  canvas.Rotate(Degrees(25));

  canvas.DrawImageRect(std::make_shared<Image>(boston), /*source=*/bounds,
                       /*dest=*/bounds.Shift(-image_center), paint);

  ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
}

Copy link
Member Author

Choose a reason for hiding this comment

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

sgtm, I went with this and adjusted the clip slightly to make it cover a smaller area of the image.

@flutter-dashboard
Copy link

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.

Changes reported for pull request #48886 at sha 40434c5

@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #48886 at sha a178d2a

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

lgtm! thanks

@bdero bdero force-pushed the bdero/gaussian-clip-golden branch from 47d608e to 3467a9f Compare December 13, 2023 23:36
@flutter-dashboard
Copy link

Golden file changes are available for triage from new commit, Click here to view.

Changes reported for pull request #48886 at sha 7f4738d

@bdero bdero added the autosubmit Merge PR when tree becomes green via auto submit App label Dec 14, 2023
@auto-submit auto-submit bot merged commit 096def3 into flutter:main Dec 14, 2023
27 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 14, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Dec 14, 2023
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Dec 14, 2023
…140130)

flutter/engine@9f7004e...923f9e2

2023-12-14 98614782+auto-submit[bot]@users.noreply.github.com Reverts "[Windows] Move to `FlutterCompositor` for rendering" (flutter/engine#49015)
2023-12-14 magder@google.com Add xcprivacy privacy manifest to iOS framework (flutter/engine#48951)
2023-12-14 30870216+gaaclarke@users.noreply.github.com [Impeller] Made the new blur support 1D blurs (flutter/engine#49001)
2023-12-14 skia-flutter-autoroll@skia.org Roll Skia from 69c02c9d56b2 to 188515347032 (1 revision) (flutter/engine#49005)
2023-12-14 bdero@google.com [Impeller] Add golden for clipped+transformed blur. (flutter/engine#48886)
2023-12-14 bdero@google.com [Flutter GPU] Runtime shader import. (flutter/engine#48875)
2023-12-13 737941+loic-sharma@users.noreply.github.com [Windows] Move to `FlutterCompositor` for rendering (flutter/engine#48849)

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 jsimmons@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller will affect goldens
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants