fix(gpu): present to the title's window, not a pseudoconsole's 0x0 window (white window) #49

Open
github-bot wants to merge 1 commit from github-bot/gh-49 into main AGit
Owner

@⁠JRamos1993 on GitHub · 2026-11-27 14:26 UTC · original
JRamos1993:fix/title-window-pseudoconsole → main · +80 −7 · 2 files · 1 commits · open

Problem

title_window() in victory-gpu/src/host.rs takes the first visible top-level window of the process for the swap chain. When victory is started under a pseudoconsole (from Windows Terminal, or by a parent process that has one, such as a script or tool started from it), the process also owns a visible PseudoConsoleWindow of 0x0 pixels. That is the window GetConsoleWindow returns under ConPTY. Whenever it is above the title's window in z-order when the swap chain is made, the swap chain is made for it. The title then runs and presents, but its own window is never presented to and stays white. The frame-rate caption goes to the invisible window too.

On an RTX 5090 it happened in 1 of 7 starts of d12eb1b, with the play defaults (DLSS Quality, frame generation ready). It looked like a frame generation problem, but it is not one: forcing the same z-order turns the window white with --dlss off as well (below).

Fix

  • The title's window is the one our window procedure hook marked (victory.wndproc, set by lifecycle::hook). Without one, it is the first visible window with a non-empty client area. A pseudoconsole's window alone gives none, so our own window is made, as before when the title had made no window.
  • The choice is a pure function (pick_title_window) with four unit tests.
  • A log line when no window of the title's is found.
  • A comment at TITLE_PROC in lifecycle.rs, since the property is now looked up by name from victory-gpu too.

Verification

RTX 5090 (driver 621.24), Windows 11 build 26200, Series X profile at 2560x1440.

Forced repro: for the first 10 s after the start, a helper script raises the process's PseudoConsoleWindow to the top of the z-order every 20 ms (SetWindowPos(HWND_TOP, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE)). The game window was captured with PrintWindow every 5 s.

Build Settings Game window
d12eb1b play --dlss off white for the whole run; the frame-rate caption never appears
this branch play --dlss off the title's frames; the caption updates
this branch play (DLSS Quality, frame generation ready) the title's frames; the caption updates

Without the helper, this branch also ran normally (frames and caption) with the default play settings.

CI commands, this branch against d12eb1b:

  • Clippy fails on d12eb1b already: the workspace run stops at an operator precedence lint in victory-formats (lib test) in both configurations. Run on the two crates this touches (cargo clippy -p victory-gpu -p victory-hle --all-targets --locked -- -D warnings), d12eb1b and this branch both give 39 errors. None of them is in the changed lines.
  • cargo test --workspace --locked: the four new tests pass. victory-gpu lib: 418 passed, 2 failed, 35 ignored. The two failures, indirect::tests::host_list_budget_starts_empty_at_each_submission and indirect::tests::warp_batch_charges_every_execution, fail the same way on d12eb1b.

AI use

This change was made with Claude Code (Claude Opus 5.5): the diagnosis, the patch, the tests and the runs above. It was reviewed and run on my PC (RTX 5090) before being sent.

**@⁠JRamos1993** on GitHub · 2026-11-27 14:26 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/49) `JRamos1993:fix/title-window-pseudoconsole` → `main` · +80 −7 · 2 files · 1 commits · open ### Problem `title_window()` in `victory-gpu/src/host.rs` takes the first visible top-level window of the process for the swap chain. When victory is started under a pseudoconsole (from Windows Terminal, or by a parent process that has one, such as a script or tool started from it), the process also owns a visible `PseudoConsoleWindow` of 0x0 pixels. That is the window `GetConsoleWindow` returns under ConPTY. Whenever it is above the title's window in z-order when the swap chain is made, the swap chain is made for it. The title then runs and presents, but its own window is never presented to and stays white. The frame-rate caption goes to the invisible window too. On an RTX 5090 it happened in 1 of 7 starts of d12eb1b, with the `play` defaults (DLSS Quality, frame generation ready). It looked like a frame generation problem, but it is not one: forcing the same z-order turns the window white with `--dlss off` as well (below). ### Fix - The title's window is the one our window procedure hook marked (`victory.wndproc`, set by `lifecycle::hook`). Without one, it is the first visible window with a non-empty client area. A pseudoconsole's window alone gives none, so our own window is made, as before when the title had made no window. - The choice is a pure function (`pick_title_window`) with four unit tests. - A log line when no window of the title's is found. - A comment at `TITLE_PROC` in `lifecycle.rs`, since the property is now looked up by name from `victory-gpu` too. ### Verification RTX 5090 (driver 621.24), Windows 11 build 26200, Series X profile at 2560x1440. Forced repro: for the first 10 s after the start, a helper script raises the process's `PseudoConsoleWindow` to the top of the z-order every 20 ms (`SetWindowPos(HWND_TOP, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE)`). The game window was captured with `PrintWindow` every 5 s. | Build | Settings | Game window | |---|---|---| | d12eb1b | `play --dlss off` | white for the whole run; the frame-rate caption never appears | | this branch | `play --dlss off` | the title's frames; the caption updates | | this branch | `play` (DLSS Quality, frame generation ready) | the title's frames; the caption updates | Without the helper, this branch also ran normally (frames and caption) with the default `play` settings. CI commands, this branch against d12eb1b: - Clippy fails on d12eb1b already: the workspace run stops at an `operator precedence` lint in `victory-formats` (lib test) in both configurations. Run on the two crates this touches (`cargo clippy -p victory-gpu -p victory-hle --all-targets --locked -- -D warnings`), d12eb1b and this branch both give 39 errors. None of them is in the changed lines. - `cargo test --workspace --locked`: the four new tests pass. `victory-gpu` lib: 418 passed, 2 failed, 35 ignored. The two failures, `indirect::tests::host_list_budget_starts_empty_at_each_submission` and `indirect::tests::warp_batch_charges_every_execution`, fail the same way on d12eb1b. ### AI use This change was made with Claude Code (Claude Opus 5.5): the diagnosis, the patch, the tests and the runs above. It was reviewed and run on my PC (RTX 5090) before being sent.
title_window() took the first visible top-level window of the process.
Started under a pseudoconsole (Windows Terminal, or a parent that has
one), the process also owns a visible PseudoConsoleWindow of 0x0 pixels;
when that one was above the title's window in z-order, the swap chain was
made for it and the title's window stayed white.

The title's window is now the one our window procedure hook marked
(victory.wndproc); without one, the first visible window with a client
area. The choice is a pure function with unit tests.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 14:30:38 +00:00
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-28 02:35 UTC · original

Independent local verification (Windows, Rust 1.100.0/MSVC, no game data):

  • PR #49 at head 6cd5231aedd2e2636a1cd2b849c8ce3000369a36, merge base d12eb1b23da4cad2f551a3dd49e82a87e564122a.
  • Exact module-qualified tests, each 1 passed / 0 failed / 454 filtered, exit 0:
    • cargo test --locked -p victory-gpu --lib -- host::title_window_tests::the_titles_window_wins_over_a_pseudo_console_above_it --exact --test-threads=1 --quiet
    • cargo test --locked -p victory-gpu --lib -- host::title_window_tests::the_titles_window_counts_even_while_its_client_area_is_empty --exact --test-threads=1 --quiet
    • cargo test --locked -p victory-gpu --lib -- host::title_window_tests::a_pseudo_console_alone_is_no_window_to_present_to --exact --test-threads=1 --quiet
  • git grep -F for these test names on the base returned no hits (tests are new on this PR); git diff --check d12eb1b HEAD clean (2 files, +80/-7).
  • Used a per-worktree CARGO_TARGET_DIR (never shared) with CARGO_BUILD_JOBS=2. Note: the recon-suggested bare filter form (cargo test ... <test> -- --exact) matched 0 tests; the correct form is --lib -- <test> --exact.
  • Only the named synthetic tests were replayed; full workspace suite and clippy were not run locally (no clippy component on this toolchain).
  • GPU/driver: N/A (CPU-only tests). No game data, assets, extracted shaders, DRM or decrypt involved.

AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-28 02:35 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/49#issuecomment-7232462984) Independent local verification (Windows, Rust 1.100.0/MSVC, no game data): - PR #49 at head `6cd5231aedd2e2636a1cd2b849c8ce3000369a36`, merge base `d12eb1b23da4cad2f551a3dd49e82a87e564122a`. - Exact module-qualified tests, each 1 passed / 0 failed / 454 filtered, exit 0: - `cargo test --locked -p victory-gpu --lib -- host::title_window_tests::the_titles_window_wins_over_a_pseudo_console_above_it --exact --test-threads=1 --quiet` - `cargo test --locked -p victory-gpu --lib -- host::title_window_tests::the_titles_window_counts_even_while_its_client_area_is_empty --exact --test-threads=1 --quiet` - `cargo test --locked -p victory-gpu --lib -- host::title_window_tests::a_pseudo_console_alone_is_no_window_to_present_to --exact --test-threads=1 --quiet` - `git grep -F` for these test names on the base returned no hits (tests are new on this PR); `git diff --check d12eb1b HEAD` clean (2 files, +80/-7). - Used a per-worktree `CARGO_TARGET_DIR` (never shared) with `CARGO_BUILD_JOBS=2`. Note: the recon-suggested bare filter form (`cargo test ... <test> -- --exact`) matched 0 tests; the correct form is `--lib -- <test> --exact`. - Only the named synthetic tests were replayed; full workspace suite and clippy were not run locally (no clippy component on this toolchain). - GPU/driver: N/A (CPU-only tests). No game data, assets, extracted shaders, DRM or decrypt involved. AI-assisted (Hy4 flash).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
The changes on this branch are already on the target branch. This will be an empty commit.
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

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