mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
Idle frame rate in the app, timed line batching, KEY REQUIRED status
Three fixes to how the globe draws and reports loading. **The idle frame rate is the app's rule.** The Cesium frame port capped the loop at `IDLE_FRAME_RATE` whenever nothing held it, so the rule lived inside the renderer. The render governor now sets the rate: the display's own while the loop is held, `IDLE_FRAME_RATE` while not. The frame port gains `onHeldChange(cb)`, which says when its first hold is taken and its last released (animated visual styles included), so the governor hears every hold. The quality setting's frame-rate cap is kept apart from the governor's rate, and the loop draws at the lower of the two, so neither overwrites the other. **Line batching is timed.** A line set waited 30 drawn frames before its unchanged lines settled into a static batch (300 for the long wait), so the batch built twice as fast at 120 Hz as at 60 Hz, and took seconds at the idle rate. It now waits `SETTLE_MS` (500 ms) and `LONG_SETTLE_MS` (5 s), and moved shapes go back into their batches on the same timing. **KEY REQUIRED.** A layer that cannot load without a provider key ended the global status chip LOAD FAILED. The chip now has a KEY REQUIRED outcome, ranked below a real failure: a layer whose stats say `keyRequired` ends KEY REQUIRED, any other failure still ends LOAD FAILED. Vessels report a missing AISStream key as `keyRequired` and name the key in the panel; a later outage clears it, as it is no longer the key that is missing. Checked: the full suite (new tests for `onHeldChange`, the quality cap against the governor's rate, timed settling, and the chip with and without a key), format, boundaries, build, the stub renderer boot and the Cesium conformance run; in the browser, the idle and held frame rates; and the first-run check now asserts that with no keys set the chip never says LOAD FAILED.
This commit is contained in:
1 parent
84d3e7b5ce
commit
0ed6cde956
33 files changed
+629
-179
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
getRenderGovernorDiagnostics,
|
||||
_resetRenderGovernorForTest,
|
||||
uninstallRenderGovernor,
|
||||
IDLE_FRAME_RATE,
|
||||
} from './renderGovernor.js';
|
||||
import { framePortFor } from './testSupport/fakeFramePort.mjs';
|
||||
|
||||
@@ -16,7 +17,9 @@ function makeViewer() {
|
||||
const scene = {
|
||||
requestRenderMode: false,
|
||||
maximumRenderTimeChange: 0,
|
||||
requestRender() { calls.requestRender += 1; },
|
||||
requestRender() {
|
||||
calls.requestRender += 1;
|
||||
},
|
||||
};
|
||||
return { viewer: { scene }, scene, calls };
|
||||
}
|
||||
@@ -73,7 +76,11 @@ test('holds are identity-keyed: double-hold cannot leak, double-release cannot c
|
||||
holdContinuousRender('traffic');
|
||||
holdContinuousRender('traffic');
|
||||
releaseContinuousRender('traffic');
|
||||
assert.equal(scene.requestRenderMode, true, 'single release clears an idempotent double-hold');
|
||||
assert.equal(
|
||||
scene.requestRenderMode,
|
||||
true,
|
||||
'single release clears an idempotent double-hold',
|
||||
);
|
||||
releaseContinuousRender('traffic');
|
||||
releaseContinuousRender('never-held');
|
||||
assert.equal(scene.requestRenderMode, true);
|
||||
@@ -97,7 +104,10 @@ test('governorRequestRender forwards to the scene and records reasons only in id
|
||||
const baseline = calls.requestRender;
|
||||
governorRequestRender('layer-tick:earthquakes');
|
||||
assert.equal(calls.requestRender, baseline + 1);
|
||||
assert.equal(getRenderGovernorDiagnostics().recentRequests.at(-1).reason, 'layer-tick:earthquakes');
|
||||
assert.equal(
|
||||
getRenderGovernorDiagnostics().recentRequests.at(-1).reason,
|
||||
'layer-tick:earthquakes',
|
||||
);
|
||||
holdContinuousRender('flights');
|
||||
const idleRequests = getRenderGovernorDiagnostics().recentRequests.length;
|
||||
governorRequestRender('slider');
|
||||
@@ -119,7 +129,11 @@ test('holds registered before install apply at install time', () => {
|
||||
holdContinuousRender('flights');
|
||||
const { viewer, scene } = makeViewer();
|
||||
installRenderGovernor(framePortFor(viewer.scene));
|
||||
assert.equal(scene.requestRenderMode, false, 'pre-install hold keeps continuous mode');
|
||||
assert.equal(
|
||||
scene.requestRenderMode,
|
||||
false,
|
||||
'pre-install hold keeps continuous mode',
|
||||
);
|
||||
releaseContinuousRender('flights');
|
||||
assert.equal(scene.requestRenderMode, true);
|
||||
});
|
||||
@@ -146,8 +160,41 @@ function makeCamera({ position = null, direction = null } = {}) {
|
||||
return camera;
|
||||
}
|
||||
|
||||
// The frame rate each mode draws at is the frame port's (ports.test.mjs:
|
||||
// 'with an idle rate, …'); the governor only holds and releases.
|
||||
test('idle, the loop ticks at the idle rate; held, at the display rate', () => {
|
||||
const { viewer, scene } = makeViewer();
|
||||
installRenderGovernor(framePortFor(viewer.scene));
|
||||
assert.equal(scene.targetFps, IDLE_FRAME_RATE, 'idle at install');
|
||||
holdContinuousRender('flights');
|
||||
assert.equal(scene.targetFps, 0, 'held: the display rate');
|
||||
releaseContinuousRender('flights');
|
||||
assert.equal(scene.targetFps, IDLE_FRAME_RATE);
|
||||
});
|
||||
|
||||
test('a hold already out at install draws at the display rate', () => {
|
||||
holdContinuousRender('boot');
|
||||
const { viewer, scene } = makeViewer();
|
||||
installRenderGovernor(framePortFor(viewer.scene));
|
||||
assert.equal(scene.targetFps, 0);
|
||||
releaseContinuousRender('boot');
|
||||
assert.equal(scene.targetFps, IDLE_FRAME_RATE);
|
||||
});
|
||||
|
||||
test('the renderer holding the loop itself (animated visual styles) also draws at the display rate', () => {
|
||||
const { viewer, scene } = makeViewer();
|
||||
const frame = framePortFor(viewer.scene);
|
||||
installRenderGovernor(frame);
|
||||
const release = frame.holdContinuous('effects:animated');
|
||||
assert.equal(scene.targetFps, 0, 'held by the renderer');
|
||||
holdContinuousRender('flights');
|
||||
release();
|
||||
assert.equal(scene.targetFps, 0, 'still held by flights');
|
||||
releaseContinuousRender('flights');
|
||||
assert.equal(scene.targetFps, IDLE_FRAME_RATE);
|
||||
// Uninstalled, the governor no longer sets the rate.
|
||||
uninstallRenderGovernor(frame);
|
||||
frame.holdContinuous('effects:animated');
|
||||
assert.equal(scene.targetFps, IDLE_FRAME_RATE);
|
||||
});
|
||||
|
||||
test('a camera move holds continuous render from moveStart to moveEnd', () => {
|
||||
const { viewer, scene } = makeViewer();
|
||||
|
||||
Reference in new issue
Block a user