GPU: present to the title's stand-in window, not Windows Terminal's empty console window #3718

Open
upipibi wants to merge 2 commits from upstream-pr/3718 into main
upipibi commented 2026-11-28 10:49:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T10:49:07Z.


Two commits on main 63bcca4: the fix, and a test commit by @andrewpozdnakov7-jpg that checks the swap chain the presenter makes is bound to the window chosen. Claimed in #1633 (claim).

What

title_window() (crates/victory-gpu/src/host.rs) took the first visible top-level window of the process. Started by Windows Terminal as the first process of a new console (a double-click with Terminal as the default console host, wt victory.exe, or a launcher that makes a new console), this process also owns Terminal's PseudoConsoleWindow. Terminal shows that window, with an empty client area, and keeps it above the title's window whenever Terminal is in front. So the presenter can make its swap chain for that window and leave the title's window white.

It now prefers the visible window of class VIctory.title, the stand-in make_stand_in shows for the title's window (victory-hle/src/modules/lifecycle.rs:312-320). Failing that, it takes the first visible window, in z-order, with a client area. The title's own top-level window is message-only (lifecycle.rs:140, :181), so EnumWindows never sees it.

trustno1-coder/VIctory-NVIDIA fixed the same symptom in 3f054e467. Their fix prefers the window marked victory.wndproc; on main that window is message-only, so it would not match here. The code here is written separately.

Measured (Windows 11 26100)

A probe process lists its own top-level windows after it makes a 640x480 window:

Started GetConsoleWindow Its console window First visible window of the process
detached, no console none none the 640x480 window
in a new console (opens in Windows Terminal here) PseudoConsoleWindow, owned by this process visible from +0.5 s, 0x0, owned by Terminal's window the 640x480 window while it is above Terminal; the 0x0 window once it is below
under a bare CreatePseudoConsole PseudoConsoleWindow, owned by this process never visible the 640x480 window
from a shell already running in a console owned by the shell none the 640x480 window

So only Windows Terminal shows the window. A bare pseudoconsole doesn't, and a VIctory started from a shell doesn't own one.

Tested

RTX 3070, driver 616.56, Windows 11 Pro 10.0.26100, debug.

  • New tests host::title_window_tests, 3 of 3 runs. Each test first checks that the decoy really is above the window it expects:

    • an_empty_window_above_the_titles_is_passed_over: a visible 0x0 popup above a 64x64 one;
    • the_stand_in_wins_over_other_windows_above_it: a 64x64 window above a VIctory.title window.

    With main's title_window() and these tests, both fail (the decoy is returned).

  • With the test commit (3d0e177), the two tests also create a swap chain through the presenter and check GetHwnd(): 3 of 3 on the 3070 (no skip, so on the hardware device).

  • cargo test --locked -p victory-gpu --lib: 231 passed, 2 failed, 1 ignored; main 63bcca4: 229 passed, 2 failed, 1 ignored. The same two failures on both: dynamic_slots_are_held_until_released and lists_share_a_table_and_copies_keep_their_views, from the capped view heap on this card.

  • cargo clippy --workspace --all-targets --locked -- -D warnings, also with --all-features: clean. cargo run -p xtask -- policy: ok.

Not tested

The title itself (no game data here), and a launcher that keeps its own console hidden.

AI use

Claude Code (Claude Opus 5.5) found the trigger with the probe above, wrote the fix and the tests, and ran everything listed.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5539336263 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3718). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T10:49:07Z. --- Two commits on `main` `63bcca4`: the fix, and a test commit by @andrewpozdnakov7-jpg that checks the swap chain the presenter makes is bound to the window chosen. Claimed in #1633 ([claim](https://github.com/Marvisak/VIctory/issues/1633#issuecomment-7238129979)). ## What `title_window()` (`crates/victory-gpu/src/host.rs`) took the first visible top-level window of the process. Started by Windows Terminal as the first process of a new console (a double-click with Terminal as the default console host, `wt victory.exe`, or a launcher that makes a new console), this process also owns Terminal's `PseudoConsoleWindow`. Terminal shows that window, with an empty client area, and keeps it above the title's window whenever Terminal is in front. So the presenter can make its swap chain for that window and leave the title's window white. It now prefers the visible window of class `VIctory.title`, the stand-in `make_stand_in` shows for the title's window (`victory-hle/src/modules/lifecycle.rs:312-320`). Failing that, it takes the first visible window, in z-order, with a client area. The title's own top-level window is message-only (`lifecycle.rs:140`, `:181`), so `EnumWindows` never sees it. trustno1-coder/VIctory-NVIDIA fixed the same symptom in 3f054e467. Their fix prefers the window marked `victory.wndproc`; on main that window is message-only, so it would not match here. The code here is written separately. ## Measured (Windows 11 26100) A probe process lists its own top-level windows after it makes a 640x480 window: | Started | `GetConsoleWindow` | Its console window | First visible window of the process | |---|---|---|---| | detached, no console | none | none | the 640x480 window | | in a new console (opens in Windows Terminal here) | `PseudoConsoleWindow`, owned by this process | visible from +0.5 s, 0x0, owned by Terminal's window | the 640x480 window while it is above Terminal; **the 0x0 window** once it is below | | under a bare `CreatePseudoConsole` | `PseudoConsoleWindow`, owned by this process | never visible | the 640x480 window | | from a shell already running in a console | owned by the shell | none | the 640x480 window | So only Windows Terminal shows the window. A bare pseudoconsole doesn't, and a VIctory started from a shell doesn't own one. ## Tested RTX 3070, driver 616.56, Windows 11 Pro 10.0.26100, debug. - New tests `host::title_window_tests`, 3 of 3 runs. Each test first checks that the decoy really is above the window it expects: - `an_empty_window_above_the_titles_is_passed_over`: a visible 0x0 popup above a 64x64 one; - `the_stand_in_wins_over_other_windows_above_it`: a 64x64 window above a `VIctory.title` window. With main's `title_window()` and these tests, both fail (the decoy is returned). - With the test commit (`3d0e177`), the two tests also create a swap chain through the presenter and check `GetHwnd()`: 3 of 3 on the 3070 (no skip, so on the hardware device). - `cargo test --locked -p victory-gpu --lib`: 231 passed, 2 failed, 1 ignored; `main` `63bcca4`: 229 passed, 2 failed, 1 ignored. The same two failures on both: `dynamic_slots_are_held_until_released` and `lists_share_a_table_and_copies_keep_their_views`, from the capped view heap on this card. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, also with `--all-features`: clean. `cargo run -p xtask -- policy`: ok. ## Not tested The title itself (no game data here), and a launcher that keeps its own console hidden. ## AI use Claude Code (Claude Opus 5.5) found the trigger with the probe above, wrote the fix and the tests, and ran everything listed. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
andrewpozdnakov7-jpg commented 2026-11-28 11:35:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T11:35:04Z.


I checked the actual DXGI binding on your exact e556203. Test commit 4143ffc extends both window fixtures to create a swap chain with the production presenter and compare its GetHwnd() result with the expected window. The zero-area popup stayed above the default window in one fixture. A normal-size decoy stayed above the VIctory.title stand-in in the other.

Both bindings and the existing PresentX fallback exercise passed together in eight separate Windows WARP processes with three test threads. The tests that create presentation windows share a test-only lock. With the original selector substituted, the stand-in case failed the actual swap-chain HWND assertion. Both strict GPU Clippy configurations and the asset policy passed. These runs used generated popup windows.

@upipibi, the test is ready to cherry-pick if you want this coverage. Please retain the Git author on cherry-pick or rebase, or add Co-authored-by: andrewpozdnakov7-jpg <[email protected]> if folding it into your commit.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7238648247 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3718#issuecomment-7238648247). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T11:35:04Z. --- I checked the actual DXGI binding on your exact `e556203`. [Test commit `4143ffc`](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/4143ffc32ace77b5be43b690c9099c639a874d0e) extends both window fixtures to create a swap chain with the production presenter and compare its `GetHwnd()` result with the expected window. The zero-area popup stayed above the default window in one fixture. A normal-size decoy stayed above the `VIctory.title` stand-in in the other. Both bindings and the existing PresentX fallback exercise passed together in eight separate Windows WARP processes with three test threads. The tests that create presentation windows share a test-only lock. With the original selector substituted, the stand-in case failed the actual swap-chain HWND assertion. Both strict GPU Clippy configurations and the asset policy passed. These runs used generated popup windows. @upipibi, the test is ready to cherry-pick if you want this coverage. Please retain the Git author on cherry-pick or rebase, or add `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>` if folding it into your commit. AI-assisted with OpenAI Codex.
upipibi commented 2026-11-28 11:36:50 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by upipibi on 2026-11-28T11:36:50Z.


@andrewpozdnakov7-jpg Thanks, it's in as 3d0e177, with you as the author. On the RTX 3070 (616.56) both tests create the swap chain on the hardware device (no skip line) and pass 3 of 3. victory-gpu lib is unchanged at 231 passed, 2 failed (the two known capped-heap tests), 1 ignored, and clippy is clean.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7238667384 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3718#issuecomment-7238667384). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-28T11:36:50Z. --- @andrewpozdnakov7-jpg Thanks, it's in as `3d0e177`, with you as the author. On the RTX 3070 (616.56) both tests create the swap chain on the hardware device (no skip line) and pass 3 of 3. `victory-gpu` lib is unchanged at 231 passed, 2 failed (the two known capped-heap tests), 1 ignored, and clippy is clean.
andrewpozdnakov7-jpg commented 2026-11-28 19:20:41 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T19:20:41Z.


I checked 3d0e177 together with the packed-float presentation change from #3784. Combined 169cc3e preserves the two exact PR heads. Both groups of presenter tests now share this PR's window lock.

The stand-in test created real RGBA8 and FP16 DXGI swap chains and checked that both bind to the stand-in with a different window above it. The packed-float test checked all 5,120 readback pixels across five frames. Both window tests and both presenter tests passed in six separate Windows WARP runs with four test threads. Strict all-feature GPU Clippy and the asset policy passed.

This is ready for maintainer review or an integration pick if the two PRs land together. Please retain the Git authors on cherry-pick or rebase.

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7244473775 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3718#issuecomment-7244473775). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T19:20:41Z. --- I checked 3d0e177 together with the packed-float presentation change from #3784. [Combined 169cc3e](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/169cc3e03fa88a7b72a8db3461676434a89941c4) preserves the two exact PR heads. Both groups of presenter tests now share this PR's window lock. The stand-in test created real RGBA8 and FP16 DXGI swap chains and checked that both bind to the stand-in with a different window above it. The packed-float test checked all 5,120 readback pixels across five frames. Both window tests and both presenter tests passed in six separate Windows WARP runs with four test threads. Strict all-feature GPU Clippy and the asset policy passed. This is ready for maintainer review or an integration pick if the two PRs land together. Please retain the Git authors on cherry-pick or rebase. AI-assisted with OpenAI Codex.
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/3718:upstream-pr/3718'
git switch 'upstream-pr/3718'

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/3718'
git switch 'upstream-pr/3718'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3718'
git switch 'upstream-pr/3718'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3718'
git switch 'main'
git merge --squash 'upstream-pr/3718'
git switch 'main'
git merge --ff-only 'upstream-pr/3718'
git switch 'main'
git merge 'upstream-pr/3718'
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
Marvisak/VIctory!3718
No description provided.