mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Keep the render governor's holds on the frame port
The governor no longer writes the Cesium scene's render mode itself: each
owner holds the renderer's frame port once, requests go to it, and the
port is the one place the loop's mode is set. The port now also keeps
the loop from redrawing for scene time alone, which the governor did.
The application installs the governor as soon as its renderer exists and
holds the loop continuous ('boot') until its tools are up, where the
governor used to be installed, so boot draws as before. The hidden-tab
suspension goes through the port too, and the application's renderer now
has the whole frame port.
This commit is contained in:
1 parent
e6d22e55d7
commit
d969df3d37
16 files changed
+192
-113
No files matched your search
@@ -19,6 +19,7 @@ import {
|
||||
installRenderGovernor,
|
||||
_resetRenderGovernorForTest,
|
||||
} from '../renderGovernor.js';
|
||||
import { framePortFor } from '../testSupport/fakeFramePort.mjs';
|
||||
|
||||
const FULL_RAW = {
|
||||
id: 'us7000abcd',
|
||||
@@ -246,7 +247,7 @@ test('a quake poll still reaches the screen with the render loop idle', async ()
|
||||
});
|
||||
|
||||
_resetRenderGovernorForTest();
|
||||
installRenderGovernor(viewer);
|
||||
installRenderGovernor(framePortFor(viewer.scene));
|
||||
// Installing the governor enters idle mode, which itself paints one settling
|
||||
// frame. Drop that from the baseline or the enable assertion below can pass on
|
||||
// the install alone, without the manager ever requesting anything.
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
} from '../renderGovernor.js';
|
||||
import { getContextStore } from './contextStore.js';
|
||||
import { readEntityRecord } from './entityRecords.js';
|
||||
import { framePortFor } from '../testSupport/fakeFramePort.mjs';
|
||||
|
||||
/** The catalog's services, with the overlay host each test supplies. */
|
||||
const createLocalGeoJsonLayer = (options) =>
|
||||
@@ -793,7 +794,7 @@ for (const [terrainHeight, sampledHeight, expectedHeight, globeShown] of [
|
||||
test('a failed ground sample schedules the retry frame the idle governor would never produce', async (t) => {
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
installRenderGovernor({ scene: { requestRender() {} } });
|
||||
installRenderGovernor(framePortFor({ requestRender() {} }));
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
t.after(() => {
|
||||
env.layer.destroy(env.viewer);
|
||||
@@ -821,7 +822,7 @@ test('a failed ground sample schedules the retry frame the idle governor would n
|
||||
test('a far camera arms no retry render — the governor stays fully idle', async (t) => {
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
installRenderGovernor({ scene: { requestRender() {} } });
|
||||
installRenderGovernor(framePortFor({ requestRender() {} }));
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
t.after(() => {
|
||||
env.layer.destroy(env.viewer);
|
||||
@@ -844,7 +845,7 @@ test('a far camera arms no retry render — the governor stays fully idle', asyn
|
||||
test('disable cancels a pending ground-retry render', async (t) => {
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
installRenderGovernor({ scene: { requestRender() {} } });
|
||||
installRenderGovernor(framePortFor({ requestRender() {} }));
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
t.after(() => {
|
||||
env.layer.destroy(env.viewer);
|
||||
@@ -928,7 +929,7 @@ test('a scene that cannot sample heights never arms a retry — not even once',
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: false });
|
||||
_resetRenderGovernorForTest();
|
||||
const governorScene = { renders: 0, requestRender() { this.renders += 1; } };
|
||||
installRenderGovernor({ scene: governorScene });
|
||||
installRenderGovernor(framePortFor(governorScene));
|
||||
governorScene.renders = 0; // discard the governor's own install settling frame
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const clock = installFakeClock(t);
|
||||
@@ -965,7 +966,7 @@ test('a sampleable scene still measures the retry distance it needs', async (t)
|
||||
// remove it — a scene that CAN sample still pays one distance per walk.
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
installRenderGovernor({ scene: { requestRender() {} } });
|
||||
installRenderGovernor(framePortFor({ requestRender() {} }));
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const clock = installFakeClock(t);
|
||||
t.after(() => {
|
||||
@@ -991,7 +992,7 @@ test('capability arriving late re-opens a spent budget without camera motion', a
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
const governorScene = { renders: 0, requestRender() { this.renders += 1; } };
|
||||
installRenderGovernor({ scene: governorScene });
|
||||
installRenderGovernor(framePortFor(governorScene));
|
||||
governorScene.renders = 0;
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const clock = installFakeClock(t);
|
||||
@@ -1024,7 +1025,7 @@ test('a sampleable scene that keeps failing gives up after a bounded run of arms
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
const governorScene = { renders: 0, requestRender() { this.renders += 1; } };
|
||||
installRenderGovernor({ scene: governorScene });
|
||||
installRenderGovernor(framePortFor(governorScene));
|
||||
governorScene.renders = 0; // discard the governor's own install settling frame
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const clock = installFakeClock(t);
|
||||
@@ -1056,7 +1057,7 @@ test('after the cap a camera-motion frame still samples, and re-opens the budget
|
||||
const env = await createRealLocalLayerHarness({ sampleHeightSupported: true });
|
||||
_resetRenderGovernorForTest();
|
||||
const governorScene = { renders: 0, requestRender() { this.renders += 1; } };
|
||||
installRenderGovernor({ scene: governorScene });
|
||||
installRenderGovernor(framePortFor(governorScene));
|
||||
governorScene.renders = 0; // discard the governor's own install settling frame
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const clock = installFakeClock(t);
|
||||
|
||||
@@ -47,6 +47,7 @@ import {
|
||||
} from '../layers/awareness/panel.js';
|
||||
import { NAVIGATION_AUTHORITY_EVENT } from '../navigationPolicy.js';
|
||||
import { withEntityRecord } from './entityRecords.js';
|
||||
import { framePortFor } from '../testSupport/fakeFramePort.mjs';
|
||||
|
||||
const militaryAwarenessSource = readLayerSource(
|
||||
new URL('./militaryAwareness.js', import.meta.url),
|
||||
@@ -3860,7 +3861,7 @@ test('parked Contacts takes no continuous-render hold and requests at most the p
|
||||
|
||||
try {
|
||||
Date.now = () => clockMs;
|
||||
installRenderGovernor(runtime.viewer);
|
||||
installRenderGovernor(framePortFor(runtime.viewer.scene));
|
||||
runtime.viewer.camera = {
|
||||
positionWC: new Cesium.Cartesian3(1_000_000, 200_000, 300_000),
|
||||
heading: 0,
|
||||
@@ -3996,7 +3997,7 @@ test('a moving view over failed feeds takes no continuous-render hold', () => {
|
||||
|
||||
try {
|
||||
Date.now = () => clockMs;
|
||||
installRenderGovernor(runtime.viewer);
|
||||
installRenderGovernor(framePortFor(runtime.viewer.scene));
|
||||
runtime.viewer.camera = {
|
||||
positionWC: new Cesium.Cartesian3(1_000_000, 200_000, 300_000),
|
||||
heading: 0,
|
||||
|
||||
@@ -350,7 +350,7 @@ async function runInstallationLoad({
|
||||
};
|
||||
try { militaryInstallationsLayer.init(viewer); }
|
||||
finally { Cesium.ScreenSpaceEventHandler.prototype.setInputAction = originalSetInputAction; }
|
||||
installRenderGovernor(viewer);
|
||||
installRenderGovernor(framePortFor(viewer.scene));
|
||||
militaryInstallationsLayer.enable();
|
||||
await militaryInstallationsLayer.update();
|
||||
|
||||
@@ -799,6 +799,7 @@ test('zoom-out aborts an active installation request and returns non-loading gui
|
||||
// by source probes against the shipped file, the same technique the HUD datum
|
||||
// tests use where a full boot is impractical.
|
||||
import { installationRetryDelayMs } from './militaryInstallations.js';
|
||||
import { framePortFor } from '../testSupport/fakeFramePort.mjs';
|
||||
|
||||
const installationsSource = readLayerSource(
|
||||
new URL('./militaryInstallations.js', import.meta.url), 'utf8');
|
||||
|
||||
Reference in new issue
Block a user