Scope render demand to each scene attachment

Give each scene its own render governor, owner holds and recent idle requests.
Make the Cesium render backend own its request mode directly, so the governor
drives engine.render on both engines without a dependency back from Cesium.
Route layer requests through their attached engine and capture the attachment's
governor for camera motions, orbit, annotations and shell controls. Release
retained-layer holds before clearing the outgoing engine, and destroy the
governor after scene consumers have detached.

Preserve Cesium's owner-keyed holds, pre-install buffering, last-release settling
frame and one-shot requests during continuous rendering. Navara keeps the same
render policy. There is no intended visible change on either engine. Simultaneous
scenes no longer share holds, and an old captured service cannot release a
replacement attachment's hold. Cover both rules on fake and headless Cesium
engines, including an old orbit ending after reattachment.

Viewer-reference lines fall from 910 to 891, Navara-kind checks from 2 to 1,
and engine-name lines from 33 to 32. All other coupling counts stay unchanged.

Checked in the browser, keyless: qa-perf passes on both engines with the
same idle, active and release counts as before (24 checks on Cesium, 22 on
Navara).
This commit is contained in:
German Khokhlov committed 2026-11-07 16:56:34 +04:00
1 parent 4252ed0798
commit 0459ee6d58
87 files changed
+720 -935

No files matched your search

+6 -3
View File
@@ -534,7 +534,7 @@ perform no network requests and discover no additional modules.
`maps/controller` coordinates scene changes and lifetimes. `maps/imagery`,
`maps/terrain` and `maps/3d` supply constructors; `maps/defaults` selects the
standard sources and their setup/fallback policy. The standalone facade wires
these to the application's render governor.
these to their engine's render requests.
A registry supplies `sources`, `defaultId`, `unknownId` and optional `recoveryId`.
Each source has a user-facing `descriptor`, availability/reason, and either an
@@ -638,8 +638,11 @@ refresh policy. `app/layerSession.js` defines the retained session fields and
handoff predicate. `standalone/sceneSwitcher.js` coordinates page handoff;
`ui/shellScene.js` owns scene-bound shell construction, while `applicationShell`
keeps page controls and policy. Request, host and shell queues are not yet one
queue. Overlay, render-governor, tracked-readout and pick services still include
module singletons; debug access still exposes the native viewer and tileset.
queue. Pick ownership, selection dispatch and render demand belong to
`scene.services`; render demand drives the engine contract, with no dependency
from the Cesium render backend to the governor. Overlay and tracked-readout
services still include module singletons; debug access still exposes the native
viewer and tileset.
## UI state owners
+7 -2
View File
@@ -277,8 +277,13 @@ one application, and only the globe-bound parts move to the next engine.
resolve these services with their attached engine; simultaneous engines do
not share owner predicates or click subscriptions. Detach releases both
services before the renderer is parked. Reattachment creates fresh services,
while retained layers register their current picks again. The overlay host,
render governor and tracked readout still have module-owned state.
while retained layers register their current picks again.
- **Scene render demand.** `scene.services.render` owns the attachment's holds
and recent idle requests. It drives `engine.render` on both engines;
Cesium implements its render mode directly. Retained layers identify their
attached engine, and scene callbacks capture their governor. Teardown clears
only that scene's holds; an old service cannot release a replacement's hold.
The overlay host and tracked readout still have module-owned state.
- **The session owns the state.** Catalog, layer models, sources, selection,
camera mode and URL state outlive a switch. A layer that is a session model
gets `attachRenderer(viewer, { engine })` / `detachRenderer()` instead of being rebuilt,
+18
View File
@@ -547,6 +547,24 @@ the same services on first use. The application destroys them on detach and
creates fresh services when reattaching a parked engine. Identical layer IDs in
simultaneous scenes cannot replace or unregister one another's picks.
## Render demand
`scene.services.render` owns continuous-render holds and the last 16 idle
request reasons for one attachment. `holdContinuousRender(id)` and
`releaseContinuousRender(id)` are idempotent per owner; the last release
requests one settling frame. `governorRequestRender(reason)` forwards a
one-shot request even while another owner holds continuous rendering.
The tools call `install()` after scene consumers have registered their holds.
The governor drives `engine.render` on every engine. Cesium implements
`setContinuous` with its scene's `requestRenderMode` and disables automatic
simulation-time renders with `maximumRenderTimeChange = Infinity`. Engine
internals request their own scene directly and never import the governor.
Layer service helpers take their attached engine as the final argument;
attachment-bound callbacks can capture `renderGovernorFor(engine)` directly.
Destroying the scene clears its holds and makes the captured service inert.
A parked engine gets a fresh service when reattached.
## Render effects
The optional `visualStyles`, `bloom` and `contactSonar` capabilities are