mirror of
https://github.com/bevyengine/bevy
synced 2025-01-06 18:28:59 +00:00
0a4136d266
# Objective - Add a helper for storage buffers similar to `UniformVec` ## Solution - Add a `StorageBuffer<T, U>` where `T` is the main body of the shader struct without any final variable-sized array member, and `U` is the type of the items in a variable-sized array. - Use `()` as the type for unwanted parts, e.g. `StorageBuffer<(), Vec4>::default()` would construct a binding that would work with `struct MyType { data: array<vec4<f32>>; }` in WGSL and `StorageBuffer<MyType, ()>::default()` would work with `struct MyType { ... }` in WGSL as long as there are no variable-sized arrays. - Std430 requires that there is at most one variable-sized array in a storage buffer, that if there is one it is the last member of the binding, and that it has at least one item. `StorageBuffer` handles all of these constraints. |
||
---|---|---|
.. | ||
imp | ||
std140 | ||
std430 | ||
glsl.rs | ||
imp.rs | ||
internal.rs | ||
lib.rs | ||
std140.rs | ||
std430.rs | ||
util.rs |