bevy_hanabi
bevy_hanabi copied to clipboard
Cache bind group layouts before specializing pipelines
We create bind group layouts during pipeline specialization because we need them, but then discard them (because we can't mutate anything inside specialize()), and then re-create a second exact copy of the layout layer when we need to cache it to be able to later create the bind group. This is a source of errors, and a waste of GPU memory. We should create and cache those layouts once and for all before we specialize the pipeline, and use the same object for the pipeline specialization and for the bind group creation.