mirror of
https://github.com/Noratrieb/webgpu-mandelbrot.git
synced 2026-01-14 17:05:02 +01:00
compute
This commit is contained in:
commit
1a07df64ca
4 changed files with 192 additions and 0 deletions
19
mandelbrot.wgsl
Normal file
19
mandelbrot.wgsl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
@group(0) @binding(0)
|
||||
var<storage, read_write> output: array<f32>;
|
||||
|
||||
@compute @workgroup_size(64)
|
||||
fn main(
|
||||
@builtin(global_invocation_id)
|
||||
global_id : vec3u,
|
||||
|
||||
@builtin(local_invocation_id)
|
||||
local_id : vec3u,
|
||||
) {
|
||||
// Avoid accessing the buffer out of bounds
|
||||
if (global_id.x >= 1000) {
|
||||
return;
|
||||
}
|
||||
|
||||
output[global_id.x] =
|
||||
f32(local_id.x);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue