码迷,mamicode.com
首页 > 其他好文 > 详细

OpenGL程序使用独显运行的方法

时间:2020-01-12 18:30:29      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:multi   line   following   game   developer   变量   usr   dllexport   VID   

在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;

OpenGL程序使用独显运行的方法

标签:multi   line   following   game   developer   变量   usr   dllexport   VID   

原文地址:https://www.cnblogs.com/sdragonx/p/12183194.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!