Repository navigation
[Impeller] Update impellerc to create fat shader blobs. #123741
Description
Activity
- addedengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.P1High-priority issues at the top of the work listHigh-priority issues at the top of the work liste: impellerImpeller rendering backend issues and features requestsImpeller rendering backend issues and features requests
on Mar 30, 2023 Do we need to combine the compiled shaders into one file? Seems like we could just ship with both files and load the appropriate shaders depending on what backend is chosen (vulkan or opengl es).
On Android, we will end up using both Vulkan and OpenGL ES. So I do think this is necessary.
- addedP2Important issues not at the top of the work listImportant issues not at the top of the work listand removedP1High-priority issues at the top of the work listHigh-priority issues at the top of the work list
on May 16, 2023 How can this affect the app size compared to using Skia?
The increase in size of the compressed Flutter engine binary (that contains the prepackaged shaders) for all of Impeller is ~100K with one rendering backend. Having two backends in a binary (like Android) won't necessarily be 2x the size due to shared components but that is a reasonable (very) conservative estimate.
Uncompressed (because that is easier to analyze), the shaders are 90 KB and backend 28 KB. So we expect to duplicate just these. But the shaders compress really well in the APK/IPA.
OTOH, just Skia GPU and SKSL (the runtime shader compiler) are 553 and 192.32 KB respectively. So just the online shader compiler is larger than the Impeller prepackaged shaders. Impellers shader compiler is significantly larger but all that is in ImpellerC and run at build time only. Impeller can't generate and compile shaders at runtime so there is less code to package.
During the transition we expect to have both Impeller and Skia in the binary since we want folks to be able to opt out in case of unexpected issues. But we are working towards a Skia-GPU (and its deps) less engine. Early experiments show a binary size decrease of at least 7%.
Either way, Impeller will be significantly smaller than the current backend once we complete the transition and remove the legacy backend.
Reacted by DP and Liber Da SilvaReacted by Liber Da Silva- addedteam-engineOwned by Engine teamOwned by Engine teamtriaged-engineTriaged by Engine teamTriaged by Engine team
on Jul 8, 2023 Strawman design: When compiling for Android, we invoke impellerc twice - once for each backend type, GLES/VUlkan. Then a third time with each of the previous input files to merge them together into a combined format.
Might be easier than refactoring impellerc to create two different compilers.
Thats a good idea. I was thinking of something like blobcat but refactored to also create fat shader blobs instead of single backend shader libraries. But we don't ship blobcat as an artifact and we need that for runtime stages.
The argument parsing in impellerc is pretty rudimentary. But perhaps it can take multiple commands,
impellerc compiler <all existing args>and then animpellerc lipo <options>.- added a commit that references this issue
on Oct 24, 2023 - added a commit that references this issue
on Oct 24, 2023 This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.- locked as resolved and limited conversation to collaborators
on Jan 25, 2024
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields✅ Done



When targeting Android, the shader blobs must contain SPIRV as well OpenGL ES shaders along with the necessary metadata.
impellercmust be able to generate fat shader blobs similar to thelipotool for dylibs. We never had this issue with iOS/macOS because there is only the Metal backend.