Skip to content

Fix Gaussian Splat race condition problem#13189

Draft
danielzhong wants to merge 5 commits intomainfrom
DanielZ/Splat_FIX
Draft

Fix Gaussian Splat race condition problem#13189
danielzhong wants to merge 5 commits intomainfrom
DanielZ/Splat_FIX

Conversation

@danielzhong
Copy link
Contributor

Description

Fixes a race condition in Gaussian splat sorting / snapshot updates that caused WebGL errors, flickering, and inconsistent LOD loading. The update pipeline is now guarded against stale async results and against sorter unavailability during WASM init, which previously left the system stuck in a partial state.

Issue

  • The error Vertex buffer is not big enough for the draw call is non-deterministic and easier to trigger during loading + camera interaction, which is typical of a race rather than a deterministic size limit.
  • The error appeared even for smaller splat counts, though more frequently with larger datasets.
  • The failure window disappeared when state transitions were tightened, indicating timing/state inconsistency rather than a hard limit.

Fixes

  • Snapshot pipeline with explicit state (BUILDING → TEXTURE_PENDING → TEXTURE_READY → SORTING → READY) to avoid partial/invalid states being committed.
  • Generation/token guards: sort results are only accepted if they match the current request and data generation.
  • If radixSortIndexes returns undefined, we do not transition to SORTING; instead we keep the snapshot in TEXTURE_READY and retry later.
  • Old textures are retired and released safely instead of being destroyed immediately, avoiding “bind deleted object” issues.
  • Once a snapshot is committed, we do not mark _dirty again unless inputs actually change.

Result:

  • Eliminates the intermittent WebGL errors and flickering during LOD load/transition.
  • Prevents the “stuck in SORTING” state when the sorter is not ready.
  • When switching between different LOD levels, loading is still slow (but not flickering anymore),I believe this is a separate optimization issue and not directly related to the race condition.

Issue number and link

Testing plan

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

@danielzhong danielzhong self-assigned this Feb 5, 2026
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Thank you for the pull request, @danielzhong!

✅ We can confirm we have a CLA on file for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant