Forcing NVIDIA GPU programmatically in Optimus laptops

后端 未结 2 818
梦毁少年i
梦毁少年i 2020-12-02 15:36

I\'m programming a DirectX game, and when I run it on an Optimus laptop the Intel GPU is used, resulting in horrible performance. If I force the NVIDIA GPU using the context

2条回答
  •  天命终不由人
    2020-12-02 16:35

    According to http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf starting from 302 drivers it is enough to link statically with one of the following libraries: vcamp110.dll, vcamp110d.dll, nvapi.dll, nvapi64.dll, opencl.dll, nvcuda.dll, cudart*.*, or to export a NvOptimusEnablement variable in your program:

    extern "C" {
        _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    }
    

提交回复
热议问题