2023-04-25 04:30:49 +00:00
|
|
|
struct UniformIndex {
|
|
|
|
index: u32
|
|
|
|
}
|
|
|
|
|
2024-03-23 18:46:59 +00:00
|
|
|
struct Foo { x: u32, far: array<i32> }
|
2023-04-25 04:30:49 +00:00
|
|
|
@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;
|
|
|
|
|
2024-03-23 18:46:59 +00:00
|
|
|
u1 += arrayLength(&storage_array[0].far);
|
2024-03-23 18:51:29 +00:00
|
|
|
u1 += arrayLength(&storage_array[uniform_index].far);
|
|
|
|
u1 += arrayLength(&storage_array[non_uniform_index].far);
|
2024-03-23 18:46:59 +00:00
|
|
|
|
2023-04-25 04:30:49 +00:00
|
|
|
return u1;
|
|
|
|
}
|