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] use screen space coordinates for dithering. #51668

Conversation

jonahwilliams
Copy link
Member

Currently we're using the canvas coordinate positions for dithering. This usually works, but if the gradient includes a transform, then we might end up with 1 canvas coordinate pt = multiple physical pixels. This can result dithering artifacts since larger blocks will get the same color weight.

instead we can use gl_FragCoord.xy to get the screenspace coordinates which aren't effect by this transform.

Fixes flutter/flutter#145481

Before

flutter_04

After

flutter_05

Using the app from flutter/flutter#145481 but with the scaling factor increased to 10.0.

@jonahwilliams
Copy link
Member Author

I've confirmed locally the dithering is still working by creating a gradient with a single color and checking that the framebuffer values were slightly varied. (You can also still see the dithering pattern if you zoom in)

image

image

@jonahwilliams jonahwilliams marked this pull request as ready for review March 26, 2024 00:09
Copy link
Contributor

@matanlurey matanlurey left a comment

Choose a reason for hiding this comment

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

Neat!

@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 #51668 at sha d387c8b

@jonahwilliams jonahwilliams added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 26, 2024
@auto-submit auto-submit bot merged commit 92ebd47 into flutter:main Mar 26, 2024
26 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 26, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 27, 2024
…145788)

flutter/engine@026d890...92ebd47

2024-03-26 jonahwilliams@google.com [Impeller] use screen space coordinates for dithering. (flutter/engine#51668)

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
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
None yet
2 participants