Builtin Library
- ..
- README.md1.1 KB
- bindings.yaml1.1 KB
- shader.wgsl809 B
README.md
hash
The first step of a spatial hash over a run of points: the bucket of the cell
each point stands in. The sort kernel orders the points by bucket, and
hash_starts then states where each bucket's points start and end in that
order. The keys, the order and the bucket spans, with the cell size, are the
index hash_count, hash_gather, hash_nearest, hash_repel and hash_hook
search. core.spatial builds the index with it. Exact: the same points give the
same keys.
It reads pts (xyz a point) and writes keys, one a point; the params are
buckets (a power of two) and inv_cell (one over the cell side).
Over a live count (COUNT=device, see the abi README) n is the capacity and the
first domain_count slots are live. A slot at or past the live count holds the key
0x7fffffff, which is past every bucket: the sort (over the same live count, or
over the capacity) places it after every live key, and hash_starts over the
capacity states every bucket's span over the live points only. It binds 3 storage
buffers (2 in the plain variant).