fix: fire setDirty when pager fetch pipeline drains#316
Open
onderilkesever wants to merge 1 commit intosparkjsdev:mainfrom
Open
fix: fire setDirty when pager fetch pipeline drains#316onderilkesever wants to merge 1 commit intosparkjsdev:mainfrom
onderilkesever wants to merge 1 commit intosparkjsdev:mainfrom
Conversation
044e0de to
4842c09
Compare
…v#298) When a static camera is combined with on-demand rendering, the onDirty chain breaks during paged LOD loading because chunk fetches complete asynchronously — outside any render frame — and nothing signals the renderer that new data is ready to process. Fix: call setDirty() via a new onDirty callback on SplatPager when processFetched() fully empties the fetched queue. This fires after every individual chunk lands, giving progressive rendering. The consumeLodTreeUpdates path is intentionally unchanged; SparkRenderer already calls setDirty() there via the existing lodDirty flow. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4842c09 to
ec14a62
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Fixes #298.
When
SparkRendereris used in an on-demand rendering architecture (render only whenonDirtyfires, no continuous loop) with a static camera, paged LOD splats can stop loading partway through. TheonDirtychain has a gap: chunk fetches complete asynchronously, outside any render frame, and nothing callssetDirty()to signal that new data is ready.Root cause
setDirty()is only called from:driveSort)updateInternal)updateLodInstanceswhenlodDirty = true(driveLod)All three require a render frame to be in progress. If the camera is static and
dirty = false,onBeforeRendernever fires →driveLodnever runs →consumeLodTreeUpdatesis never called → downloaded chunks sit inlodTreeUpdatesforever.Fix
Add an optional
onDirtycallback toSplatPagerOptionsand call it whenprocessFetched()fully empties thefetchedqueue — i.e. after each chunk finishes decoding and is moved into the LOD pipeline.SparkRendererpasses() => this.setDirty()when constructing the pager.This fires after every individual chunk lands, giving progressive rendering. The
consumeLodTreeUpdatespath is intentionally unchanged —SparkRendereralready callssetDirty()via thelodDirtyflow when it processes those updates inside a render frame.Changes
SplatPagerOptions: add optionalonDirty?: () => voidSplatPager: store callback, call it whenprocessFetched()drainsfetchedto emptySparkRenderer: pass() => this.setDirty()when constructing the pagerVerified
Confirmed against an on-demand renderer that previously required a polling workaround to drive rendering during paged LOD loading. With this fix the workaround is no longer needed.
— Claude