- renderer: release_transfer_images() deletes the transfer framebuffer instead of only zeroing the name; the leak exhausted VRAM and killed the GPU process under Vulkan after ~3-7 minutes - canvas: status notices are absolute overlays, so they no longer resize the native surface (each show/hide freed and recreated region draw buffers and eventually froze the main regions) - compute: bounded shader/layout/pipeline caches, staging pool, device-lost error propagation, dev-only ?glStats / ?computeFault / ?compute hooks - headed tools: soak/probe/smoke assets and docs - evidence: 20-minute Vulkan soak STABLE (GPU-SOAK-20261205-161007), SwiftShader control STABLE (GPU-SOAK-20261205-162105), Clip 28/28 NOT_CLAIMED (CLIP-HEADED-20261205-162214) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
81 lines
3.9 KiB
JavaScript
81 lines
3.9 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* Headed boot smoke: wait for the engine to report ready and assert the
|
|
* expected native-canvas / fallback state.
|
|
*
|
|
* node tools/web/headed/smoke/smoke-headed-boot.mjs [--url <origin>] [--flags <csv>]
|
|
* [--expect-native true|false|any] [--expect-fallback true|false|any]
|
|
*
|
|
* Exit 0 pass, 1 failed expectation, 2 preflight blocked.
|
|
*/
|
|
import path from "node:path";
|
|
import { launchChrome, normalizeArgs } from "../lib/browser.mjs";
|
|
import { preflight, preflightBlocked } from "../lib/preflight.mjs";
|
|
import { receiptDir, mediaDir, writeReceipt } from "../lib/receipt.mjs";
|
|
|
|
const argv = normalizeArgs(process.argv.slice(2));
|
|
if (argv.includes("--help")) {
|
|
console.log("usage: smoke-headed-boot.mjs [--url <origin>] [--flags <csv>] [--expect-native true|false|any] [--expect-fallback true|false|any] [--out <dir>] [--shots <dir>] [--json-only]");
|
|
process.exit(0);
|
|
}
|
|
const take = (name) => { const index = argv.indexOf(`--${name}`); return index >= 0 && argv[index + 1] ? argv[index + 1] : null; };
|
|
for (let index = 0; index < argv.length; index += 1) {
|
|
if (!argv[index].startsWith("--")) { console.error(`unexpected argument: ${argv[index]}`); process.exit(64); }
|
|
const name = argv[index].slice(2);
|
|
if (!["url", "flags", "expect-native", "expect-fallback", "out", "shots", "json-only", "help"].includes(name)) { console.error(`unknown option: --${name}`); process.exit(64); }
|
|
if (name !== "json-only") index += 1;
|
|
}
|
|
const url = take("url") ?? "http://127.0.0.1:5173/";
|
|
const flags = (take("flags") ?? "").split(",").filter(Boolean);
|
|
const expectNative = take("expect-native") ?? "any";
|
|
const expectFallback = take("expect-fallback") ?? "any";
|
|
const jsonOnly = argv.includes("--json-only");
|
|
|
|
const preflightItems = await preflight({ url });
|
|
if (preflightBlocked(preflightItems)) {
|
|
console.error(JSON.stringify({ status: "BLOCKED", preflight: preflightItems }, null, 2));
|
|
process.exit(2);
|
|
}
|
|
|
|
const shots = mediaDir("headed-smoke", take("shots"));
|
|
const session = await launchChrome({ flags: ["--no-sandbox", ...flags], viewport: { width: 1600, height: 900 } });
|
|
const state = async () => session.page.evaluate(() => ({
|
|
engine: document.querySelector('[data-testid="engine-status"]')?.textContent ?? null,
|
|
wasm: document.querySelector('[data-testid="wasm-status"]')?.textContent ?? null,
|
|
nativeDesktop: document.querySelector('[aria-label="Blender 桌面"]')?.getAttribute("data-native-canvas-open") ?? null,
|
|
fallbackNotice: Boolean(document.querySelector('[data-testid="webgpu-fallback-notice"]')),
|
|
})).catch(() => null);
|
|
|
|
const started = Date.now();
|
|
let ready = false;
|
|
let current = null;
|
|
try {
|
|
await session.page.goto(url, { waitUntil: "domcontentloaded", timeout: 60_000 });
|
|
for (let attempt = 0; attempt < 90; attempt += 1) {
|
|
current = await state();
|
|
if (current && /ready/i.test(current.wasm ?? "") && /new General project|SceneIR/i.test(current.engine ?? "")) { ready = true; break; }
|
|
await session.page.waitForTimeout(1000);
|
|
}
|
|
await session.page.screenshot({ path: path.join(shots, "boot.png") }).catch(() => {});
|
|
} finally {
|
|
await session.close();
|
|
}
|
|
|
|
const checks = [];
|
|
const check = (name, actual, expected) => {
|
|
if (expected === "any") return;
|
|
checks.push({ name, actual, expected, ok: String(actual) === expected });
|
|
};
|
|
check("nativeDesktop", current?.nativeDesktop, expectNative);
|
|
check("fallbackNotice", current?.fallbackNotice, expectFallback);
|
|
const ok = ready && checks.every((item) => item.ok);
|
|
const report = {
|
|
tool: "smoke-headed-boot", url, flags, chrome: session.chrome, preflight: preflightItems,
|
|
ready, readyMs: Date.now() - started, state: current, checks, shots,
|
|
status: ok ? "PASS" : "FAIL",
|
|
};
|
|
const file = writeReceipt(receiptDir("HEADED-SMOKE", take("out")), report);
|
|
if (jsonOnly) console.log(JSON.stringify(report, null, 2));
|
|
else console.log(JSON.stringify({ receipt: file, status: report.status, ready, state: current, checks }, null, 2));
|
|
process.exit(ok ? 0 : 1);
|