桌面复制 API 和可切换图形

Desktop Duplication API & switchable graphics

问题:当您 运行 在机器上使用独立图形控制器的应用程序时调用 IDXGIOutput1::DuplicateOutput method returns DXGI_ERROR_UNSUPPORTED具有可切换的图形。

This answer 阐明了这个问题。简而言之,独立显卡只渲染屏幕的一部分,并将数据发送到集成图形控制器的帧缓冲区——换句话说,所有输出始终通过集成图形控制器。看来这就是为什么 DuplicateOutput returns DXGI_ERROR_UNSUPPORTED.

我编写了一个示例,使用 winapi (EnumDisplayDevices function) & directx (IDXGIFactory::EnumAdapters method & IDXGIAdapter::EnumOutputs method) 获取所有输出及其视频适配器,以便在具有可切换图形的机器上进行比较(Intel HD 4600 和 NVIDIA 840M ).这是结果:

不确定我的比较是否正确,但是你可以看到 winapi 说 DISPLAY1 属于 Intel 卡和 directx 说 DISPLAY1 属于 NVIDIA 卡。一种解决方案是复制 Intel 卡的输出(因为一切都通过它)但是 EnumOutputs returns 没有输出。

目前有一个解决方法:总是运行一个使用集成图形控制器的复制API的应用程序。

问题:如何使 DuplicateOutput 与可切换显卡笔记本电脑上的独立显卡控制器一起工作?或者是桌面复制的限制 API?

已解决:

unfortunately this issue occurs because the Desktop Duplication API does not support being run against the discrete GPU on a Microsoft Hybrid system. By design, the call fails together with error code DXGI_ERROR_UNSUPPORTED in such a scenario.

To work around this issue, run the application on the integrated GPU instead of on the discrete GPU on a Microsoft Hybrid system.

从这里开始:https://support.microsoft.com/en-us/kb/3019314