playcanvas
Version:
Open-source WebGL/WebGPU 3D engine for the web
2 lines (1 loc) • 948 B
TypeScript
export const computeGsplatLocalChunkSortSource: "\n\n#include \"gsplatLocalBitonicCS\"\n\n@group(0) @binding(0) var<storage, read_write> tileEntries: array<u32>;\n@group(0) @binding(1) var<storage, read> depthBuffer: array<u32>;\n@group(0) @binding(2) var<storage, read> chunkRanges: array<u32>;\n@group(0) @binding(3) var<storage, read> totalChunks: array<u32>;\n\nstruct Uniforms {\n maxChunks: u32,\n}\n@group(0) @binding(4) var<uniform> uniforms: Uniforms;\n\n@compute @workgroup_size(256)\nfn main(\n @builtin(local_invocation_index) localIdx: u32,\n @builtin(workgroup_id) wid: vec3u,\n @builtin(num_workgroups) numWorkgroups: vec3u\n) {\n let chunkIdx = wid.y * numWorkgroups.x + wid.x;\n if (chunkIdx >= min(totalChunks[0], uniforms.maxChunks)) {\n return;\n }\n let tStart = chunkRanges[chunkIdx * 2u];\n let count = chunkRanges[chunkIdx * 2u + 1u];\n bitonicSortRange(localIdx, tStart, count);\n}\n";