Builtin Library
- ..
- README.md1.1 KB
- bindings.yaml683 B
- shader.wgsl1.2 KB
README.md
search
Binary search of a run of queries in a sorted column: the pick of a value from a cumulative distribution, the segment of an arc length.
| Specialize | Options | Meaning |
|---|---|---|
T | f32, i32 | the scalar the column and the queries hold |
SIDE | lower, upper | which boundary a query answers |
lower answers the first place whose value is not below the query, upper the
first place whose value is above it, and both answer the length of the column
when no place qualifies. The greatest place whose value is not above a query is
upper - 1; with the cumulative sums of a run of weights, upper of a draw in
[0, total) is the index of the weight it lands in.
The column bound as sorted is the sorted run, every element of it. One thread
per query; the dispatch size n is the number of queries.
Exact: a search reads the column and nothing else, so the same inputs give the same answers on every dispatch.
core.sample.surface picks a primitive by area with upper; attribute.normalize
and geometry.shared search with lower.