There is an option in Windows control panel that allows to set a app to "high performance". Control Panel -> System -> Display -> Graphics Settings.
On adding my application there, I noticed that, when encoding with Media Foundation and H.265 it uses the NVIDIA gfx adapter for encoding. Before that, it used to use the embedded Intel graphics which would only do H.264 encoding, so H.265 encoding was slowly done in CPU.
How can I add my application there programmatically? It's crucial for my sequencer's performance.
Thanks a lot.
To my best knowledge there is no API or documentation for this. The preference is, however, kept in registry under
HKEY_CURRENT_USER\Software\Microsoft\DirectX\UserGpuPreferences
String value with GpuPreference
part and integer value corresponding DXGI_GPU_PREFERENCE
enumeration.
If you set the value there programmatically, it is picked up with next app restart. The parent UserGpuPreferences
and DirectX
keys might not exist, so you need to make sure they are present too.
Also, to my best knowledge, this preference takes precedence over possibly existing similar preference setting in vendor (AMD, NVIDIA) specific settings.
See also:
If your application is C:\testapp.exe
, you want to create the following registry entry:
[HKEY_CURRENT_USER\SOFTWARE\Microsoft\DirectX\UserGpuPreferences]
"C:\\testapp.exe"="GpuPreference=1;"
Or another way is to add the override interactively using settings and then review the created registry value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With