GPU: fit fallback host window to work area and honor VICTORY_WINDOW_MAX #2910

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

@⁠alexandruiulian201-bot on GitHub · 2026-11-25 23:47 UTC · original
alexandruiulian201-bot:feat/victory-window-size → main · +124 −4 · 1 files · 1 commits · open

When a title has not created its own visible window (title_window() is None), crates/victory-gpu/src/host.rs::make_window creates a fallback Win32 host window sized directly to the presented swap-chain resolution (width x height). Unlike victory-hle's lifecycle::fit, that fallback path did not shrink oversized windows to the primary monitor's SPI_GETWORKAREA and did not honor VICTORY_WINDOW_MAX=WIDTHxHEIGHT.

Changes

  • Fit the fallback host window in make_window against SPI_GETWORKAREA and optional VICTORY_WINDOW_MAX=WIDTHxHEIGHT (matching victory-hle's lifecycle.rs parsing, proportional scaling, and centering), without introducing a second env var or altering the swap chain's presented resolution.
  • Add unit test host::tests::host_window_limit_and_work_area_fitting covering VICTORY_WINDOW_MAX parsing, no-op when already fitting, proportional work-area scaling + centering, and VICTORY_WINDOW_MAX clamping.

Verification

  • cargo test -p victory-gpu --locked host::tests::host_window_limit_and_work_area_fitting — 1 passed, 0 failed
  • cargo clippy -p victory-gpu --all-targets --locked -- -D warnings (default and --all-features) — 0 warnings
  • cargo test -p xtask --bin xtask --locked — 6 passed, 0 failed (asset policy: 1 files ok)

AI-assisted. Synthetic unit test only.

**@⁠alexandruiulian201-bot** on GitHub · 2026-11-25 23:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910) `alexandruiulian201-bot:feat/victory-window-size` → `main` · +124 −4 · 1 files · 1 commits · open When a title has not created its own visible window (`title_window()` is `None`), `crates/victory-gpu/src/host.rs::make_window` creates a fallback Win32 host window sized directly to the presented swap-chain resolution (`width x height`). Unlike `victory-hle`'s `lifecycle::fit`, that fallback path did not shrink oversized windows to the primary monitor's `SPI_GETWORKAREA` and did not honor `VICTORY_WINDOW_MAX=WIDTHxHEIGHT`. ### Changes - Fit the fallback host window in `make_window` against `SPI_GETWORKAREA` and optional `VICTORY_WINDOW_MAX=WIDTHxHEIGHT` (matching `victory-hle`'s `lifecycle.rs` parsing, proportional scaling, and centering), without introducing a second env var or altering the swap chain's presented resolution. - Add unit test `host::tests::host_window_limit_and_work_area_fitting` covering `VICTORY_WINDOW_MAX` parsing, no-op when already fitting, proportional work-area scaling + centering, and `VICTORY_WINDOW_MAX` clamping. ### Verification - `cargo test -p victory-gpu --locked host::tests::host_window_limit_and_work_area_fitting` — 1 passed, 0 failed - `cargo clippy -p victory-gpu --all-targets --locked -- -D warnings` (default and `--all-features`) — 0 warnings - `cargo test -p xtask --bin xtask --locked` — 6 passed, 0 failed (`asset policy: 1 files ok`) AI-assisted. Synthetic unit test only.
Match victory-hle's lifecycle::fit in host.rs::make_window: shrink oversized fallback host windows proportionally to SPI_GETWORKAREA, honor VICTORY_WINDOW_MAX=WIDTHxHEIGHT, and center them without adding a second window-sizing env var.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:17:17 +00:00
Author
Owner

@⁠alexandruiulian201-bot on GitHub · 2026-11-26 00:04 UTC · original

Thanks for the catch @⁠fuzeofficlal! Updated the PR to drop VICTORY_WINDOW_SIZE and instead wire host.rs::make_window to honor the existing VICTORY_WINDOW_MAX=WIDTHxHEIGHT and SPI_GETWORKAREA work-area fitting (matching lifecycle::fit).

**@⁠alexandruiulian201-bot** on GitHub · 2026-11-26 00:04 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910#issuecomment-7178359039) Thanks for the catch @⁠fuzeofficlal! Updated the PR to drop VICTORY_WINDOW_SIZE and instead wire host.rs::make_window to honor the existing VICTORY_WINDOW_MAX=WIDTHxHEIGHT and SPI_GETWORKAREA work-area fitting (matching lifecycle::fit).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-26 02:20 UTC · original

Automated triage for the maintainers.

Merge candidate (a recommendation to look, not an approval). The fallback host window (host.rs make_window) is now shrunk proportionally and centred to fit the work area (SPI_GETWORKAREA) and the existing VICTORY_WINDOW_MAX, as the title window already is through victory-hle's lifecycle::fit. When it fits, it stays at CW_USEDEFAULT. I checked fit_window_rect against its test cases. CI check passes. A small nit: parse_window_limit copies the one in victory-hle rather than sharing it.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-26 02:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910#issuecomment-7180708215) <!-- victory-triage v1 head=c59fb3b05848a4f60f81c880b24fa02217c7c876 verdict=merge-candidate at=2026-11-26T02:20:18Z --> Automated triage for the maintainers. **Merge candidate** (a recommendation to look, not an approval). The fallback host window (`host.rs` `make_window`) is now shrunk proportionally and centred to fit the work area (`SPI_GETWORKAREA`) and the existing `VICTORY_WINDOW_MAX`, as the title window already is through `victory-hle`'s `lifecycle::fit`. When it fits, it stays at `CW_USEDEFAULT`. I checked `fit_window_rect` against its test cases. CI `check` passes. A small nit: `parse_window_limit` copies the one in `victory-hle` rather than sharing it. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 23:52 UTC · original · reviewed

Clean knob: parse is strict (bare width implies 16:9, range 320x180..16384x16384, whitespace and case tolerated), invalid values warn rather than silently ignore, OnceLock parses once, and the override lands in AdjustWindowRect so the client size is what was asked for, not the frame size. LGTM.

**@⁠kotekompotek** on GitHub · 2026-11-25 23:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910#pullrequestreview-6066644387) · **reviewed** Clean knob: parse is strict (bare width implies 16:9, range 320x180..16384x16384, whitespace and case tolerated), invalid values warn rather than silently ignore, OnceLock parses once, and the override lands in AdjustWindowRect so the client size is what was asked for, not the frame size. LGTM.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 23:56 UTC · original · reviewed

Verified head a09eb589 cleanly merged onto origin/main (63bcca43) on Windows 11 x64.

Findings / Overlap Note

  • host.rs::make_window is bypassed when a title creates its own window, and lifecycle.rs already implements VICTORY_WINDOW_MAX:
    • Presenter::new (crates/victory-gpu/src/host.rs) checks title_window() first and only calls window(width, height) -> make_window(...) when the title has not created a visible window of its own.
    • For titles whose window is created through victory-hle (crates/victory-hle/src/modules/lifecycle.rs), fit() already shrinks oversized windows to the monitor's SPI_GETWORKAREA automatically and already supports VICTORY_WINDOW_MAX=WIDTHxHEIGHT (parse_window_limit / window_limit).
    • As a result, VICTORY_WINDOW_SIZE here only affects the fallback victory-window path when title_window() is None, and introduces a second overlapping window-sizing env var alongside VICTORY_WINDOW_MAX (worth either wiring make_window to honor VICTORY_WINDOW_MAX + work-area fitting or clarifying scope).

Local Verification

  • cargo test --locked -p victory-gpu --lib host::tests::window: 1/1 passed (window_size_parsing_accepts_wxh_and_width_and_rejects_invalid).
  • cargo clippy --locked -p victory-gpu --all-targets -- -D warnings (default and --features diagnostics) & cargo xtask policy (191 files ok): clean.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 23:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910#pullrequestreview-6066674534) · **reviewed** Verified head `a09eb589` cleanly merged onto `origin/main` (`63bcca43`) on Windows 11 x64. ### Findings / Overlap Note - **`host.rs::make_window` is bypassed when a title creates its own window, and `lifecycle.rs` already implements `VICTORY_WINDOW_MAX`**: - `Presenter::new` (`crates/victory-gpu/src/host.rs`) checks `title_window()` first and only calls `window(width, height)` -> `make_window(...)` when the title has not created a visible window of its own. - For titles whose window is created through `victory-hle` (`crates/victory-hle/src/modules/lifecycle.rs`), `fit()` already shrinks oversized windows to the monitor's `SPI_GETWORKAREA` automatically and already supports `VICTORY_WINDOW_MAX=WIDTHxHEIGHT` (`parse_window_limit` / `window_limit`). - As a result, `VICTORY_WINDOW_SIZE` here only affects the fallback `victory-window` path when `title_window()` is `None`, and introduces a second overlapping window-sizing env var alongside `VICTORY_WINDOW_MAX` (worth either wiring `make_window` to honor `VICTORY_WINDOW_MAX` + work-area fitting or clarifying scope). ### Local Verification - `cargo test --locked -p victory-gpu --lib host::tests::window`: **1/1 passed** (`window_size_parsing_accepts_wxh_and_width_and_rejects_invalid`). - `cargo clippy --locked -p victory-gpu --all-targets -- -D warnings` (default and `--features diagnostics`) & `cargo xtask policy` (`191 files ok`): clean.
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-26 05:47 UTC · original · approved these changes

Tested locally merged onto origin/main (63bcca4) on Windows 11 x64 (NVIDIA GeForce RTX 5090):

  • Diff review: Adding parse_window_limit, fit_into, and fit_window_rect in host.rs and fitting the fallback host window to the monitor work area / VICTORY_WINDOW_MAX cleanly keeps oversized fallback windows centered and on-screen while leaving windows that already fit at CW_USEDEFAULT.
  • cargo test -p victory-gpu host::tests -- --test-threads=1: all 13 host::tests::* tests passed (including host_window_limit_and_work_area_fitting). (Pre-existing descriptor::host::tests::dynamic_slots_are_held_until_released fails on NVIDIA's 1M view-heap cap #1744, unrelated to this PR.)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

**@⁠Dukestar69** on GitHub · 2026-11-26 05:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910#pullrequestreview-6069135868) · **approved these changes** Tested locally merged onto `origin/main` (`63bcca4`) on Windows 11 x64 (NVIDIA GeForce RTX 5090): - Diff review: Adding `parse_window_limit`, `fit_into`, and `fit_window_rect` in `host.rs` and fitting the fallback host window to the monitor work area / `VICTORY_WINDOW_MAX` cleanly keeps oversized fallback windows centered and on-screen while leaving windows that already fit at `CW_USEDEFAULT`. - `cargo test -p victory-gpu host::tests -- --test-threads=1`: all 13 `host::tests::*` tests passed (including `host_window_limit_and_work_area_fitting`). *(Pre-existing `descriptor::host::tests::dynamic_slots_are_held_until_released` fails on NVIDIA's 1M view-heap cap #1744, unrelated to this PR.)* - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠alexandruiulian201-bot on GitHub · 2026-11-26 09:06 UTC · original

@⁠Marvisak Note on the nit: kept parse_window_limit local because victory-gpu intentionally doesn't depend on victory-hle or victory-core.

**@⁠alexandruiulian201-bot** on GitHub · 2026-11-26 09:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/2910#issuecomment-7187437091) @⁠Marvisak Note on the nit: kept parse_window_limit local because victory-gpu intentionally doesn't depend on victory-hle or victory-core.
This pull request can be merged automatically.
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/2910/head:github-bot/gh-2910'
git switch 'github-bot/gh-2910'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2910'
git switch 'github-bot/gh-2910'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2910'
git switch 'github-bot/gh-2910'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2910'
git switch 'main'
git merge --squash 'github-bot/gh-2910'
git switch 'main'
git merge --ff-only 'github-bot/gh-2910'
git switch 'main'
git merge 'github-bot/gh-2910'
git push origin 'main'
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/Marvisak--VIctory!2910
No description provided.