vvvv / VL.StandardLibs

A collection of standard libraries for vvvv including VL.Stride, VL.Skia, VL.ImGui, msgpack.org[VL]
https://visualprogramming.net
GNU Lesser General Public License v3.0
41 stars 16 forks source link

Startup exported app with high performance GPU on hybrid or optimus systems #113

Open tebjan opened 2 years ago

tebjan commented 2 years ago

Problem: Exported apps start with low-power GPU by default.

Some discussion here: https://github.com/stride3d/stride/issues/707

Possible with DXGI >= 1.6 according to: https://stackoverflow.com/questions/55435230/how-to-ensure-directx-11-app-use-the-discrete-gpu-on-a-dual-gpu-laptop-with-c

But SharpDX only has up to DXGI 1.5: https://github.com/sharpdx/SharpDX/tree/master/Source/SharpDX.DXGI

So we have to wait for: https://github.com/stride3d/stride/pull/1123 Or hack it in some other way...

Considerations: The ideal way to solve this is with a registry entry for the exe. If the exe itself requests the high-performance GPU the end-user cannot change it in the windows setting anymore.

joreg commented 2 years ago

arturo wrote:

there's a way to force the integrated gpu by exporting some symbols in the app binary. In c and other systems languages, it's as simple as defining a variable with a specific name and mark it as dllexport:

__declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;

never used it in c# but looking a bit there's some related results: http://lucasmagder.com/blog/2014/05/exporting-data-symbols-in-c-for-nvidia-optimus/ The first line forces integrated nvidia and the second one integrated amd. They can be both enabled at once and it's not a problem if they are used when an integrated card is not present or if there's no iGPU. What I don't think is it can be enabled or disabled at runtime like via a command line parameter since it's just symbols defined in the binary. But probably you want vvvv to run by default on the integrated card anyway and most probably this can be overridden by the setting in the nvidia control panel