Repository navigation
[material_ui] Use named uniforms instead of setFloat in InkSparkle - #13445
Conversation
|
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 |
There was a problem hiding this comment.
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.
|
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.
|
|
autosubmit label was removed for flutter/packages/13445, because - This pull request has the |
|
test exempt: just a refactor away from an api being deprecated |
|
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.
|
| // uResolutionScale | ||
| ..setFloat(11, 1.0 / _width) | ||
| ..setFloat(12, 1.0 / _height) | ||
| // uNoiseScale |
There was a problem hiding this comment.
I guess we don't need these comments any more now that everything is mapped in _InkSparkleUniforms.
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]>
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]>
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
Moves
InkSparklefrom the index-basedFragmentShader.setFloatto the named uniform API (getUniformFloat,getUniformVec2,getUniformVec4), as part of deprecatingsetFloat(flutter/flutter#195357).InkSparklelooks 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
InkSparkleandStretchEffect. Since Material is frozen in flutter/flutter (flutter/flutter#188444), the work is split:StretchEffectis in flutter/flutter#195372, andInkSparkleis here.Part of flutter/flutter#195358
Version and CHANGELOG: adds a
pending_changelogsentry withversion: 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
[shared_preferences]///).