wgpu/tests/in/pointers.wgsl
Jim Blandy 0e3fbc8166
Replace pointer-access.spv snapshot test with WGSL source. (#1450)
The original pointer access test used SPIR-V for its input because WGSL didn't
have a working pointer indirection operator at the time. Now that it does, we
can just write this test in WGSL directly.

Fixes #1432.
2021-10-06 16:30:36 -04:00

17 lines
271 B
WebGPU Shading Language

fn f() {
var v: vec2<i32>;
let px = &v.x;
*px = 10;
}
[[block]]
struct DynamicArray {
array: array<u32>;
};
fn index_dynamic_array(p: ptr<workgroup, DynamicArray>, i: i32, v: u32) -> u32 {
let old = (*p).array[i];
(*p).array[i] = v;
return old;
}