Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat(spine): a world pose is resolved when somebody wants it

esengine336240d52626
diff --git a/sdk/benchmarks/spine-pose-demand.bench.ts b/sdk/benchmarks/spine-pose-demand.bench.ts
index c834b9810..bba4f628e 100644
--- a/sdk/benchmarks/spine-pose-demand.bench.ts
+++ b/sdk/benchmarks/spine-pose-demand.bench.ts
@@ -42,6 +42,21 @@
* meaning — events, mixes, track positions — costs 15% of the win,
* which is what says the thing worth skipping is the world transform
* and never the animation state.
+ *
+ * SHIPPED. The path exists now: a certified stateless skeleton keeps
+ * its world-pose debt until a camera asks. Measured against resolving
+ * every frame, ms per frame at a thousand entities, min of five:
+ *
+ * scene eager demand-driven
+ * all visible 3.39 3.36
+ * 200 visible, 800 not 3.29 1.06
+ * none visible 3.26 0.49
+ *
+ * The row that had to be checked is the first: a scene where every
+ * entity is visible pays for the culling authority and saves nothing.
+ * It does not measurably. The per-entity visibility question is one
+ * crossing, and a bare crossing is 0.006 ms per frame per thousand
+ * entities by the ladder in spine-extract-stages — 0.2% of this frame.
*/
import { describe, bench, beforeAll } from 'vitest';
import { existsSync, readFileSync } from 'node:fs';
diff --git a/sdk/src/spine/SpineRuntime.ts b/sdk/src/spine/SpineRuntime.ts
index 89edf96cb..0cba2bd20 100644
--- a/sdk/src/spine/SpineRuntime.ts
+++ b/sdk/src/spine/SpineRuntime.ts
@@ -31,6 +31,12 @@ import { mayDeferWorldPose } from './spineBounds';
import type { SpineCullingEnvelope } from './spineBounds';
import { withScratch } from '../wasm/wasmScratch';
+/**
+ * What a camera said about an entity. `unknown` is not a no — it is the absence
+ * of an answer, and only an answer may remove work.
+ */
+type RenderVisibility = 'visible' | 'culled' | 'unknown';
+
interface EntityInfo {
skelHandle: number;
instanceId: number;
@@ -170,7 +176,8 @@ export class SpineRuntime {
// belongs to the skeleton this handle is, not to the name it came under.
this.skeletons_.set(era.id, {
skelHandle, refcount: 1, claim,
- culling: era.culling,
+ // A binding that carries no envelope promised nothing.
+ culling: era.culling ?? { kind: 'unknown' },
requiresContinuousWorldPose: this.controller_.requiresContinuousWorldPose(skelHandle),
});
return skelHandle;
@@ -332,26 +339,26 @@ export class SpineRuntime {
*/
private cameraWouldDraw_(
core: NonNullable<EngineApi>, registry: CppRegistry, entity: Entity, info: EntityInfo,
- ): boolean | null {
+ ): RenderVisibility {
const ask = (core as { renderer_entityVisibleToCamera?: unknown })
.renderer_entityVisibleToCamera as
| ((r: CppRegistry, e: number, layer: number,
minX: number, minY: number, maxX: number, maxY: number, out: number) => void)
| undefined;
- if (!ask) return null;
+ if (!ask) return 'unknown';
const residency = this.skeletons_.get(info.era);
- if (!residency || residency.culling.kind !== 'certified') return null;
+ if (!residency || residency.culling.kind !== 'certified') return 'unknown';
const { bounds } = residency.culling;
const scale = info.skeletonScale;
const heap = core.HEAPU32;
- if (!heap || !core._malloc || !core._free) return null;
+ if (!heap || !core._malloc || !core._free) return 'unknown';
return withScratch({ _malloc: core._malloc, _free: core._free }, (alloc) => {
const ptr = alloc(4);
ask(registry, entity as unknown as number, info.layer,
bounds.minX * scale, bounds.minY * scale,
bounds.maxX * scale, bounds.maxY * scale, ptr);
- return heap[ptr >> 2] !== 0;
+ return heap[ptr >> 2] !== 0 ? 'visible' : 'culled';
});
}
@@ -390,7 +397,7 @@ export class SpineRuntime {
const info = this.entities_.get(entity);
if (!info || this.disabledEntities_.has(entity)) return false;
if (info.worldRevision === info.logicalRevision) {
- if (this.metrics_) this.metrics_.pose.worldDeferred++;
+ if (this.metrics_) this.metrics_.pose.worldAlreadyCurrent++;
return false;
}
this.controller_.materializeWorldPose(info.instanceId, info.pendingDt);
@@ -426,10 +433,11 @@ export class SpineRuntime {
info.pendingDt += step;
if (m) { m.abi.pose++; m.pose.logicalUpdates++; }
}
- // Every entity's world pose is demanded here for now. Which of them
- // could be left owed is the next cut's question; this one is only
- // about the debt existing.
- this.ensurePose(entity);
+ // Whoever may not defer pays here: a skeleton whose world pose
+ // carries state, or one nothing promised an extent for. The rest
+ // keep the debt until a camera asks.
+ const residency = this.skeletons_.get(info.era);
+ if (!residency || !residencyMayDefer(residency)) this.ensurePose(entity);
}
if (!m) return;
m.time.pose = performance.now() - started;
@@ -447,14 +455,16 @@ export class SpineRuntime {
const started = m ? performance.now() : 0;
for (const [entity, info] of this.entities_) {
if (this.disabledEntities_.has(entity)) continue;
- // What this camera would do with it, asked of the renderer rather
- // than worked out here. Nothing acts on the answer yet: this pass
- // still resolves, extracts and submits exactly what it did before.
- if (m && this.cameraWouldDraw_(core, registry, entity, info) === false) {
- m.pose.renderCulled++;
+ // Only a NO from the renderer, about an extent somebody certified,
+ // removes work. Unknown is not a no: an entity whose extent nobody
+ // promised has unknown visibility and is drawn.
+ if (this.cameraWouldDraw_(core, registry, entity, info) === 'culled') {
+ if (m) m.pose.renderCulled++;
+ continue;
}
// The renderer is a consumer of the world pose like any other, and
- // asks for it the same way. Today it is already resolved.
+ // asks for it the same way — the first camera that wants it pays,
+ // and the rest of this frame's cameras find the debt settled.
this.ensurePose(entity);
if (m) m.pose.meshExtractions++;
// Shared with every skeletal runtime (skeletal/submitMeshes): the core's
diff --git a/sdk/src/spine/spineMetrics.ts b/sdk/src/spine/spineMetrics.ts
index e20197710..541394611 100644
--- a/sdk/src/spine/spineMetrics.ts
+++ b/sdk/src/spine/spineMetrics.ts
@@ -83,15 +83,16 @@ export interface SpineByteCounts {
/**
* A frame's posing, as what was asked for rather than what was called.
*
- * `worldDeferred` is a demand that found the world already current — which is
- * how "at most one materialization per revision" reads from the outside.
+ * Each counts ONE thing. `renderCulled` is per (entity, CAMERA): an entity four
+ * cameras declined was declined four times and owes one world pose, so it is not
+ * a count of deferrals and is not reported as one — that would need somewhere
+ * that knows the frame ended, and there is no such place yet.
*/
export interface SpinePoseCounts {
logicalUpdates: number;
worldMaterializations: number;
- worldDeferred: number;
+ worldAlreadyCurrent: number;
meshExtractions: number;
- /** Extractions the camera in hand would not have drawn. Counted, not acted on. */
renderCulled: number;
}
@@ -115,7 +116,7 @@ export function newSpineFrameMetrics(): SpineFrameMetrics {
return {
frame: 0, entities: 0, residencies: 0, meshBatches: 0, vertices: 0, indices: 0,
abi: { pose: 0, world: 0, batchCount: 0, vertexCount: 0, indexCount: 0, batchData: 0, malloc: 0, free: 0, submit: 0 },
- pose: { logicalUpdates: 0, worldMaterializations: 0, worldDeferred: 0, meshExtractions: 0, renderCulled: 0 },
+ pose: { logicalUpdates: 0, worldMaterializations: 0, worldAlreadyCurrent: 0, meshExtractions: 0, renderCulled: 0 },
bytes: { wasmRead: 0, coreWrite: 0, scratchAllocated: 0 },
time: { pose: 0, readback: 0, total: 0 },
};
@@ -129,7 +130,7 @@ export function beginSpineFrame(m: SpineFrameMetrics): void {
m.abi.batchData = 0; m.abi.malloc = 0; m.abi.free = 0; m.abi.submit = 0;
m.bytes.wasmRead = 0; m.bytes.coreWrite = 0; m.bytes.scratchAllocated = 0;
m.pose.logicalUpdates = 0; m.pose.worldMaterializations = 0;
- m.pose.worldDeferred = 0; m.pose.meshExtractions = 0; m.pose.renderCulled = 0;
+ m.pose.worldAlreadyCurrent = 0; m.pose.meshExtractions = 0; m.pose.renderCulled = 0;
m.time.pose = 0; m.time.readback = 0; m.time.total = 0;
}
diff --git a/sdk/tests/spine-camera-visibility.test.ts b/sdk/tests/spine-camera-visibility.test.ts
index f47bc422e..248ffb413 100644
--- a/sdk/tests/spine-camera-visibility.test.ts
+++ b/sdk/tests/spine-camera-visibility.test.ts
@@ -75,18 +75,17 @@ describe('what this camera would draw, asked of the renderer', () => {
runtime.dispose();
});
- it('an entity this camera cannot see is counted, not skipped', () => {
- // The whole point of this cut landing before the next one: the fact is
- // available and changes nothing.
+ it('an entity this camera cannot see costs it nothing', () => {
const { runtime } = runtimeWith();
const { core: engine } = core(() => false);
runtime.updateAll(1 / 60);
runtime.extractAndSubmitMeshes(engine, {} as never);
const m = runtime.metrics()!;
- expect(m.pose.renderCulled, 'the camera fact was not recorded').toBe(1);
- expect(m.pose.worldMaterializations, 'a world pose was skipped already').toBe(1);
- expect(m.pose.meshExtractions, 'an extraction was skipped already').toBe(1);
+ expect(m.pose.renderCulled).toBe(1);
+ expect(m.pose.logicalUpdates, 'the animation stopped advancing').toBe(1);
+ expect(m.pose.worldMaterializations, 'a pose nobody wanted was resolved').toBe(0);
+ expect(m.pose.meshExtractions).toBe(0);
runtime.dispose();
});
@@ -149,21 +148,21 @@ describe('what this camera would draw, asked of the renderer', () => {
runtime.dispose();
});
- it('two cameras are two passes, and the second finds the pose paid', () => {
+ it('two cameras are two passes, and the one that wants it pays', () => {
// The union, without a bitmask: each camera runs its own submit, and the
// revision model means only the first one that wants it pays.
const { runtime } = runtimeWith();
const invisible = core(() => false);
const visible = core(() => true);
runtime.updateAll(1 / 60);
- const before = runtime.metrics()!.pose.worldMaterializations;
runtime.extractAndSubmitMeshes(invisible.core, {} as never);
runtime.extractAndSubmitMeshes(visible.core, {} as never);
const m = runtime.metrics()!;
- expect(m.pose.worldMaterializations, 'a second camera re-resolved the pose').toBe(before);
expect(m.pose.renderCulled, 'only one of the two cameras declined it').toBe(1);
+ expect(m.pose.worldMaterializations, 'the camera that wanted it did not pay once').toBe(1);
+ expect(m.pose.meshExtractions).toBe(1);
runtime.dispose();
});
});
diff --git a/sdk/tests/spine-demand-driven-pose.test.ts b/sdk/tests/spine-demand-driven-pose.test.ts
new file mode 100644
index 000000000..0792badd7
--- /dev/null
+++ b/sdk/tests/spine-demand-driven-pose.test.ts
@@ -0,0 +1,274 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/**
+ * @file spine-demand-driven-pose.test.ts
+ * @brief The three facts meeting, in the one place they are allowed to.
+ *
+ * @details A revision says whether the debt is paid, a residency says whether it
+ * may be owed, and a camera says whether anyone wants it this pass.
+ * None of them is a scheduler on its own, and this is where they
+ * combine: an entity nobody promised an extent for, or whose world pose
+ * carries state, pays at the advance; a certified stateless one keeps
+ * the debt until a camera asks for it.
+ *
+ * The animation never stops. What is deferred is the world-space
+ * solve, and re-entering after any number of unseen frames must draw
+ * what posing every frame would have drawn — byte for byte, not
+ * approximately.
+ */
+import { describe, it, expect, beforeAll } from 'vitest';
+import { existsSync, readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { WASM_DIR } from './helpers/loadWasm';
+import type { SpineWasmModule } from '../src/spine/SpineModuleLoader';
+import { SpineRuntime } from '../src/spine/SpineRuntime';
+import { certifyBounds } from '../src/spine/spineBounds';
+import type { SpineCullingEnvelope } from '../src/spine/spineBounds';
+import type { SpineEraBinding } from '../src/spine/prepareSpine';
+import type { Entity } from '../src/types';
+import { drawnGeometry } from './helpers/clipGeometry';
+import { fakeSpineModule, fakeSpineEra } from './helpers/fakeSpineModule';
+
+const SPINE38_JS = resolve(WASM_DIR, 'spine38.js');
+const SPINE38_WASM = resolve(WASM_DIR, 'spine38.wasm');
+const FIXTURES = resolve(__dirname, '../benchmarks/fixtures/spine');
+const HAS_WASM = existsSync(SPINE38_WASM)
+ && existsSync(resolve(FIXTURES, 'spineboy-38/spineboy-pro.skel'));
+const DT = 1 / 60;
+const CERTIFIED = certifyBounds({ minX: -300, minY: -20, maxX: 300, maxY: 800 });
+
+let raw: SpineWasmModule;
+let skelData: Uint8Array;
+let atlasText: string;
+
+beforeAll(async () => {
+ if (!HAS_WASM) return;
+ const factory = (await import(SPINE38_JS)).default as (opts: unknown) => Promise<SpineWasmModule>;
+ const bytes = readFileSync(SPINE38_WASM);
+ raw = await factory({
+ instantiateWasm(imports: WebAssembly.Imports, cb: (i: WebAssembly.Instance, m: WebAssembly.Module) => void) {
+ void WebAssembly.instantiate(bytes, imports).then((r) => cb(r.instance, r.module));
+ return {};
+ },
+ });
+ skelData = new Uint8Array(readFileSync(resolve(FIXTURES, 'spineboy-38/spineboy-pro.skel')));
+ atlasText = readFileSync(resolve(FIXTURES, 'spineboy-38/spineboy.atlas'), 'utf-8');
+});
+
+function era(id: string, culling: SpineCullingEnvelope): SpineEraBinding {
+ return {
+ id, culling,
+ value: { skelData, atlasText, isBinary: true, textures: new Map() },
+ retain: () => ({ release: () => {} }),
+ };
+}
+
+/** A core that answers visibility as the test says, and records what it drew. */
+function camera(visible: boolean): { core: never; submits: number } {
+ const state = { submits: 0 };
+ const heap = new Uint32Array(64);
+ const api = {
+ renderer_submitSkeletalBatchByEntity: () => { state.submits++; },
+ renderer_entityVisibleToCamera: (
+ _r: unknown, _e: number, _l: number,
+ _a: number, _b: number, _c: number, _d: number, out: number,
+ ) => { heap[out >> 2] = visible ? 1 : 0; },
+ _malloc: () => 4, _free: () => {},
+ HEAPU8: new Uint8Array(heap.buffer), HEAPU32: heap,
+ };
+ return { core: api as never, get submits() { return state.submits; } } as never;
+}
+
+function bound(culling: SpineCullingEnvelope, id = 'demand#1'): SpineRuntime {
+ const runtime = new SpineRuntime('3.8', raw);
+ runtime.loadEntity(1 as Entity, era(id, culling));
+ runtime.setAnimation(1 as Entity, 'walk', true);
+ runtime.observe(true);
+ return runtime;
+}
+
+/** What a frame of this entity draws, read straight from the module. */
+function drawn(runtime: SpineRuntime): string {
+ const controller = (runtime as unknown as { controller_: {
+ getMeshBatchCount(id: number): number;
+ getMeshBatchVertexCount(id: number, b: number): number;
+ getMeshBatchIndexCount(id: number, b: number): number;
+ } }).controller_;
+ const instanceId = (runtime as unknown as { entities_: Map<Entity, { instanceId: number }> })
+ .entities_.get(1 as Entity)!.instanceId;
+ const api = (controller as unknown as { api_: Record<string, (...a: never[]) => never> }).api_;
+ const batches = api.getMeshBatchCount(instanceId as never) as unknown as number;
+ return drawnGeometry({
+ batches,
+ vertexCount: (b) => api.getMeshBatchVertexCount(instanceId as never, b as never) as unknown as number,
+ indexCount: (b) => api.getMeshBatchIndexCount(instanceId as never, b as never) as unknown as number,
+ read(b) {
+ const vertices = api.getMeshBatchVertexCount(instanceId as never, b as never) as unknown as number;
+ const indices = api.getMeshBatchIndexCount(instanceId as never, b as never) as unknown as number;
+ const vp = raw._malloc(vertices * 8 * 4 + 4);
+ const ip = raw._malloc(indices * 2 + 2);
+ const tp = raw._malloc(4);
+ const bp = raw._malloc(4);
+ api.getMeshBatchData(instanceId as never, b as never, vp as never, ip as never, tp as never, bp as never);
+ const out = {
+ vertices: new Float32Array(raw.HEAPU8.buffer.slice(vp, vp + vertices * 8 * 4)),
+ indices: new Uint16Array(raw.HEAPU8.buffer.slice(ip, ip + indices * 2)),
+ };
+ raw._free(vp); raw._free(ip); raw._free(tp); raw._free(bp);
+ return out;
+ },
+ }).digest;
+}
+
+describe.skipIf(!HAS_WASM)('the three facts, combined once', () => {
+ it('certified, stateless and unseen costs an advance and nothing else', () => {
+ const runtime = bound(CERTIFIED);
+ const offscreen = camera(false);
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(offscreen.core, {} as never);
+
+ const m = runtime.metrics()!;
+ expect(m.pose.logicalUpdates, 'the animation stopped').toBe(1);
+ expect(m.pose.worldMaterializations).toBe(0);
+ expect(m.pose.meshExtractions).toBe(0);
+ expect(offscreen.submits).toBe(0);
+ runtime.dispose();
+ });
+
+ it('certified and seen pays once, however many consumers ask', () => {
+ const runtime = bound(CERTIFIED);
+ const onscreen = camera(true);
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(onscreen.core, {} as never);
+ runtime.ensurePose(1 as Entity);
+
+ const m = runtime.metrics()!;
+ expect(m.pose.worldMaterializations).toBe(1);
+ expect(m.pose.worldAlreadyCurrent, 'a second asker paid again').toBeGreaterThan(0);
+ runtime.dispose();
+ });
+
+ it('an uncertified entity behaves exactly as it did', () => {
+ const runtime = bound({ kind: 'unknown' });
+ const offscreen = camera(false);
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(offscreen.core, {} as never);
+
+ const m = runtime.metrics()!;
+ expect(m.pose.worldMaterializations, 'an uncertified pose was deferred').toBe(1);
+ expect(m.pose.meshExtractions, 'an uncertified entity was culled').toBe(1);
+ expect(m.pose.renderCulled, 'an uncertified extent was culled against').toBe(0);
+ runtime.dispose();
+ });
+
+ it('an observed entity behaves exactly as it did', () => {
+ const runtime = bound({
+ kind: 'observed', source: 'animation-scan', sampleStep: DT, era: 'demand#1',
+ bounds: { minX: -300, minY: -20, maxX: 300, maxY: 800 },
+ coverage: { animations: 11, skins: 1, samples: 400 },
+ });
+ const offscreen = camera(false);
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(offscreen.core, {} as never);
+
+ const m = runtime.metrics()!;
+ expect(m.pose.worldMaterializations, 'a scan authorised a deferral at the effect').toBe(1);
+ expect(m.pose.meshExtractions).toBe(1);
+ runtime.dispose();
+ });
+
+ it('re-entering draws what posing every frame would have drawn', () => {
+ // The whole design in one assertion, and byte-for-byte: sixty unseen
+ // frames, then a camera wants it, against a reference that never stopped.
+ const lazy = bound(CERTIFIED, 'demand#lazy');
+ const eager = bound({ kind: 'unknown' }, 'demand#eager');
+ const offscreen = camera(false);
+ const onscreen = camera(true);
+
+ for (let frame = 0; frame < 60; frame++) {
+ lazy.updateAll(DT);
+ lazy.extractAndSubmitMeshes(offscreen.core, {} as never);
+ eager.updateAll(DT);
+ eager.extractAndSubmitMeshes(onscreen.core, {} as never);
+ }
+ expect(lazy.metrics()!.pose.worldMaterializations, 'the unseen one was resolved anyway').toBe(0);
+
+ lazy.updateAll(DT);
+ lazy.extractAndSubmitMeshes(onscreen.core, {} as never);
+ eager.updateAll(DT);
+ eager.extractAndSubmitMeshes(onscreen.core, {} as never);
+
+ expect(drawn(lazy), 'a deferred pose came back as a different animation')
+ .toBe(drawn(eager));
+ lazy.dispose();
+ eager.dispose();
+ });
+
+ it('the events of an unseen sixty frames are the events of a seen sixty', () => {
+ const unseen = bound(CERTIFIED, 'demand#unseen');
+ const seen = bound(CERTIFIED, 'demand#seen');
+ unseen.enableEvents(1 as Entity);
+ seen.enableEvents(1 as Entity);
+ const offscreen = camera(false);
+ const onscreen = camera(true);
+
+ const drain = (runtime: SpineRuntime): string[] =>
+ runtime.collectAllEvents().map(
+ ({ raw }) => `${raw.animation}:${raw.name}:${raw.type}`);
+ const unseenEvents: string[][] = [];
+ const seenEvents: string[][] = [];
+ for (let frame = 0; frame < 120; frame++) {
+ unseen.updateAll(DT);
+ unseenEvents.push(drain(unseen));
+ unseen.extractAndSubmitMeshes(offscreen.core, {} as never);
+ seen.updateAll(DT);
+ seenEvents.push(drain(seen));
+ seen.extractAndSubmitMeshes(onscreen.core, {} as never);
+ }
+ expect(unseenEvents.flat().length, 'the walk produced no events at all').toBeGreaterThan(0);
+ expect(unseenEvents, 'visibility changed what an animation announced').toEqual(seenEvents);
+ unseen.dispose();
+ seen.dispose();
+ });
+
+ it('a world pose that carries state is resolved even when nobody sees it', () => {
+ // Continuous world is not always-render: the pose keeps being resolved
+ // because deferring it would change it, and the camera that cannot see
+ // it still costs nothing to draw.
+ const fake = fakeSpineModule();
+ fake.continuousWorldPose = true;
+ const runtime = new SpineRuntime('4.2', fake.module);
+ runtime.loadEntity(1 as Entity, fakeSpineEra('physics#1', new Uint8Array([1]), CERTIFIED));
+ runtime.setAnimation(1 as Entity, 'walk', true);
+ runtime.observe(true);
+
+ const offscreen = camera(false);
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(offscreen.core, {} as never);
+
+ const m = runtime.metrics()!;
+ expect(m.pose.worldMaterializations, 'a stateful world pose was deferred').toBe(1);
+ expect(m.pose.renderCulled).toBe(1);
+ expect(m.pose.meshExtractions, 'a stateful skeleton was drawn to a camera that cannot see it')
+ .toBe(0);
+ runtime.dispose();
+ });
+
+ it('a frozen entity that is seen is drawn without being resolved again', () => {
+ const runtime = bound(CERTIFIED);
+ const onscreen = camera(true);
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(onscreen.core, {} as never);
+ runtime.setEntityProps(1 as Entity, { playing: false });
+
+ runtime.observe(true);
+ for (let frame = 0; frame < 30; frame++) {
+ runtime.updateAll(DT);
+ runtime.extractAndSubmitMeshes(onscreen.core, {} as never);
+ }
+ const m = runtime.metrics()!;
+ expect(m.pose.worldMaterializations, 'a frozen pose was resolved again').toBe(0);
+ expect(m.pose.meshExtractions, 'a frozen entity stopped being drawn').toBe(1);
+ runtime.dispose();
+ });
+});
diff --git a/sdk/tests/spine-observability.test.ts b/sdk/tests/spine-observability.test.ts
index 198794462..7c76e8b45 100644
--- a/sdk/tests/spine-observability.test.ts
+++ b/sdk/tests/spine-observability.test.ts
@@ -165,7 +165,7 @@ describe.skipIf(!HAS_ASSETS)('a frame can say what it cost', () => {
// what had to be resolved, and what asked and found it already was.
expect(m.pose.logicalUpdates).toBe(100);
expect(m.pose.worldMaterializations, 'a world pose was resolved twice').toBe(100);
- expect(m.pose.worldDeferred, 'the extraction re-resolved what it asked for').toBe(100);
+ expect(m.pose.worldAlreadyCurrent, 'the extraction re-resolved what it asked for').toBe(100);
runtime.dispose();
});
});
diff --git a/sdk/tests/spine-pose-materialization.test.ts b/sdk/tests/spine-pose-materialization.test.ts
index d57c04f0f..bf1bc7c90 100644
--- a/sdk/tests/spine-pose-materialization.test.ts
+++ b/sdk/tests/spine-pose-materialization.test.ts
@@ -165,7 +165,7 @@ describe.skipIf(!HAS_WASM)('a world pose is owed, and paid once', () => {
const m = runtime.metrics()!;
expect(m.pose.logicalUpdates).toBe(5);
expect(m.pose.worldMaterializations).toBe(5);
- expect(m.pose.worldDeferred, 'the extraction found five debts already paid').toBe(5);
+ expect(m.pose.worldAlreadyCurrent, 'the extraction found five debts already paid').toBe(5);
expect(m.pose.meshExtractions).toBe(5);
runtime.dispose();
});