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