@aardworx/wombat.rendering 0.19.25 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/renderObject.d.ts +9 -0
- package/dist/core/renderObject.d.ts.map +1 -1
- package/dist/resources/preparedRenderObject.d.ts.map +1 -1
- package/dist/resources/preparedRenderObject.js +9 -3
- package/dist/resources/preparedRenderObject.js.map +1 -1
- package/dist/resources/uniformBuffer.d.ts.map +1 -1
- package/dist/resources/uniformBuffer.js +3 -1
- package/dist/resources/uniformBuffer.js.map +1 -1
- package/dist/runtime/derivedUniforms/codegen.d.ts.map +1 -1
- package/dist/runtime/derivedUniforms/codegen.js +34 -13
- package/dist/runtime/derivedUniforms/codegen.js.map +1 -1
- package/dist/runtime/derivedUniforms/dispatch.d.ts.map +1 -1
- package/dist/runtime/derivedUniforms/dispatch.js +6 -0
- package/dist/runtime/derivedUniforms/dispatch.js.map +1 -1
- package/dist/runtime/derivedUniforms/sceneIntegration.d.ts.map +1 -1
- package/dist/runtime/derivedUniforms/sceneIntegration.js +9 -4
- package/dist/runtime/derivedUniforms/sceneIntegration.js.map +1 -1
- package/dist/runtime/heapAdapter.d.ts.map +1 -1
- package/dist/runtime/heapAdapter.js +3 -0
- package/dist/runtime/heapAdapter.js.map +1 -1
- package/dist/runtime/heapEffect.d.ts +23 -1
- package/dist/runtime/heapEffect.d.ts.map +1 -1
- package/dist/runtime/heapEffect.js +17 -2
- package/dist/runtime/heapEffect.js.map +1 -1
- package/dist/runtime/heapEffectIR.d.ts.map +1 -1
- package/dist/runtime/heapEffectIR.js +33 -2
- package/dist/runtime/heapEffectIR.js.map +1 -1
- package/dist/runtime/heapScene.d.ts +9 -0
- package/dist/runtime/heapScene.d.ts.map +1 -1
- package/dist/runtime/heapScene.js +90 -1
- package/dist/runtime/heapScene.js.map +1 -1
- package/dist/runtime/heapShaderFamily.d.ts.map +1 -1
- package/dist/runtime/heapShaderFamily.js +19 -0
- package/dist/runtime/heapShaderFamily.js.map +1 -1
- package/dist/runtime/hybridScene.d.ts +6 -0
- package/dist/runtime/hybridScene.d.ts.map +1 -1
- package/dist/runtime/hybridScene.js +17 -0
- package/dist/runtime/hybridScene.js.map +1 -1
- package/dist/runtime/renderTask.d.ts +6 -0
- package/dist/runtime/renderTask.d.ts.map +1 -1
- package/dist/runtime/renderTask.js +3 -0
- package/dist/runtime/renderTask.js.map +1 -1
- package/dist/runtime/runtime.d.ts +15 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +3 -0
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/textureAtlas/atlasMipGutterKernel.d.ts +19 -2
- package/dist/runtime/textureAtlas/atlasMipGutterKernel.d.ts.map +1 -1
- package/dist/runtime/textureAtlas/atlasMipGutterKernel.js +37 -6
- package/dist/runtime/textureAtlas/atlasMipGutterKernel.js.map +1 -1
- package/dist/runtime/textureAtlas/atlasPool.d.ts +5 -0
- package/dist/runtime/textureAtlas/atlasPool.d.ts.map +1 -1
- package/dist/runtime/textureAtlas/atlasPool.js +25 -3
- package/dist/runtime/textureAtlas/atlasPool.js.map +1 -1
- package/dist/window/loop.d.ts.map +1 -1
- package/dist/window/loop.js +31 -4
- package/dist/window/loop.js.map +1 -1
- package/package.json +3 -3
- package/src/core/renderObject.ts +9 -0
- package/src/resources/preparedRenderObject.ts +7 -3
- package/src/resources/uniformBuffer.ts +3 -1
- package/src/runtime/derivedUniforms/codegen.ts +34 -13
- package/src/runtime/derivedUniforms/dispatch.ts +6 -0
- package/src/runtime/derivedUniforms/sceneIntegration.ts +9 -4
- package/src/runtime/heapAdapter.ts +3 -0
- package/src/runtime/heapEffect.ts +30 -2
- package/src/runtime/heapEffectIR.ts +36 -2
- package/src/runtime/heapScene.ts +109 -1
- package/src/runtime/heapShaderFamily.ts +21 -0
- package/src/runtime/hybridScene.ts +23 -0
- package/src/runtime/renderTask.ts +9 -0
- package/src/runtime/runtime.ts +18 -0
- package/src/runtime/textureAtlas/atlasMipGutterKernel.ts +52 -3
- package/src/runtime/textureAtlas/atlasPool.ts +28 -2
- package/src/window/loop.ts +32 -4
package/src/window/loop.ts
CHANGED
|
@@ -131,6 +131,8 @@ export function runFrame(
|
|
|
131
131
|
let lastTime = performance.now();
|
|
132
132
|
let rafId = 0;
|
|
133
133
|
let pending = false;
|
|
134
|
+
let consecutiveErrors = 0;
|
|
135
|
+
const MAX_CONSECUTIVE_ERRORS = 30;
|
|
134
136
|
const UNCAPPED = isUncapped();
|
|
135
137
|
|
|
136
138
|
// Wrap the frame callback in an AVal so the adaptive system tracks
|
|
@@ -143,10 +145,34 @@ export function runFrame(
|
|
|
143
145
|
attachment.markFrame();
|
|
144
146
|
try {
|
|
145
147
|
frame(token, { frame: frameNo, timestampMs: now, deltaMs: delta });
|
|
148
|
+
consecutiveErrors = 0;
|
|
146
149
|
} catch (e) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
+
// A throwing frame used to kill the loop for good. That is far too harsh
|
|
151
|
+
// for a transient fault (a resource disposed mid-frame, a one-off device
|
|
152
|
+
// hiccup): the page then looks alive — DOM, input and workers all keep
|
|
153
|
+
// running — while nothing renders again and any animation driven from the
|
|
154
|
+
// frame callback freezes. Retry instead, and only give up if the fault
|
|
155
|
+
// repeats every frame (a genuinely broken scene, which would otherwise
|
|
156
|
+
// spin the error path forever).
|
|
157
|
+
consecutiveErrors++;
|
|
158
|
+
console.error(
|
|
159
|
+
`runFrame: error in frame callback (${consecutiveErrors}/${MAX_CONSECUTIVE_ERRORS})`, e,
|
|
160
|
+
);
|
|
161
|
+
if (consecutiveErrors >= MAX_CONSECUTIVE_ERRORS) {
|
|
162
|
+
stopped = true;
|
|
163
|
+
console.error("runFrame: giving up after repeated frame errors — render loop stopped");
|
|
164
|
+
throw e;
|
|
165
|
+
}
|
|
166
|
+
// Keep the loop breathing: schedule the next frame ourselves, since a
|
|
167
|
+
// frame that died early may not have read the inputs it would be marked
|
|
168
|
+
// by. Swallow the error rather than rethrowing — an exception escaping
|
|
169
|
+
// the aval eval leaves the wrapper's dirty state ambiguous, and we have
|
|
170
|
+
// already reported it.
|
|
171
|
+
queueMicrotask(() => {
|
|
172
|
+
if (stopped || pending) return;
|
|
173
|
+
pending = true;
|
|
174
|
+
rafId = schedule(tick);
|
|
175
|
+
});
|
|
150
176
|
}
|
|
151
177
|
frameNo++;
|
|
152
178
|
return frameNo;
|
|
@@ -188,8 +214,10 @@ export function runFrame(
|
|
|
188
214
|
// frame.
|
|
189
215
|
if (opts.pacer !== undefined) {
|
|
190
216
|
opts.pacer().then(finalizeFrame, (e) => {
|
|
191
|
-
|
|
217
|
+
// A rejected pacer (GPU hiccup) must not brick the loop either — the
|
|
218
|
+
// frame is done as far as we're concerned; carry on.
|
|
192
219
|
console.error("runFrame: pacer rejected", e);
|
|
220
|
+
finalizeFrame();
|
|
193
221
|
});
|
|
194
222
|
} else {
|
|
195
223
|
finalizeFrame();
|