playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
30 lines (25 loc) • 722 B
JavaScript
import dispatchCoreCS from "../common/comp/dispatch-core.js";
const computeGsplatLocalCopySource = (
/* wgsl */
`
${dispatchCoreCS}
var<storage, read> totalChunks: array<u32>;
var<storage, read_write> chunkSortIndirect: array<u32>;
struct Uniforms {
maxChunks: u32,
maxWorkgroupsPerDim: u32,
}
var<uniform> uniforms: Uniforms;
fn main() {
let count = min(totalChunks[0], uniforms.maxChunks);
let dim = calcDispatch2D(count, uniforms.maxWorkgroupsPerDim);
chunkSortIndirect[0] = dim.x;
chunkSortIndirect[1] = dim.y;
chunkSortIndirect[2] = 1u;
}
`
);
export {
computeGsplatLocalCopySource
};