The showcase prompt, round 3, Sonnet 5.5

user

+19:05

[redacted: harness tag]

agent

+23:22

Something is hanging, probably an infinite loop in my code rather than slow GL. I'll probe in small steps.

  • Bashpkill -f headless_shell; cat > dbg.mjs <<'EOF'error

    command

    pkill -f headless_shell; cat > dbg.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:640,height:360} });
    p.on('console', m=>console.log('console:',m.text())); p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    console.log('loaded', JSON.stringify(await p.evaluate(()=>window.__spectrum.stats())));
    const lay = await p.evaluate(()=>{const s=window.__spectrum.sc; return {src:[s.src.x,s.src.y,s.src.a], objs:s.objs.map(o=>[o.x,o.y,o.a])}});
    console.log(JSON.stringify(lay));
    for (const n of [1,2]) {
      const t0=Date.now();
      await Promise.race([ p.evaluate((n)=>{window.__spectrum.advance(1/30,n,n)}, n), new Promise((_,r)=>setTimeout(()=>r(new Error('timeout')),60000)) ]).catch(e=>console.log(e.message));
      console.log('adv',n,Date.now()-t0,'ms', JSON.stringify(await p.evaluate(()=>window.__spectrum.stats()).catch(e=>'hung')));
    }
    await b.close(); process.exit(0);
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node dbg.mjs 2>&1 | tail -20

    result, error, 1 line

    Exit code 144
  • Bashpkill -f headless_shell; export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; (timeout 100 node dbg.mjs > dbg.out 2>&1; echo done >> dbg.out) ; cat dbg.outerror

    command

    pkill -f headless_shell; export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; (timeout 100 node dbg.mjs > dbg.out 2>&1; echo done >> dbg.out) ; cat dbg.out

    result, error, 1 line

    Exit code 144

agent

+23:35

My own pkill -f was matching its own shell command and killing it. I'll drop it and rerun.

  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg.mjs > dbg.out 2>&1; echo "exit $?" >> dbg.out; cat dbg.out

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg.mjs > dbg.out 2>&1; echo "exit $?" >> dbg.out; cat dbg.out

    result, 19 lines

    node:internal/modules/cjs/loader:1386
      throw err;
      ^
    
    Error: Cannot find module '~/run/work/dbg.mjs'
        at Function._resolveFilename (node:internal/modules/cjs/loader:1383:15)
        at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
        at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
        at Function._load (node:internal/modules/cjs/loader:1192:37)
        at TracingChannel.traceSync (node:diagnostics_channel:328:14)
        at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
        at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:171:5)
        at node:internal/main/run_main_module:36:49 {
      code: 'MODULE_NOT_FOUND',
      requireStack: []
    }
    
    Node.js v22.21.1
    exit 1
  • Bashcat > dbg.mjs <<'EOF'

    command

    cat > dbg.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:640,height:360} });
    p.on('console', m=>console.log('console:',m.text())); p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    console.log('loaded', JSON.stringify(await p.evaluate(()=>window.__spectrum.stats())));
    const lay = await p.evaluate(()=>{const s=window.__spectrum.sc; return {src:[s.src.x,s.src.y,s.src.a], objs:s.objs.map(o=>[o.x,o.y,o.a])}});
    console.log(JSON.stringify(lay));
    for (const n of [1,3]) {
      const t0=Date.now();
      await p.evaluate((n)=>{window.__spectrum.advance(1/30,n,n)}, n);
      console.log('adv',n,Date.now()-t0,'ms', JSON.stringify(await p.evaluate(()=>window.__spectrum.stats())));
    }
    await p.screenshot({path:'dbg.png'});
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 150 node dbg.mjs > dbg.out 2>&1; echo "exit $?" >> dbg.out; cat dbg.out

    result, 25 lines

    loaded {"nseg":0,"sMax":1000,"mode":"turnon","scene":0,"T":0}
    {"src":[30,159.8501975582148,0],"objs":[[400,235,0.4205876948063353],[917.1586730686065,587.8488564827971,3.5621803483961285],[1291.0358840532172,662.9986589245823,0]]}
    adv 1 973 ms {"nseg":259927,"sMax":5107.607842410021,"mode":"turnon","scene":0,"T":0.03333333333333333}
    adv 3 1522 ms {"nseg":259940,"sMax":5104.435722515795,"mode":"turnon","scene":0,"T":0.13333333333333333}
    node:internal/modules/run_main:123
        triggerUncaughtException(
        ^
    
    page.screenshot: Timeout 30000ms exceeded.
    Call log:
      - taking page screenshot
      - waiting for fonts to load...
      - fonts loaded
    
        at ~/run/work/dbg.mjs:15:9 {
      log: [
        '  - taking page screenshot',
        '  - waiting for fonts to load...',
        '  - fonts loaded'
      ],
      name: 'TimeoutError'
    }
    
    Node.js v22.21.1
    exit 1

agent

+24:43
reasoning

The trace is producing about 260k segments because faint Fresnel branches multiply, and the lens focus sits at the world edge. I'm fixing both, making the pulse-timing bound ignore faint segments, and keeping a compositor frame loop alive in capture mode.

  • Bashpython3 - <<'EOF'

    command

    python3 - <<'EOF'
    p='spectrum.html'
    s=open(p).read()
    def rep(a,b,cnt=1):
        global s
        assert s.count(a)>=1, a
        s=s.replace(a,b)
    rep("const e = ho < 0 ? s + 1800 : s1; if (e > smx) smx = e;","if (w * sc.shade(depth, k, med >= 0) > .08) { const e = ho < 0 ? s + 700 : s1; if (e > smx) smx = e; }")
    rep("polyShape(prismPts(side), glass, 400, 235, i0 - 30 * D2R)","polyShape(prismPts(side), glass, 330, 235, i0 - 30 * D2R)")
    rep("lensShape(300, 66, new Material(\"crown\", 1), ex + 330, ey, 0)","lensShape(270, 62, new Material(\"crown\", 1), ex + 310, ey, 0)")
    rep("wmin: .004, maxDepth: 14, N: 7000, decay: .72","wmin: .012, maxDepth: 14, N: 5500, decay: .72")
    rep("""} else requestAnimationFrame(frame);""","""  (function keep() { requestAnimationFrame(keep); })();
    } else requestAnimationFrame(frame);""")
    open(p,'w').write(s)
    EOF
    sed -i "s/for (const n of \[1,3\])/for (const n of [1,2])/; s/width:640,height:360/width:800,height:450/" dbg.mjs
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 150 node dbg.mjs > dbg.out 2>&1; echo "exit $?" >> dbg.out; cat dbg.out

    result, 26 lines

    loaded {"nseg":0,"sMax":1000,"mode":"turnon","scene":0,"T":0}
    {"src":[30,159.8501975582148,0],"objs":[[330,235,0.4205876948063353],[847.1586730686065,587.8488564827971,3.5621803483961285],[1201.0358840532172,662.9986589245823,0]]}
    adv 1 243 ms {"nseg":216337,"sMax":2309.981586127243,"mode":"turnon","scene":0,"T":0.03333333333333333}
    adv 2 289 ms {"nseg":213634,"sMax":2309.4634892938734,"mode":"turnon","scene":0,"T":0.1}
    node:internal/modules/run_main:123
        triggerUncaughtException(
        ^
    
    page.screenshot: Timeout 30000ms exceeded.
    Call log:
      - taking page screenshot
      - waiting for fonts to load...
      - fonts loaded
    
        at ~/run/work/dbg.mjs:15:9 {
      log: [
        '  - taking page screenshot',
        '  - waiting for fonts to load...',
        '  - fonts loaded'
      ],
      name: 'TimeoutError'
    }
    
    Node.js v22.21.1
    exit 1
    [This command modified 1 file you've previously read: spectrum.html. Call Read before editing.]
  • Bashcat > dbg2.mjs <<'EOF'

    command

    cat > dbg2.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:400,height:225} });
    p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    for (const [wm,md] of [[.012,14],[.05,14],[.012,6],[.2,14],[1,14]]) {
      const r = await p.evaluate(([wm,md])=>{const S=window.__spectrum; S.sc.wmin=wm; S.sc.maxDepth=md; S.advance(1/30,1,1); return S.stats().nseg/ (S.sc.N*1.6)},[wm,md]);
      console.log('wmin',wm,'maxDepth',md,'segs/ray',r.toFixed(2));
    }
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg2.mjs 2>&1 | tail

    result, 5 lines

    wmin 0.012 maxDepth 14 segs/ray 24.58
    wmin 0.05 maxDepth 14 segs/ray 15.83
    wmin 0.012 maxDepth 6 segs/ray 18.66
    wmin 0.2 maxDepth 14 segs/ray 8.41
    wmin 1 maxDepth 14 segs/ray 1.38
  • Bashcat > dbg3.mjs <<'EOF'

    command

    cat > dbg3.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:640,height:360} });
    p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    let t=Date.now();
    await p.screenshot({path:'a.png', timeout:20000}).then(()=>console.log('shot0 ok',Date.now()-t)).catch(e=>console.log('shot0 fail'));
    await p.evaluate(()=>{const S=window.__spectrum; S.sc.wmin=.04; S.advance(1/30,1,1)});
    t=Date.now();
    await p.screenshot({path:'b.png', timeout:40000}).then(()=>console.log('shot1 ok',Date.now()-t)).catch(e=>console.log('shot1 fail'));
    // manual composite
    const url = await p.evaluate(()=>{const g=document.getElementById('gl'),o=document.getElementById('ov'); const c=document.createElement('canvas'); c.width=g.width; c.height=g.height; const x=c.getContext('2d'); x.drawImage(g,0,0); x.drawImage(o,0,0); return c.toDataURL('image/png')});
    import fs from 'fs'; fs.writeFileSync('c.png', Buffer.from(url.split(',')[1],'base64')); console.log('manual ok');
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 120 node dbg3.mjs 2>&1 | tail

    result, 3 lines

    shot0 ok 1454
    shot1 ok 14094
    manual ok
  • Read~/run/work/c.png

    input

    {
      "file_path": "~/run/work/c.png"
    }

    result

    no output

    c.png
    c.png

agent

+26:56

The scene geometry works. I'll switch the capture to a direct canvas composite, which is much faster than a compositor screenshot, and look at a fully lit frame.

  • Bashsed -i 's/wmin: .012, maxDepth: 14, N: 5500/wmin: .04, maxDepth: 14, N: 4800/' spectrum.html && cat > shot.mjs <<'EOF'

    command

    sed -i 's/wmin: .012, maxDepth: 14, N: 5500/wmin: .04, maxDepth: 14, N: 4800/' spectrum.html && cat > shot.mjs <<'EOF'
    import { chromium } from 'playwright';
    import fs from 'fs';
    const [,, scene='0', secs='5', out='shot.png', w='960', h='540', tail='6', extra=''] = process.argv;
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:+w,height:+h} });
    p.on('console', m=>console.log('console:',m.text())); p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=${scene}${extra}`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    const t0=Date.now();
    await p.evaluate(([secs,tail])=>{ const S=window.__spectrum; S.auto=false; S.advance(1/30, Math.round(secs*30), +tail); }, [+secs,+tail]);
    console.log('render ms', Date.now()-t0, JSON.stringify(await p.evaluate(()=>window.__spectrum.stats())));
    const url = await p.evaluate(()=>{const g=document.getElementById('gl'),o=document.getElementById('ov'); const c=document.createElement('canvas'); c.width=g.width; c.height=g.height; const x=c.getContext('2d'); x.drawImage(g,0,0); x.drawImage(o,0,0); return c.toDataURL('image/png')});
    fs.writeFileSync(out, Buffer.from(url.split(',')[1],'base64'));
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node shot.mjs 0 5 s0.png 1280 720 8 2>&1 | tail

    result, 11 lines

    node:internal/modules/run_main:123
        triggerUncaughtException(
        ^
    
    page.evaluate: Target page, context or browser has been closed
        at ~/run/work/shot.mjs:10:9 {
      log: []
    }
    
    Node.js v22.21.1
    [This command modified 1 file you've previously read: spectrum.html. Call Read before editing.]
  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node shot.mjs 0 5 s0.png 800 450 4 2>&1 | tail -5; ls -la s0.pngerror

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node shot.mjs 0 5 s0.png 800 450 4 2>&1 | tail -5; ls -la s0.png

    result, error, 7 lines

    Exit code 2
        at ~/run/work/shot.mjs:10:9 {
      log: []
    }
    
    Node.js v22.21.1
    ls: cannot access 's0.png': No such file or directory
  • Bashcat > dbg4.mjs <<'EOF'

    command

    cat > dbg4.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:800,height:450} });
    p.on('pageerror', e=>console.log('ERR:',e.message)); p.on('crash',()=>console.log('PAGE CRASH')); p.on('console', m=>console.log('console:',m.text()));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    await p.evaluate(()=>{window.__spectrum.auto=false});
    for (let i=0;i<8;i++){
      try { const t=Date.now(); await p.evaluate(()=>{window.__spectrum.advance(1/30,15,1)}); console.log(i, Date.now()-t,'ms', JSON.stringify(await p.evaluate(()=>window.__spectrum.stats()))); }
      catch(e){ console.log('died at',i,e.message.split('\n')[0]); break; }
    }
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 150 node dbg4.mjs 2>&1 | tail -12

    result, 1 line

    died at 0 page.evaluate: Target page, context or browser has been closed
  • Bashsed -i 's/advance(1\/30,15,1)/advance(1\/30,15,0)/' dbg4.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg4.mjs 2>&1 | tail -12

    command

    sed -i 's/advance(1\/30,15,1)/advance(1\/30,15,0)/' dbg4.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg4.mjs 2>&1 | tail -12

    result, 1 line

    died at 0 page.evaluate: Target page, context or browser has been closed
  • Bashcat > dbg5.mjs <<'EOF'

    command

    cat > dbg5.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:800,height:450} });
    p.on('pageerror', e=>console.log('ERR:',e.message)); p.on('crash',()=>console.log('PAGE CRASH')); p.on('console', m=>console.log('console:',m.text()));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    for (let i=0;i<40;i++){
      try { const r = await p.evaluate(()=>{const S=window.__spectrum; try{ S.step(1/30); return S.stats().T }catch(e){ return 'EXC '+e.message } }); if(i%5==0||typeof r==='string') console.log(i, r); }
      catch(e){ console.log('died at',i,e.message.split('\n')[0]); break; }
    }
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg5.mjs 2>&1 | tail -12

    result, 8 lines

    0 0.03333333333333333
    5 0.19999999999999998
    10 0.36666666666666664
    15 0.5333333333333333
    20 0.7
    25 0.8666666666666666
    30 1.0333333333333332
    35 1.2000000000000004
  • Bashcat > dbg6.mjs <<'EOF'

    command

    cat > dbg6.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:800,height:450} });
    p.on('pageerror', e=>console.log('ERR:',e.message)); p.on('crash',()=>console.log('PAGE CRASH'));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    const tests = {
     setAuto: ()=>{window.__spectrum.auto=false; return 'ok'},
     adv1: ()=>{window.__spectrum.advance(1/30,1,0); return 'ok'},
     adv15: ()=>{window.__spectrum.advance(1/30,15,0); return window.__spectrum.stats().T},
    };
    for (const [k,f] of Object.entries(tests)) {
      try { console.log(k, await p.evaluate(f)); } catch(e){ console.log(k,'DIED', e.message.split('\n')[0]); break; }
    }
    await b.close();
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg6.mjs 2>&1 | tail -12

    result, 3 lines

    setAuto ok
    adv1 ok
    adv15 0.5333333333333333

agent

+39:15

I'm chasing a page crash that appears intermittent, so I suspect stray headless browsers from my earlier killed runs are eating resources. I'm checking and cleaning those up.

  • Bashps aux | grep -E "[h]eadless|[s]hot.mjs|[d]bg" | awk '{print $2, $3, $4, $11, $12}' | head -20; echo ---; free -m | head -2

    command

    ps aux | grep -E "[h]eadless|[s]hot.mjs|[d]bg" | awk '{print $2, $3, $4, $11, $12}' | head -20; echo ---; free -m | head -2

    result, 3 lines

    ---
                   total        used        free      shared  buff/cache   available
    Mem:           50191       16688        6571        2025       26932       30962
  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg4.mjs 2>&1 | tail -12; echo ----; timeout 100 node shot.mjs 0 5 s0.png 800 450 4 2>&1 | tail -4

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg4.mjs 2>&1 | tail -12; echo ----; timeout 100 node shot.mjs 0 5 s0.png 800 450 4 2>&1 | tail -4

    result, 7 lines

    0 1575 ms {"nseg":118268,"sMax":2306.3442694410296,"mode":"turnon","scene":0,"T":0.49999999999999994}
    died at 1 page.evaluate: Target page, context or browser has been closed
    ----
      log: []
    }
    
    Node.js v22.21.1
  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; DEBUG=pw:browser timeout 100 node dbg4.mjs 2>&1 | grep -v "^\s*$" | grep -iE "fatal|crash|error|check|signal|oom|memory|abort|died|ERR" | head -15

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; DEBUG=pw:browser timeout 100 node dbg4.mjs 2>&1 | grep -v "^\s*$" | grep -iE "fatal|crash|error|check|signal|oom|memory|abort|died|ERR" | head -15

    result, 15 lines

    2026-11-11T10:00:25.468Z pw:browser <launching> ~/run/work/browsers/chromium_headless_shell-1254/chrome-headless-shell-linux64/chrome-headless-shell --disable-field-trial-config --disable-background-networking --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-edgeupdater --disable-extensions --disable-features=AvoidUnnecessaryBeforeUnloadCheckSync,DestroyProfileOnBrowserClose,HttpsUpgrades,HttpsFirstBalancedModeAutoEnable,LensOverlay,MediaRouter,PaintHolding,ThirdPartyStoragePartitioning,AvoidCorsURLLoaderRestartOnRedirect,TcpPortRandomizationWin,OptimizationHints,NetworkTimeServiceQuerying,AimEnabled,PreconnectToSearch,msForceBrowserSignIn,msEdgeUpdateLaunchServicesPreferredVersion --enable-features=CDPScreenshotNewSurface,SkipListAccountsWithoutGaiaCookies --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-updater-scheduler --force-color-profile=srgb --metrics-recording-only --no-first-run [redacted: browser flag flagged by the scan] --use-mock-keychain --no-service-autorun --disable-search-engine-choice-screen --unsafely-disable-devtools-self-xss-warnings --enable-unsafe-swiftshader --edge-skip-compat-layer-relaunch --disable-stack-profiler --disable-infobars --disable-sync --do-not-de-elevate --headless --hide-scrollbars --mute-audio --blink-settings=primaryHoverType=2,availableHoverTypes=2,primaryPointerType=4,availablePointerTypes=4 --no-sandbox --use-gl=angle --use-angle=swiftshader --enable-unsafe-swiftshader --ignore-gpu-blocklist --user-data-dir=/tmp/playwright_chromiumdev_profile-p683cR --remote-debugging-pipe --no-startup-window
    2026-11-11T10:00:25.564Z pw:browser [pid=2310][err] [1111/100025.558690:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
    2026-11-11T10:00:25.566Z pw:browser [pid=2310][err] [1111/100025.558782:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
    2026-11-11T10:00:25.566Z pw:browser [pid=2310][err] [1111/100025.558816:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
    2026-11-11T10:00:25.566Z pw:browser [pid=2310][err] [1111/100025.558889:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Failed to connect to socket /run/dbus/system_bus_socket: No such file or directory
    2026-11-11T10:00:25.566Z pw:browser [pid=2310][err] [1111/100025.559703:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
    2026-11-11T10:00:25.566Z pw:browser [pid=2310][err] [1111/100025.559724:WARNING:dbus/object_proxy.cc:439] Failed to connect to NameOwnerChanged signal for object: /org/freedesktop/portal/desktop
    2026-11-11T10:00:25.566Z pw:browser [pid=2310][err] [1111/100025.559733:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
    2026-11-11T10:00:25.567Z pw:browser [pid=2310][err] [1111/100025.559741:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
    2026-11-11T10:00:25.586Z pw:browser [pid=2310][err] [1111/100025.582222:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
    2026-11-11T10:00:25.586Z pw:browser [pid=2310][err] [1111/100025.582312:WARNING:device/bluetooth/dbus/bluez_dbus_manager.cc:209] Floss manager service not available, cannot set Floss enable/disable.
    2026-11-11T10:00:25.586Z pw:browser [pid=2310][err] [1111/100025.582534:ERROR:dbus/bus.cc:405] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
    2026-11-11T10:00:25.586Z pw:browser [pid=2310][err] [1111/100025.585848:ERROR:dbus/object_proxy.cc:572] Failed to call method: org.freedesktop.DBus.NameHasOwner: object_path= /org/freedesktop/DBus: unknown error type: 
    2026-11-11T10:00:25.760Z pw:browser [pid=2310][err] [1111/100025.748895:WARNING:media/gpu/vaapi/vaapi_wrapper.cc:1652] drmGetDevices2() has not found any devices
    2026-11-11T10:00:25.764Z pw:browser [pid=2310][err] [1111/100025.762829:WARNING:sandbox/policy/linux/sandbox_linux.cc:405] InitializeSandbox() called with multiple threads in process gpu-process.
  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; DEBUG=pw:browser timeout 100 node dbg4.mjs 2>&1 | grep -E "\[err\]|died|^[0-9] " | grep -viE "dbus|bluetooth|vaapi|drmGet|InitializeSandbox|launching" | cut -c1-300 | tail -12

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; DEBUG=pw:browser timeout 100 node dbg4.mjs 2>&1 | grep -E "\[err\]|died|^[0-9] " | grep -viE "dbus|bluetooth|vaapi|drmGet|InitializeSandbox|launching" | cut -c1-300 | tail -12

    result, 2 lines

    0 4520 ms {"nseg":118227,"sMax":2306.3283412343862,"mode":"turnon","scene":0,"T":0.49999999999999994}
    died at 1 page.evaluate: Target page, context or browser has been closed
  • Bashsed -i "s/'--ignore-gpu-blocklist'\]/'--ignore-gpu-blocklist','--enable-logging=stderr','--v=0']/" dbg4.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; DEBUG=pw:browser timeout 100 node dbg4.mjs 2>&1 | grep -E "\[err\]|died|^[0-9] " | grep -viE "dbus|bluetooth|vaapi|drmGet|InitializeSandbox|launching|floss" | cut -c1-400 | tail -15

    command

    sed -i "s/'--ignore-gpu-blocklist'\]/'--ignore-gpu-blocklist','--enable-logging=stderr','--v=0']/" dbg4.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; DEBUG=pw:browser timeout 100 node dbg4.mjs 2>&1 | grep -E "\[err\]|died|^[0-9] " | grep -viE "dbus|bluetooth|vaapi|drmGet|InitializeSandbox|launching|floss" | cut -c1-400 | tail -15

    result, 1 line

    died at 0 page.evaluate: Target page, context or browser has been closed
  • Bashcat /sys/fs/cgroup/memory.max 2>/dev/null; cat /sys/fs/cgroup/memory.current 2>/dev/null; cat /sys/fs/cgroup/memory.events 2>/dev/null; ulimit -a | grep -E "processes|virtual|memory|file size"; nproc

    command

    cat /sys/fs/cgroup/memory.max 2>/dev/null; cat /sys/fs/cgroup/memory.current 2>/dev/null; cat /sys/fs/cgroup/memory.events 2>/dev/null; ulimit -a | grep -E "processes|virtual|memory|file size"; nproc

    result, 7 lines

    core file size              (blocks, -c) 0
    file size                   (blocks, -f) unlimited
    max locked memory           (kbytes, -l) 6424532
    max memory size             (kbytes, -m) unlimited
    max user processes                  (-u) 200727
    virtual memory              (kbytes, -v) unlimited
    10

agent

+48:12

Quick status: the page keeps dying under software rendering. I suspect Chromium's GPU watchdog is killing the slow software-GL process. I'm retrying with the watchdog disabled.

  • Bashsed -i "s/'--enable-logging=stderr','--v=0'/'--disable-gpu-watchdog','--in-process-gpu'/" dbg4.mjs && sed -i "s/'--ignore-gpu-blocklist'\]/'--ignore-gpu-blocklist','--disable-gpu-watchdog','--in-process-gpu']/" shot.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 150 node dbg4.mjs 2>&1 | tail -10

    command

    sed -i "s/'--enable-logging=stderr','--v=0'/'--disable-gpu-watchdog','--in-process-gpu'/" dbg4.mjs && sed -i "s/'--ignore-gpu-blocklist'\]/'--ignore-gpu-blocklist','--disable-gpu-watchdog','--in-process-gpu']/" shot.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 150 node dbg4.mjs 2>&1 | tail -10

    result, 4 lines

    0 1910 ms {"nseg":118292,"sMax":2306.3300240941044,"mode":"turnon","scene":0,"T":0.49999999999999994}
    1 112124 ms {"nseg":114357,"sMax":2302.5890125791157,"mode":"turnon","scene":0,"T":0.9999999999999999}
    2 464 ms {"nseg":110617,"sMax":2299.3407149112336,"mode":"turnon","scene":0,"T":1.5000000000000013}
    died at 3 page.evaluate: Target page, context or browser has been closed

agent

+51:13
reasoning

The slow frame was my bug: with the beam fully on, u_tail hit −1e9, making smoothstep's edges identical and filling the HDR buffer with NaNs. I'm fixing that and lowering the per-frame ray budget, since temporal accumulation will make up for it.

  • Bashpython3 - <<'EOF'

    command

    python3 - <<'EOF'
    p='spectrum.html'
    s=open(p).read()
    def rep(a,b):
        global s
        assert a in s, a
        s=s.replace(a,b)
    rep('let front = 1e9, tail = -1e9, flash = 0, dtb = T - beam.t0;\n  if (beam.mode === "off") front = -1e9;','let front = 1e5, tail = -1e5, flash = 0, dtb = T - beam.t0;\n  if (beam.mode === "off") front = -1e5;')
    rep('gl.uniform1f(U.u_pc, pulse ? (T - pulse.t0) * CP - 120 : -1e9)','gl.uniform1f(U.u_pc, pulse ? (T - pulse.t0) * CP - 120 : -1e5)')
    rep("N: 4800, decay: .72","N: 2600, decay: .78")
    rep("N: 9000, decay: .72","N: 3200, decay: .78")
    rep("N: 3600, decay: .72","N: 2400, decay: .78")
    open(p,'w').write(s)
    EOF
    grep -n "1e9" spectrum.html | head; export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node shot.mjs 0 5 s0.png 960 540 6 2>&1 | tail -4

    result, 7 lines

    146:    let d = -1e9; const P = this.P;
    580:  const px = mouse.wx, py = mouse.wy, R = 7 / VS * DPR; let sw = 0, sl = 0, lo = 1e9, hi = -1, inside = -1, best = 0;
    605:  let best = null, bd = 1e9;
      log: []
    }
    
    Node.js v22.21.1
  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 250 node shot.mjs 0 5 s0.png 960 540 6 2>&1 | head -12

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 250 node shot.mjs 0 5 s0.png 960 540 6 2>&1 | head -12

    result, 10 lines

    node:internal/modules/run_main:123
        triggerUncaughtException(
        ^
    
    page.evaluate: Target page, context or browser has been closed
        at ~/run/work/shot.mjs:10:9 {
      log: []
    }
    
    Node.js v22.21.1
  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; sed -i 's/width:800,height:450/width:960,height:540/' dbg4.mjs; time (timeout 250 node dbg4.mjs 2>&1 | tail -10)

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; sed -i 's/width:800,height:450/width:960,height:540/' dbg4.mjs; time (timeout 250 node dbg4.mjs 2>&1 | tail -10)

    result, 10 lines

    0 1073 ms {"nseg":64084,"sMax":2306.3189955291045,"mode":"turnon","scene":0,"T":0.49999999999999994}
    1 644 ms {"nseg":61956,"sMax":2302.5898895618266,"mode":"turnon","scene":0,"T":0.9999999999999999}
    2 592 ms {"nseg":59932,"sMax":2299.343939327551,"mode":"turnon","scene":0,"T":1.5000000000000013}
    3 561 ms {"nseg":58330,"sMax":2296.8605687536647,"mode":"turnon","scene":0,"T":2.0000000000000027}
    4 120037 ms {"nseg":57287,"sMax":2295.384056751059,"mode":"on","scene":0,"T":2.500000000000001}
    died at 5 page.evaluate: Target page, context or browser has been closed
    
    real	4m10.391s
    user	5m1.790s
    sys	1m44.354s

pow(x, 2.) with a negative base is undefined in GLSL, which is another NaN source in my pulse terms. Replacing it with x*x.

  • Bashpython3 - <<'EOF'

    command

    python3 - <<'EOF'
    p='spectrum.html'
    s=open(p).read()
    def rep(a,b):
        global s
        assert a in s, a
        s=s.replace(a,b)
    rep("float fl = u_flash * exp(-pow((s-u_front+10.)/26., 2.)) * smoothstep(u_tail-30., u_tail, s);","float qf = (s-u_front+10.)/26.;\n  float fl = u_flash * exp(-qf*qf) * smoothstep(u_tail-30., u_tail, s);")
    rep("float pl = u_pa * exp(-pow((s-u_pc)/u_pw, 2.));","float qp = (s-u_pc)/u_pw;\n  float pl = u_pa * exp(-min(qp*qp, 80.));")
    rep("exp(-qf*qf)","exp(-min(qf*qf, 80.))")
    open(p,'w').write(s)
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 250 node dbg4.mjs 2>&1 | tail -10)

    result, 10 lines

    0 675 ms {"nseg":64061,"sMax":2306.325628353051,"mode":"turnon","scene":0,"T":0.49999999999999994}
    1 865 ms {"nseg":61956,"sMax":2302.5864843229374,"mode":"turnon","scene":0,"T":0.9999999999999999}
    2 1150 ms {"nseg":59951,"sMax":2299.3389670885863,"mode":"turnon","scene":0,"T":1.5000000000000013}
    3 776 ms {"nseg":58333,"sMax":2296.8389968708316,"mode":"turnon","scene":0,"T":2.0000000000000027}
    4 787 ms {"nseg":57292,"sMax":2295.3888441968193,"mode":"on","scene":0,"T":2.500000000000001}
    died at 5 page.evaluate: Target page, context or browser has been closed
    
    real	4m10.289s
    user	4m35.160s
    sys	1m56.533s
  • Bashcat > dbg7.mjs <<'EOF'

    command

    cat > dbg7.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist','--disable-gpu-watchdog','--in-process-gpu'] });
    const p = await b.newPage({ viewport:{width:960,height:540} });
    p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0&t=2.4`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    await p.evaluate(()=>{window.__spectrum.auto=false});
    for (let i=0;i<14;i++){
      const r = await Promise.race([ p.evaluate(()=>{const S=window.__spectrum; const t=performance.now(); S.step(1/30); const t1=performance.now(); S.render(); const gl=document.getElementById('gl').getContext('webgl2'); gl.finish(); return [S.stats().mode, +(t1-t).toFixed(1), +(performance.now()-t1).toFixed(1), S.stats().nseg, S.stats().T.toFixed(2)]}), new Promise(r=>setTimeout(()=>r('TIMEOUT 40s'),40000)) ]);
      console.log(i, JSON.stringify(r)); if (r==='TIMEOUT 40s') break;
    }
    await b.close(); process.exit(0);
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node dbg7.mjs 2>&1 | tail -16

    result, 7 lines

    0 ["on",0,187.9,52174,"2.43"]
    1 ["on",0,35.2,52140,"2.47"]
    2 ["on",0.1,84.2,52064,"2.50"]
    3 ["on",0,40.9,52064,"2.53"]
    4 ["on",0.1,53.2,52024,"2.57"]
    5 ["on",0,63.8,51988,"2.60"]
    6 "TIMEOUT 40s"
  • Bashpython3 - <<'EOF'

    command

    python3 - <<'EOF'
    p='spectrum.html'
    s=open(p).read()
    a="    set auto(v) { auto = v; }, get nseg() { return nseg; },"
    assert a in s
    s=s.replace(a,"""    scan() { let nan = 0, big = 0, mx = 0, mc = 0, long = 0; for (let i = 0; i < nseg; i++) { const o = i * STRIDE; for (let k = 0; k < 7; k++) { const v = SEG[o + k]; if (!isFinite(v)) nan++; else { if (k < 4 && Math.abs(v) > mx) mx = Math.abs(v); if (k >= 4 && v > mc) mc = v; } }
          const l = Math.hypot(SEG[o + 2] - SEG[o], SEG[o + 3] - SEG[o + 1]); if (l > 7000) long++; } return { nan, mx, mc, long }; },
        trace() { traceAll(sc, sc.N * 1.6, 1e-3); },
        set auto(v) { auto = v; }, get nseg() { return nseg; },""")
    open(p,'w').write(s)
    EOF
    sed -i "s/S.step(1\/30); const t1=performance.now(); S.render();/S.step(1\/30); S.trace(); const sc=S.scan(); const t1=performance.now(); S.render();/; s/S.stats().T.toFixed(2)\]/S.stats().T.toFixed(2), JSON.stringify(sc)]/" dbg7.mjs
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 200 node dbg7.mjs 2>&1 | tail -16

    result, 15 lines

    0 ["on",139,30.3,52152,"2.43","{\"nan\":0,\"mx\":7193.771484375,\"mc\":0.004248733166605234,\"long\":0}"]
    1 ["on",39.3,23.6,52128,"2.47","{\"nan\":0,\"mx\":7194.287109375,\"mc\":0.004248733166605234,\"long\":0}"]
    2 ["on",42.2,51.4,52085,"2.50","{\"nan\":0,\"mx\":7193.7802734375,\"mc\":0.004248733166605234,\"long\":0}"]
    3 ["on",37.3,54.8,52058,"2.53","{\"nan\":0,\"mx\":7192.5810546875,\"mc\":0.004248733166605234,\"long\":0}"]
    4 ["on",35.2,36,52019,"2.57","{\"nan\":0,\"mx\":7192.50341796875,\"mc\":0.004248733166605234,\"long\":0}"]
    5 ["on",25.9,55.6,51959,"2.60","{\"nan\":0,\"mx\":7192.28564453125,\"mc\":0.004248733166605234,\"long\":0}"]
    6 ["on",60.2,51.4,51954,"2.63","{\"nan\":0,\"mx\":7191.8291015625,\"mc\":0.004248733166605234,\"long\":0}"]
    7 ["on",22.9,27.3,51895,"2.67","{\"nan\":0,\"mx\":7191.2568359375,\"mc\":0.004248733166605234,\"long\":0}"]
    8 ["on",16,24,51897,"2.70","{\"nan\":0,\"mx\":7191.748046875,\"mc\":0.004248733166605234,\"long\":0}"]
    9 ["on",24.2,43,51915,"2.73","{\"nan\":0,\"mx\":7192.19140625,\"mc\":0.004248733166605234,\"long\":0}"]
    10 ["on",14.3,36.7,51895,"2.77","{\"nan\":0,\"mx\":7191.4521484375,\"mc\":0.004248733166605234,\"long\":0}"]
    11 ["on",22.1,32.6,51885,"2.80","{\"nan\":0,\"mx\":7191.24169921875,\"mc\":0.004248733166605234,\"long\":0}"]
    12 ["on",34.7,49.9,51873,"2.83","{\"nan\":0,\"mx\":7190.88623046875,\"mc\":0.004248733166605234,\"long\":0}"]
    13 ["on",44.7,36.9,51872,"2.87","{\"nan\":0,\"mx\":7191.40673828125,\"mc\":0.004248733166605234,\"long\":0}"]
    [This command modified 1 file you've previously read: spectrum.html. Call Read before editing.]
reasoning

All 14 frames passed on this run, so the earlier hang seems to be flaky software-GL rather than my content. The trace stage is still slow, and I'll profile it separately; first I'm moving on to an image.

  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 200 node shot.mjs 0 4 s0.png 960 540 8 2>&1 | tail -4)

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 200 node shot.mjs 0 4 s0.png 960 540 8 2>&1 | tail -4)

    result, 8 lines

      log: []
    }
    
    Node.js v22.21.1
    
    real	3m20.166s
    user	0m1.097s
    sys	0m0.231s

Frames only completed reliably when I called gl.finish() each time, so the capture path was probably flooding the software command queue. I'm adding a sync per frame in capture mode.

  • Bashpython3 - <<'EOF'

    command

    python3 - <<'EOF'
    p='spectrum.html'
    s=open(p).read()
    a="  gl.activeTexture(gl.TEXTURE0);\n  drawOverlay();"
    assert a in s
    s=s.replace(a,"  gl.activeTexture(gl.TEXTURE0);\n  if (CAPTURE) gl.finish();\n  drawOverlay();")
    open(p,'w').write(s)
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 200 node shot.mjs 0 4 s0.png 960 540 8 2>&1 | tail -4)

    result, 8 lines

      log: []
    }
    
    Node.js v22.21.1
    
    real	3m20.118s
    user	0m0.800s
    sys	0m0.248s
  • Bashcat > dbg8.mjs <<'EOF'

    command

    cat > dbg8.mjs <<'EOF'
    import { chromium } from 'playwright';
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist'] });
    const p = await b.newPage({ viewport:{width:640,height:360} });
    p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0&t=3`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    const r = await Promise.race([ p.evaluate(()=>{const S=window.__spectrum; const t=performance.now(); let mx=0; for(let i=0;i<300;i++){ const t0=performance.now(); S.trace(); const d=performance.now()-t0; if(d>mx) mx=d; } return {avg:(performance.now()-t)/300, max:mx, nseg:S.stats().nseg}}), new Promise(r=>setTimeout(()=>r('TIMEOUT'),60000)) ]);
    console.log('JS-only trace x300:', JSON.stringify(r));
    await b.close(); process.exit(0);
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; timeout 100 node dbg8.mjs 2>&1 | tail -5

    result, 1 line

    JS-only trace x300: {"avg":12.101666666666667,"max":93.60000002384186,"nseg":41478}
  • Bashcat > dbg9.mjs <<'EOF'

    command

    cat > dbg9.mjs <<'EOF'
    import { chromium } from 'playwright';
    const flags = (process.argv[2]||'').split(',').filter(Boolean);
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist',...flags] });
    const p = await b.newPage({ viewport:{width:960,height:540} });
    p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=0&t=2.4`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    let ok=0, slow=0; const t00=Date.now();
    for (let i=0;i<30;i++){
      const t0=Date.now();
      const r = await Promise.race([ p.evaluate(()=>{const S=window.__spectrum; S.step(1/30); S.render(); return 1}), new Promise(r=>setTimeout(()=>r('TO'),20000)) ]);
      if (r==='TO'){ console.log('hang at frame',i); break;} ok++; if (Date.now()-t0>1500) slow++;
    }
    console.log(flags.join(' '),'ok',ok,'slow',slow,'total s',((Date.now()-t00)/1000).toFixed(1));
    await b.close(); process.exit(0);
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; for f in "" "--disable-gpu-compositing" "--disable-gpu-watchdog,--in-process-gpu"; do timeout 100 node dbg9.mjs "$f" 2>&1 | tail -2; done

    result, 5 lines

    hang at frame 6
     ok 6 slow 0 total s 20.3
    --disable-gpu-compositing ok 30 slow 2 total s 33.0
    hang at frame 27
    --disable-gpu-watchdog --in-process-gpu ok 27 slow 2 total s 29.6

--disable-gpu-compositing ran all 30 frames cleanly. The hang was the compositor competing with software WebGL, not my content. Using that flag now.

  • Bashsed -i "s/'--disable-gpu-watchdog','--in-process-gpu'/'--disable-gpu-compositing'/" shot.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 250 node shot.mjs 0 4 s0.png 960 540 8 2>&1 | tail -4)

    command

    sed -i "s/'--disable-gpu-watchdog','--in-process-gpu'/'--disable-gpu-compositing'/" shot.mjs && export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 250 node shot.mjs 0 4 s0.png 960 540 8 2>&1 | tail -4)

    result, 8 lines

    console: [.WebGL-0x1a7c003a6400]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
    render ms 96162 {"nseg":59130,"sMax":2297.973450732128,"mode":"on","scene":0,"T":3.9999999999999956}
    console: [.WebGL-0x1a7c003a6400]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
    console: [.WebGL-0x1a7c003a6400]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
    
    real	2m24.491s
    user	0m0.798s
    sys	0m0.341s
  • Read~/run/work/s0.png

    input

    {
      "file_path": "~/run/work/s0.png"
    }

    result

    no output

    s0.jpg
    s0.jpg
reasoning

The optics render is working and the physics looks right, but the fan is too wide for the second prism, the lens sits off-band, and the faint side branches are too bright. I'm fixing those and switching the capture to frame-by-frame rendering to avoid the GL stalls.

  • Bashpython3 - <<'EOF'

    command

    python3 - <<'EOF'
    p='spectrum.html'
    s=open(p).read()
    def rep(a,b,count=None):
        global s
        assert a in s, a
        s=s.replace(a,b)
    # br (reflection-branch) count passed to shade
    rep("let x = stk[b], y = stk[b + 1], dx = stk[b + 2], dy = stk[b + 3], w = stk[b + 4], s = stk[b + 5], med = stk[b + 6], k = stk[b + 7], depth = stk[b + 8];",
        "let x = stk[b], y = stk[b + 1], dx = stk[b + 2], dy = stk[b + 3], w = stk[b + 4], s = stk[b + 5], med = stk[b + 6], k = stk[b + 7], depth = stk[b + 8], br = stk[b + 9];")
    rep("const stk = new Float64Array(64 * 9)","const stk = new Float64Array(64 * 10)")
    rep("sp--; const b = sp * 9;","sp--; const b = sp * 10;")
    rep("stk[4] = 1; stk[5] = 0; stk[6] = -1; stk[7] = 0; stk[8] = 0; sp = 1;","stk[4] = 1; stk[5] = 0; stk[6] = -1; stk[7] = 0; stk[8] = 0; stk[9] = 0; sp = 1;")
    rep("const g = sc.shade(depth, k, med >= 0) * w * amp;","const g = sc.shade(depth, k, med >= 0, br) * w * amp;")
    rep("if (w * sc.shade(depth, k, med >= 0) > .08)","if (w * sc.shade(depth, k, med >= 0, br) > .08)")
    rep("const q = sp * 9; stk[q] = x1;","const q = sp * 10; stk[q] = x1;")
    rep("stk[q + 7] = kr; stk[q + 8] = depth + 1; sp++; }","stk[q + 7] = kr; stk[q + 8] = depth + 1; stk[q + 9] = br + 1; sp++; }")
    rep("w = wr; s = s1; k = kr; depth++; }","w = wr; s = s1; k = kr; depth++; br++; }")
    # Newton tuning
    rep('new Material("flint", 3.2), nd = glass.nd, side = 300;','new Material("flint", 2.1), nd = glass.nd, side = 340;')
    rep("GAP = 520;","GAP = 450;")
    rep("chief(src, [p1], 587.56)","chief(src, [p1], 500)")
    rep("bloom: .55, shade: () => 1,","bloom: .45, shade: (d, k, ins, br) => br ? .38 : 1,")
    open(p,'w').write(s)
    EOF
    grep -n "GAP\|chief(src" spectrum.html | head -5
    cat > shot.mjs <<'EOF'
    import { chromium } from 'playwright';
    import fs from 'fs';
    const [,, scene='0', secs='5', out='shot.png', w='960', h='540', tail='5', extra=''] = process.argv;
    const b = await chromium.launch({ args:['--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader','--ignore-gpu-blocklist','--disable-gpu-compositing'] });
    const p = await b.newPage({ viewport:{width:+w,height:+h} });
    p.on('pageerror', e=>console.log('ERR:',e.message));
    await p.goto(`file://~/run/work/spectrum.html?capture&scene=${scene}${extra}`);
    await p.waitForFunction(()=>window.__spectrum, null, {timeout:20000});
    const t0=Date.now();
    await p.evaluate(([secs])=>{ const S=window.__spectrum; S.auto=false; for(let i=0;i<Math.round(secs*30)-0;i++) S.step(1/30); }, [+secs]);
    for (let i=0;i<+tail;i++) { const r = await Promise.race([p.evaluate(()=>{const S=window.__spectrum; S.step(1/30); S.render(); return 1}), new Promise(r=>setTimeout(()=>r('TO'),45000))]); if(r==='TO'){console.log('hang');break;} }
    console.log('render ms', Date.now()-t0, JSON.stringify(await p.evaluate(()=>window.__spectrum.stats())));
    const url = await p.evaluate(()=>{const g=document.getElementById('gl'),o=document.getElementById('ov'); const c=document.createElement('canvas'); c.width=g.width; c.height=g.height; const x=c.getContext('2d'); x.drawImage(g,0,0); x.drawImage(o,0,0); return c.toDataURL('image/png')});
    fs.writeFileSync(out, Buffer.from(url.split(',')[1],'base64'));
    await b.close(); process.exit(0);
    EOF
    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; time (timeout 250 node shot.mjs 0 4 s0.png 960 540 6 2>&1 | tail -4)

    result, 8 lines

    261:function chief(src, objs, lam) {
    290:      const ev = chief(src, [p1], 500), A = ev[0], Bq = ev[1], GAP = 450;
    291:      const C = { x: Bq.x + Bq.dx * GAP / 2, y: Bq.y + Bq.dy * GAP / 2 };
    render ms 6293 {"nseg":65164,"sMax":2296.1673921887677,"mode":"on","scene":0,"T":4.199999999999995}
    
    real	0m8.313s
    user	0m0.728s
    sys	0m0.398s

Now it renders in about 6 seconds, so I can iterate quickly.

  • Read~/run/work/s0.png

    input

    {
      "file_path": "~/run/work/s0.png"
    }

    result

    no output

    s0_2.jpg
    s0_2.jpg

The spectrum is complete now. It passes through the second prism, runs level through the lens, and converges to a white focus. Checking the other two scenes.

  • Bashexport PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; sed -i 's/br ? .38 : 1/br ? .24 : 1/' spectrum.html; (timeout 250 node shot.mjs 1 6 s1.png 960 540 6 2>&1 | tail -2) & (timeout 250 node shot.mjs 2 6 s2.png 960 540 6 2>&1 | tail -2); wait

    command

    export PLAYWRIGHT_BROWSERS_PATH=~/run/work/browsers; sed -i 's/br ? .38 : 1/br ? .24 : 1/' spectrum.html; (timeout 250 node shot.mjs 1 6 s1.png 960 540 6 2>&1 | tail -2) & (timeout 250 node shot.mjs 2 6 s2.png 960 540 6 2>&1 | tail -2); wait

    result, 3 lines

    render ms 9230 {"nseg":36088,"sMax":5849.924304772984,"mode":"on","scene":1,"T":6.199999999999988}
    render ms 11541 {"nseg":68005,"sMax":3530.041829808246,"mode":"on","scene":2,"T":6.199999999999988}
    [This command modified 1 file you've previously read: spectrum.html. Call Read before editing.]
  • Read~/run/work/s1.png

    input

    {
      "file_path": "~/run/work/s1.png"
    }

    result

    no output

    s1.jpg
    s1.jpg
  • Read~/run/work/s2.png

    input

    {
      "file_path": "~/run/work/s2.png"
    }

    result

    no output

    s2.jpg
    s2.jpg