Skip to content

Handle linear and radial gradients in UberSDF (re-implement after fix) - #192124

Merged
auto-submit[bot] merged 3 commits into
flutter:masterfrom
b-luk:gradient-ubersdf-again
Sep 3, 2026
Merged

auto-submit[bot] merged 3 commits into
flutter:masterfrom
b-luk:gradient-ubersdf-again

Conversation

@b-luk

@b-luk b-luk commented Sep 1, 2026 •

Copy link
Copy Markdown
Contributor

This re-implements #190874, after landing:

#191925 - Separated out some of the fixes from the original PR
#191980 - Add support for wide gamut colors.

This re-implements the rest of the original PR. This is the same exact code as the original PR, minus the changes that have already been merged in #191925.

Verified locally that the wide gamut test passes.

Related: #190401

Original PR description:

Adds direct support for linear and radial gradient color sources to UberSDF, enabling single-pass rendering of these gradients without the multi-pass blending that is currently used.

  • Adds a color_source_sampler input to UberSDF, which is used to sample a texture representing the gradient color ramp for a linear or radial gradient. This sampler may also be extended in the future for image-based color sources, but that is outside the scope of this PR.
  • Adds properties to UberSDFParameters and to UberSDF's FragInfo for specifying gradient properties.
  • Factors out code in linear_gradient_fill.frag and radial_gradient_fill.frag that samples a texture to get a color for linear and radial gradients. This logic is moved to functions in gradient.glsl, to share with uber_sdf.frag.
  • Updates Canvas::AddRenderSDFEntityToCurrentPass to fill in the gradient texture and gradient related properties when paint.color_source is a gradient supported by UberSDF.

This supports only linear and radial gradients. It does not support conical and sweep gradients. According to Gemini, linear and radial gradients make up more than 99% of gradient usage. Supporting conical and sweep gradients would require additional complexity to UberSDF, so it may not be worth it. We can revisit optimizing these other gradients in the future if we see performance related to them in real world use cases.

This change by itself speeds up gradient rendering significantly, according to the results below. This can be further improved in a follow up PR by adding caching for gradient textures, similar to TextShadowCache in ContentContext.

Addresses #190401.

Results from the demo app in #190401, run on my Windows VM.
Note that my Windows VM may not necessarily reflect real-world performance, but these numbers still show significant improvements with this PR. Also, my Windows VM reports a refresh rate of 500 hz, so almost all frame render times are considered "over budget". So ignore the "over budget" percentages and just look at the raw timing numbers.

before:

=== Windows linear-gradient comparison ===
mode=profile speed=1400px/s
Solid color | frames=953 fps=238.00 | ui p50/p95=0.669/1.231ms | raster p50/p90/p95/p99/max=4.131/5.154/5.519/6.192/6.830ms | raster_over_budget=949/953 (99.6%)
Linear gradient | frames=204 fps=50.75 | ui p50/p95=1.231/1.658ms | raster p50/p90/p95/p99/max=19.094/23.040/23.982/26.812/32.019ms | raster_over_budget=204/204 (100.0%)
================================================

after:

=== Windows linear-gradient comparison ===
mode=profile speed=1400px/s
Solid color | frames=833 fps=208.00 | ui p50/p95=0.635/1.033ms | raster p50/p90/p95/p99/max=4.752/5.570/5.732/6.134/7.504ms | raster_over_budget=833/833 (100.0%)
Linear gradient | frames=687 fps=171.50 | ui p50/p95=1.187/1.804ms | raster p50/p90/p95/p99/max=5.665/7.414/7.925/8.951/12.153ms | raster_over_budget=687/687 (100.0%)
================================================

Skia:

=== Windows linear-gradient comparison ===
mode=profile speed=1400px/s
Solid color | frames=1375 fps=343.50 | ui p50/p95=0.495/0.845ms | raster p50/p90/p95/p99/max=2.679/3.514/3.851/4.631/5.777ms | raster_over_budget=1160/1375 (84.4%)
Linear gradient | frames=1234 fps=308.25 | ui p50/p95=1.087/1.645ms | raster p50/p90/p95/p99/max=1.731/2.251/2.445/2.960/3.903ms | raster_over_budget=319/1234 (25.9%)
================================================

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.

@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 1, 2026
@b-luk
b-luk marked this pull request as ready for review September 1, 2026 17:33

@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 adds support for linear and radial gradients to the UberSDF renderer in Impeller by updating shaders, adding parameter mapping, and updating rendering logic. Feedback on these changes suggests adding an unreachable assertion to ToShaderColorSourceType to avoid potential undefined behavior, and implementing a caching mechanism for gradient textures to mitigate performance overhead and memory churn.

Comment thread engine/src/flutter/impeller/entity/contents/uber_sdf_contents.cc
Comment thread engine/src/flutter/impeller/display_list/canvas.cc
@b-luk b-luk added the CICD Run CI/CD label Sep 1, 2026
@b-luk
b-luk requested a review from gaaclarke September 1, 2026 22:22
gaaclarke
gaaclarke previously approved these changes Sep 2, 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!

@b-luk b-luk added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 2, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Sep 3, 2026
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 3, 2026
@b-luk

b-luk commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor Author

@gaaclarke PTAL. Merged from upstream, resolving conflicts with https://github.com/flutter/flutter/pull/192193/changes

@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

@b-luk b-luk added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 3, 2026
@auto-submit

auto-submit Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/192124, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 3, 2026
@b-luk b-luk added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 3, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Sep 3, 2026
Merged via the queue into flutter:master with commit fdb1d09 Sep 3, 2026
29 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Sep 3, 2026
@b-luk
b-luk deleted the gradient-ubersdf-again branch September 3, 2026 21:13
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Sep 4, 2026
…12760)

Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions)

Manual roll requested by [email protected]

flutter/flutter@70797e1...5a6cfa7

2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767)
2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306)
2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443)
2026-09-04 [email protected] [AGP 9.1.0 Migration #5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116)
2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802)
2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294)
2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292)
2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283)
2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276)
2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275)
2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062)
2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269)
2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760)
2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263)
2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098)
2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146)
2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244)
2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514)
2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655)
2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764)
2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124)
2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240)
2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202)
2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136)
2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587)
2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838)
2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236)
2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185)
2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746)
2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235)
2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150)
2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228)
2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225)
2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219)
2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217)
2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139)
2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215)
2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212)
2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209)
2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308)
2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196)
2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130)
2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544)
2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193)
...
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…lutter#12760)

Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions)

Manual roll requested by [email protected]

flutter/flutter@70797e1...5a6cfa7

2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767)
2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306)
2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443)
2026-09-04 [email protected] [AGP 9.1.0 Migration flutter#5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116)
2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802)
2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294)
2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292)
2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283)
2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276)
2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275)
2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062)
2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269)
2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760)
2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263)
2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098)
2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146)
2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244)
2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514)
2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655)
2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764)
2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124)
2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240)
2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202)
2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136)
2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587)
2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838)
2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236)
2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185)
2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746)
2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235)
2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150)
2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228)
2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225)
2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219)
2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217)
2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139)
2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215)
2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212)
2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209)
2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308)
2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196)
2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130)
2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544)
2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193)
...
victorsanni pushed a commit to victorsanni/packages that referenced this pull request Sep 9, 2026
…lutter#12760)

Manual roll Flutter from 70797e15325e to 5a6cfa7f3d26 (52 revisions)

Manual roll requested by [email protected]

flutter/flutter@70797e1...5a6cfa7

2026-09-04 [email protected] [tool] Migrate ScreenshotCommand to modular dependency injection (flutter/flutter#190767)
2026-09-04 [email protected] Roll Skia from 8fce167bdded to 93ac1e630d1d (3 revisions) (flutter/flutter#192306)
2026-09-04 [email protected] Add iOS Universal Link integration test (Simulator) (flutter/flutter#191443)
2026-09-04 [email protected] [AGP 9.1.0 Migration flutter#5] Delete getLegacyAndroidExtension and migrate NDK fallback to public DSL (flutter/flutter#192116)
2026-09-04 [email protected] Reland "[tool_tests] Remove bringup from Windows tool_tests_commands_2_2" (#191732) (flutter/flutter#191802)
2026-09-04 [email protected] [flutter_tools] Fix unhandled DebugAdapterException on early process termination (flutter/flutter#192294)
2026-09-04 [email protected] Roll Packages from f9b3954 to 9af9c60 (4 revisions) (flutter/flutter#192292)
2026-09-04 [email protected] Roll Skia from 2e3f7e07eee6 to 8fce167bdded (5 revisions) (flutter/flutter#192283)
2026-09-04 [email protected] Roll Fuchsia Linux SDK from GTZNkoIR_WegRPWgL... to FgDQeF6jb1dVRVh3K... (flutter/flutter#192276)
2026-09-04 [email protected] Roll Skia from b6b00df360e5 to 2e3f7e07eee6 (2 revisions) (flutter/flutter#192275)
2026-09-04 [email protected] [iOS] TextField should support typing accented words with external keyboard (flutter/flutter#191062)
2026-09-04 [email protected] Roll Skia from 1f68c0b16f17 to b6b00df360e5 (7 revisions) (flutter/flutter#192269)
2026-09-04 [email protected] [flutter_tools] add typed enum and defaulted option descriptors (flutter/flutter#191760)
2026-09-04 [email protected] Roll Dart SDK from c2edc382a4f8 to 5501d02b583d (1 revision) (flutter/flutter#192263)
2026-09-04 [email protected] [Linux] Use fences to synchronize frames between OpenGL contexts (flutter/flutter#192098)
2026-09-03 [email protected] Defer semantics geometry updates for blocked branches (flutter/flutter#192146)
2026-09-03 [email protected] Roll Skia from 8d3e197531c6 to 1f68c0b16f17 (8 revisions) (flutter/flutter#192244)
2026-09-03 [email protected] Fix DeleteSurrounding splitting UTF-16 surrogate pairs (flutter/flutter#190514)
2026-09-03 [email protected] Remove no-shuffle from progress indicator test (flutter/flutter#186655)
2026-09-03 [email protected] [material] Remove unused parameters from constructors of generic test class (flutter/flutter#191764)
2026-09-03 [email protected] Handle linear and radial gradients in UberSDF (re-implement after fix) (flutter/flutter#192124)
2026-09-03 [email protected] Roll Dart SDK from fcbfb64f42a1 to c2edc382a4f8 (2 revisions) (flutter/flutter#192240)
2026-09-03 [email protected] Fix parsing of --enable-hcpp-and-surface-control switch and add --no-enable-hcpp tests (flutter/flutter#192202)
2026-09-03 [email protected] Fix issue where shapes rendered with gradient+blur+rotation end up incorrectly cut off (flutter/flutter#192136)
2026-09-03 [email protected] Fix sibling nodes crash under MergeSemantics (flutter/flutter#191587)
2026-09-03 [email protected] Makes backdrop groups operate on the union. (flutter/flutter#191838)
2026-09-03 [email protected] Roll Skia from 008936396810 to 8d3e197531c6 (1 revision) (flutter/flutter#192236)
2026-09-03 [email protected] [docs] Remove superseded AI rules for Flutter (flutter/flutter#192185)
2026-09-03 [email protected] Collect analytics about SwiftPM errors and warnings (flutter/flutter#191746)
2026-09-03 [email protected] Roll Packages from 18fe786 to f9b3954 (7 revisions) (flutter/flutter#192235)
2026-09-03 [email protected] [Linux] Remove frame sharing between OpenGL contexts (flutter/flutter#192150)
2026-09-03 [email protected] Roll Dart SDK from cf79067a1e44 to fcbfb64f42a1 (1 revision) (flutter/flutter#192228)
2026-09-03 [email protected] Roll Skia from 731fe9af4c0b to 008936396810 (3 revisions) (flutter/flutter#192225)
2026-09-03 [email protected] Roll Dart SDK from 700ab60bfe53 to cf79067a1e44 (2 revisions) (flutter/flutter#192219)
2026-09-03 [email protected] Roll Skia from 823f82e18177 to 731fe9af4c0b (5 revisions) (flutter/flutter#192217)
2026-09-03 [email protected] Fixes OverlayPortal semantics bounds corruption (flutter/flutter#192139)
2026-09-03 [email protected] Roll Fuchsia Linux SDK from idslm9FikVLy2K_A-... to GTZNkoIR_WegRPWgL... (flutter/flutter#192215)
2026-09-03 [email protected] Roll Fuchsia Test Scripts from u_fSMsPU22VvUsvSo... to VObjlh3xw2P9sEbC_... (flutter/flutter#192212)
2026-09-03 [email protected] Roll Skia from ae22da2e8308 to 823f82e18177 (13 revisions) (flutter/flutter#192209)
2026-09-02 [email protected] Expose skipTraversal in FocusableActionDetector (flutter/flutter#191308)
2026-09-02 [email protected] Add `IsProgram` mock method to `MockGLESImpl`, use it in `BufferBindingsGLESTest` (flutter/flutter#192196)
2026-09-02 [email protected] Fix nested scroll view fling crash (flutter/flutter#191130)
2026-09-02 [email protected] Fix TabBarView/PageView edge auto-scroll during mouse text selection (flutter/flutter#189544)
2026-09-02 [email protected] Bypass gamma correction when alpha >= 1.0 (flutter/flutter#192193)
...
RickyvdBerg added a commit to avio-os/avio-flutter that referenced this pull request Oct 2, 2026
…lutter#192124, flutter#192962)

UberSDF in this fork cannot shade a color source, so every antialiased
gradient rect, rrect, oval or circle (Avio's Shell and greeter run with
use_sdfs) was blended through a white SDF mask: two snapshots and a blend
target per draw, plus a deferred coverage pass in externalLinearBackdrop
mode. Upstream fixed this in the owning layer: fdb1d09 (flutter#192124) shades
linear and radial gradients inside UberSDF and 419f9dd (flutter#192962) adds the
storage-buffer variant used on Vulkan, so no ramp texture is made per draw.

Both upstream commits sit on intermediate UberSDF changes this fork does not
carry (uniform reordering, rect-path derivatives, stroke pixel size, which
would change other SDF output), and Avio's UberSDF carries patch 45's
coverage fields, so this is an adapted backport in one commit, not literal
cherry-picks:
- uber_sdf.frag is split into uber_sdf_common.glsl (shape SDFs, getColor,
  main) plus uber_sdf.frag (ramp texture) and uber_sdf_ssbo.frag (gradient
  stops in a storage buffer, the same math as the SSBO gradient shaders).
  Wherever the backend supports SSBOs (Vulkan), every UberSDF draw uses the
  SSBO variant, as upstream does.
- UberSDFParameters gains GradientParameters; UberSDFContents renders both
  variants from one FragInfo setup; color filters wrap on the GPU for a
  gradient, and a gradient is never a background color.
- Canvas::AddRenderSDFEntityToCurrentPass shades a linear or radial gradient
  whose local matrix (with the inverse shape transform) is a similarity.
  Conical and sweep gradients, images and runtime effects keep the masked
  kSrcIn path patch 52 slims. Patch 52's no-mask rect still comes first.
- A gradient shaded in UberSDF takes the coverage transfer in the shader;
  defer_coverage no longer includes the color source in that case.

Avio deltas against upstream (decision D3, accepted on the condition that
Avio's crisp look stays):
- Edges keep the old response: a gradient's SDF alpha uses the
  light-foreground gamma correction of the white mask it was blended through
  before, not the gradient's luma; the SSBO variant dithers like the SSBO
  gradient shaders, and like the masked composite it dithers the gradient
  color before coverage scales it, so a pixel the shape does not cover (the
  AA band's outside, the quad corners around a rounded shape) stays exactly
  transparent and srcOver adds nothing to what lies underneath. Upstream
  does not dither in UberSDF.
- Linear gradients also require a similarity matrix (upstream checks only
  affinity); mapping end points through a shear or non-uniform scale does not
  map the gradient's field.
- flutter#191925 and flutter#191980 are not brought in: the ramp-texture variant uses the
  fork's current GradientData, and Avio's SDF users take the SSBO variant.
- malioc.json is not updated.

Nothing else on the branch depends on this commit; its tests use patch
52's Playground::EnsureContextUsesSDFs. Reverting it alone restores the
masked path exactly.

Tests:
- UberSDFContentsTest.ApplyColorFilterWithGradient and
  AsBackgroundColorGradientReturnsNullopt (from upstream; red as compile
  failures on the base: GradientParameters did not exist).
- On every playground that renders with SDFs (Playground::
  EnsureContextUsesSDFs: Vulkan with SDFs enabled, which runs the
  storage-buffer variant Avio ships, and the OpenGL ES and Metal SDF
  backends, which run the ramp-texture variant; plain backends skip):
  AiksTest.SdfLinearGradientRectAllocatesNoOffscreen (expected red on the
  base: three offscreens), SdfRadialGradientCircleUnderNonUniformScale-
  AllocatesNoOffscreen, UnsupportedColorSourceStillBlends (a sweep gradient
  keeps exactly three offscreens), and SdfGradientEdgesMatchMaskedComposite:
  the pixel guard the user asked for. It renders rect, rounded rect, oval
  and circle with an opaque dark-to-light gradient and a translucent glass
  sheen, in platformDefault and externalLinearBackdrop, once shaded in
  UberSDF and once through the old masked composite (the same horizontal
  gradient with a y-scale local matrix, which leaves its field unchanged but
  routes it through the masked path). Every pixel, corners and antialiased
  edges included, must hold alpha within 2/255 and color within 2/255
  (ramp texture, no dither) or 5/255 (storage buffer: the composite dithered
  in its snapshot's grid, then quantized once more); every pixel the
  composite leaves fully transparent must stay exactly zero. Green by
  construction on the base (both renders take the masked path there); after
  this patch it fails if edges, corners, glass coverage or uncovered pixels
  drift.
- SdfGradientLeavesUncoveredQuadPixelsTransparent: the quad corners around a
  gradient circle are exactly zero in both coverage modes, opaque and glass.
  Red on the storage-buffer variant if the dither runs after coverage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants