forked from bevyengine/bevy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor mesh bind groups to be based on a set of flags.
Currently, Bevy hardcodes the bind group layouts and bind groups for every combination of mesh features: `model_only`, `skinned`, `morphed`, and `morphed_skinned`. This causes a combinatorial explosion when new mesh features are added, as PR bevyengine#10231 does for lightmaps. To solve this, PR introduces `MeshLayoutKey`, which is a set of flags that define which mesh features are enabled. All possible combinations of bind group layouts and bind groups are generated generically, so new mesh features can be easily added in the future. To avoid a runtime combinatorial explosion, the following optimizations have been added: * Some flags are marked *generic*, which means that bind groups with them only have to be generated once and then can be reused across all meshes. * `SKINNED` and `MORPHED` bind groups are never generated if the scene doesn't contain any skinned or morphed meshes, respectively. * `SKINNED` and `MORPHED` bind groups are only generated for meshes that actually have skins or morph targets, respectively.
- Loading branch information
Showing
2 changed files
with
224 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.