OpenGL程序使用獨顯運行的方法


在exe里面導出下面兩個變量,同時對N卡和A卡都有效,程序默認打開就會使用獨顯運行。
導出的變量名字必須和下面的一致,不能有前置下划線。
D3D這些年沒琢磨過,理論這個設置D3D也能用。這個方法是系統層顯卡驅動在程序執行時檢測的一個標記,有這個標記,則用獨顯運行。

// http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
// The following line is to favor the high performance NVIDIA GPU if there are multiple GPUs
// Has to be .exe module to be correctly detected.
// N卡使用獨顯運行
extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;

// And the AMD equivalent
// Also has to be .exe module to be correctly detected.
// A顯卡使用獨顯運行
extern "C" __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 0x00000001;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM