From 6d999fad891584e0d8087b8f42b6f9b18f6ad20f Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 11 Jun 2019 15:45:32 +0200 Subject: [PATCH] [dxgi] Fix some issues introduced with FilterModesByDesc cleanup --- src/dxgi/dxgi_output.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/dxgi/dxgi_output.cpp b/src/dxgi/dxgi_output.cpp index 1da174a3..34008974 100644 --- a/src/dxgi/dxgi_output.cpp +++ b/src/dxgi/dxgi_output.cpp @@ -475,17 +475,30 @@ namespace dxvk { }); } + bool testScanlineOrder = false; + bool testScaling = false; + bool testFormat = false; + + for (const auto& mode : Modes) { + testScanlineOrder |= TargetMode.ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED + && TargetMode.ScanlineOrdering == mode.ScanlineOrdering; + testScaling |= TargetMode.Scaling != DXGI_MODE_SCALING_UNSPECIFIED + && TargetMode.Scaling == mode.Scaling; + testFormat |= TargetMode.Format != DXGI_FORMAT_UNKNOWN + && TargetMode.Format == mode.Format; + } + for (auto it = Modes.begin(); it != Modes.end(); ) { bool skipMode = it->Stereo != TargetMode.Stereo; - if (TargetMode.ScanlineOrdering != DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED) + if (testScanlineOrder) skipMode |= it->ScanlineOrdering != TargetMode.ScanlineOrdering; - if (TargetMode.Scaling != DXGI_MODE_SCALING_UNSPECIFIED) + if (testScaling) skipMode |= it->Scaling != TargetMode.Scaling; - if (TargetMode.Format != DXGI_FORMAT_UNKNOWN) - skipMode |= it->Scaling != TargetMode.Scaling; + if (testFormat) + skipMode |= it->Format != TargetMode.Format; if (TargetMode.Width) { uint32_t diff = std::abs(int32_t(TargetMode.Width - it->Width))