playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
29 lines (26 loc) • 761 B
JavaScript
const computeGsplatLocalDispatchPrepLargeSource = (
/* wgsl */
`
var<storage, read> countersBuffer: array<u32>;
var<storage, read_write> dispatchArgs: array<u32>;
var<storage, read> largeSplatIds: array<u32>;
fn main() {
let count = min(countersBuffer[1], arrayLength(&largeSplatIds));
let maxDim = {MAX_DIM}u;
if (count <= maxDim) {
dispatchArgs[0] = count;
dispatchArgs[1] = 1u;
} else {
let y = (count + maxDim - 1u) / maxDim;
let x = (count + y - 1u) / y;
dispatchArgs[0] = x;
dispatchArgs[1] = y;
}
dispatchArgs[2] = 1u;
}
`
);
export {
computeGsplatLocalDispatchPrepLargeSource
};