GPU: display mode changes and devices added or removed go to the log and to the removal report's trail #1004

Open
github-bot wants to merge 6 commits from github-bot/gh-1004 into main AGit
Owner

@⁠PiloteCode on GitHub · 2026-11-25 15:40 UTC · original
PiloteCode:pr/window-changes → main · +36 −15 · 9 files · 6 commits · open

Based on 0b0074e0. Four commits:

  • The two clippy fixes for main that #992 also starts with.
  • Two small changes to the window procedure in host.rs: about 20 lines.

Why

On our test machine, Windows reset the card several times in one day ("Resetting TDR" from the display driver), and each reset ended the run under way with its host device lost. The system's own logs showed what came before: each time, 2.5 to 4.6 s earlier, a remote-desktop host had ended its session and removed its virtual input device. Nothing in our log showed it, so the losses first looked like ours.

What changes

Our window now notes two messages the system sends every top-level window:

  • WM_DISPLAYCHANGE, with the new size and bits per pixel ("the display's mode changed");
  • WM_DEVICECHANGE with DBT_DEVNODES_CHANGED ("a device was added to or removed from the system").

Each goes to the log and to the trail (host::trail). The report of a lost device prints the trail with how long before the loss each entry came, so the report says whether a display or device change preceded the loss.

In every build, with no switch: two log lines per change, which is rare. The window procedure otherwise does as before (DefWindowProcW).

Tested

The branch was checked as it is, on 0b0074e0:

  • cargo test -p victory-gpu --features diagnostics -- --test-threads=1 with VICTORY_D3D12_WARP=1: 185 passed, 1 failed, 6 ignored. The failure is depth_bounds_pipeline_loads_and_filters_draws: WARP does not reject the pixels outside the depth bounds, the same as on main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean.
  • cargo build --release -p victory, cargo build --profile diag -p victory --features diagnostics and cargo xtask policy pass.

In our tree, these lines have been in every run since they went in. No unit test: the messages come from the system.

Not tested

  • A device loss with this branch (the losses it was written for came from the remote-desktop host).
  • Linux/Proton, where the window messages may differ.
**@⁠PiloteCode** on GitHub · 2026-11-25 15:40 UTC · [original](https://github.com/fxceless/victory-fork/pull/1004) `PiloteCode:pr/window-changes` → `main` · +36 −15 · 9 files · 6 commits · open Based on `0b0074e0`. Four commits: - The two clippy fixes for `main` that #992 also starts with. - Two small changes to the window procedure in `host.rs`: about 20 lines. ## Why On our test machine, Windows reset the card several times in one day ("Resetting TDR" from the display driver), and each reset ended the run under way with its host device lost. The system's own logs showed what came before: each time, 2.5 to 4.6 s earlier, a remote-desktop host had ended its session and removed its virtual input device. Nothing in our log showed it, so the losses first looked like ours. ## What changes Our window now notes two messages the system sends every top-level window: - `WM_DISPLAYCHANGE`, with the new size and bits per pixel ("the display's mode changed"); - `WM_DEVICECHANGE` with `DBT_DEVNODES_CHANGED` ("a device was added to or removed from the system"). Each goes to the log and to the trail (`host::trail`). The report of a lost device prints the trail with how long before the loss each entry came, so the report says whether a display or device change preceded the loss. In every build, with no switch: two log lines per change, which is rare. The window procedure otherwise does as before (`DefWindowProcW`). ## Tested The branch was checked as it is, on `0b0074e0`: - `cargo test -p victory-gpu --features diagnostics -- --test-threads=1` with `VICTORY_D3D12_WARP=1`: 185 passed, 1 failed, 6 ignored. The failure is `depth_bounds_pipeline_loads_and_filters_draws`: WARP does not reject the pixels outside the depth bounds, the same as on `main`. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and the same with `--all-features`: clean. - `cargo build --release -p victory`, `cargo build --profile diag -p victory --features diagnostics` and `cargo xtask policy` pass. In our tree, these lines have been in every run since they went in. No unit test: the messages come from the system. ## Not tested - A device loss with this branch (the losses it was written for came from the remote-desktop host). - Linux/Proton, where the window messages may differ.
`cargo clippy --workspace --all-targets -- -D warnings` (CI) fails on 9376fd6
with this toolchain: unnecessary_sort_by in draw.rs, the bench's
depth_written in indirect.rs never read, and placed_filler_twins unused
without the diagnostics feature. No code changes.
On a test machine Windows reset the card four times in one day (the
display driver's "Resetting TDR"), each 2.5 to 4.6 s after a
remote-desktop host ended a session and removed its virtual input device
(as the system's device log shows), and each reset ended the run under
way with its host device lost; nothing in our log showed what came
before. Our window now notes the messages the system sends every
top-level window: WM_DISPLAYCHANGE with the new size, and
WM_DEVICECHANGE's "devices changed".
So the report of a lost device says how long before it a device was
added or removed or the display's mode changed (2.5 to 4.6 s for the
four card resets on the test machine that day), next to the sweeps and
library calls.
No conflict. This branch's one change outside its lint lines is in window_proc (host.rs), which upstream's commits do not touch.
`cargo clippy --workspace --all-targets --locked -- -D warnings` fails on
085ee7c4 with the pinned toolchain (1.98.1), after the two fixes before
this one too: map_entry in fpsbox.rs, collapsible_if in
pipeline/library.rs, manual_is_multiple_of in queue.rs and shadow.rs, and
with --all-features in draw.rs and watch.rs (twice). No change of
behaviour.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:55:39 +00:00
Author
Owner

@⁠PiloteCode on GitHub · 2026-11-25 22:11 UTC · original

Merged main (c36971b) into the branch: a merge commit on top of the commits already here (d1d247d), then one lint commit. No conflict: this branch's change is in window_proc, which main's commits since 0b0074e do not touch.

Added after the merge: one lint commit for main's newer code, the same as on our other open branches: map_entry in fpsbox.rs, collapsible_if in pipeline/library.rs, manual_is_multiple_of in queue.rs, shadow.rs, draw.rs and watch.rs. Without it cargo clippy --workspace --all-targets --locked -- -D warnings fails on c36971b, with or without --all-features.

Checked, the branch as it is (66fa13b), every test on the software adapter:

  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean.
  • cargo xtask policy, cargo build --release -p victory and cargo build --profile diag -p victory --features diagnostics: pass.
  • cargo test -p victory-gpu --features diagnostics -- --test-threads=1 with VICTORY_D3D12_WARP=1: 200 passed, 1 failed, 6 ignored, as on main. The failure is depth_bounds_pipeline_loads_and_filters_draws: WARP does not reject the pixels outside the depth bounds.
  • cargo test -p victory-shader -- --test-threads=1 with VICTORY_WARP=1: 212 passed, 4 failed, 3 ignored, the same four as on main on the software adapter.
  • cargo test -p victory-hle -- --test-threads=1: 100 + 1 passed, as on main.
  • cargo test -p victory -p victory-loader: passed.
**@⁠PiloteCode** on GitHub · 2026-11-25 22:11 UTC · [original](https://github.com/fxceless/victory-fork/pull/1004#issuecomment-7176056144) Merged `main` (`c36971b`) into the branch: a merge commit on top of the commits already here (`d1d247d`), then one lint commit. No conflict: this branch's change is in `window_proc`, which `main`'s commits since `0b0074e` do not touch. **Added after the merge:** one lint commit for `main`'s newer code, the same as on our other open branches: `map_entry` in `fpsbox.rs`, `collapsible_if` in `pipeline/library.rs`, `manual_is_multiple_of` in `queue.rs`, `shadow.rs`, `draw.rs` and `watch.rs`. Without it `cargo clippy --workspace --all-targets --locked -- -D warnings` fails on `c36971b`, with or without `--all-features`. **Checked**, the branch as it is (`66fa13b`), every test on the software adapter: - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and the same with `--all-features`: clean. - `cargo xtask policy`, `cargo build --release -p victory` and `cargo build --profile diag -p victory --features diagnostics`: pass. - `cargo test -p victory-gpu --features diagnostics -- --test-threads=1` with `VICTORY_D3D12_WARP=1`: 200 passed, 1 failed, 6 ignored, as on `main`. The failure is `depth_bounds_pipeline_loads_and_filters_draws`: WARP does not reject the pixels outside the depth bounds. - `cargo test -p victory-shader -- --test-threads=1` with `VICTORY_WARP=1`: 212 passed, 4 failed, 3 ignored, the same four as on `main` on the software adapter. - `cargo test -p victory-hle -- --test-threads=1`: 100 + 1 passed, as on `main`. - `cargo test -p victory -p victory-loader`: passed.
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/fpsbox.rs
  • crates/victory-gpu/src/indirect.rs
  • crates/victory-gpu/src/pipeline/library.rs
  • crates/victory-gpu/src/resource.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1004/head:github-bot/gh-1004'
git switch 'github-bot/gh-1004'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1004'
git switch 'github-bot/gh-1004'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1004'
git switch 'github-bot/gh-1004'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1004'
git switch 'main'
git merge --squash 'github-bot/gh-1004'
git switch 'main'
git merge --ff-only 'github-bot/gh-1004'
git switch 'main'
git merge 'github-bot/gh-1004'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.