我创建了DXGI适配器和监视器枚举。连接到我的电脑的第二个显示器是Dell P2715Q,具有3840*2160分辨率:
然而,该程序将其报告为第二个可用分辨率2560*1440。最小代码以重现:
int main()
{
IDXGIFactory1* pFactory1;
HRESULT hr = CreateDXGIFactory1(__uuidof(IDXGIFactory1), (void**)(&pFactory1));
if (FAILED(hr))
{
wcout << L"CreateDXGIFactory1 failed. " << endl;
return 0;
}
for (UINT i = 0;; i++)
{
IDXGIAdapter1* pAdapter1 = nullptr;
hr = pFactory1->EnumAdapters1(i, &pAdapter1);
if (hr == DXGI_ERROR_NOT_FOUND)
{
// no more adapters
break;
}
if (FAILED(hr))
{
wcout << L"EnumAdapters1 failed. " << endl;
return 0;
}
DXGI_ADAPTER_DESC1 desc;
hr = pAdapter1->GetDesc1(&desc);
if (FAILED(hr))
{
wcout << L"GetDesc1 failed. " << endl;
return 0;
}
wcout << L"Adapter: " << desc.Description << endl;
for (UINT j = 0;; j++)
{
IDXGIOutput *pOutput = nullptr;
HRESULT hr = pAdapter1->EnumOutputs(j, &pOutput);
if (hr == DXGI_ERROR_NOT_FOUND)
{
// no more outputs
break;
}
if (FAILED(hr))
{
wcout << L"EnumOutputs failed. " << endl;
return 0;
}
DXGI_OUTPUT_DESC desc;
hr = pOutput->GetDesc(&desc);
if (FAILED(hr))
{
wcout << L"GetDesc1 failed. " << endl;
return 0;
}
wcout << L" Output: " << desc.DeviceName <<
L" (" << desc.DesktopCoordinates.left << L"," << desc.DesktopCoordinates.top << L")-(" <<
(desc.DesktopCoordinates.right - desc.DesktopCoordinates.left) << L"," <<
(desc.DesktopCoordinates.bottom - desc.DesktopCoordinates.top) << L")" << endl;
}
}
return 0;
}
输出:
适配器:英特尔(R)Iris(TM)Pro Graphics 6200 输出:\\.\DISPLAY1 (0,0)-(1920,1200) 输出:\\.\DISPLAY2 (1920,0)-(2560,1440)
这种行为可能的原因:DirectX限制、视频内存、显示适配器、驱动程序、显示器?
环境:
Windows 10 x64 Intel(R) Iris(TM) Pro Graphics 6200 DELL P2715Q