Measurement switches: VICTORY_CAPTURE_WORLD_EVERY and VICTORY_HIDDEN_WINDOW=1 #1039

Open
OtavMacedo wants to merge 1 commit from upstream-pr/1039 into main
OtavMacedo commented 2026-11-28 11:50:42 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by OtavMacedo on 2026-11-28T11:50:42Z.


Two small switches for unattended measurement runs. Both are off unless set: with neither variable set, VIctory-NVIDIA behaves exactly as today.

VICTORY_CAPTURE_WORLD_EVERY=<n>

With VICTORY_CAPTURE_WORLD, every 8th frame after the first frame of 500 draws or more is saved, and the 8 is fixed in capture::wanted. A saved frame is read back and written as a PNG inside the present, so that frame runs several times longer than the frames around it. Any frame-time measurement taken with world captures on therefore has a regular dip every 8 frames.

  • VICTORY_CAPTURE_WORLD_EVERY=<n> (a positive whole number) sets the interval, e.g. 64 for a run that measures speed but still wants a picture now and then.
  • Unset, 0, negative or not a number: 8, as before.
  • parse_every is split out with a unit test for those cases.

VICTORY_HIDDEN_WINDOW=1

The title's top-level window is made right of the virtual desktop (SM_XVIRTUALSCREEN + SM_CXVIRTUALSCREEN + 64), with WS_EX_TOOLWINDOW (out of the taskbar) and WS_EX_NOACTIVATE. A test run can then go on while someone uses the machine. The swap chain presents to the window as usual: the window is shown, just not on any screen.

  • Child windows are left alone (parent not null).
  • With it on, VICTORY_FULLSCREEN and VICTORY_MOUSE_CAPTURE leave the window alone. Fullscreen's SetWindowPos would move it back to 0,0, and the capture would clip the cursor to an off-screen rectangle.
  • It follows the other window switches (enabled): only =1 turns it on.

Both switches come from VItoria Spark, which uses them for its unattended runs. Its VICTORY_HIDDEN_WINDOW accepts any value but 0. Here it takes =1 like the other switches in lifecycle.rs, and it also skips fullscreen and the mouse capture, which Spark does not have.

Files

  • crates/victory-gpu/src/capture.rs: world_every, parse_every, and a test.
  • crates/victory-hle/src/modules/lifecycle.rs: hidden_window, hide (called in CreateWindowExW/CreateWindowExA after fit), plus guards in fullscreen and capture_mouse.

How to test

  1. Leave both unset and play as usual: nothing changes. With VICTORY_CAPTURE=<dir> VICTORY_CAPTURE_WORLD=1, world pictures are still saved every 8th frame.
  2. VICTORY_CAPTURE=<dir> VICTORY_CAPTURE_WORLD=1 VICTORY_CAPTURE_WORLD_EVERY=64: world pictures come every 64th frame after the first 500-draw frame (the 2nd/6th-frame and power-of-two pictures stay).
  3. VICTORY_HIDDEN_WINDOW=1: the log has title window made off the screens (VICTORY_HIDDEN_WINDOW). No window shows on any monitor or in the taskbar, and the game keeps presenting (fps lines and captures go on). With VICTORY_FULLSCREEN=1 as well, the window still stays off the screens.

Validated on hardware (RTX 3070 8 GB, driver 32.0.16.2124, Windows 11, 16 GB RAM)
This patch was applied to a VIctory-NVIDIA tree at 64d4931 and built as diag. In one short run with both switches:

  • VICTORY_HIDDEN_WINDOW=1: the log has title window made off the screens (VICTORY_HIDDEN_WINDOW) x=1984. Checked from outside during the run: window rectangle 1984..3818 against a virtual desktop of 0..1920, extended style 0x08000180 (WS_EX_TOOLWINDOW and WS_EX_NOACTIVATE), and the window title kept showing fps.
  • VICTORY_CAPTURE_WORLD_EVERY=64: 116 PNGs. Before the world, the existing early pictures. In the world, one every 64 frames (…1693, 1757, 1821, 1885, …), plus the power-of-two ones.
  • That run ended at 130 s with the device removed after a host command list did not close (0x8007000E), with 740 MB left to commit on that 16 GB machine. That is the out-of-memory crash already reported in #576, and it is not related to these switches. Their effect on frame times was not measured.

Checks run (Linux, cross-compiled for x86_64-pc-windows-msvc with cargo-xwin, on main at 63b902f)

  • cargo xwin clippy -p victory-gpu -p victory-hle --all-targets --locked, with and without --all-features: no warning in the touched files. The warnings left (2 without features, 3 with) are older ones in descriptor.rs, shadow.rs and gameinput.rs, which this PR does not touch, so CI's clippy step with -D warnings stays red for reasons unrelated to this PR.
  • cargo xtask policy: ok.
  • rustfmt (max_width 100): the lines added follow it. The touched files already had unformatted lines before, and those were left as they were.
  • Unit tests (lib) under Wine:
    • victory-gpu with --features diagnostics: 503 passed and 4 failed. The 4 are watch::* tests that depend on Windows memory behaviour Wine lacks; they also failed on main under Wine.
    • capture is compiled only with diagnostics, so CI's cargo test --workspace does not run its tests. capture:: gives 3 of 3 passed, the new world_capture_interval_defaults_to_eight among them.
    • victory-hle: 186 passed and 2 failed (net::only_loopback_is_reachable and xgamesave::a_kept_blob_past_the_link_limit_is_copied). Both also fail on main under Wine. lifecycle gives 11 of 11 passed.
  • The window the swap chain presents to is now picked by the victory.wndproc property (3f054e4). The off-screen window still gets that property from our window procedure hook, so it is still the one presented to.
  • Diag build (cargo xwin build --profile diag -p victory --features diagnostics): it builds, with no rustc warning.
  • The game was run once on hardware (see above).

🤖 Generated with Claude Code

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5539826673 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1039). Originally posted by [OtavMacedo](https://github.com/OtavMacedo) on 2026-11-28T11:50:42Z. --- Two small switches for unattended measurement runs. Both are off unless set: with neither variable set, VIctory-NVIDIA behaves exactly as today. **`VICTORY_CAPTURE_WORLD_EVERY=<n>`** With `VICTORY_CAPTURE_WORLD`, every 8th frame after the first frame of 500 draws or more is saved, and the 8 is fixed in `capture::wanted`. A saved frame is read back and written as a PNG inside the present, so that frame runs several times longer than the frames around it. Any frame-time measurement taken with world captures on therefore has a regular dip every 8 frames. - `VICTORY_CAPTURE_WORLD_EVERY=<n>` (a positive whole number) sets the interval, e.g. `64` for a run that measures speed but still wants a picture now and then. - Unset, `0`, negative or not a number: 8, as before. - `parse_every` is split out with a unit test for those cases. **`VICTORY_HIDDEN_WINDOW=1`** The title's top-level window is made right of the virtual desktop (`SM_XVIRTUALSCREEN + SM_CXVIRTUALSCREEN + 64`), with `WS_EX_TOOLWINDOW` (out of the taskbar) and `WS_EX_NOACTIVATE`. A test run can then go on while someone uses the machine. The swap chain presents to the window as usual: the window is shown, just not on any screen. - Child windows are left alone (`parent` not null). - With it on, `VICTORY_FULLSCREEN` and `VICTORY_MOUSE_CAPTURE` leave the window alone. Fullscreen's `SetWindowPos` would move it back to 0,0, and the capture would clip the cursor to an off-screen rectangle. - It follows the other window switches (`enabled`): only `=1` turns it on. Both switches come from VItoria Spark, which uses them for its unattended runs. Its `VICTORY_HIDDEN_WINDOW` accepts any value but `0`. Here it takes `=1` like the other switches in `lifecycle.rs`, and it also skips fullscreen and the mouse capture, which Spark does not have. **Files** - `crates/victory-gpu/src/capture.rs`: `world_every`, `parse_every`, and a test. - `crates/victory-hle/src/modules/lifecycle.rs`: `hidden_window`, `hide` (called in `CreateWindowExW`/`CreateWindowExA` after `fit`), plus guards in `fullscreen` and `capture_mouse`. **How to test** 1. Leave both unset and play as usual: nothing changes. With `VICTORY_CAPTURE=<dir> VICTORY_CAPTURE_WORLD=1`, world pictures are still saved every 8th frame. 2. `VICTORY_CAPTURE=<dir> VICTORY_CAPTURE_WORLD=1 VICTORY_CAPTURE_WORLD_EVERY=64`: world pictures come every 64th frame after the first 500-draw frame (the 2nd/6th-frame and power-of-two pictures stay). 3. `VICTORY_HIDDEN_WINDOW=1`: the log has `title window made off the screens (VICTORY_HIDDEN_WINDOW)`. No window shows on any monitor or in the taskbar, and the game keeps presenting (fps lines and captures go on). With `VICTORY_FULLSCREEN=1` as well, the window still stays off the screens. **Validated on hardware (RTX 3070 8 GB, driver 32.0.16.2124, Windows 11, 16 GB RAM)** This patch was applied to a VIctory-NVIDIA tree at 64d4931 and built as diag. In one short run with both switches: - `VICTORY_HIDDEN_WINDOW=1`: the log has `title window made off the screens (VICTORY_HIDDEN_WINDOW) x=1984`. Checked from outside during the run: window rectangle 1984..3818 against a virtual desktop of 0..1920, extended style 0x08000180 (`WS_EX_TOOLWINDOW` and `WS_EX_NOACTIVATE`), and the window title kept showing fps. - `VICTORY_CAPTURE_WORLD_EVERY=64`: 116 PNGs. Before the world, the existing early pictures. In the world, one every 64 frames (…1693, 1757, 1821, 1885, …), plus the power-of-two ones. - That run ended at 130 s with the device removed after `a host command list did not close (0x8007000E)`, with 740 MB left to commit on that 16 GB machine. That is the out-of-memory crash already reported in #576, and it is not related to these switches. Their effect on frame times was not measured. **Checks run** (Linux, cross-compiled for `x86_64-pc-windows-msvc` with cargo-xwin, on `main` at 63b902f) - `cargo xwin clippy -p victory-gpu -p victory-hle --all-targets --locked`, with and without `--all-features`: no warning in the touched files. The warnings left (2 without features, 3 with) are older ones in `descriptor.rs`, `shadow.rs` and `gameinput.rs`, which this PR does not touch, so CI's clippy step with `-D warnings` stays red for reasons unrelated to this PR. - `cargo xtask policy`: ok. - rustfmt (max_width 100): the lines added follow it. The touched files already had unformatted lines before, and those were left as they were. - Unit tests (lib) under Wine: - victory-gpu with `--features diagnostics`: 503 passed and 4 failed. The 4 are `watch::*` tests that depend on Windows memory behaviour Wine lacks; they also failed on `main` under Wine. - `capture` is compiled only with `diagnostics`, so CI's `cargo test --workspace` does not run its tests. `capture::` gives 3 of 3 passed, the new `world_capture_interval_defaults_to_eight` among them. - victory-hle: 186 passed and 2 failed (`net::only_loopback_is_reachable` and `xgamesave::a_kept_blob_past_the_link_limit_is_copied`). Both also fail on `main` under Wine. `lifecycle` gives 11 of 11 passed. - The window the swap chain presents to is now picked by the `victory.wndproc` property (3f054e4). The off-screen window still gets that property from our window procedure hook, so it is still the one presented to. - Diag build (`cargo xwin build --profile diag -p victory --features diagnostics`): it builds, with no rustc warning. - The game was run once on hardware (see above). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/1039:upstream-pr/1039'
git switch 'upstream-pr/1039'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/1039'
git switch 'upstream-pr/1039'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/1039'
git switch 'upstream-pr/1039'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/1039'
git switch 'main'
git merge --squash 'upstream-pr/1039'
git switch 'main'
git merge --ff-only 'upstream-pr/1039'
git switch 'main'
git merge 'upstream-pr/1039'
git push origin 'main'
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
trustno1-coder/VIctory-NVIDIA!1039
No description provided.