present: LEONIDA_PRESENT_DUMP_SLOW_MS also dumps every present that comes late (RT-PRESENT-DUMP-SLOW) #2146

Closed
thegalaxydev wants to merge 1 commit from upstream-pr/2146 into main
thegalaxydev commented 2026-11-25 23:20:40 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by thegalaxydev on 2026-11-25T23:20:40Z.


RT-PRESENT-DUMP-SLOW, claimed in #1608 as RT-PRESENT-DUMP-FROM. The claim named a first frame number; measuring showed that number is not stable (below), so the option is keyed on the gap between presents instead and renamed to say so.

What

LEONIDA_PRESENT_DUMP_SLOW_MS=<ms>: with LEONIDA_PRESENT_DUMP=DIR[,N], a present that comes at least <ms> after the one before it is dumped too, whatever N is.

  • present_dump::parse_slow_gap reads the value: milliseconds over 0; unset or empty is off; anything else is refused with one log line and the dump goes on as before.
  • PresentDump::due(index) measures the gap the first time a present asks and gives both of that present's questions (copy the swapchain image in finish_image, save it after the present) the same answer, so a frame is never copied without being saved or saved without being copied.
  • runtime/README.md has the new row under LEONIDA_PRESENT_DUMP.

Why

At a world start the loading screens are thousands of presents a few milliseconds apart, and the frames after them come seconds apart. DIR,N then either misses the slow frames (large N: of the first 8 world frames of one run, N=50 kept 1) or writes thousands of loading frames first (small N: 713 PNGs, about 10 GB at 2544x1401, before the first world frame of another run). A fixed first frame does not work either: on the same machine and title the world started at present 1,930 in one run and at 2,634 in the next, because the loading screens present faster when a submission costs less. The gap separates the two kinds of frame in every run.

Tested

  • RTX 5060 Ti 16 GB, NVIDIA 610.88, Windows 11 23H2, MSVC via scripts/build_runtime.ps1, on main 1bf5eeafd.
  • vk_present_dump_test gains --slow (vk_present_dump_slow): N=60 and LEONIDA_PRESENT_DUMP_SLOW_MS=1000, three presents with a 1.5 s pause before the third; exactly the first (an Nth one) and the third (a late one) are written and decoded, the second is not. The parser's cases run before the test asks for a device, so they run on a host without one.
  • ctest -R present: 11/11 pass (vk_present_dump, _default, _invalid, _slow, xbox_present, xs_present_lazy, vk_presenter_capture_colour, present_window, xbox_present_readback_size and two more).
  • scripts/check_no_game_data.py on the changed files: clean.
  • Not run: the full suite on this branch, and a game run with the new variable (the earlier frame-number form of the option was used in game runs; this form is tested by the unit test only).
<!-- greyfinch-sync:ubiquitarianism/leonida:issue:5500888054 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2146). Originally posted by [thegalaxydev](https://github.com/thegalaxydev) on 2026-11-25T23:20:40Z. --- RT-PRESENT-DUMP-SLOW, claimed in [#1608](https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7177310222) as RT-PRESENT-DUMP-FROM. The claim named a first frame number; measuring showed that number is not stable (below), so the option is keyed on the gap between presents instead and renamed to say so. ## What `LEONIDA_PRESENT_DUMP_SLOW_MS=<ms>`: with `LEONIDA_PRESENT_DUMP=DIR[,N]`, a present that comes at least `<ms>` after the one before it is dumped too, whatever `N` is. - `present_dump::parse_slow_gap` reads the value: milliseconds over 0; unset or empty is off; anything else is refused with one log line and the dump goes on as before. - `PresentDump::due(index)` measures the gap the first time a present asks and gives both of that present's questions (copy the swapchain image in `finish_image`, save it after the present) the same answer, so a frame is never copied without being saved or saved without being copied. - `runtime/README.md` has the new row under `LEONIDA_PRESENT_DUMP`. ## Why At a world start the loading screens are thousands of presents a few milliseconds apart, and the frames after them come seconds apart. `DIR,N` then either misses the slow frames (large `N`: of the first 8 world frames of one run, `N=50` kept 1) or writes thousands of loading frames first (small `N`: 713 PNGs, about 10 GB at 2544x1401, before the first world frame of another run). A fixed first frame does not work either: on the same machine and title the world started at present 1,930 in one run and at 2,634 in the next, because the loading screens present faster when a submission costs less. The gap separates the two kinds of frame in every run. ## Tested - RTX 5060 Ti 16 GB, NVIDIA 610.88, Windows 11 23H2, MSVC via `scripts/build_runtime.ps1`, on main 1bf5eeafd. - `vk_present_dump_test` gains `--slow` (`vk_present_dump_slow`): `N=60` and `LEONIDA_PRESENT_DUMP_SLOW_MS=1000`, three presents with a 1.5 s pause before the third; exactly the first (an Nth one) and the third (a late one) are written and decoded, the second is not. The parser's cases run before the test asks for a device, so they run on a host without one. - `ctest -R present`: 11/11 pass (`vk_present_dump`, `_default`, `_invalid`, `_slow`, `xbox_present`, `xs_present_lazy`, `vk_presenter_capture_colour`, `present_window`, `xbox_present_readback_size` and two more). - `scripts/check_no_game_data.py` on the changed files: clean. - Not run: the full suite on this branch, and a game run with the new variable (the earlier frame-number form of the option was used in game runs; this form is tested by the unit test only).
fiestorra commented 2026-11-30 11:20:10 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by fiestorra on 2026-11-30T11:20:10Z.


Verified with a negative control that does not bite: the four tests in this target pass with the header reverted as well, so they do not observe this change.

1. It applies and builds. merge-tree clean onto main d367675c7; vk_present_dump_test links ([4/4]).

2. With the branch:

ctest -R '^vk_present_dump'
100% tests passed, 0 tests failed out of 4

3. The control - revert only runtime/src/present_dump.h, keep the tests:

git checkout origin/main -- runtime/src/present_dump.h
cmake --build … --target vk_present_dump_test
ctest -R '^vk_present_dump'
100% tests passed, 0 tests failed out of 4      <- still green

What that means, stated narrowly: the change to the present-dump header - whatever it alters in what a dump records - is not observed by these four tests. They pass either way.

What I am not saying: that the change is wrong or useless. It may be exercised by a test elsewhere (a dump consumer, a replay test) that I did not run; or the header change may be a doc/enum addition whose effect the four tests do not touch. I did not read the diff closely enough to choose between those, and the control only tells me these four do not discriminate.

What would settle it: a case that asserts on the recorded content of a dump produced with and without the change, compared byte for byte or field for field. If the change only adds a field, the test would have to read that field.

Why I am commenting: I verify open pull requests that replay onto current main, build the binaries their tests name, run them, and then revert only the source change. A green control is a real result and worth reporting - it says the tests are not yet covering this, not that the code is wrong.

Written with an AI assistant.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7276880131 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2146#issuecomment-7276880131). Originally posted by [fiestorra](https://github.com/fiestorra) on 2026-11-30T11:20:10Z. --- **Verified with a negative control that does not bite: the four tests in this target pass with the header reverted as well, so they do not observe this change.** **1. It applies and builds.** `merge-tree` clean onto `main` `d367675c7`; `vk_present_dump_test` links (`[4/4]`). **2. With the branch:** ``` ctest -R '^vk_present_dump' 100% tests passed, 0 tests failed out of 4 ``` **3. The control - revert only `runtime/src/present_dump.h`, keep the tests:** ``` git checkout origin/main -- runtime/src/present_dump.h cmake --build … --target vk_present_dump_test ctest -R '^vk_present_dump' 100% tests passed, 0 tests failed out of 4 <- still green ``` **What that means, stated narrowly:** the change to the present-dump header - whatever it alters in what a dump **records** - is **not observed by these four tests**. They pass either way. **What I am not saying:** that the change is wrong or useless. **It may be exercised by a test elsewhere** (a dump consumer, a replay test) that I did not run; **or the header change may be a doc/enum addition** whose effect the four tests do not touch. **I did not read the diff closely enough to choose between those**, and the control only tells me these four do not discriminate. **What would settle it:** a case that asserts on the recorded content of a dump produced **with** and **without** the change, compared byte for byte or field for field. If the change only adds a field, the test would have to read that field. **Why I am commenting:** I verify open pull requests that replay onto current `main`, build the binaries their tests name, run them, and then revert **only** the source change. **A green control is a real result and worth reporting** - it says the tests are not yet covering this, not that the code is wrong. Written with an AI assistant.
aslan2142 commented 2026-12-01 12:23:26 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T12:23:26Z.


Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review.

(AI-assisted triage.)

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7311062688 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2146#issuecomment-7311062688). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T12:23:26Z. --- Marking Ready for Review since no WIP/blocker reason for draft status is specified on this PR, so it can enter normal CI and review. *(AI-assisted triage.)*
aslan2142 commented 2026-12-01 16:42:45 +00:00 (Migrated from github.com)

Imported from ubiquitarianism/leonida. Originally posted by aslan2142 on 2026-12-01T16:42:45Z.


Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (d3d12/) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, d3d12/, or general docs), please feel free to reopen it.

<!-- greyfinch-sync:ubiquitarianism/leonida:comment:7318084957 --> Imported from [ubiquitarianism/leonida](https://github.com/ProjectLeonida/mandy/pull/2146#issuecomment-7318084957). Originally posted by [aslan2142](https://github.com/aslan2142) on 2026-12-01T16:42:45Z. --- Closing this PR because the legacy C++ Vulkan runtime (and legacy Python shader compiler) is now considered deprecated in favor of the new Rust Vulkan runtime (in progress) and the Rust DX12 runtime (`d3d12/`) available now. Thank you for the contribution! If you believe this PR was closed by mistake (for example, if it still applies to active tools, `d3d12/`, or general docs), please feel free to reopen it.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ProjectLeonida/mandy!2146
No description provided.