Skip to content

Commit 5d7a605

Browse files
authored
Add a new #[data] attribute to AsBindGroup that allows packing data for multiple materials into a single array. (#17965)
Currently, the structure-level `#[uniform]` attribute of `AsBindGroup` creates a binding array of individual buffers, each of which contains data for a single material. A more efficient approach would be to provide a single buffer with an array containing all of the data for all materials in the bind group. Because `StandardMaterial` uses `#[uniform]`, this can be notably inefficient with large numbers of materials. This patch introduces a new attribute on `AsBindGroup`, `#[data]`, which works identically to `#[uniform]` except that it concatenates all the data into a single buffer that the material bind group allocator itself manages. It also converts `StandardMaterial` to use this new functionality. This effectively provides the "material data in arrays" feature.
1 parent a171733 commit 5d7a605

File tree

7 files changed

+479
-132
lines changed

7 files changed

+479
-132
lines changed

0 commit comments

Comments
 (0)