gpt4 book ai didi

c++ - DirectX11 桌面复制不适用于 NVIDIA

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:08:02 26 4
gpt4 key购买 nike

我也在尝试使用 DirectX desktop duplication API .

我尝试从

运行 exmaples

http://www.codeproject.com/Tips/1116253/Desktop-Screen-Capture-on-Windows-via-Windows-Desk

https://code.msdn.microsoft.com/windowsdesktop/Desktop-Duplication-Sample-da4c696a

这两个都是使用 DXGI 进行屏幕捕获的示例。

我的机器上有 NVIDIA GeForce GTX 1060Windows 10 Pro。它具有 Intel™ Core i7-6700HQ 处理器。

nvidia控制面板> 3D设置被选择为自动选择处理器

时,这些示例的工作正常。

但是,如果我手动将设置设置为 NVIDIA 显卡,示例将停止工作。

错误发生在以下行。

//IDXGIOutput1* DxgiOutput1
hr = DxgiOutput1->DuplicateOutput(m_Device, &m_DeskDupl);

hr(HRESULT) 中的错误是 DXGI_ERROR_UNSUPPORTED 0x887A0004

我是 DirectX 的新手,我不知道这里的问题,NVIDIA 不支持 DirectX 桌面复制吗

如果是这种情况,那么有没有办法在程序开始时选择特定的处理器,以便程序可以在任何设置下运行?

#编辑

环顾四周后,我在 codeproject.com 上询问了第二个示例项目的开发人员 (Evgeny Pereguda)

这是讨论的链接 https://www.codeproject.com/Tips/1116253/Desktop-Screen-Capture-on-Windows-via-Windows-Desk?msg=5319978#xx5319978xx

在 codeproject.com 上发布讨论的屏幕截图以防原始链接失效

discussion with Evgeny Pereguda

我还找到了一个 answer on stackoverflow这明确表示无法使用桌面复制 API 引用微软支持网站上的支持票证 https://support.microsoft.com/en-us/help/3019314/error-generated-when-desktop-duplication-api-capable-application-is-ru

票据引用

This issue occurs because the DDA 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.

但是,有些应用程序可以在我的机器上以两种模式(集成显卡和独立显卡)有效地复制 Windows 上的桌面。 ( https://www.youtube.com/watch?v=bjE6qXd6Itw )

我查看了我机器上虚拟桌面的安装文件夹,可以看到以下感兴趣的DLL

SharpDX.D3DCompiler.dll
SharpDX.Direct2D1.dll
SharpDX.Direct3D10.dll
SharpDX.Direct3D11.dll
SharpDX.Direct3D9.dll
SharpDX.dll
SharpDX.DXGI.dll
SharpDX.Mathematics.dll

这可能表明此应用程序正在使用 DXGI 复制桌面,或者可能是该应用程序能够在启动前选择特定的处理器。

无论如何,问题仍然存在,是否有任何其他有效的方法可以在两种模式下复制桌面?

最佳答案

可能的原因是桌面复制 API 的某些内部限制,如 Error generated when Desktop Duplication API-capable application is run against discrete GPU 中所述:

... when the application tries to duplicate the desktop image against the discrete GPU on a Microsoft Hybrid system, the application may not run correctly, or it may generate one of the following errors:

  • Failed to create windows swapchain with 0x80070005
  • CDesktopCaptureDWM: IDXGIOutput1::DuplicateOutput failed: 0x887a0004

除了使用不同的 GPU 之外,这篇文章没有建议任何其他解决方法(没有更具体的细节说明它是否完全可以通过编程实现):

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

关于c++ - DirectX11 桌面复制不适用于 NVIDIA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40221187/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com