如何获得DXGI中监视器/输出的当前显示模式(分辨率,刷新率)?

All*_*uky 12 windows direct3d fullscreen dxgi

我正在创建一个多显示器全屏DXGI/D3D应用程序.我正在通过可用的输出和适配器进行枚举,以准备创建它们的交换链.

使用DXGI的IDXGIFactory :: CreateSwapChain方法创建交换链时,我需要提供一个交换链描述,其中包含DXGI_MODE_DESC类型的缓冲区描述,详细说明宽度,高度,刷新率等.如何找出输出是什么当前设置为(或者如何找出当前输出的显示模式)?当我使用此交换链进入全屏时,我不想更改用户的分辨率或刷新率.

小智 1

我在这里看到解决方案: http://www.rastertek.com/dx11tut03.html

在以下部分:

   // Now go through all the display modes and find the one that matches the screen width and height.
    // When a match is found store the numerator and denominator of the refresh rate for that monitor.
    for(i=0; i<numModes; i++)
    {
        if(displayModeList[i].Width == (unsigned int)screenWidth)
        {
            if(displayModeList[i].Height == (unsigned int)screenHeight)
            {
                numerator = displayModeList[i].RefreshRate.Numerator;
                denominator = displayModeList[i].RefreshRate.Denominator;
            }
        }
    }
Run Code Online (Sandbox Code Playgroud)

我的理解是否正确,可用的分辨率在displayModeList中。