Commit Graph
4 Commits
Author SHA1 Message Date
Joseph MattielloandClaude Opus 5.5 f1a3ef36ed fix(app): release vsync a little sooner (15% trimmed steps); stall cases
Replaying the measured Cybermorph R3x trace, 25% held vsync on through an
intermittent deficit (11% fewer new images than v3.9.0); 15% matches v3.9.0's
image count with 13 instead of 153 toggles per 60 s.  A 250 ms stall and a
3-frame 40 ms hitch on a core with time to spare change nothing.

Refs #952

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 01:17:59 -04:00
Joseph MattielloandClaude Opus 5.5 e4d8ede825 fix(app): vsync comes back after a heavy phase (restore at 80% frame cost)
A transient (Cybermorph's 14 ms phase, a state load, a loaded machine) that
releases the swap interval must not cost the vsync for the session: a core
back at 11-12.5 ms holds a vblank-locked loop.  Adds the heavy-phase and
hitch cases.

Refs #952

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 01:16:59 -04:00
Joseph MattielloandClaude Opus 5.5 919a9c8517 test(app): pacer must not toggle the swap interval on a core with time to spare
Fake-clock cases for #952: 8 ms core on 60/59.94/120/119.88 Hz with jitter
(zero toggles, no batching habit), vsync-off throughput and sleeping,
sustained deficit with vsync on, edge and alternating-cost traces measured
against the v3.9.0 loop. These fail on the #956 pacer (14+ failures).

Refs #952

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-15 01:12:37 -04:00
Joseph MattielloandClaude Opus 5.5 d2c3bdc266 perf(app): do not sleep or wait for vblank while the core is behind
When the core cannot hold full speed (RISC overclock, a heavy title) the loop
zeroed the backlog after each catch-up batch and then slept most of a period
(vsync off) or blocked in SDL_GL_SwapWindow until the next vblank (vsync on),
on the thread that runs the emulation. Doom at RISC 300% ran 54.6 fps headless
but 45 fps in the window.

Pacing moves into pacing.h (Pacer): the time spent running frames is charged to
the backlog so 'behind' is exact, the sleep is skipped while behind, and the
swap interval is released while behind and restored after ~0.5 s of keeping up.
tests/pacing_test.cpp drives it with a fake clock.

Refs #952

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-14 20:25:10 -04:00