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.

fix(gates): a run whose engine could not draw has measured nothing

esenginec2de0ba74007
diff --git a/tools/lib/deadGpu.mjs b/tools/lib/deadGpu.mjs
index 847b3df94..ccbc16da3 100644
--- a/tools/lib/deadGpu.mjs
+++ b/tools/lib/deadGpu.mjs
@@ -68,13 +68,26 @@ function backoff(attempt, stepMs) {
*/
const STEP_MS = 5000;
+/**
+ * The ENGINE saying it could not make what it draws through. A run that gets this
+ * far still prints its result — reporting an empty frame — so "it finished" is not
+ * the same as "it rendered", and only the latter is a verdict about the scene.
+ */
+export function engineCouldNotDraw(output) {
+ return /Framebuffer is incomplete|Failed to create framebuffer|Failed to create texture|createTexture failed/
+ .test(output);
+}
+
/**
* Whether this attempt reached a verdict at all. `measured` is the run's own
- * answer and wins; without one the log text is all there is.
+ * answer and wins, except that a run whose engine could not draw has measured
+ * nothing whatever else it managed to print.
*/
function reachedNoVerdict(last) {
+ const output = last.output ?? '';
+ if (engineCouldNotDraw(output)) return true;
if (typeof last.measured === 'boolean') return !last.measured;
- return gpuNeverCameUp(last.output ?? '');
+ return gpuNeverCameUp(output);
}
/**
diff --git a/tools/tests/dead-gpu.test.ts b/tools/tests/dead-gpu.test.ts
index 2b453029c..e931758f4 100644
--- a/tools/tests/dead-gpu.test.ts
+++ b/tools/tests/dead-gpu.test.ts
@@ -10,7 +10,7 @@
*/
import { describe, it, expect } from 'vitest';
// @ts-expect-error — a .mjs tool module, typed by its own JSDoc
-import { retryOnDeadGpu, gpuNeverCameUp, deadGpuVerdict } from '../lib/deadGpu.mjs';
+import { retryOnDeadGpu, gpuNeverCameUp, deadGpuVerdict, engineCouldNotDraw } from '../lib/deadGpu.mjs';
const DEAD = 'Exiting GPU process due to errors during initialization';
const BLANK = 'painted=true live=false errors=0';
@@ -154,6 +154,22 @@ describe('retryOnDeadGpu', () => {
expect(r.gpuDied).toBeUndefined();
});
+ // The runner ran out of GPU resources and every scene came back empty. Each
+ // run still PRINTED its result, so 'it finished' called it a measurement and
+ // 46 of 70 scenes were reported as broken renderers in one job.
+ it('a run whose engine could not draw has measured nothing', () => {
+ const broke = 'Framebuffer is incomplete! (size: 640x480, GL error 0x37442)';
+ expect(engineCouldNotDraw(broke)).toBe(true);
+ expect(engineCouldNotDraw(BLANK)).toBe(false);
+ const r = runReporting([
+ { ok: false, output: broke, measured: true, drew: false },
+ { ok: true },
+ ]);
+ expect(r.ok).toBe(true);
+ expect(r.attempts).toBe(2);
+ expect(r.notes).toEqual([true]);
+ });
+
it('gives up at the cap and says the GPU is why', () => {
const r = run([DEAD]);
expect(r.ok).toBe(false);