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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(gates): the GPU-outage detector knows what the outage actually said
esenginece1cf4d158c6
diff --git a/desktop/tests/dead-gpu.test.ts b/desktop/tests/dead-gpu.test.tsindex 6204cadbe..ceca525b1 100644--- a/desktop/tests/dead-gpu.test.ts+++ b/desktop/tests/dead-gpu.test.ts@@ -78,6 +78,17 @@ describe('retryOnDeadGpu', () => {expect(r.notes).toEqual([true, false]);});+ it('reads a lost device that then fails to make TEXTURES', () => {+ // Verbatim from the runner, the day the second clause was found to only+ // know about framebuffers.+ const real = [+ '[ERROR] GPU device lost: context-lost [backend=WebGL2, vendor=Google Inc.]',+ '[ERROR] Texture::initialize: createTexture failed for 70x70',+ '[ERROR] Failed to create texture from spec',+ ].join('\n');+ expect(gpuNeverCameUp(real)).toBe(true);+ });+it('words the give-up once, for both runners', () => {// The two of them each had their own sentence for it, and one of them// blamed the game — the failure this file exists to keep apart.diff --git a/tools/lib/deadGpu.mjs b/tools/lib/deadGpu.mjsindex 71514c130..6339a3f0b 100644--- a/tools/lib/deadGpu.mjs+++ b/tools/lib/deadGpu.mjs@@ -17,7 +17,11 @@/** Did the renderer never get a GPU, whatever it then said about pixels? */export function gpuNeverCameUp(output) {return /Exiting GPU process due to errors during initialization/.test(output)- || (/GPU device lost/.test(output) && /Failed to create framebuffer/.test(output))+ // A lost device, then resources it can no longer make — textures as well as+ // framebuffers. The runner's outage said "Failed to create texture from+ // spec", which only the line above caught, and that one fires on every launch.+ || (/GPU device lost/.test(output)+ && /Failed to create (framebuffer|texture)|createTexture failed/.test(output))|| /WebGL2 is not available/.test(output);}@@ -46,6 +50,13 @@ function backoff(attempt, stepMs) {Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, stepMs * (attempt + 1));}+/**+ * Measured on the runner: a GPU that goes takes about two minutes to come back,+ * and six attempts two seconds apart spanned ninety seconds of it — every retry+ * spent inside the same dead window. Five seconds a step covers it.+ */+const STEP_MS = 5000;+/*** Run `attempt` (→ `{ ok, output }`) until it succeeds or fails with the GPU up.*@@ -54,7 +65,7 @@ function backoff(attempt, stepMs) {* nothing about why. A game that truly draws nothing still fails on the first* attempt, since no attempt reports a death. `note(died)` announces each retry.*/-export function retryOnDeadGpu(attempt, note, stepMs = 2000) {+export function retryOnDeadGpu(attempt, note, stepMs = STEP_MS) {let sawDeath = false;let last;for (let i = 0; i < MAX_ATTEMPTS; i++) {