You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UnloadTilesPlugin: revisited tiles remain evictable in the GPU cache #1767
A tile retained while hidden by a nonzero GPU byte target remains marked unused in the plugin cache when shown again. A later cleanup can remove its cache entry while the visibility guard skips GPU disposal. This understates estimatedGpuBytes and prevents that tile from being unloaded on a later hide.
The visibility callback updates the renderer cache through tiles.markTileUsed(tile), but not the plugin cache. lruCache.add(tile, ...) does not mark an existing item used again. Proposed fix: also call the plugin cache's lruCache.markUsed(tile) on every visible transition, keeping the renderer cache marking unchanged.
I have two regression tests and an AI-assisted fix prepared as a draft for discussion. The first regression fails against master and passes with the additional mark.
Reproduction steps
Register UnloadTilesPlugin({ bytesTarget: 100 }) and use two tile scenes each estimated at 100 bytes. Set an equal-priority comparator for deterministic eviction order.
Show tile A, hide it, and let the scheduled cleanup run. The budget retains A as unused.
Show A again, then show and hide B. Let cleanup run.
On master, A is removed from the plugin cache even though it is visible; its unload callback skips actual disposal and B remains resident.
Set bytesTarget to zero and hide A again. A cannot be unloaded because it is no longer tracked. With the fix, B unloads in step 3, A remains counted, and A unloads in step 5.
No hosted browser sandbox. Runnable regression tests and the proposed fix are available in the fork draft: hoyleb#1
In that checkout: npm ci && npx vitest run test/three/UnloadTilesPlugin.test.js. The first regression was verified failing on unmodified master and passing after the fix.
Screenshots & Tile Set
No dataset is needed: the reproduction uses two synthetic Group scenes and controlled byte estimates to isolate the cache lifecycle. No browser GPU benchmark was performed.
Activity