Repository navigation
[Bugfix] Restore pack-loader LOD setup on scene reload - #1386
Merged
Merged
Conversation
Saving and reloading a scene used to drop three things the pack loader sets up at first load: shared GPU builds for repeated placements of a model, the LOD chain of a multi-node model (so its parts switch level together), and LODComponent.selectsByScreenSize/screenSizeRadius (never serialized). Reload went through addLODLevel and the plain mesh path instead of the pack loader. - LODData now serializes selectsByScreenSize, screenSizeRadius, and levelsShareMaterials. - deserializeScene shares one UntoldBuildCache across the whole reload, so repeated placements of the same .untold build once. - A new packLODChain(forModelAt:) re-derives a multi-node model's LOD chain on reload by finding the .untoldpack that placed it, since a saved scene has no live link back to the originating pack. - Also fixes a related pre-existing bug surfaced while testing this against a real scene: LOD level reloads fired as unbounded concurrent Tasks instead of going through the same bounded dispatcher base-mesh loads use, which could hang scenes with many LOD entities on reload. Fixes #1326
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
LODComponent.selectsByScreenSize/screenSizeRadius(never serialized).LODDatanow serializesselectsByScreenSize,screenSizeRadius, andlevelsShareMaterials.deserializeSceneshares oneUntoldBuildCacheacross the whole reload, so repeated placements of the same.untoldbuild once instead of once per entity.packLODChain(forModelAt:)re-derives a multi-node model's LOD chain on reload by finding the.untoldpackthat placed it, since a saved scene has no live link back to the originating pack.Tasks instead of going through the same bounded dispatcher base-mesh loads already use, which could hang reload entirely on scenes with many LOD entities.Fixes #1326
Test plan
SceneReloadPackLODTests(round-tripsselectsByScreenSize/screenSizeRadius, multi-node LOD chain sync, and shared-build mesh identity across repeated placements, through save→destroy→reload)UntoldEngineTestssuite passes (1727 tests)UntoldEngineRenderTestssuite passes.untoldpackscene cooked via the actual exporter CLI: reload went from hanging indefinitely to completing in ~3s with all entities restored