Smooth look on WebGPU: WGSL port fed by GPU inputs and CPU overrides (t88 phase 2c)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 22:42:12 -04:00
co-authored by Claude Opus 5.5
parent 65054e691b
commit 452b6aed32
26 changed files with 780 additions and 80 deletions
+5 -3
View File
@@ -92,6 +92,8 @@ def main():
for code in [pathlib.Path(a.setup).read_text() if a.setup else None, a.js]:
if code:
pg.evaluate(f'() => {{ {code}\n}}')
# Setup scenes can change surfY after the renderer cached the world's horizon.
pg.evaluate('SM.surf = -1')
if a.ticks:
pg.evaluate(f'for (let k = 0; k < {a.ticks}; k++) simTick();')
pg.evaluate(f"""GAME.paused = true; $('hud').hidden = {'false' if a.hud else 'true'}; GAME.hidePreviews = {'false' if a.previews else 'true'};
@@ -103,7 +105,7 @@ def main():
pg.evaluate("() => { window.__frozenNow = 5000; window.requestAnimationFrame = () => 0; }")
pg.wait_for_timeout(100)
pg.evaluate("() => { R.frame = 999; if (typeof SM !== 'undefined') SM.t0 = 0; frame(lastRender + 1000); }")
if a.look == 'pixel' and a.renderer == 'webgpu' and not pg.evaluate('R.gpuOn'):
if a.renderer == 'webgpu' and not pg.evaluate('R.gpuOn'):
raise RuntimeError('WebGPU fell back: ' + pg.evaluate('GPU.error'))
kw = {}
if a.clip:
@@ -111,9 +113,9 @@ def main():
kw['clip'] = {'x': x, 'y': y, 'width': w, 'height': h}
pathlib.Path(a.out).parent.mkdir(parents=True, exist_ok=True)
pg.screenshot(path=a.out, **kw)
note = pg.evaluate("SET.look === 'smooth' ? (SM.ok ? 'smooth look' : 'smooth look FAILED: ' + SM.why) : 'pixel look'")
note = pg.evaluate("SET.look === 'smooth' ? (R.smoothOn ? 'smooth look' : 'smooth look FAILED: ' + SM.why) : 'pixel look'")
b.close()
print(f"saved {a.out} ({note}, {a.renderer if a.look == 'pixel' else 'legacy'})")
print(f"saved {a.out} ({note}, {a.renderer})")
for e in errors:
print('ERROR', e)
sys.exit(1 if errors else 0)