2021-04-16 21:11:18 +00:00
|
|
|
// This snapshot tests accessing various containers, dereferencing pointers.
|
|
|
|
|
2021-05-01 02:40:32 +00:00
|
|
|
[[block]]
|
|
|
|
struct Bar {
|
2021-05-04 02:47:33 +00:00
|
|
|
matrix: mat4x4<f32>;
|
|
|
|
data: [[stride(4)]] array<i32>;
|
2021-05-01 02:40:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
[[group(0), binding(0)]]
|
|
|
|
var<storage> bar: [[access(read_write)]] Bar;
|
|
|
|
|
2021-04-16 21:11:18 +00:00
|
|
|
[[stage(vertex)]]
|
|
|
|
fn foo([[builtin(vertex_index)]] vi: u32) -> [[builtin(position)]] vec4<f32> {
|
2021-06-08 14:15:26 +00:00
|
|
|
var foo: f32 = 0.0;
|
|
|
|
// We should check that backed doesn't skip this expression
|
|
|
|
let baz: f32 = foo;
|
|
|
|
foo = 1.0;
|
|
|
|
|
2021-05-04 02:47:33 +00:00
|
|
|
let index = 3u;
|
|
|
|
let b = bar.matrix[index].x;
|
|
|
|
|
2021-05-28 04:52:31 +00:00
|
|
|
let a = bar.data[arrayLength(&bar.data) - 2u];
|
2021-06-04 16:57:20 +00:00
|
|
|
|
2021-07-06 05:16:15 +00:00
|
|
|
var c = array<i32, 5>(a, i32(b), 3, 4, 5);
|
|
|
|
c[vi + 1u] = 42;
|
2021-06-04 16:57:20 +00:00
|
|
|
let value = c[vi];
|
2021-05-04 02:47:33 +00:00
|
|
|
|
2021-04-16 21:11:18 +00:00
|
|
|
return vec4<f32>(vec4<i32>(value));
|
|
|
|
}
|