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

Manually merged
github merged 1 commit from github-bot/gh-1617 into main 2026-11-29 08:21:02 +00:00 AGit
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-28 22:24 UTC · original
Jesper-Andersson:pr/alt-enter → main · +151 −23 · 4 files · 1 commits · merged 2026-11-29 08:16 UTC

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).

**@⁠Jesper-Andersson** on GitHub · 2026-11-28 22:24 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1617) `Jesper-Andersson:pr/alt-enter` → `main` · +151 −23 · 4 files · 1 commits · merged 2026-11-29 08:16 UTC <!-- 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).
Cause: 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 one kept DXGI's built-in 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.

Change:
- One helper, no_alt_enter, called after every creation path: it takes
  the swap chain's parent factory (GetParent) and calls
  MakeWindowAssociation(hwnd, DXGI_MWA_NO_ALT_ENTER) on it.
- The window procedure handles Alt+Enter (WM_SYSKEYDOWN/UP/SYSCHAR with
  VK_RETURN and the Alt bit) itself and does not pass it on: it toggles a
  borderless WS_POPUP window over the window's monitor
  (MonitorFromWindow/GetMonitorInfoW) and restores the previous style and
  rectangle on the way back. VICTORY_FULLSCREEN's startup path shares the
  same helper, so Alt+Enter also leaves that mode.
- The swap chain's buffers stay at the title's render size and DXGI scales
  to the window, so no ResizeBuffers or FSR 3 context recreation is
  involved in the toggle.
- Unit tests for the style math and the key test; README and docs/dlss.md.

Research (Microsoft Learn: IDXGIFactory::MakeWindowAssociation, DXGI
flip-model and full-screen guidance; Streamline programming guide 12.0;
FidelityFX frame interpolation swap chain notes): MakeWindowAssociation
must be called on the factory that created the swap chain, and
DXGI_MWA_NO_ALT_ENTER stops DXGI from handling Alt+Enter; for flip model,
borderless windowed is recommended and exclusive full screen is not needed
for tearing/VRR with ALLOW_TEARING; Streamline wants frame generation off
across a windowed/full-screen change. Not re-read in this session (the
docs tool was unavailable); cited from the existing code comment and
prior knowledge.

On upstream main, VICTORY_FULLSCREEN places an aspect-fitted box with a
black backdrop window behind it; that box goes through the same
enter_borderless helper, and Alt+Enter back to windowed also removes the
backdrop.

This change was made with AI assistance (Claude Code).
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-28 22:30:08 +00:00
github manually merged commit 685d33f688 into main 2026-11-29 08:21:02 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
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.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1617
No description provided.