强制在 Microsoft 混合系统上使用集成(Intel)显卡

2024-02-12

我使用 Microsoft 桌面复制 API,如果我的代码在集成(英特尔)显卡上运行,则一切正常。但如果我在专用卡上运行,则会出现错误。

我找到微软不支持这种用法 https://support.microsoft.com/en-my/help/3019314/error-generated-when-desktop-duplication-api-capable-application-is-ru在 Microsoft 混合系统的专用卡上

DXGI_ERROR_UNSUPPORTED

类似的问题没有解决我的需求:

  • DirectX11 桌面复制不适用于 NVIDIA https://stackoverflow.com/questions/40221187/directx11-desktop-duplication-not-working-with-nvidia
  • 桌面复制 API 和可切换显卡 https://stackoverflow.com/questions/37349427/desktop-duplication-api-switchable-graphics

解决方法是在集成卡上启动该程序。

我想从代码中解决这个问题。
我找到可以从我的代码中强制使用 NVIDIA / AMD 卡 https://www.gamedev.net/forums/topic/687516-two-graphics-cards-in-one-computer-how-to-make-decision-when-createdevice

extern "C" { // Hint to Hybrid laptop drivers that our app would really rather use the NVidia/AMD GPU that you've got sitting over there rather than Intel Graphics...
    _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    _declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
  1. Intel 卡有类似的选项吗?
  2. 或者是否可以从我的代码中更改 NVIDIA / AMD 卡设置,以便下次在集成 GPU 上运行? 我的意思是:启动我的应用程序,检查 NVIDIA / AMD 设置,如果不强制使用集成显卡(如果可用),则修改此设置并重新启动我的应用程序。
  3. 还有其他使用集成卡的解决方案吗? (不是手动解决方案)

尽管您可以使用 NVAPI 创建应用程序配置文件并设置特定标志以使您的应用程序在集成芯片上运行,但较新版本的 Windows 可能会覆盖您的首选项。因此,最可靠/最简单的方法是设置注册表值 https://stackoverflow.com/questions/59732181/programmatically-set-graphics-performance-for-an-app是在Windows 10 内部版本 17093 https://blogs.windows.com/windows-insider/2018/02/07/announcing-windows-10-insider-preview-build-17093-pc/.

或者是否可以从我的代码中更改 NVIDIA / AMD 卡设置,以便下次在集成 GPU 上运行?我的意思是:启动我的应用程序,检查 NVIDIA / AMD 设置,如果不强制使用集成显卡(如果可用),则修改此设置并重新启动我的应用程序。

您可以使用注册表值来做到这一点,是的。我在实践中使用这种方法写了一篇概述 https://www.freemancw.com/2020/11/desktop-duplication-on-hybrid-graphics-systems/我如何选择进行 GPU 检查。我相信罗曼·雷尔佐夫(Roman Ryltsov)在他的作品中也做了类似的事情DxgiTakeSnapshot https://alax.info/blog/2075应用程序(他有很多关于该主题的帖子值得阅读)。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

强制在 Microsoft 混合系统上使用集成(Intel)显卡 的相关文章

随机推荐