C++ Switching Laptop primary GPU

-1

Problem: Laptops with multi GPUs has Nvidia Optimus or AMD PowerXpress switches which uses laptops dedicated GPUs if load on IGPU is too high, I tried to find a way to manipulate this switch, but with no success.

Half of solution and problem: Using endlesly google I found that you can enable/disable switch by using this code:

extern "C" {
// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
__declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;

// http://developer.amd.com/community/blog/2015/10/02/amd-enduro-system-for-developers/
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}

It does switch to dedicated GPU, but if I want to restore by changing from 1 to 0 it does not work.

What I want to achieve: By manipulating this switch I want control each GPU, by using D3D11CreateDevice or CreateDevice to use every GPU without triggering mentioned switches even load on IGPU is too high to handle

What might help you to help me a solve this issue: I found switch does same thing on Mac OS: https://github.com/0xbb/gpu-switch

How to check if switch is working: since laptops has one screen using DirectX function EnumerateAdapters(); and GetAdapterIdentifier shows single GPU, meaning by default it should show IGPU and using my mentioned code it switch to dedicated GPU but restoring values to 0 it does not switch back to IGPU.

c++
windows
gpu
asked on Stack Overflow Jul 5, 2019 by Joel2 • edited Jul 5, 2019 by SE_net4 the downvoter

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0