UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

23 lines (22 loc) 677 B
import dispatchCoreCS from "../common/comp/dispatch-core.js"; const computeGsplatLocalCopySource = ` ${dispatchCoreCS} @group(0) @binding(0) var<storage, read> totalChunks: array<u32>; @group(0) @binding(1) var<storage, read_write> chunkSortIndirect: array<u32>; struct Uniforms { maxChunks: u32, maxWorkgroupsPerDim: u32, } @group(0) @binding(2) var<uniform> uniforms: Uniforms; @compute @workgroup_size(1) 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 };