API

Class GaussianSplattingGpuSorterExperimental

WebGPU compute depth sorter for Gaussian Splatting. It reproduces the ordering of the CPU sort worker (back-to-front counting sort) entirely on the GPU, and writes the sorted splat indices in a vertex buffer ready to be used as the instanced splatIndex attributes (GaussianSplattingGpuSortOutput).

Pipeline of a sort (all dispatches are enqueued on the engine's command encoder, without any CPU readback):

  1. keys: for each active splat, compute the view depth and quantize it to a keyBits-bit key (farthest = smallest). Supports splat intervals, compound parts (per-part matrices) and SOG decoded means.
  2. a stable LSD radix sort with 4-bit digits, ceil(keyBits / 4) passes of count, scan (2 levels) and scatter. No subgroup operation is required.
  3. output: writes the sorted indices as float32, padding to a multiple of 16 with vertexCount.

Usage constraints:

  • sort ends the current render pass: call it outside of any render pass (e.g. in onBeforeRenderObservable / onBeforeCameraRenderObservable).
  • Uniform-like data is written with queue writes, which take effect before the whole frame's commands. So call sort at most once per output and per frame, and do not change the source, the intervals or the part matrices between two sorts of the same frame.
  • If the textures given to setSource are recreated, call setSource again.
  • The compute shaders and the WebGPU compute engine extension are loaded by GaussianSplattingGpuSorter.LoadDependenciesAsync: await it before the first sort. Until it has completed, sort returns false without enqueuing anything.
Index
  • Experimental

    Restricts the sort to ranges of source splats, like the CPU worker's intervals message.

    Parameters

    • intervals: Nullable<ArrayLike<number>>

      flat [start0, count0, start1, count1, ...] (start, COUNT pairs), or null to sort every splat

    Returns boolean

    false (and logs an error) if the packed intervals or padded active count exceed the scan or device storage-buffer limits. Overlapping intervals count each occurrence. Sorting is disabled until valid intervals or a valid source are set.

  • Experimental

    Registers the WebGPU compute engine extension and loads the compute shaders of the sorter. The result is cached: calling it again returns the same promise. It must have completed before the first sort (which returns false until then). If loading fails, the promise rejects and the next call retries.

    Returns Promise<void>

    a promise resolved when the dependencies are ready