Use the discrete GPU on laptops instead of the integrated one #22
No reviewers
Labels
No labels
accessibility
bench-bm-v1
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/PastiiJay--klbf-lab!22
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-22"
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?
@spy0eye-beep on GitHub · 2026-11-25 17:03 UTC · original
spy0eye-beep:klbf-discrete-gpu→beta· +71 −15 · 2 files · 1 commits · openWhat
On a laptop with two GPUs, KLBF Lab made its D3D12 device on the default adapter, which Windows lists as the integrated GPU unless the user sets a per-app preference. So on a hybrid laptop the game, and every "hardware" shader test, run on the integrated GPU.
Found on an RTX 4060 Laptop GPU + Intel UHD Graphics (i7-13620H, Windows 11 24H2): adapter 0 is the Intel UHD, adapter 1 the RTX 4060.
Change
victory-gpuhost: the first hardware adapter inDXGI_GPU_PREFERENCE_HIGH_PERFORMANCEorder that creates a D3D12 device is used, and its name is logged (host device adapter=...). If DXGI cannot order adapters it falls back to the default, as before. Software adapters (WARP, the Basic Render Driver) are never picked.emit/host.rs): the same choice, so GPU tests run on the discrete GPU.VICTORY_TEST_ADAPTER=ntakes the n-th hardware adapter in that order, to run the suite on each GPU of a machine. The adapter name is printed in test output only.high_performance_adapter_is_hardware.Note: this overrides a "power saving" choice made for victory.exe in Windows graphics settings, which is the usual behaviour for games.
Testing
cargo test --workspace --all-featuresonbeta(c71c7d6), RTX 4060 Laptop + Intel UHD, Windows 11 24H2, Rust 1.98.1:betaas publishedVICTORY_TEST_ADAPTER=17 of the 9 failures are Intel UHD driver behaviour (
intersect_tests×4,ds_min_max_f32...,v_permlane16...,whole_wave_f64...). The 2 left (emit::rect::tests::*) fail onbetatoo and are not touched here.Also seen: in one run of
betaas published on the Intel UHD, thevictory-gputest binary exited withSTATUS_ACCESS_VIOLATIONafterwatch::mapping_tests::reads_in_place_and_remappings_wait_for_each_other. It did not happen with this PR, but I did not look into it.cargo check/cargo build --release -p victory: OK.cargo clippy -D warningsreports the same two errors with and without this PR (draw.rssort_unstable_by_key,indirect.rsdepth_written); none are new.The same fix is open upstream as Marvisak/VIctory#1483.
AI-assisted (Claude).
🤖 Generated with Claude Code
The host device and the shader test host were made on the default adapter, which on a laptop with two GPUs is the integrated one (adapter 0) unless the user set a per-app preference in Windows. On an RTX 4060 Laptop + Intel UHD machine the game and every "hardware" test ran on the Intel UHD. Now the first hardware adapter in DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE order that makes a D3D12 device is used, and its name is logged ("host device"). Falls back to the default adapter if DXGI cannot order them. Software adapters (WARP, the Basic Render Driver) are never picked. For the tests, VICTORY_TEST_ADAPTER=n takes the n-th hardware adapter in that order, so a suite can be run on each GPU of a machine. Co-Authored-By: Claude Opus 5.5 <[email protected]>@PastiiJay on GitHub · 2026-11-25 18:38 UTC · original
Thanks a lot @spy0eye-beep! Noted. It goes into tonight's RX 9070 XT test queue and I'll report the result here.
@HandshakeHackin on GitHub · 2026-11-26 04:38 UTC · original
On a Windows runner with no physical GPU,
high_performance_adapter()at6b4569breturned Microsoft Basic Render Driver as the preferred hardware adapter. Its DXGI descriptor was1414:008c, flags0x0. Explicit WARP had the same IDs, flags0x2, and a different LUID. The PR’s shader host already recognizes both forms and correctly reportsno hardware adapter. Original resultI tested a three-line change on top of this PR that gives the runtime selector the same PCI-ID check. It then returns
Noneon this machine. The normal runtime still starts through its existing default fallback, and forcing WARP still selects the explicit software adapter. All three checks passed. The original laptop results remain the test of discrete-versus-integrated selection. Cherry-pick7786134· Windows verification@PastiiJay on GitHub · 2026-11-26 10:42 UTC · original
Thanks for catching the Basic Render Driver case on GPU-less runners. We'll try it on a laptop before merging.
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.