/ proof-of-concept / steelsim21
Sign in
proof-of-concept / steelsim21
steelsim21 / src / sim / shaders / extract.wgsl
12 lines · 418 BCodeBlameHistory
f8a8a6cNonlinear steel sheet gong simulator with WebGPUJeremy Magland 1// Copies the out-of-plane displacement into a plain f32 array (display / movie frame).
3@group(0) @binding(0) var<uniform> P: Params;
4@group(0) @binding(1) var<storage, read> pos: array<f32>;
5@group(0) @binding(2) var<storage, read_write> out: array<f32>;
7@compute @workgroup_size(256)
8fn main(@builtin(global_invocation_id) gid: vec3u) {
9 let k = gid.x;
10 if (k >= P.n) { return; }
11 out[k] = pos[2u * P.n + k];
↑↓ move↵openescclose