WebGPU renderer complete: dirty uploads, default limits, legacy removed, WebGPU required, warm-up (t88 phase 2d)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 23:17:17 -04:00
co-authored by Claude Opus 5.5
parent 452b6aed32
commit 20963c776e
83 changed files with 776 additions and 1240 deletions
+53
View File
@@ -4,6 +4,59 @@ What agents have done, newest first. Add an entry for every piece of work: the d
note or request it was for, what changed, the files touched, the tests run, and anything left
open or not verified. Keep each entry short; the git history has the details.
## 2026-10-27: t88 phase 2d, required WebGPU and dirty uploads (Codex)
- Per-32x32-chunk `renderDirty` marks cell writes, heat with its conduction halo, stationary
fire life, fog, drill damage, tree growth, eviction and block edits. `gpu/uploads.js` merges
horizontal dirty chunks into strips; clean resident chunks survive scrolling. GPU byte
readback matches the full CPU data after 240 busy ticks; an unchanged frame uploads no world cells.
- Both looks stay within default WebGPU limits: four storage textures, sixteen sampled textures,
eight storage buffers per shader stage, 8192 texture dimension; timestamp queries optional.
Smooth colour/geometry and glow use two passes. All pipelines compile asynchronously at startup;
both looks submit behind the loading screen. No fallback: missing/insufficient adapters cannot
start. Loss tries one device recreation; failure stops frames, autosaves, offers Reload (or
Export if saving fails). Firefox 157 on Linux shows the required-WebGPU notice.
- Removed `render/light.js`, `smooth.js`, `smooth-shaders.js`, `slope-belt-shader.js`, the CPU
plain-colour loop, renderer setting/tool switch and Canvas2D `drawCracks`. The rare CPU shade
classifier remains in `cell.js`; no CPU light sweep. Drill contours now use GPU colour shading
from `digp` and the same three seeded Perlin fields at screen resolution.
- Before removal captured 28 legacy reference crops (renderer, joins, sky, lamp/opening/magma/fire;
both looks, zoom 12/2), 384x288 PNGs under `test/fixtures/golden/` (1.7 MB total). All pass:
mean RGB error 0.012-0.287/255; <=0.15% pixels over 8. Golden test allows mean <0.5 and <0.3%
pixels over 8 for smooth AO rounding. Both contact sheets and pixel/smooth drill screenshots
inspected. The zoom-12 joins crop was recentered on actual geometry using the original renderer
built in a temporary checkout; the four joins crops were recaptured there.
- Final full matrix (1920x1080, RTX 5070), drawWorld zoom 2/6 (ms; baseline -> final):
settled pixel 21.78/2.71 -> 2.64/0.44, smooth 25.64/3.08 -> 5.16/0.71;
factory pixel 24.55/2.89 -> 2.53/0.47, smooth 28.20/3.34 -> 3.93/0.85;
heat pixel 24.35/3.41 -> 2.19/0.34, smooth 27.43/3.54 -> 3.51/0.85.
Factory uploads zoom 2/6: pixel 6.55/1.76 -> 0.53/0.09 ms, smooth 8.05/1.92 -> 1.88/0.44 ms
(fresh before/after runs). Real-loop CPU p50/p95 zoom 2/6: pixel 9.28/10.56 and 6.63/7.74 ms;
smooth 10.60/12.03 and 6.66/7.65 ms. Zoom 2 CPU p50 baseline pixel/smooth 31.70/34.71 ms.
Standalone sim is a remaining regression vs the old baseline: factory 3.66 -> 4.20 ms/tick,
heat 4.94 -> 5.65; settled 3.71 -> 3.49. No simulation behaviour changed (output diff exact).
Full default matrix and comparison: `/tmp/t88-final.json`, `/tmp/t88-final.log` (222.5 s).
- Isolated 960x600 warm-up check: async pipeline compilation 125.55 ms at startup; world warm-up
23.73 ms while loading; first visible frame 4.87 ms, following frames 2.10-12.47 ms (including
normal scheduling/GC variation). Look/zoom timings are in `/tmp/t88-gpu-final.log`; no pipeline
creation occurs on switches. First switch to smooth at zoom 12: 3.42 ms (normal max 3.51);
first zoom 2 smooth: 6.01 ms (1.85 ms above the normal max of 4.16); zoom 6 smooth
3.74 ms (normal max 3.38). All below a 16.67 ms frame budget; no first-use shader compilation.
These timings include waiting for submitted GPU work.
- Files: `sim/{world,cells,heat,fog,drill,tools,nature,machines,blocks,actions,conveyors}.js`,
`render/{world,cell,setup}.js`, `render/gpu/{uploads,cracks,surface,colour,device,draw,smooth,textures}.js`,
`ui/{title,session,claims,state,settings,loop,perf,preview-drill}.js`, manifest; browser tests,
`test/{light-cases,light-readback,t_render_dirty}.js`, golden fixtures; profiler/shot tools,
`tools/browser.py`, README, TESTING, PROJECT_MAP, t88 record. Old `test/t_light.js` moved to actual GPU checks,
`test/gpu-readback.js` retained for the play test. DESIGN and other tasks untouched.
- Verification: final `python3 test/run_all.py --browser` exited 0, ALL PASSED (361 play,
28 smooth, 18 console, 6 capabilities, 12 GPU, 28 golden, 71 light, 2 Firefox checks;
all headless suites, including nine render-dirty checks). Retained headless outputs match
before/after exactly (timing lines ignored). `tools/test_perf.py`, map generation, diff check
and kandown doctor passed. Early gate caught premature GAME.running during warm-up; fixed by
warming before enterGame. No commit. Phase 2 implementation complete; Phase 3 next. Owner
visual review pending; other GPU hardware and Firefox with an actual adapter not tested.
## 2026-10-27: t88 phase 2c, smooth look on WebGPU (Codex + Claude Code)
- WGSL port of the smooth look (`src/render/gpu/smooth.js`, `smooth-shader.js`, `smooth-slope.js`):