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

Open
alexandruiulian201-bot wants to merge 1 commit from upstream-pr/2910 into main
alexandruiulian201-bot commented 2026-11-25 23:47:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-25T23:47:00Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6616137059 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-25T23:47:00Z. --- 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.
kotekompotek commented 2026-11-26 00:03:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T23:52:52Z.

Review: COMMENTED


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.

<!-- greyfinch-sync:Marvisak/VIctory:review:6066644387 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910#pullrequestreview-6066644387). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-25T23:52:52Z. **Review:** COMMENTED --- 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.
fuzeofficlal commented 2026-11-26 00:03:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T23:56:59Z.

Review: COMMENTED


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.
<!-- greyfinch-sync:Marvisak/VIctory:review:6066674534 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910#pullrequestreview-6066674534). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-25T23:56:59Z. **Review:** COMMENTED --- 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.
upstream-sync changed title from [PR #2910] GPU: add VICTORY_WINDOW_SIZE to size the host window to [PR #2910] GPU: fit fallback host window to work area and honor VICTORY_WINDOW_MAX 2026-11-26 01:03:40 +00:00
alexandruiulian201-bot commented 2026-11-26 01:03:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-26T00:04:06Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7178359039 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910#issuecomment-7178359039). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-26T00:04:06Z. --- 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).
Marvisak commented 2026-11-26 03:05:07 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T02:20:24Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7180708215 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910#issuecomment-7180708215). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T02:20:24Z. --- <!-- 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)_
Dukestar69 commented 2026-11-26 06:02:47 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T05:47:14Z.

Review: APPROVED


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

<!-- greyfinch-sync:Marvisak/VIctory:review:6069135868 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910#pullrequestreview-6069135868). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T05:47:14Z. **Review:** APPROVED --- 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).
alexandruiulian201-bot commented 2026-11-26 10:05:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by alexandruiulian201-bot on 2026-11-26T09:06:39Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7187437091 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2910#issuecomment-7187437091). Originally posted by [alexandruiulian201-bot](https://github.com/alexandruiulian201-bot) on 2026-11-26T09:06:39Z. --- @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 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/2910:upstream-pr/2910'
git switch 'upstream-pr/2910'

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