scripts: ask for the high-performance GPU on two-GPU laptops #126
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/126"
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?
Imported from Zettrox/ztrx. Originally posted by Logan-Gaillard on 2026-11-25T13:13:14Z.
On a laptop with an integrated GPU and a discrete one, Windows gives a newly built exe the power-saving GPU. There the game fails at once: on an RTX 5070 Laptop + Intel iGPU machine, fresh builds run without a preference died with
E_OUTOFMEMORY(the log showswave lanes 8–32and a "card budget" that is shared RAM), as reported in the opening post of #91, until the exe was given the high-performance GPU.scripts/play.ps1now sets the per-application graphics preference for the exe it runs: current user only, the same setting as Settings → System → Display → Graphics (HKCU\Software\Microsoft\DirectX\UserGpuPreferences,GpuPreference=2). Nothing system-wide changes.-KeepGpuChoiceleaves it alone.Tested: this is the same registry value our test runner writes before every run (
Set-GpuPreference), which is how all of that bench's runs got the discrete GPU.play.ps1itself parses but was not run end to end.From a three-agent test bench (reviewed by @1mlesc before posting). No game data.
Imported from Zettrox/ztrx. Originally posted by xiaotu030202 on 2026-11-25T15:24:45Z.
I can confirm the mechanism on a real Windows 11 machine, including the exact value string — this is the kind of claim that is easy to get subtly wrong and cheap to check.
The registry key is real and already populated
HKCU:\Software\Microsoft\DirectX\UserGpuPreferencesexists on this box (RTX 5070 Ti, Windows 11 22631) without anything having to create it, and four applications were already using it:Two things that follows:
The value format matches yours exactly —
GpuPreference=2;, with the trailing semicolon. I wrote and read back a test entry to be sure the type and shape survive:2is what other applications use for "high performance" and1for "power saving", which is the same numbering the Settings > Graphics dropdown writes. Armoury Crate on this machine is explicitly set to1(it wants the iGPU); three other apps are2. So your constant is the right one and the semantics are not something you inferred from documentation alone — they are observable in a real profile.I also confirmed
Resolve-Path $Exeis not decorative: the key is matched against the full path, and the existing entries above are all absolute. A relative.\target\release\victory.exein the key would not match. Your line before the write is load-bearing.Where I would push back slightly
Resolve-Paththrows when the exe is missing, and it now does so before the old code would have failed.Unpatched, a bad
-Exeproduced whatever error came later fromStart-Process— afterNew-Itemhad created the cache and data directories, and after theEnv:cleanup. Patched,Resolve-Paththrows at that line, so$Cache/$Dataare no longer created andVICTORY_CACHE_DIRis no longer set. That is arguably better (fail earlier, change nothing) but it is a behaviour change in the failure path that the PR description does not mention. Worth one sentence either way.The write is not attempted under
-KeepGpuChoice, but nothing tells the user the preference persists. The registry value outlives the script. Someone who runsplay.ps1once and later wants the default back has to go to Settings > Graphics, or pass-KeepGpuChoicebefore the first run — after the value is written, the switch does nothing. A line saying so, or a-DefaultGpuChoicethat removes the value, would close that.Neither is a blocker; the core change is right and the switch name is honest about what it does.
What I could not test
I have no second GPU, so I cannot demonstrate the failure it fixes — that a freshly built exe lands on the iGPU and dies with
E_OUTOFMEMORY. The report's premise (Windows picks the power-saving adapter for a new binary) is consistent with what I see here — the fact that applications bother to writeGpuPreference=2;at all is evidence that the default is not the discrete one — but the actual iGPU path is untested on this machine.If you want that covered, a
Get-ItemPropertycheck after a run on the two-GPU laptop would show the value stuck, which is the closest thing to a test this can have.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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.