mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-12-01 11:13:30 +00:00
37b3c36a8f
* Support buffer resource arrays in IR, wgsl-in, and spv-out * spv-out: refactor non-uniform indexing semantics to support buffers * Update the doc comment on BindingArray type * Improve TypeInfo restrictions on binding arrays * Strip DATA out of binding arrays * Include suggested documentation, more binding array tests, enforce structs
28 lines
551 B
WebGPU Shading Language
28 lines
551 B
WebGPU Shading Language
struct UniformIndex {
|
|
index: u32
|
|
}
|
|
|
|
struct Foo { x: u32 }
|
|
@group(0) @binding(0)
|
|
var<storage, read> storage_array: binding_array<Foo, 1>;
|
|
@group(0) @binding(10)
|
|
var<uniform> uni: UniformIndex;
|
|
|
|
struct FragmentIn {
|
|
@location(0) index: u32,
|
|
}
|
|
|
|
@fragment
|
|
fn main(fragment_in: FragmentIn) -> @location(0) u32 {
|
|
let uniform_index = uni.index;
|
|
let non_uniform_index = fragment_in.index;
|
|
|
|
var u1 = 0u;
|
|
|
|
u1 += storage_array[0].x;
|
|
u1 += storage_array[uniform_index].x;
|
|
u1 += storage_array[non_uniform_index].x;
|
|
|
|
return u1;
|
|
}
|