fix(gsplat): re-render work buffer for non-streaming splats on device restore#8973
Merged
Conversation
… restore After a graphics context restore the unified-gsplat work buffer render target comes back blank: its contents are GPU-rendered, not re-uploaded from CPU like source textures, and nothing re-triggered the rebuild. A non-streaming SOG/PLY splat therefore disappeared after a context loss/restore. Add a `devicerestored` handler on GSplatManager that forces a full work-buffer rebuild and re-sort. It is skipped when the world has streaming octree instances: those destroy and asynchronously reload their source resources from URL via their own device-lost handling, so rebuilding here would render from textures that have been destroyed (and not yet reloaded). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Build size reportThis PR changes the size of the minified bundles.
|
mvaligursky
added a commit
that referenced
this pull request
Jun 26, 2026
… restore (#8973) After a graphics context restore the unified-gsplat work buffer render target comes back blank: its contents are GPU-rendered, not re-uploaded from CPU like source textures, and nothing re-triggered the rebuild. A non-streaming SOG/PLY splat therefore disappeared after a context loss/restore. Add a `devicerestored` handler on GSplatManager that forces a full work-buffer rebuild and re-sort. It is skipped when the world has streaming octree instances: those destroy and asynchronously reload their source resources from URL via their own device-lost handling, so rebuilding here would render from textures that have been destroyed (and not yet reloaded). Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Summary
A non-streaming SOG/PLY gsplat disappears after a WebGL context lose/restore (the ground/rest of the scene renders, but the splat is gone).
Cause: the unified-gsplat work buffer is a render target whose contents are GPU-rendered, not re-uploaded from CPU like normal textures. On restore it is recreated empty, and nothing re-triggers the rebuild. (The streaming/octree path already handles this — its own
devicelosthandler reloads resources from URL, which drives a full rebuild.)Fix:
GSplatManagersubscribes todevicerestoredand forces a full work-buffer rebuild + re-sort (mirroring the existingprepareRendererModeinvalidation). It is gated on!world.hasOctreeInstances:The subscription uses the
EventHandlereturned byon()and removes it viahandle.off()indestroy().Testing
Lose/restore via
WEBGL_lose_context, counting"texture has been destroyed"asserts:spherical-harmonics), CPU sortlod-streaming)world— octree + direct ply + SOG, ~4M splats)