Take Alt+Enter from DXGI on every swap chain; Alt+Enter toggles borderless full screen instead #1617

Merged
Jesper-Andersson merged 1 commit from upstream-pr/1617 into main 2026-11-29 08:16:55 +00:00
Jesper-Andersson commented 2026-11-28 22:24:59 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Jesper-Andersson on 2026-11-28T22:24:59Z.


Fixes: no open issue (this draft PR is the claim).

What it changes

DXGI_MWA_NO_ALT_ENTER was set only on the Streamline-proxied swap chain. The FSR 3 frame interpolation swap chain (FidelityFX) and the plain swap chain kept DXGI's own Alt+Enter, which switches the chain to exclusive full screen. With FSR 3 frame generation, that hangs the game until Alt+Enter is pressed again.

  • crates/victory-gpu/src/host.rs: one helper, no_alt_enter, runs after every way the swap chain is made (FSR 3, Streamline proxy, plain, Streamline present hook). It gets the swap chain's parent factory (GetParent) and calls MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER) on it, which is the factory Microsoft's docs require. A failure is logged.
  • crates/victory-hle/src/modules/lifecycle.rs: the window procedure handles Alt+Enter itself (WM_SYSKEYDOWN/UP/SYSCHAR with VK_RETURN and the Alt bit) and does not pass it on. On a key-down without repeat, on a top-level window, it toggles a borderless WS_POPUP window over the window's monitor (MonitorFromWindow / GetMonitorInfoW). Toggling back restores the earlier style and rectangle. The startup VICTORY_FULLSCREEN path (upstream's aspect-fitted box with the black backdrop) goes through the same helper, so Alt+Enter also leaves that mode, and going back to windowed removes the backdrop window.
  • The swap chain's buffers keep the title's render size and DXGI scales them to the window, so the toggle needs no ResizeBuffers and no FSR 3 context recreation.
  • README and docs/dlss.md say that Alt+Enter toggles borderless full screen and that exclusive full screen isn't used.

This is a behaviour change with no switch: Alt+Enter never goes to exclusive full screen any more, on any swap chain, and it now toggles borderless full screen. With DLSS frame generation (the Streamline path) Alt+Enter already did nothing at the DXGI level; now it toggles borderless there too.

Background (from the existing code comment and general knowledge of the DXGI docs, not re-read for this PR): MakeWindowAssociation has to be called on the factory that made the swap chain; borderless windowed is the usual choice with flip-model swap chains; the Streamline guide (section 12.0, as cited in the existing comment) wants frame generation off across a windowed/full-screen change.

How it was tested

  • GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p output, DLSS Performance, FSR 3 frame generation 2x, no ray tracing.
  • Before (seen on this PC with FSR 3 frame generation 2x, and also reported in #1132 on an RTX 3060 Ti): Alt+Enter switches to exclusive full screen and the game freezes until Alt+Enter is pressed again.
  • After: unit tests cover the style math (borderless_style) and the key test (is_alt_enter: Alt+Enter told apart from plain Enter, WM_KEYDOWN and Alt+F4). A release build passes. Not yet tried in game. Not tested at all: DLSS frame generation, no frame generation, VRR/tearing, multiple monitors, HDR. This PR stays a draft until Alt+Enter has been tried in game with FSR 3 frame generation, with DLSS frame generation and without frame generation.
  • For shader changes, the wave sizes tested: N/A (no translator changes).
  • cargo test passed for the crates it touches: yes (victory-gpu: 550 passed; victory-hle: 201 passed)
  • cargo clippy --no-deps -p victory-gpu -p victory-hle: no new warnings; -p victory-hle --all-targets -- -D warnings is clean. victory-gpu: With -D warnings, clippy stops only on lints that are already on main (victory-gpu host.rs, host/send.rs, pool.rs, resource.rs, streamline.rs, streamline/fsr.rs; victory-shader emit/lower.rs). The warning set is the same as on main (the open #1527 fixes them).
  • cargo xtask policy: fails on upstream main's own crates/victory-shader/src/emit/lower.rs (667,523 bytes, over the 640 KiB limit; #1429; the open #1493 and #1527 fix it). Nothing this PR adds trips it, and the pre-commit asset check passed for every file it changes.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches. Related: #1132, #1067, #1002, #1356, #1195, #1149
    • #1132 (disable DXGI Alt+Enter on the FSR 3 swap chain) covers part of the same fix, on the FSR 3 chain only (in fsr.rs). This PR covers every chain in one place and replaces the key with a borderless toggle. Taking one of the two is enough; if #1132 is merged first, this PR's helper is harmless on top of it.
    • #1067 (F11 full screen toggle) touches lifecycle.rs and the F1 menu. Same idea on another key. The two could share enter_borderless / toggle_fullscreen.
    • #1002 (mouse capture while dragging or resizing) touches window_proc in lifecycle.rs. Neighbouring lines. The toggle moves and resizes the window, so the capture logic sees WM_SIZE / WM_MOVE as for any resize.
    • #1356 (mouse, vehicles, launcher), #1195 (mouse look hold) and #1149 (mouse look sensitivity) edit lifecycle.rs in other functions. Textual overlap only.

This was written with AI assistance (Claude Code).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5545167918 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1617). Originally posted by [Jesper-Andersson](https://github.com/Jesper-Andersson) on 2026-11-28T22:24:59Z. --- <!-- Labels: pr-fix, frame-generation, input (in the title, as the template asks). --> Fixes: no open issue (this draft PR is the claim). ## What it changes `DXGI_MWA_NO_ALT_ENTER` was set only on the Streamline-proxied swap chain. The FSR 3 frame interpolation swap chain (FidelityFX) and the plain swap chain kept DXGI's own Alt+Enter, which switches the chain to exclusive full screen. With FSR 3 frame generation, that hangs the game until Alt+Enter is pressed again. - `crates/victory-gpu/src/host.rs`: one helper, `no_alt_enter`, runs after every way the swap chain is made (FSR 3, Streamline proxy, plain, Streamline present hook). It gets the swap chain's parent factory (`GetParent`) and calls `MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER)` on it, which is the factory Microsoft's docs require. A failure is logged. - `crates/victory-hle/src/modules/lifecycle.rs`: the window procedure handles Alt+Enter itself (`WM_SYSKEYDOWN`/`UP`/`SYSCHAR` with `VK_RETURN` and the Alt bit) and does not pass it on. On a key-down without repeat, on a top-level window, it toggles a borderless `WS_POPUP` window over the window's monitor (`MonitorFromWindow` / `GetMonitorInfoW`). Toggling back restores the earlier style and rectangle. The startup `VICTORY_FULLSCREEN` path (upstream's aspect-fitted box with the black backdrop) goes through the same helper, so Alt+Enter also leaves that mode, and going back to windowed removes the backdrop window. - The swap chain's buffers keep the title's render size and DXGI scales them to the window, so the toggle needs no `ResizeBuffers` and no FSR 3 context recreation. - README and `docs/dlss.md` say that Alt+Enter toggles borderless full screen and that exclusive full screen isn't used. **This is a behaviour change with no switch:** Alt+Enter never goes to exclusive full screen any more, on any swap chain, and it now toggles borderless full screen. With DLSS frame generation (the Streamline path) Alt+Enter already did nothing at the DXGI level; now it toggles borderless there too. Background (from the existing code comment and general knowledge of the DXGI docs, not re-read for this PR): `MakeWindowAssociation` has to be called on the factory that made the swap chain; borderless windowed is the usual choice with flip-model swap chains; the Streamline guide (section 12.0, as cited in the existing comment) wants frame generation off across a windowed/full-screen change. ## How it was tested - GPU and profile: RTX 2070 SUPER 8 GB, Windows 11, Series S, 1080p output, DLSS Performance, FSR 3 frame generation 2x, no ray tracing. - Before (seen on this PC with FSR 3 frame generation 2x, and also reported in #1132 on an RTX 3060 Ti): Alt+Enter switches to exclusive full screen and the game freezes until Alt+Enter is pressed again. - After: unit tests cover the style math (`borderless_style`) and the key test (`is_alt_enter`: Alt+Enter told apart from plain Enter, `WM_KEYDOWN` and Alt+F4). A release build passes. **Not yet tried in game.** Not tested at all: DLSS frame generation, no frame generation, VRR/tearing, multiple monitors, HDR. This PR stays a draft until Alt+Enter has been tried in game with FSR 3 frame generation, with DLSS frame generation and without frame generation. - For shader changes, the wave sizes tested: N/A (no translator changes). - `cargo test` passed for the crates it touches: yes (victory-gpu: 550 passed; victory-hle: 201 passed) - `cargo clippy --no-deps -p victory-gpu -p victory-hle`: no new warnings; `-p victory-hle --all-targets -- -D warnings` is clean. victory-gpu: With `-D warnings`, clippy stops only on lints that are already on main (victory-gpu `host.rs`, `host/send.rs`, `pool.rs`, `resource.rs`, `streamline.rs`, `streamline/fsr.rs`; victory-shader `emit/lower.rs`). The warning set is the same as on main (the open #1527 fixes them). - `cargo xtask policy`: fails on upstream main's own `crates/victory-shader/src/emit/lower.rs` (667,523 bytes, over the 640 KiB limit; #1429; the open #1493 and #1527 fix it). Nothing this PR adds trips it, and the pre-commit asset check passed for every file it changes. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. Related: #1132, #1067, #1002, #1356, #1195, #1149 - #1132 (disable DXGI Alt+Enter on the FSR 3 swap chain) covers part of the same fix, on the FSR 3 chain only (in `fsr.rs`). This PR covers every chain in one place and replaces the key with a borderless toggle. Taking one of the two is enough; if #1132 is merged first, this PR's helper is harmless on top of it. - #1067 (F11 full screen toggle) touches `lifecycle.rs` and the F1 menu. Same idea on another key. The two could share `enter_borderless` / `toggle_fullscreen`. - #1002 (mouse capture while dragging or resizing) touches `window_proc` in `lifecycle.rs`. Neighbouring lines. The toggle moves and resizes the window, so the capture logic sees `WM_SIZE` / `WM_MOVE` as for any resize. - #1356 (mouse, vehicles, launcher), #1195 (mouse look hold) and #1149 (mouse look sensitivity) edit `lifecycle.rs` in other functions. Textual overlap only. This was written with AI assistance (Claude Code).
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!1617
No description provided.