Skip to content

Commit 81085fe

Browse files
mvaligurskyMartin Valigursky
andauthored
fix: suppress frame:ready until full LOD update after param changes (#8602)
When gsplat params change (e.g. splatBudget), the frame:ready event could report ready=true before the LOD system had fully reacted — especially with GPU sorting where sortedVersion catches up in the same frame. This made it impossible for consumers to reliably detect the not-ready→ready transition. Add _awaitingLodUpdate flag that suppresses ready=true until a fullUpdate cycle runs (which polls load completions and re-evaluates LODs). The flag is only set when octree instances exist, so non-streaming scenarios are unaffected. Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
1 parent 8c15533 commit 81085fe

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/scene/gsplat-unified/gsplat-manager.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,15 @@ class GSplatManager {
202202
/** @type {number} */
203203
sortedVersion = 0;
204204

205+
/**
206+
* When true, suppresses ready=true in frame:ready until a fullUpdate cycle runs.
207+
* Only set when octreeInstances exist and params change (dirty).
208+
*
209+
* @type {boolean}
210+
* @private
211+
*/
212+
_awaitingLodUpdate = false;
213+
205214
/**
206215
* Cached work buffer format version for detecting extra stream changes.
207216
*
@@ -1161,7 +1170,7 @@ class GSplatManager {
11611170
* Fires the frame:ready event with current sorting and loading state.
11621171
*/
11631172
fireFrameReadyEvent() {
1164-
const ready = this.sortedVersion === this.lastWorldStateVersion;
1173+
const ready = this.sortedVersion === this.lastWorldStateVersion && !this._awaitingLodUpdate;
11651174

11661175
// Count total pending loads from octree instances (including environment)
11671176
let loadingCount = 0;
@@ -1372,6 +1381,8 @@ class GSplatManager {
13721381

13731382
// check if camera has moved/rotated enough to require LOD update
13741383
cameraMovedOrRotatedForLod = this.testCameraMovedForLod();
1384+
1385+
this._awaitingLodUpdate = false;
13751386
}
13761387

13771388
// check if camera has moved enough to require re-sorting
@@ -1404,6 +1415,12 @@ class GSplatManager {
14041415
// colorization) is refreshed immediately instead of trickling in over time.
14051416
this._workBufferRebuildRequired = true;
14061417
this.sortNeeded = true;
1418+
1419+
// Suppress ready=true in frame:ready until a fullUpdate cycle runs, so
1420+
// consumers can reliably detect the not-ready→ready transition after param changes.
1421+
if (this.octreeInstances.size > 0) {
1422+
this._awaitingLodUpdate = true;
1423+
}
14071424
}
14081425

14091426
// when camera or octree need LOD evaluated, or params are dirty, or resources completed, or new instances added

0 commit comments

Comments
 (0)