Complete the Cesium frame port

The frame port now does everything the contract asks of it on Cesium:
preUpdate says whether the tick draws (Cesium's own render test, read
live until the tick is over), holds are counted per reason, and suspend,
target fps, renderNow and diagnostics are real. Releasing the last hold
asks for one more frame.

whenSettled also waits until Cesium stops redrawing on its own. Each
request or worker task Cesium completes queues a redraw (a terrain
picker build after the camera moved, say), which no loading flag shows,
so it now waits for quiet frames and then a short stretch in which the
loop draws nothing by itself. It is bounded by its timeout, names a
stopped loop, and ends on destroy.

The app renderer still leaves out the members that steer the loop:
the render governor and the page's visibility handling own those
settings until they move onto the port.

The new frame.prediction check compares the preUpdate answer with what
each tick drew.
This commit is contained in:
Sameh Khamis committed 2026-11-05 17:11:25 -08:00
1 parent 1a9bdd9b63
commit e6d22e55d7
11 files changed
+842 -55

No files matched your search

+20 -3
View File
@@ -8,8 +8,11 @@
* ports (`ports.js`), the ones the conformance renderer is checked with,
* less the members that would not be true of the application yet: the
* globe (it draws photoreal tiles the port does not know), `whenSettled`
* (it would not wait for them) and `frame.setTime` (it would stop the
* application's clock). Those arrive with the layer families that need
* (it would not wait for them), `frame.setTime` (it would stop the
* application's clock), and the frame members that steer the loop
* (`holdContinuous`, `suspend`, `setTargetFps`) with the `diagnostics` that
* report them: `renderGovernor.js` and the page's visibility handling still
* own those settings, and two owners would undo each other. Those arrive with the layer families that need
* them (phase 2 of the renderer plan); `checkRendererShape` lists what is
* still missing.
* Until a family is ported, its code reaches the Cesium viewer through
@@ -20,6 +23,14 @@ import { createApplicationViewer } from '../../app/viewer.js';
import { CONTRACT_VERSION } from '../contract/index.js';
import { cesiumCapabilities, createCesiumPorts } from './ports.js';
/** Frame members the application's own loop code still owns. */
const LOOP_OWNED = new Set([
'diagnostics',
'holdContinuous',
'setTargetFps',
'suspend',
]);
/**
* The members a transitional renderer has today.
* @typedef {Pick<import('../contract/renderer').Renderer,
@@ -98,7 +109,13 @@ export function createCesiumRendererPlugin({
contractVersion: CONTRACT_VERSION,
capabilities,
canvas: viewer.canvas,
frame: ports.frame,
frame: Object.freeze(
Object.fromEntries(
Object.entries(ports.frame).filter(
([name]) => !LOOP_OWNED.has(name),
),
),
),
draw: ports.draw,
camera: ports.camera,
query: ports.query,