[flutter_tools] Hot reload Flutter GPU shader bundles#187654
Conversation
Fixes flutter#186345 After a DevFS sync, dispatch ext.ui.gpu.reinitializeShaderLibrary for each changed asset path ending in .shaderbundle, so the engine reloads the compiled Flutter GPU shader library in place instead of keeping the old shaders until a restart. The suffix is only a filter; the engine no-ops on a registry miss, and the lazily-registered extension is tolerated when absent. Skipped on web, where the bundle falls back to the generic asset eviction.
There was a problem hiding this comment.
Code Review
This pull request introduces support for reinitializing Flutter GPU shader libraries for .shaderbundle assets during hot reload, instead of using generic asset eviction, except on the web platform. Feedback suggests adding a null check for device.targetPlatform before comparing it to prevent potential null pointer issues, and adding a test case to verify the fallback behavior on the web platform.
Cover the web path of evictDirtyAssets, where a changed .shaderbundle asset falls back to ext.flutter.evict instead of the Flutter GPU shader-library reload extension (unavailable on the web engine).
|
I don't think I know enough about what Flutter GPU exactly is and where shaders fit in to review if having custom handing in flutter_tool is the right step.
If the bytes are shipped via Flutter asset bundle, then hot restart and hot reload should already work? So then my next hypothesis is that Flutter GPU has a bit more than just |
|
Right that the bytes ship via the asset bundle, but they aren't read each frame. This is the same case as FragmentProgram ( |
flutter/flutter@66aaa9a...c0a1129 2026-06-10 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#187740) 2026-06-09 burak.karahan@mail.ru Remove Material import from view chrome style test (flutter/flutter#186994) 2026-06-09 jason-simmons@users.noreply.github.com [Impeller] Remove unused DeviceHolderVK reference from CommandBufferVK (flutter/flutter#187705) 2026-06-09 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from KNe93cf5wU4xG2d-m... to 8azSyvz57mKcPqTwk... (flutter/flutter#187745) 2026-06-09 1063596+reidbaker@users.noreply.github.com Add android-agent agent.json and update reidbaker-agent skills (flutter/flutter#187746) 2026-06-09 engine-flutter-autoroll@skia.org Roll Skia from aeed11c35004 to 9f02102df298 (9 revisions) (flutter/flutter#187744) 2026-06-09 bdero@google.com [Impeller] Remove the texture coordinate system Y-flip workaround (flutter/flutter#187686) 2026-06-09 41687333+rlueders@users.noreply.github.com [Impeller] Retry uncompressed when fixed-rate compression is exhausted (flutter/flutter#187586) 2026-06-09 burak.karahan@mail.ru Remove Material import from implicit animation tests (flutter/flutter#186673) 2026-06-09 engine-flutter-autoroll@skia.org Roll Packages from 13b49f4 to bd297cf (4 revisions) (flutter/flutter#187739) 2026-06-09 30870216+gaaclarke@users.noreply.github.com Updates dia_dll.py to support vs2026 (flutter/flutter#187714) 2026-06-09 bdero@google.com [Flutter GPU] Allow attaching specific texture mip levels and slices for rendering (flutter/flutter#187685) 2026-06-09 engine-flutter-autoroll@skia.org Roll Dart SDK from 39f1c44e294f to f3441f2067ae (1 revision) (flutter/flutter#187711) 2026-06-09 bdero@google.com [flutter_tools] Hot reload Flutter GPU shader bundles (flutter/flutter#187654) 2026-06-09 katelovett@google.com Update triage links (flutter/flutter#187709) 2026-06-09 engine-flutter-autoroll@skia.org Roll Skia from 43f135735152 to aeed11c35004 (11 revisions) (flutter/flutter#187721) 2026-06-09 jason-simmons@users.noreply.github.com Use workspace resolution for the meta package in dev/integration_tests/record_use_test_package (flutter/flutter#187733) 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 louisehsu@google.com,stuartmorgan@google.com 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
Fixes flutter#186345 After a DevFS sync, dispatch `ext.ui.gpu.reinitializeShaderLibrary` for changed `.shaderbundle` assets so the engine reloads the compiled Flutter GPU shader library in place. Gated by the `.shaderbundle` suffix (the engine no-ops on a registry miss), tolerant of the lazily-registered extension being absent, and skipped on web (where the bundle falls back to the generic asset eviction). ## 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. <!-- 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 [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
Fixes #186345
After a DevFS sync, dispatch
ext.ui.gpu.reinitializeShaderLibraryfor changed.shaderbundleassets so the engine reloads the compiled Flutter GPU shader library in place. Gated by the.shaderbundlesuffix (the engine no-ops on a registry miss), tolerant of the lazily-registered extension being absent, and skipped on web (where the bundle falls back to the generic asset eviction).Pre-launch Checklist
///).