GPU: VICTORY_ADAPTER picks the host adapter by name #79

Closed
dutch2005 wants to merge 1 commit from upstream-pr/79 into main
dutch2005 commented 2026-11-25 13:34:43 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by dutch2005 on 2026-11-25T13:34:43Z.


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.

<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6605687956 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/79). Originally posted by [dutch2005](https://github.com/dutch2005) on 2026-11-25T13:34:43Z. --- ## 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.

Pull request closed

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
Belobug/VIctory-Belobug-AMD!79
No description provided.