dynamis-world 0.6.0

GPU-driven physics engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
@group(0) @binding(0) var<uniform> params: StepParams;
@group(0) @binding(1) var<storage, read_write> island_parents: array<atomic<u32>>;
@group(0) @binding(2) var<storage, read_write> island_state: array<atomic<u32>>;

@compute @workgroup_size(WORKGROUP_SIZE)
fn main(@builtin(global_invocation_id) gid: vec3u) {
    let index = gid.y * (WORKGROUPS_PER_ROW * WORKGROUP_SIZE) + gid.x;
    if (index >= params.dynamic_count) {
        return;
    }
    atomicStore(&island_parents[index], index);
    atomicStore(&island_state[index], 0u);
}