1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 19:24:12 +01:00

[dxgi] fix DxgiOutput::FindClosestMatchingMode() implementation (#157)

* remove useless checks
* fix refresh rate matching and unspecified detection
This commit is contained in:
Mikhail Paulyshka 2018-03-13 00:28:34 +03:00 committed by Philip Rebohle
parent bfd2b29317
commit fa78259459

View File

@ -93,21 +93,14 @@ namespace dxvk {
std::vector<DXGI_MODE_DESC> modes(modesCount); std::vector<DXGI_MODE_DESC> modes(modesCount);
GetDisplayModeList(pModeToMatch->Format, 0, &modesCount, modes.data()); GetDisplayModeList(pModeToMatch->Format, 0, &modesCount, modes.data());
//filter out modes with different scanline ordering if it was set /* TODO: add scaling and scanline filter when we implement they */
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;
}
}
//filter out modes with different refresh rate if it was set //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();) { for (auto it = modes.begin(); it != modes.end();) {
if (it->RefreshRate.Denominator != modeToMatch.RefreshRate.Denominator || UINT modeRefreshRate = it->RefreshRate.Numerator / it->RefreshRate.Denominator;
it->RefreshRate.Numerator != modeToMatch.RefreshRate.Numerator) if (modeRefreshRate != targetRefreshRate)
it = modes.erase(it); it = modes.erase(it);
else else
++it; ++it;