prototype-pixi-perf: label requested vs actual renderer, README prefer wording

Pixi preference is a hint; show requested vs actual (fallback) in overlay and
benchmark header. README: prefer not force, WebGPU Linux Chrome flags.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-01 20:41:42 +01:00
co-authored by Claude Haiku 5.5
parent a5b0cf9920
commit 5ad595b01b
2 changed files with 10 additions and 3 deletions
+3 -1
View File
@@ -13,9 +13,11 @@ devbox run -- npm run dev -- --host # reachable from LAN
devbox run -- npm run build # tsc + vite build
```
URL params: `?renderer=webgl|webgpu` (force; overlay shows the renderer actually used), `?res=1` (canvas resolution, default min(dpr,2)),
URL params: `?renderer=webgl|webgpu` (prefer, not force: Pixi falls back to WebGL silently if WebGPU is unavailable, so check the overlay / benchmark header for `requested X → fallback`), `?res=1` (canvas resolution, default min(dpr,2)),
`?bench=1` (auto-run benchmark on load), `?benchMs=5000&warmMs=700`.
WebGPU on Linux Chrome: launch with `--enable-unsafe-webgpu --enable-features=Vulkan`, then confirm WebGPU is listed as enabled at `chrome://gpu`.
Controls (top right): map size, tile size override (auto = GPU max texture), local map image, grid on/off + cell size, token count,
chaos, HP churn, culling, tool (move / pen), +200 random strokes, Run benchmark (markdown table in the textarea; copy button).
Mouse: wheel = zoom, drag = pan / drag a token, pen tool: LMB draws, RMB/MMB pans. Touch: 1 finger = drag token / pan / draw, 2 fingers = pinch zoom + pan.
+7 -2
View File
@@ -35,6 +35,11 @@ await app.init({
});
document.body.prepend(app.canvas);
const rendererName = app.renderer.name;
// Pixi `preference` is only a hint; label requested vs actual so a silent WebGL fallback is visible.
const req = pref === 'webgl' || pref === 'webgpu' ? pref : undefined;
const rendererLabel = !req ? rendererName
: req === rendererName ? `${rendererName} (requested ${req}, honored)`
: `${rendererName} (requested ${req} → fallback)`;
{
const r = app.renderer as any;
maxTex = rendererName === 'webgpu'
@@ -358,7 +363,7 @@ setInterval(() => {
const s = stats();
stat.textContent =
`FPS ${s.fps.toFixed(1)} frame avg ${s.avg.toFixed(1)}ms worst(2s) ${s.worst.toFixed(1)}ms js ${s.cpu.toFixed(1)}ms\n` +
`renderer: ${rendererName}${pref ? ` (forced ${pref})` : ''} res ${app.renderer.resolution} maxTex ${maxTex}\n` +
`renderer: ${rendererLabel} res ${app.renderer.resolution} maxTex ${maxTex}\n` +
`map: ${mapInfo} (built ${mapBuildMs.toFixed(0)}ms${customBitmap ? ', custom image' : ', procedural'})\n` +
`tokens ${S.n} strokes ${strokeLayer.children.length} grid ${S.grid ? S.cell + 'px' : 'off'} chaos ${S.chaos} churn ${S.churn} cull ${S.cull} tool ${S.tool}\n` +
`zoom ${world.scale.x.toFixed(2)}${benchStatus ? '\n' + benchStatus : ''}`;
@@ -402,7 +407,7 @@ async function runBench(out: HTMLTextAreaElement) {
buildMap(); setTokens(); clearStrokes(); buildGrid(); fit(); refreshUI();
benchStatus = '';
const md =
`Renderer: ${rendererName}, GPU: ${gpuName}, maxTex ${maxTex}, res ${app.renderer.resolution}, viewport ${innerWidth}x${innerHeight}, ${BENCH_MS}ms/scenario (+${WARM_MS}ms warmup), chaos on, grid on, cull on\n` +
`Renderer: ${rendererLabel}, GPU: ${gpuName}, maxTex ${maxTex}, res ${app.renderer.resolution}, viewport ${innerWidth}x${innerHeight}, ${BENCH_MS}ms/scenario (+${WARM_MS}ms warmup), chaos on, grid on, cull on\n` +
`UA: ${navigator.userAgent}\n\n` +
`| map | map path | tokens | strokes | fps | avg ms | p99 ms | worst ms | js ms | frames |\n|---|---|---|---|---|---|---|---|---|---|\n` +
rows.join('\n');