You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何强制程序使用Intel Arc独显?附AMD/NVIDIA的C++实现代码

强制程序使用独立显卡的C++实现

AMD/NVIDIA平台实现代码

针对NVIDIA Optimus和AMD PowerXpress双显卡平台,可通过导出全局变量的方式强制启用独立显卡,代码如下:

extern "C"
{
  __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
  __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}

Intel Arc系列显卡解决方案

全局变量导出方式

Intel Arc显卡属于Xe架构平台,可通过导出IntelGPUPreference全局变量指定优先使用高性能独立显卡,代码如下:

extern "C"
{
  __declspec(dllexport) int IntelGPUPreference = 1;
}
  • 变量值1表示优先选择高性能独立显卡(Intel Arc),0表示优先使用集成显卡。

图形API显式选择(备选方案)

如果全局变量方式不生效,可通过图形API(如DirectX 12、Vulkan)显式枚举并选择Intel Arc显卡。以DirectX 12为例:

#include <d3d12.h>
#include <vector>
#include <string>

IDXGIAdapter1* FindIntelArcAdapter() {
    IDXGIFactory4* pFactory = nullptr;
    if (CreateDXGIFactory1(IID_PPV_ARGS(&pFactory)) != S_OK) {
        return nullptr;
    }

    IDXGIAdapter1* pAdapter = nullptr;
    std::vector<IDXGIAdapter1*> adapters;
    while (pFactory->EnumAdapters1(adapters.size(), &pAdapter) != DXGI_ERROR_NOT_FOUND) {
        DXGI_ADAPTER_DESC1 desc;
        pAdapter->GetDesc1(&desc);
        std::string adapterName(desc.Description);
        if (adapterName.find("Intel Arc") != std::string::npos) {
            pFactory->Release();
            return pAdapter;
        }
        adapters.push_back(pAdapter);
    }

    pFactory->Release();
    return nullptr;
}

调用该函数找到Intel Arc适配器后,即可基于此创建DirectX设备,强制程序使用独立显卡。

内容的提问来源于stack exchange,提问作者OW2 Is Trash

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.01 15:00:02