Keep current frame-token statistics at or before the poll (FRAME-PACER-EARLY-ORIGIN) #2087

Merged
leonida/mandy
alexandersato0830 merged 1 commit from codex/frame-pacer-early-origin into main 2026-11-28 18:11:48 +00:00

Pull request successfully merged and closed

alexandersato0830 commented 2026-11-25 19:55:09 +00:00

Claimed in the coordination issue as: FRAME-PACER-EARLY-ORIGIN

What and why

A current-token poll can return immediately before the configured origin offset. Its frame-event statistic then points into the future, even after the token has been presented. Record the poll timestamp when the scheduled origin is still ahead. Use the original grid to compute the token's due time.

Tested

  • Windows 11, MSVC 19.51. The new fake-clock regression failed on main db1a22d. It passed through frame_pacer CTest with the fix, including the first display on the configured vblank.
  • Verified git diff --check and the source-only check.

GPUs tested: n/a.

AI-assisted: yes.

  • Based on current main.
  • One topic.
  • Uses source and a synthetic clock.
Claimed in the coordination issue as: [FRAME-PACER-EARLY-ORIGIN](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7172851224) ### What and why A current-token poll can return immediately before the configured origin offset. Its frame-event statistic then points into the future, even after the token has been presented. Record the poll timestamp when the scheduled origin is still ahead. Use the original grid to compute the token's due time. ### Tested - Windows 11, MSVC 19.51. The new fake-clock regression failed on main `db1a22d`. It passed through `frame_pacer` CTest with the fix, including the first display on the configured vblank. - Verified `git diff --check` and the source-only check. GPUs tested: n/a. AI-assisted: yes. - [x] Based on current `main`. - [x] One topic. - [x] Uses source and a synthetic clock.
zmasi commented 2026-11-28 11:28:40 +00:00

Verified on Windows 11 (10.0.26200.9974) with MSVC 19.44.35228 (x64, /std:c++20 /EHsc /W4 /permissive- /utf-8 /O2) against main 4a54aedcb + 6921a278f (claim #2570#issuecomment-7238486276):

  • Line-by-line diff audit: Clean (runtime/src/frame_pacer.h, runtime/test/frame_pacer_test.cpp); clamps the issued current-token origin timestamp with std::min(origin, now) when wait_flag_current_token is polled before the first configured frame-event origin offset, while preserving display time at origin - offset + period_us_. check_no_game_data.py clean.
  • Red (4a54aedcb + PR test): frame_pacer_test.exe fails (rc=1 at line 196: count == 2 && stats[0].time_us == poll_us && stats[1].time_us == poll_us).
  • Green (4a54aedcb + 6921a278f merge): Auto-merges cleanly (rc=0), compiles with 0 /W4 warnings, and frame_pacer_test.exe passes (frame_pacer_test: all cases pass, rc=0).

AI-assisted.

Verified on Windows 11 (`10.0.26200.9974`) with MSVC `19.44.35228` (`x64`, `/std:c++20 /EHsc /W4 /permissive- /utf-8 /O2`) against `main` `4a54aedcb` + `6921a278f` (claim `#2570#issuecomment-7238486276`): - **Line-by-line diff audit**: Clean (`runtime/src/frame_pacer.h`, `runtime/test/frame_pacer_test.cpp`); clamps the issued current-token origin timestamp with `std::min(origin, now)` when `wait_flag_current_token` is polled before the first configured frame-event origin offset, while preserving display time at `origin - offset + period_us_`. `check_no_game_data.py` clean. - **Red (`4a54aedcb` + PR test)**: `frame_pacer_test.exe` fails (`rc=1` at `line 196: count == 2 && stats[0].time_us == poll_us && stats[1].time_us == poll_us`). - **Green (`4a54aedcb` + `6921a278f` merge)**: Auto-merges cleanly (`rc=0`), compiles with `0` `/W4` warnings, and `frame_pacer_test.exe` passes (`frame_pacer_test: all cases pass`, `rc=0`). AI-assisted.
MoonEyes commented 2026-11-28 18:11:45 +00:00

Red/green: On main frame_pacer_test fails at line 213 (current frame-token statistics are reported after the poll instant), and with the PR ctest -R "^frame_pacer$" passes.
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.

Red/green: On main frame_pacer_test fails at line 213 (current frame-token statistics are reported after the poll instant), and with the PR ctest -R "^frame_pacer$" passes. Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
OreoFR commented 2026-11-28 21:59:46 +00:00

Verified by OreoFR

  • Base: main c1ecf04ed + PR head 6921a278f; green run in a merge package of 16 PRs, no new ctest failure vs main
  • Test: ctest -R "^frame_pacer$"
  • Red on main: 1 failure, line 213 (token statistics past the poll instant)
  • Green with the PR: OK
  • Verdict: READY
  • Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11

AI-assisted (Claude Code, Claude Opus 5.5).

**Verified by OreoFR** - Base: main `c1ecf04ed` + PR head `6921a278f`; green run in a merge package of 16 PRs, no new ctest failure vs main - Test: `ctest -R "^frame_pacer$"` - Red on main: 1 failure, line 213 (token statistics past the poll instant) - Green with the PR: OK - Verdict: READY - Machine: RTX 4070 Laptop 8 GB, NVIDIA 621.40, Intel Core Ultra 7 155H, Windows 11 AI-assisted (Claude Code, Claude Opus 5.5).
Sign in to join this conversation.
No description provided.