Sitelet https://github.com/flutter/flutter/pull/192204
Skip to content

[uber_sdf] Started passing in pixel size instead of using derivatives - #192204

Closed
gaaclarke wants to merge 4 commits into
flutter:masterfrom
gaaclarke:pass-pixel-size
Closed

gaaclarke wants to merge 4 commits into
flutter:masterfrom
gaaclarke:pass-pixel-size

Conversation

@gaaclarke

@gaaclarke gaaclarke commented Sep 2, 2026 •

Copy link
Copy Markdown
Member

Performance optimization demonstrated in malioc results.

Not seen in the malioc results is the removal of thread synchronization because of derivative calls and the removal of potential crashes in ANGLE.

We get away with calculating the derivative on the cpu because the majority of the time we don't care about perspective matrices so the derivative is constant across fragments. If we detect a perspective matrix we fall back to the mesh renderer.

Ovals and superellipses calculate their normal to calculate the pixel size, they don't rely on the passed in pixel size.

Pre-launch Checklist

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

If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.

Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the gemini-code-assist bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Sep 2, 2026
@flutter-dashboard

Copy link
Copy Markdown

It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group.

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Sep 2, 2026
@gaaclarke
gaaclarke force-pushed the pass-pixel-size branch 3 times, most recently from b4479ea to 405db4c Compare September 3, 2026 16:51
@gaaclarke gaaclarke changed the title [uber_sdf] Started passing in pixel size instead of calculating it [uber_sdf] Started passing in pixel size instead of using derivatives Sep 3, 2026
@gaaclarke

Copy link
Copy Markdown
Member Author

setting aside for smaller scale prs (like https://github.com/flutter/flutter/pull/192267/changes)

@gaaclarke gaaclarke closed this Sep 3, 2026
pull Bot pushed a commit to Spencerx/flutter that referenced this pull request Sep 9, 2026
This removes derivative calls from the rect renderer in uber_sdf. It
rejiggers uniforms for gradients as well to make space for the new
uniform. It also removes uber_sdf from the codepath for rendering
perspective matrices. That allows us to have a stable derivative when
rendering with uber_sdf.

spawned from flutter#192204

Testing: see malioc results for better static analysis

Local performance testing on macos where I removed the derivatives from
rects, rrects and circles then drew a lot of those gave this about an 8%
improvement in raster time.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [AI contribution guidelines] and understand my
responsibilities, or I am not using AI tools.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant in-code documentation (doc comments with
`///`).
- [x] If this PR introduces a new feature or capability, I created and
linked a website documentation issue or PR in [flutter/website] (or
verified none is needed).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

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

If this change needs to override an active code freeze, provide a
comment explaining why. The code freeze workflow can be overridden by
code reviewers. See pinned issues for any active code freezes with
guidance.

**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[AI contribution guidelines]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#ai-contribution-guidelines
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[flutter/website]: https://github.com/flutter/website
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant