-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
Use case
As it currently stands, fragment shaders appear to be loaded outside of the typical method of loading assets. They seem to sidestep the defined DefaultAssetBundle as well as the rootBundle, opting to fetch the shader directly from an asset manager in C++ instead. I have not found a way to modify this behavior.
We have built a custom embedding, and we make our assets available via our own custom asset bundle implementation, but if we want to use any custom shaders we'd have to ship those via the built-in asset bundling method instead. Shaders don't even seem to use the asset platform channel, so making it available through that's not doable, either.
Our asset bundle does include the compiled shader, the Flutter engine just cannot find it.
Correct me if I'm wrong, of course, but it seems there's no way to load shaders any other way.
Proposal
Updating it to search the root asset bundle would likely be a breaking change, and it would require access to BuildContext in order to get the current DefaultAssetBundle. The fragment program load function could take an optional asset bundle argument and use that if supplied.
I'm unsure of the specifics of the implementation that may make this solution infeasible