Skip to content

Handle complex RSE rendering in the uber SDF pipeline - #186434

Merged
auto-submit[bot] merged 19 commits into
flutter:masterfrom
walley892:rse-full
May 29, 2026
Merged

auto-submit[bot] merged 19 commits into
flutter:masterfrom
walley892:rse-full

Conversation

@walley892

@walley892 walley892 commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Updates the uber SDF shader pipeline to support complex RSEs with asymmetric corner radii.

This works by breaking the RSE into four quadrants, and evaluating them separately.

Separates the rendering paths for symmetric and asymmetric RSEs so symmetric RSEs don't need as much branching.

Also tucks the parameter unpacking into uber_sdf_contents.cc, because the canvas code was getting bloated.

Adds unit tests and a golden.

Will need to update malioc

Pre-launch Checklist

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

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 13, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels May 13, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@walley892 walley892 added the CICD Run CI/CD label May 13, 2026
@walley892

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request enables SDF rendering for asymmetric rounded superellipses by transitioning from single-quadrant to per-quadrant parameter processing. Key changes include updating UberSDFParameters to store quadrant data in Vector4 types and rewriting the uber_sdf.frag shader to evaluate all four quadrants. Feedback highlights a critical bug where an uninitialized variable grad_norm is used in the shader, as well as opportunities to optimize performance by using split points for branching and removing the unused distanceToSegment function.

Comment thread engine/src/flutter/impeller/entity/shaders/uber_sdf.frag Outdated
Comment thread engine/src/flutter/impeller/entity/shaders/uber_sdf.frag Outdated
Comment thread engine/src/flutter/impeller/entity/shaders/uber_sdf.frag Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label May 13, 2026
@walley892
walley892 requested a review from gaaclarke May 13, 2026 20:37
@walley892 walley892 added the CICD Run CI/CD label May 13, 2026
@walley892
walley892 requested a review from dkwingsmt May 13, 2026 20:42
@walley892
walley892 marked this pull request as ready for review May 13, 2026 20:43

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request enables the rendering of asymmetric rounded superellipses via Signed Distance Fields (SDFs). The implementation refactors the UberSDF pipeline to store and process per-quadrant geometric parameters using Vector4 structures in both the C++ host code and the fragment shader. Feedback suggests unifying the component ordering of corner radii across different shape types to maintain consistency with the shader's quadrant indexing logic.

Comment thread engine/src/flutter/impeller/entity/contents/uber_sdf_parameters.cc Outdated
Comment thread engine/src/flutter/impeller/entity/contents/uber_sdf_parameters_unittests.cc Outdated
@walley892 walley892 changed the title Rse full Handle complex RSE rendering in the uber SDF pipeline May 13, 2026

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @walley892, the golden for impeller_Play_AiksTest_CanRenderAsymmetricRoundSuperellipses_MetalSDF doesn't look right https://flutter-gold.skia.org/search?issue=186434&crs=github&patchsets=6&corpus=flutter

07619c7a3bdd6ae11109ea18e903ac5f

@walley892

Copy link
Copy Markdown
Contributor Author

Confirmed with steamboat willie that the goldens look good locally on his M1 and my M4. Investigating

Screenshot 2026-05-14 at 10 12 11 AM

@github-actions github-actions Bot removed the CICD Run CI/CD label May 14, 2026
@walley892 walley892 added the CICD Run CI/CD label May 14, 2026
@github-actions github-actions Bot removed the CICD Run CI/CD label May 19, 2026
@walley892

Copy link
Copy Markdown
Contributor Author

It's not going to make this PR much bigger. Mostly the logic will just be moved from one file to another. Let's just get it over with now.

From the glsl perspective, yeah. the c++ is where the code bloat is mostly happening - split things out

@walley892
walley892 requested a review from gaaclarke May 26, 2026 20:37
@walley892 walley892 added the CICD Run CI/CD label May 26, 2026

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, there is just some minor formatting that needs to be fixed. I like us to make this lazy loaded, that can be a followup though. Nice work @walley892

Comment thread engine/src/flutter/impeller/entity/contents/complex_rse_contents.cc Outdated
Comment thread engine/src/flutter/impeller/entity/contents/complex_rse_contents.h
Comment thread engine/src/flutter/impeller/entity/contents/content_context.cc
Comment thread engine/src/flutter/impeller/entity/shaders/complex_rse.frag Outdated
Comment thread engine/src/flutter/impeller/entity/shaders/sdf_functions.glsl Outdated
Comment thread engine/src/flutter/impeller/entity/shaders/sdf_utils.glsl Outdated
@github-actions github-actions Bot removed the CICD Run CI/CD label May 28, 2026
@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label May 28, 2026
@walley892
walley892 requested a review from gaaclarke May 28, 2026 02:19
Comment thread engine/src/flutter/impeller/entity/contents/complex_rse_contents.h Outdated

@gaaclarke gaaclarke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lgtm, thanks!

@github-actions github-actions Bot removed the CICD Run CI/CD label May 28, 2026
@walley892 walley892 added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels May 28, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 28, 2026
@auto-submit

auto-submit Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/186434, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR.

@walley892 walley892 added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App and removed CICD Run CI/CD labels May 28, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue May 28, 2026
Merged via the queue into flutter:master with commit c7b914a May 29, 2026
24 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 29, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request May 29, 2026
flutter/flutter@e70534d...b05a9d7

2026-05-29 [email protected] Roll Skia from 47155534833e to d9d6b440c4e7 (1 revision) (flutter/flutter#187301)
2026-05-29 [email protected] Roll Skia from f93ed13d77fb to 47155534833e (4 revisions) (flutter/flutter#187291)
2026-05-29 [email protected] [web_ui] Optimize skwasm text layout and path decoding to eliminate dynamic boxing churn under Wasm (flutter/flutter#186978)
2026-05-29 [email protected] Roll Fuchsia Linux SDK from SBpmmPxqx3lAvGojE... to jMR_VXQi07kAk8vbR... (flutter/flutter#187279)
2026-05-29 [email protected] Remove Material import from sliver tree rendering test (flutter/flutter#187000)
2026-05-29 [email protected] [Impeller] Remove the y_coord_scale Y-flip plumbing (flutter/flutter#187224)
2026-05-29 [email protected] Add/remove overlay child RenderObject from the tree in `attach`/`detach` (flutter/flutter#186564)
2026-05-29 [email protected] Roll Skia from fcfe5975c945 to f93ed13d77fb (4 revisions) (flutter/flutter#187273)
2026-05-28 [email protected] Handle complex RSE rendering in the uber SDF pipeline (flutter/flutter#186434)
2026-05-28 [email protected] Roll Dart SDK from 082191101fcc to 683322426411 (2 revisions) (flutter/flutter#187270)
2026-05-28 [email protected] Clarify route transition animations (flutter/flutter#186552)
2026-05-28 [email protected] document that the default Key is null and explain proper usage in list diffing (flutter/flutter#185197)
2026-05-28 [email protected] [flutter_tools] Use super parameters in missed spots (flutter/flutter#186197)
2026-05-28 [email protected] docs: Document MediaQueryData.alwaysUse24HourFormat on macOS, Windows, Linux, web (#160664) (flutter/flutter#186642)
2026-05-28 [email protected] Roll Skia from 5493e4c144cd to fcfe5975c945 (3 revisions) (flutter/flutter#187256)
2026-05-28 [email protected] Shares opengles golden context (flutter/flutter#187243)
2026-05-28 [email protected] Update the Curl CIPD package in .ci.yaml to version 8.20.0 (flutter/flutter#187133)
2026-05-28 [email protected] Improve SizedBox's docs (flutter/flutter#187208)
2026-05-28 [email protected] [Impeller] Support instanced rendering across all backends (flutter/flutter#186653)
2026-05-28 [email protected] [Android] Reset system UI visibility flags when setting edge-to-edge mode (flutter/flutter#187207)
2026-05-28 [email protected] Roll Skia from a38708fb7926 to 5493e4c144cd (7 revisions) (flutter/flutter#187241)
2026-05-28 [email protected] Turned on impeller by default on macos (flutter/flutter#186546)
2026-05-28 [email protected] Clarify lazy scroll extent docs (flutter/flutter#186864)
2026-05-28 [email protected] [web] Fix WebParagraph locales test (flutter/flutter#186813)
2026-05-28 [email protected] Roll Packages from 4b424d7 to 10cbdc5 (3 revisions) (flutter/flutter#187238)
2026-05-28 [email protected] Roll Dart SDK from f3db7b7d9801 to 082191101fcc (8 revisions) (flutter/flutter#187235)
2026-05-28 [email protected] Roll Skia from 32acea791248 to a38708fb7926 (1 revision) (flutter/flutter#187221)
2026-05-28 [email protected] [Flutter GPU] Add r32Float and remove Apple-only XR pixel formats (flutter/flutter#187069)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…r#11803)

flutter/flutter@e70534d...b05a9d7

2026-05-29 [email protected] Roll Skia from 47155534833e to d9d6b440c4e7 (1 revision) (flutter/flutter#187301)
2026-05-29 [email protected] Roll Skia from f93ed13d77fb to 47155534833e (4 revisions) (flutter/flutter#187291)
2026-05-29 [email protected] [web_ui] Optimize skwasm text layout and path decoding to eliminate dynamic boxing churn under Wasm (flutter/flutter#186978)
2026-05-29 [email protected] Roll Fuchsia Linux SDK from SBpmmPxqx3lAvGojE... to jMR_VXQi07kAk8vbR... (flutter/flutter#187279)
2026-05-29 [email protected] Remove Material import from sliver tree rendering test (flutter/flutter#187000)
2026-05-29 [email protected] [Impeller] Remove the y_coord_scale Y-flip plumbing (flutter/flutter#187224)
2026-05-29 [email protected] Add/remove overlay child RenderObject from the tree in `attach`/`detach` (flutter/flutter#186564)
2026-05-29 [email protected] Roll Skia from fcfe5975c945 to f93ed13d77fb (4 revisions) (flutter/flutter#187273)
2026-05-28 [email protected] Handle complex RSE rendering in the uber SDF pipeline (flutter/flutter#186434)
2026-05-28 [email protected] Roll Dart SDK from 082191101fcc to 683322426411 (2 revisions) (flutter/flutter#187270)
2026-05-28 [email protected] Clarify route transition animations (flutter/flutter#186552)
2026-05-28 [email protected] document that the default Key is null and explain proper usage in list diffing (flutter/flutter#185197)
2026-05-28 [email protected] [flutter_tools] Use super parameters in missed spots (flutter/flutter#186197)
2026-05-28 [email protected] docs: Document MediaQueryData.alwaysUse24HourFormat on macOS, Windows, Linux, web (#160664) (flutter/flutter#186642)
2026-05-28 [email protected] Roll Skia from 5493e4c144cd to fcfe5975c945 (3 revisions) (flutter/flutter#187256)
2026-05-28 [email protected] Shares opengles golden context (flutter/flutter#187243)
2026-05-28 [email protected] Update the Curl CIPD package in .ci.yaml to version 8.20.0 (flutter/flutter#187133)
2026-05-28 [email protected] Improve SizedBox's docs (flutter/flutter#187208)
2026-05-28 [email protected] [Impeller] Support instanced rendering across all backends (flutter/flutter#186653)
2026-05-28 [email protected] [Android] Reset system UI visibility flags when setting edge-to-edge mode (flutter/flutter#187207)
2026-05-28 [email protected] Roll Skia from a38708fb7926 to 5493e4c144cd (7 revisions) (flutter/flutter#187241)
2026-05-28 [email protected] Turned on impeller by default on macos (flutter/flutter#186546)
2026-05-28 [email protected] Clarify lazy scroll extent docs (flutter/flutter#186864)
2026-05-28 [email protected] [web] Fix WebParagraph locales test (flutter/flutter#186813)
2026-05-28 [email protected] Roll Packages from 4b424d7 to 10cbdc5 (3 revisions) (flutter/flutter#187238)
2026-05-28 [email protected] Roll Dart SDK from f3db7b7d9801 to 082191101fcc (8 revisions) (flutter/flutter#187235)
2026-05-28 [email protected] Roll Skia from 32acea791248 to a38708fb7926 (1 revision) (flutter/flutter#187221)
2026-05-28 [email protected] [Flutter GPU] Add r32Float and remove Apple-only XR pixel formats (flutter/flutter#187069)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: 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
via-guy pushed a commit to via-guy/flutter that referenced this pull request Jun 26, 2026
Updates the uber SDF shader pipeline to support complex RSEs with
asymmetric corner radii.

This works by breaking the RSE into four quadrants, and evaluating them
separately.

Separates the rendering paths for symmetric and asymmetric RSEs so
symmetric RSEs don't need as much branching.

Also tucks the parameter unpacking into uber_sdf_contents.cc, because
the canvas code was getting bloated.

Adds unit tests and a golden.

Will need to update malioc

## 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 documentation (doc comments with `///`).
- [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.
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.

4 participants