scene: host handles a lost GL context (ground on loss, rebuild on restore) #44
Loading…
Reference in a new issue
No description provided.
Delete branch "nibu/context-lost"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Wires the lost-GL-context path (follow-up ratatoskr-onContextLost-host-unwired). Branched from dev, not from the sky-state PR.
host.tspassesonContextLostto the scene. On loss it disposes the dead scene (generation bumped so a start still in flight is dropped) and calls the newonInactive;BackgroundScene.tsxremovesdata-sceneso the CSS ground shows.webglcontextrestoredlistener on the canvas starts a fresh scene (onActive,login()if a session exists). It is removed on dispose.Run: full vitest 36 files, 479 tests, pass. prettier clean on scene/. eslint clean on the touched files (repo-wide has errors in files not touched). tsc: no errors in host.ts, host.test.ts, BackgroundScene.tsx; the repo-wide run reports 847 errors in other files (matrix-js-sdk typings, Terrain.ts, other tests), which this PR does not touch; I did not diff them against dev's baseline.
Not run in a browser: no real webglcontextlost/restored (e.g. WEBGL_lose_context) against a live canvas. Tests use a fake EventTarget canvas and a mocked startBackgroundScene, so that a real Terrain scene rebuilds cleanly on a restored context (no leaked GL objects, TAA/timer state fresh) is unverified.