Unvanquished / updater

QML based updater to install, update and launch the Unvanquished game.
https://unvanquished.net/download
15 stars 7 forks source link

Default to Nvidia GPU on Windows 10 Optimus systems #96

Closed slipher closed 2 months ago

slipher commented 2 years ago

On these systems there is a "Graphics settings" configuration window where you can configure which GPU you want to use on a per-application basis. The options are "Let Windows decide" (default), "Power saving" (Intel), or "High performance" (Nvidia). "Let Windows decide" seems to always pick Intel for Daemon.

We can programmatically set this preference to "High performance" by creating a registry entry in HKEY_CURRENT_USER\SOFTWARE\Microsoft\DirectX\UserGpuPreferences like C:\Program Files\Unvanquished\daemon.exe REG_SZ GpuPreference=2;.

It's also possible to set this from inside the application, but the registry method seems better since then the "Graphics settings" configurator will work as expected

illwieckz commented 2 years ago

The registry way looks good.

slipher commented 2 years ago

Might want to do this at the launch phase rather than installation, since it's apparently a per-user setting, and the process' user during the install can be different from the actual user (due to admin elevation), or there can be more than one user who wants to play the game.

In any case we should make sure not to change the key if it already exists, so that if the user changes the setting it won't be overwritten on next run/install.