Programmatically set Graphics Performance for an app

谁说胖子不能爱 提交于 2021-02-07 04:17:57

问题


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.


回答1:


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.

Also, to my best knowledge, this preference takes precedence over possibly existing similar preference setting in vendor (AMD, NVIDIA) specific settings.

See also:

  • Graphics performance preference on MSDN Forums


来源:https://stackoverflow.com/questions/59732181/programmatically-set-graphics-performance-for-an-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!