Thanks to visit codestin.com
Credit goes to github.com

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

[Impeller] Add rounded rect SDF blur #35084

Merged
merged 6 commits into from
Aug 2, 2022
Merged

Conversation

bdero
Copy link
Member

@bdero bdero commented Aug 2, 2022

Adds an SDF blur that can be used for rects, rounded rects, and circles.

Uses #35083.

Right now there are visible corner artifacts when the blur radius is larger than the corner radius due to gradient discontinuities. I'm experimenting with a couple of promising solutions for this (one that samples the field a few times and one that interpolates with another field), but I figured I'd land this initial implementation since everything else is in place.

Will probably move some of the utilities into the shader lib depending on what the final solution ends up needing.

Screen.Recording.2022-08-02.at.3.55.23.AM.mov

@bdero bdero requested review from chinmaygarde and zanderso August 2, 2022 11:49
@bdero bdero self-assigned this Aug 2, 2022
@@ -93,6 +93,11 @@ def main():
command += [
'--std=macos-metal1.2',
]
elif args.platform == 'ios':
command += [
'--std=ios-metal1.2',
Copy link
Member

Choose a reason for hiding this comment

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

It looks like these will get duplicated when args.optimize is true.

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops, this wasn't an intentional change, removed. It's a diff I lug around in my git stage to stop the xcode GPU profiler from crashing in debug unopt.

frag_info.corner_radius =
std::min(corner_radius_, std::min(positive_rect.size.width / 2.0f,
positive_rect.size.height / 2.0f));
;
Copy link
Member

Choose a reason for hiding this comment

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

Nit: Extra ;

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@bdero bdero force-pushed the bdero/rrect-blur branch from 1884c19 to 557f8ac Compare August 2, 2022 20:46
@bdero bdero force-pushed the bdero/rrect-blur branch from 557f8ac to 8c3f916 Compare August 2, 2022 22:08
@bdero bdero added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 2, 2022
@auto-submit auto-submit bot merged commit c07e1ac into flutter:main Aug 2, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 3, 2022
betrevisan pushed a commit to betrevisan/engine that referenced this pull request Aug 5, 2022
emilyabest pushed a commit to emilyabest/engine that referenced this pull request Aug 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App e: impeller
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants