mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-21 06:50:59 +01:00
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.
17 lines
271 B
WebGPU Shading Language
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;
|
|
}
|