Skip to content

[material_ui] Use named uniforms instead of setFloat in InkSparkle - #13445

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
mohamedalsamrai:material-ui-ink-sparkle
Nov 2, 2026
Merged

auto-submit[bot] merged 1 commit into
flutter:mainfrom
mohamedalsamrai:material-ui-ink-sparkle

Conversation

@mohamedalsamrai

@mohamedalsamrai mohamedalsamrai commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Moves InkSparkle from the index-based FragmentShader.setFloat to the named uniform API (getUniformFloat, getUniformVec2, getUniformVec4), as part of deprecating setFloat (flutter/flutter#195357).

InkSparkle looks up its 13 uniforms once, when it creates its shader, and sets them through those slots on each paint. Every uniform gets the same value as before, so there is no visual change. The named API is available in Flutter 3.47.0, the package's minimum, so the SDK constraint doesn't change.

flutter/flutter#195358 covers both InkSparkle and StretchEffect. Since Material is frozen in flutter/flutter (flutter/flutter#188444), the work is split: StretchEffect is in flutter/flutter#195372, and InkSparkle is here.

Part of flutter/flutter#195358

Version and CHANGELOG: adds a pending_changelogs entry with version: patch.

Tests: this is a refactor with no semantic change, so I think it qualifies for a test exemption. It's covered by the existing golden tests in test/ink_sparkle_test.dart, and a misspelled uniform name would throw when those tests paint.

Pre-Review Checklist

@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 both you and the PR author believe this PR qualifies for a test exemption, escalate to the tech lead for the changed area to review and apply the test-exempt label. All reviewers should feel empowered to ask for tests before escalating.

@github-actions github-actions Bot added p: material_ui triage-design Should be looked at in design triage labels Oct 26, 2026

@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 updates the InkSparkle class to set its shader uniforms by name using a new _InkSparkleUniforms helper class, replacing the previous approach of setting them by index via FragmentShader.setFloat. A pending changelog entry has also been added to document this change. There are no review comments, and I have no feedback to provide.

@gaaclarke gaaclarke added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Oct 30, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2026
@auto-submit

auto-submit Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/13445, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@auto-submit

auto-submit Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/13445, because - This pull request has the missing-tests label and does not have the test-exempt label. Please add tests or obtain a test exemption from a tech lead before re-applying the autosubmit label.

@gaaclarke gaaclarke added the test-exempt Exempt from tests. Overrides `missing-tests` label label Oct 30, 2026
@gaaclarke

Copy link
Copy Markdown
Member

test exempt: just a refactor away from an api being deprecated

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 30, 2026
@auto-submit

auto-submit Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/packages/13445, because This PR has not met approval requirements for merging. The PR author is not a member of flutter-hackers and needs 1 more review(s) in order to merge this PR.

  • Merge guidelines: A PR needs at least one approved review if the author is already part of flutter-hackers or two member reviews if the author is not a member of flutter-hackers before re-applying the autosubmit label. Reviewers: If you left a comment approving, please use the "approve" review action instead.

@gaaclarke
gaaclarke requested a review from justinmc October 30, 2026 16:39

@justinmc justinmc 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.

LGTM 👍

// uResolutionScale
..setFloat(11, 1.0 / _width)
..setFloat(12, 1.0 / _height)
// uNoiseScale

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.

I guess we don't need these comments any more now that everything is mapped in _InkSparkleUniforms.

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 2, 2026
@auto-submit
auto-submit Bot merged commit 30d67e6 into flutter:main Nov 2, 2026
13 checks passed
Leapward-Koex pushed a commit to Leapward-Koex/flutter that referenced this pull request Nov 3, 2026
IMoves `StretchEffect` from the index-based `FragmentShader.setFloat` to
`getUniformFloat`, as part of deprecating `setFloat` (flutter#195357).

`StretchEffect` creates a new shader on every build, so it looks up its
four uniforms by name right after creating it, using a local variable
instead of repeating `_fragmentShader!`. `u_size` and `u_texture` are
still set by the engine for `ImageFilter.shader`. Every uniform gets the
same value as before, so there is no visual change.

The `InkSparkle` part of flutter#195358 is in flutter/packages#13445, since
Material is frozen in this repo (flutter#188444).

Part of flutter#195358

This is a refactor with no semantic change, so I think it qualifies for
`test-exempt`. It's covered by the existing golden test in
`stretch_effect_test.dart`, which runs in the Impeller shard, and a
misspelled uniform name would throw when that test runs.
## 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.


<!-- 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/CONTRIBUTING.ai.md
[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: gaaclarke <[email protected]>
gmackall pushed a commit to gmackall/flutter that referenced this pull request Nov 3, 2026
IMoves `StretchEffect` from the index-based `FragmentShader.setFloat` to
`getUniformFloat`, as part of deprecating `setFloat` (flutter#195357).

`StretchEffect` creates a new shader on every build, so it looks up its
four uniforms by name right after creating it, using a local variable
instead of repeating `_fragmentShader!`. `u_size` and `u_texture` are
still set by the engine for `ImageFilter.shader`. Every uniform gets the
same value as before, so there is no visual change.

The `InkSparkle` part of flutter#195358 is in flutter/packages#13445, since
Material is frozen in this repo (flutter#188444).

Part of flutter#195358

This is a refactor with no semantic change, so I think it qualifies for
`test-exempt`. It's covered by the existing golden test in
`stretch_effect_test.dart`, which runs in the Impeller shard, and a
misspelled uniform name would throw when that test runs.
## 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.


<!-- 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/CONTRIBUTING.ai.md
[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: gaaclarke <[email protected]>
RamyAkin pushed a commit to RamyAkin/flutter that referenced this pull request Nov 3, 2026
flutter/packages@3f34a6f...1df8447

2026-11-03 [email protected] [webview_flutter] Convert iOS impl
example app to Swift (flutter/packages#13538)
2026-11-03 [email protected] [material_ui]
Temporarily exclude material_ui from non-Wasm web unit tests
(flutter/packages#13537)
2026-11-02 [email protected] [material_ui]
Removes list semantics in some a11y_assessment samples
(flutter/packages#13257)
2026-11-02 [email protected] [material_ui] Use named uniforms
instead of setFloat in InkSparkle (flutter/packages#13445)
2026-11-02 [email protected] [VPAT] Fix contrast and reflow in
three a11y_assessments demos (flutter/packages#13409)
2026-11-02 [email protected]
[two_dimensional_scrollables] Fix pinned cells hit test
(flutter/packages#13376)
2026-11-02 [email protected] [tool] Let the OS pick a port for
chromedriver and wait for exit (flutter/packages#13355)
2026-11-02 [email protected] [vector_graphics] Draw <text> under an RTL ambient
direction (flutter/packages#13408)
2026-11-02 [email protected] [VPAT] Keep a11y_assessments
snackbars open until closed (flutter/packages#13451)
2026-11-02 [email protected] [pigeon] Fix race in event channel
handler removal integration test (flutter/packages#13528)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] 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 CICD Run CI/CD missing-tests p: material_ui test-exempt Exempt from tests. Overrides `missing-tests` label triage-design Should be looked at in design triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants