From fa782594590a6d0b442aad8162efe8f4c11b01d4 Mon Sep 17 00:00:00 2001 From: Mikhail Paulyshka Date: Tue, 13 Mar 2018 00:28:34 +0300 Subject: [PATCH] [dxgi] fix DxgiOutput::FindClosestMatchingMode() implementation (#157) * remove useless checks * fix refresh rate matching and unspecified detection --- src/dxgi/dxgi_output.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/src/dxgi/dxgi_output.cpp b/src/dxgi/dxgi_output.cpp index 965f769a..44894a6a 100644 --- a/src/dxgi/dxgi_output.cpp +++ b/src/dxgi/dxgi_output.cpp @@ -93,21 +93,14 @@ namespace dxvk { std::vector modes(modesCount); GetDisplayModeList(pModeToMatch->Format, 0, &modesCount, modes.data()); - //filter out modes with different scanline ordering if it was set - if (modeToMatch.ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED) { - for (auto it = modes.begin(); it != modes.end();) { - if (it->ScanlineOrdering != modeToMatch.ScanlineOrdering) - it = modes.erase(it); - else - ++it; - } - } + /* TODO: add scaling and scanline filter when we implement they */ //filter out modes with different refresh rate if it was set - if (modeToMatch.RefreshRate.Denominator != 0 || modeToMatch.RefreshRate.Numerator != 0) { + if (modeToMatch.RefreshRate.Denominator != 0 && modeToMatch.RefreshRate.Numerator != 0) { + UINT targetRefreshRate = modeToMatch.RefreshRate.Numerator / modeToMatch.RefreshRate.Denominator; for (auto it = modes.begin(); it != modes.end();) { - if (it->RefreshRate.Denominator != modeToMatch.RefreshRate.Denominator || - it->RefreshRate.Numerator != modeToMatch.RefreshRate.Numerator) + UINT modeRefreshRate = it->RefreshRate.Numerator / it->RefreshRate.Denominator; + if (modeRefreshRate != targetRefreshRate) it = modes.erase(it); else ++it;