gpt4 book ai didi

DXGI 1.5 DuplicateOutput1 失败并显示 DXGI_ERROR_UNSUPPORTED (0x887a0004)

转载 作者:行者123 更新时间:2023-12-02 17:12:47 24 4
gpt4 key购买 nike

由于某些原因,DuplicateOutput1 失败,而 DuplicateOutput 没有。

#include <D3D11.h>
#include <DXGI1_5.h>

int main() {
ID3D11Device *device;
D3D_FEATURE_LEVEL levels[] = { D3D_FEATURE_LEVEL_11_1 };
D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, levels, ARRAYSIZE(levels), D3D11_SDK_VERSION, &device, NULL, NULL);

IDXGIDevice *dxDevice;
device->QueryInterface<IDXGIDevice>(&dxDevice);

IDXGIAdapter *adapter;
dxDevice->GetAdapter(&adapter);

IDXGIOutput *output;
adapter->EnumOutputs(0, &output);

IDXGIOutput5 *output5;
output->QueryInterface<IDXGIOutput5>(&output5);

IDXGIOutputDuplication *outputDuplication;
auto hr1 = output5->DuplicateOutput(device, &outputDuplication);

S_OK 在这里

    const DXGI_FORMAT formats[] = { DXGI_FORMAT_B8G8R8A8_UNORM };
auto hr2 = output5->DuplicateOutput1(device, 0, ARRAYSIZE(formats), formats, &outputDuplication);
}

0x887a0004 : 此系统不支持指定的设备接口(interface)或功能级别。

最佳答案

我会在这里发布@weggo 的答案,因为我差点错过了!

For those that might stumble upon this in the future, calling SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2) allows the DuplicateOutput1 to succeed. I have no idea why the DuplicateOutput1 checks the process dpi version, though.

我只想补充一点,您必须在 list 设置中的解决方案属性中将 DPI 感知设置为 False,才能让 SetProcessDpiAwarenessContext 工作:)

关于DXGI 1.5 DuplicateOutput1 失败并显示 DXGI_ERROR_UNSUPPORTED (0x887a0004),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48207677/

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