Skip to content

Commit 864263a

Browse files
[d3d9] Add a modeHeightFilter config option
1 parent 0746a3b commit 864263a

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

dxvk.conf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,19 @@
555555

556556
# d3d9.forceAspectRatio = ""
557557

558+
# Mode Height Filter
559+
#
560+
# Only exposes modes with certain heights, if they are
561+
# also supported by the adapter. Can be used in conjunction
562+
# with forceAspectRatio to further restrict reported modes.
563+
# Useful for titles that break when too many modes are reported,
564+
# e.g., AquaNox, AquaNox 2: Revelation.
565+
#
566+
# Supported values:
567+
# - A list of mode heights, ie. "480,720,1080"
568+
569+
# d3d9.modeHeightFilter = ""
570+
558571
# Enumerate by Displays
559572
#
560573
# Whether we should enumerate D3D9 adapters by display (windows behaviour)

src/d3d9/d3d9_adapter.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,14 @@ namespace dxvk {
771771
uint32_t modeIndex = 0;
772772

773773
const auto forcedRatio = Ratio<DWORD>(options.forceAspectRatio);
774+
775+
if (!options.modeHeightFilter.empty() && m_forcedHeights.empty()) {
776+
uint32_t forcedHeight;
777+
for (auto height : str::split(options.modeHeightFilter, ",")) {
778+
std::from_chars(height.data(), height.data() + height.size(), forcedHeight);
779+
m_forcedHeights.emplace_back(forcedHeight);
780+
}
781+
}
774782

775783
while (wsi::getDisplayMode(wsi::getDefaultMonitor(), modeIndex++, &devMode)) {
776784
// Skip interlaced modes altogether
@@ -784,6 +792,10 @@ namespace dxvk {
784792
if (!forcedRatio.undefined() && Ratio<DWORD>(devMode.width, devMode.height) != forcedRatio)
785793
continue;
786794

795+
if (!m_forcedHeights.empty() &&
796+
std::find(m_forcedHeights.begin(), m_forcedHeights.end(), devMode.height) == m_forcedHeights.end())
797+
continue;
798+
787799
D3DDISPLAYMODEEX mode = ConvertDisplayMode(devMode);
788800
// Fix up the D3DFORMAT to match what we are enumerating
789801
mode.Format = static_cast<D3DFORMAT>(Format);

src/d3d9/d3d9_adapter.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ namespace dxvk {
107107

108108
const D3D9VkFormatTable m_d3d9Formats;
109109

110+
std::vector<uint32_t> m_forcedHeights;
111+
110112
};
111113

112114
}

0 commit comments

Comments
 (0)