GPU: VICTORY_ADAPTER picks the host adapter by name #79

Closed
github-bot wants to merge 1 commit from gh-pr/79/head into gh-pr/79/base
Owner

@⁠dutch2005 on GitHub · 2026-11-25 13:34 UTC · original
feat/adapter-override → main · +163 −1 · 2 files · 1 commits · closed without merging

Why

On a laptop with switchable graphics, DXGI's ranking does not always put the discrete GPU first, and the title's own DXGI view can end up on the integrated one. The host device currently always takes the adapter Windows ranks fastest (IDXGIGpuPreference::HighPerformance), with no way to say otherwise. Upstream carries VICTORY_ADAPTER for the same reason (Marvisak/VIctory#2367); this is written against this tree's device creation.

What

  • VICTORY_ADAPTER=<part of a name> picks the first hardware adapter whose description contains the text, ignoring case (for example VICTORY_ADAPTER=radeon).
  • Software adapters are skipped.
  • A name that matches nothing falls back to the fastest adapter, with a warning, so a typo cannot stop a run.
  • Without the variable, the behaviour is unchanged.

Testing

  • cargo test -p victory-gpu --lib adapter -- --test-threads=1 — 7 passed, 0 failed: env trimming, hardware flag, case-insensitive match, first matching hardware adapter, unknown name, a real adapter found by its own name, WARP rejection.
  • Mutation coverage on the diff: 17 caught, 1 equivalent, 3 unviable. The equivalent mutant is the adapters.is_empty() error guard (with no adapters the following index lookup returns Err either way); it is documented in docs/mutation-testing.md rather than suppressed.

Notes

This only selects the host D3D12 adapter; it does not change the title's own DXGI adapter reporting. The environment guard, hardware filter, name match and selection are pure helpers; the DXGI enumeration is exercised by the real-adapter test.

**@⁠dutch2005** on GitHub · 2026-11-25 13:34 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/79) `feat/adapter-override` → `main` · +163 −1 · 2 files · 1 commits · closed without merging ## Why On a laptop with switchable graphics, DXGI's ranking does not always put the discrete GPU first, and the title's own DXGI view can end up on the integrated one. The host device currently always takes the adapter Windows ranks fastest (`IDXGIGpuPreference::HighPerformance`), with no way to say otherwise. Upstream carries `VICTORY_ADAPTER` for the same reason (Marvisak/VIctory#2367); this is written against this tree's device creation. ## What - `VICTORY_ADAPTER=<part of a name>` picks the first hardware adapter whose description contains the text, ignoring case (for example `VICTORY_ADAPTER=radeon`). - Software adapters are skipped. - A name that matches nothing falls back to the fastest adapter, with a warning, so a typo cannot stop a run. - Without the variable, the behaviour is unchanged. ## Testing - `cargo test -p victory-gpu --lib adapter -- --test-threads=1` — 7 passed, 0 failed: env trimming, hardware flag, case-insensitive match, first matching hardware adapter, unknown name, a real adapter found by its own name, WARP rejection. - Mutation coverage on the diff: **17 caught, 1 equivalent, 3 unviable**. The equivalent mutant is the `adapters.is_empty()` error guard (with no adapters the following index lookup returns `Err` either way); it is documented in `docs/mutation-testing.md` rather than suppressed. ## Notes This only selects the host D3D12 adapter; it does not change the title's own DXGI adapter reporting. The environment guard, hardware filter, name match and selection are pure helpers; the DXGI enumeration is exercised by the real-adapter test.
A laptop with switchable graphics can be told which adapter to run on: the first hardware adapter whose description holds the text, ignoring case. A name that matches nothing falls back to the fastest, with a warning; without the variable nothing changes. The env guard, hardware filter, selection and NUL-terminated description are pure helpers or have direct tests; a real-adapter test exercises the DXGI path.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:09 +00:00
github-bot closed this pull request 2026-11-26 03:35:09 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.