GPU: choose an adapter that can run the title, and name the ones that cannot #967
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!967
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-967"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@zzm1234560621-prog on GitHub · 2026-11-24 14:35 UTC · original
zzm1234560621-prog:gpu/adapter-selection→main· +385 −2 · 3 files · 2 commits · openGPU: choose an adapter that can run the title, and name the ones that cannot
What
victory_gpu::host::createnow picks the host adapter instead of takingD3D12CreateDevice(None, …). New modulecrates/victory-gpu/src/adapter.rs:enumerate()walksIDXGIFactory4::EnumAdapters1and probes each adapter:its description, whether a D3D12 device can be created on it,
SHADER_MODEL,D3D12_OPTIONS7::MeshShaderTier, and the software flag.choose()is a pure function over those facts and is where the policy lives.report()renders one line per adapter, for the error below.open()creates the device on the chosen adapter.create()keeps its WARP branch unchanged (VICTORY_D3D12_WARP, diagnosticsbuilds) and returns
anyhow::Resultinstead ofwindows::core::Result, so afailure can carry the adapter list rather than a bare
E_FAIL.Why
D3D12CreateDevice(None, …)means "whatever DXGI calls the default adapter",which is the adapter driving the primary output. That is the wrong adapter in
two common configurations:
integrated GPU. It may create a device and still not be what runs the
world; the old code would either use it or fail the SM 6.6 check with
the device supports SM 0x65 onlyand no hint that a capable GPU is inthe machine.
adapters that enumerate like any other and cannot create a D3D12 device.
When one of them ends up as the default, the failure was an
E_FAILwithno name attached.
The title needs shader model 6.6 (README) and, for the world, mesh shaders,
so "the default adapter" is not a safe default.
How the choice is made
Microsoft Basic Render Driverreports SM 6.6 and mesh shaders too (measured below), andsilently running the title on the CPU is worse than a failure that names
the reason. WARP stays the explicit
VICTORY_D3D12_WARPswitch.DedicatedVideoMemory.order the driver enumerates in.
When nothing qualifies, the error lists every adapter with its LUID, vendor,
dedicated memory, shader model, mesh support and whether it is software.
Measured
enumerate()+choose()on the machine this was written on (Windows 11,Core Ultra 9 185H, one Intel Arc iGPU, plus a remote-desktop display driver
and an emulator display driver installed):
Two things this shows that the old code could not:
the three is "the default" is not stable across runs; the LUID tie-break is.
reason for rule 1.
Not verified
what is drawn.
README ("mesh shaders for the world"), not something measured on a GPU
without mesh support.
touched by this PR; it is the same host the old code would have used
whenever the default adapter was the right one.
Tested
cargo test -p victory-gpu --locked: 50 passed, 1 ignored, 0 failed(8 of them new; they drive
chooseandreportover synthetic facts andneed neither a GPU nor a display).
CI's commands, on Windows 11 with MSVC 14.51 and Rust 1.98.1 (the pinned
toolchain):
cargo clippy --workspace --all-targets --locked -- -D warnings: cleancargo clippy --workspace --all-targets --all-features --locked -- -D warnings: cleancargo xtask policy: okcargo test --workspace --locked: see the run belowOne caveat for anyone re-running the suite:
victory-core's twopolicy::testsandvictory-gpu'sshader_cache/watchtests createdirectories under
%TEMP%. They pass on a normal machine; a run whose%TEMP%is not writable fails them withPermissionDenied, which is not acode failure.
Relation to open PRs
VICTORY_ADAPTERand adapter helpers for the shader testhost. This PR deliberately adds no environment variable: if that lands
first,
Factsandchooseare the shared implementation those helpersshould call, and the override becomes one more input to
choose.victory-shader, so #233 / #439's stack is unaffected.@Zipettte on GitHub · 2026-11-24 15:13 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
66d97ee:cargo test -p victory-gpupasses, 57 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@heromike405-arch on GitHub · 2026-11-24 15:18 UTC · original
Independent DXGI/D3D12 probe on a hybrid Windows 11 laptop (build 26100). I created a feature-level 12.0 D3D12 device per enumerated adapter and made the same SM 6.6 and OPTIONS7 mesh-tier queries used in
66d97ee.Applying the PR's selection rules to the measured facts picks the RTX 5060. In this configuration,
D3D12CreateDevice(NULL, ...)also returned the RTX device, so this run does not reproduce the default-adapter mismatch. The software adapter did report mesh support despite being flagged as software.Standalone probe of the Windows APIs and the selection criteria. The PR binary and game were not run. AI-assisted with Codex.
@Marvisak on GitHub · 2026-11-25 00:30 UTC · original
Automated triage for the maintainers.
Needs rebase. This PR does not merge cleanly into current
main(ac2525d). Conflicting files:crates/victory-gpu/src/lib.rs.The content has not been reviewed yet; it will be once the branch is rebased onto
main.Generated by Claude Code
@Coderlord on GitHub · 2026-11-25 05:21 UTC · original
A suggestion from testing #967: skip software adapters in
probe().probe()makes a D3D12 device on every enumerated adapter, the Microsoft Basic Render Driver included, thoughruns_the_title()never picks a software adapter. A WARP device is one per adapter and process, so the probe makes and drops the very device that code asking for WARP on purpose holds. In a fork with a WARP-based test (fxceless/victory-gta6'sinplace::tests::warp_a_title_buffer_in_place_shows_its_bytes_at_its_offset), that test failed in 2 of 2 fullcargo test --workspaceruns with #967 applied (aVirtualFree(MEM_DECOMMIT)of memory that a just-dropped WARP placed buffer covered was refused), and in 1 of 4 full runs with the change below (so the change makes it rarer, not gone; the test itself races WARP releasing the placed buffer late). Run alone, it passes either way. The main point stands on its own: the probe makes a device no choice can use.The change, in
crates/victory-gpu/src/adapter.rs: return early fromprobe()for software adapters, and havereport()saynot probedfor them instead ofno D3D12 device:The choice does not change: on Windows 11 with an RTX 5080, an AMD integrated GPU and the Basic Render Driver, #967 with this change picks the RTX 5080 (
host adapter chosen adapter=NVIDIA GeForce RTX 5080 shader_model=0x66 mesh_shaders=true adapters=3), and it no longer makes a WARP device at every start.AI use: found, written and tested with Claude Code (Claude Opus 5.5).
66d97eea7eto489eca15ce@mercuryVM on GitHub · 2026-11-24 14:46 UTC · original · approved these changes
Tested
66d97eeaon Windows 11, RTX 5070, MSVC:cargo test -p victory-gpu -- --test-threads=157 passed, and with--features diagnostics60 passed, including the sevenchoosetests.cargo clippy -p victory-gpu --all-targetsis clean. This machine has the RTX 5070, an AMD integrated GPU and two virtual display adapters, so it's a realistic multi-adapter host. The selection itself isn't exercised by a test against the real adapters, and the title wasn't run.chooseas a pure function over probed facts (device creatable, SM 6.6, mesh tier, software flag, VRAM, LUID) is easy to reason about. Excluding software adapters keeps WARP an explicit switch, and the LUID tiebreak makes the result stable for a given machine.VICTORY_ADAPTER=<LUID or index>escape hatch, listed inreport()'s output, would cover that.debug!per probe so a slow driver at startup is attributable.AI-assisted (Claude Code).
@zzm1234560621-prog on GitHub · 2026-11-26 11:13 UTC · original
Rebased onto
main63bcca4, and #967 now carries theprobe()change Coderlord asked for.What changed since the first push
crates/victory-gpu/src/lib.rsconflict resolved:mod adapter;sits abovemod bindless;.create()now callscrate::adapter::open()in the non-WARP branch of currentmain, and keepscrate::tdr::log()after the device exists (that arrived onmainafter the first push).probe()returns before making a device on a software adapter, with the comment Coderlord suggested;report()saysnot probedfor them instead ofno D3D12 device. A test covers the wording.adapter::testsnow.Numbers on the rebased head, Intel Arc iGPU (Xe-LPG, driver 32.0.101.6127), Rust 1.98.1 MSVC
cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo test -p victory-gpu: 237 passed, 2 failed, 1 ignored. Both failures are onmaintoo, unmodified, on this GPU —descriptor::host::tests::dynamic_slots_are_held_until_released(assertion failed: heap.heap.GetDesc().NumDescriptors >= victory_shader::emit::HEAP_VIEWS) andmemory::tests::lists_share_a_table_and_copies_keep_their_views(past the dynamic slots). They look like heap-size limits of this adapter rather than anything this PR touches; worth its own issue if nobody has filed it.adapter::testspass; they are syntheticFacts, no DXGI call, so they also pass on a GPU-less CI runner.On the software adapter, after the change
probe()no longer makes a device onMicrosoft Basic Render Driver, so the fork's WARP collision Coderlord described should be gone at the source: this path creates no WARP device at all now. What still makes one iswarp_adapter()itself, which is where an explicitVICTORY_D3D12_WARPrun goes, and that has not changed.Overlap with #1483
#1483 adds
high_performance_adapter()(+45 incrates/victory-gpu/src/host.rs) for the same problem:EnumAdapterByGpuPreference(HIGH_PERFORMANCE), first adapter that makes a device, software skipped. That picks the discrete GPU but does not check SM 6.6 or mesh shaders, does not order equal candidates deterministically, and reports nothing when it finds none — where aD3D12CreateDevice(None, …)failure names no adapter at all. If #1483 lands first,adapter::Facts/chooseare what its helper should call; if this lands first, #1483 only needs to drop that hunk. Say which you prefer and I will adapt this one — the shader half of #1483 is independent of it, and I have no opinion on which of the two adapter shapes you want.No game files were used. Tested with AI assistance (Claude).
@zzm1234560621-prog on GitHub · 2026-11-26 15:31 UTC · original
Your note — "the selection itself isn't exercised by a test against the real adapters" — is now addressed in
51a79ba.the_real_enumeration_names_every_adapter_and_never_chooses_softwarecallsenumerate()and then asserts only what holds on any host: every adapter is named in the report,choosenever returns a software adapter or one that cannot run the title, and does not pass such an adapter over. It prints the pick, and skips where there is no DXGI adapter.On a machine that has the awkward set — Intel Arc iGPU plus two indirect display adapters and Oray/MuMu virtual ones:
So the enumeration seen by the real DXGI on this host is four adapters, three of which cannot create an SM 6.6 device, and the choice is the one that can. That is the case the PR exists for, and it now has a test behind it rather than only the synthetic orderings.
Two failures in
cargo test -p victory-gpu --libhere (238 passed, 2 failed, 1 ignored) are this host's 1M view-heap cap, not from this change:descriptor::host::tests::dynamic_slots_are_held_until_released— the test #3191 fixes;memory::tests::lists_share_a_table_and_copies_keep_their_views—assert!(pairs.0 >= 1 << 18, "past the dynamic slots")atmemory.rs:1030, the same assumption; I have flagged it in #3178 rather than widen this PR.cargo clippy -p victory-gpu --all-targets -- -D warnings: clean.cargo xtask policy: ok.Thanks for running it on the RTX 5070 host — the two virtual display adapters there are exactly what made me confident the filter is right.
AI-assisted (Claude).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.