Keep the scene command trim in the Cesium adapter and take its installer off the Cesium list

The private-field trim of Cesium's reused per-pass command arrays moves to
src/render/cesium/sceneCommandRelease.js. The installer waits for the
renderer frame port's postRender after each layer disable and calls a trim
the application scene hands over, so it no longer touches the Cesium scene.
This commit is contained in:
Sameh Khamis committed 2026-11-07 05:29:57 -08:00
1 parent 71ff682c7f
commit b9248bfce5
10 files changed
+226 -170

No files matched your search

+16 -10
View File
@@ -20,7 +20,11 @@ import {
import { entityRecord, readEntityRecord } from '../data/entityRecords.js';
import { overlayHost } from './layers/overlayHost.js';
/** Attach scene tools, rendering listeners and the application debug handle. */
/**
* Attach scene tools, rendering listeners and the application debug handle.
* `scene` is what `createApplicationScene` returns; its `trimStaleCommands`
* runs after each layer disable (a scene without one keeps that memory).
*/
export function createApplicationTools({
scene,
controls,
@@ -131,15 +135,17 @@ export function createApplicationTools({
// per frame. It goes idle only now, after every module above has had its
// chance to hold. (perf wave 2)
releaseContinuousRender('boot');
// Cesium keeps a turned-off layer's draw commands (and so all its entities)
// alive in reused per-pass arrays; trim them after each disable.
defer(
installLayerReleaseTrim({
scene: viewer.scene,
dataManager,
requestRender: governorRequestRender,
}),
);
// The renderer may keep a turned-off layer's draw commands (and so all its
// entities) alive; trim them after each disable.
if (scene.trimStaleCommands)
defer(
installLayerReleaseTrim({
frame: renderer.frame,
dataManager,
requestRender: governorRequestRender,
trim: scene.trimStaleCommands,
}),
);
// Install the explicit scope mask used by the DISPLAY controls.
installScopeMask(viewer);