From 64ece36349f73d5ccaccdcfee3b8b797ce20e166 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sat, 11 Jan 2020 02:34:37 +0000 Subject: [PATCH] [d3d9] Implement d3d9.forceSwapchainMSAA Works good enough for some titles like Vampire The Masquerade: Bloodlines. --- dxvk.conf | 6 ++++++ src/d3d9/d3d9_options.cpp | 1 + src/d3d9/d3d9_options.h | 3 +++ src/d3d9/d3d9_swapchain.cpp | 6 ++++++ 4 files changed, 16 insertions(+) diff --git a/dxvk.conf b/dxvk.conf index 1abe286b1..b07b62b3c 100644 --- a/dxvk.conf +++ b/dxvk.conf @@ -289,3 +289,9 @@ # d3d9.enableDialogMode = False +# Overrides the application's MSAA level on the swapchain +# +# Supported values: -1 (application) and 0 to 16 (user override) + +# d3d9.forceSwapchainMSAA = -1 + diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp index 1f290f760..a3c5c6986 100644 --- a/src/d3d9/d3d9_options.cpp +++ b/src/d3d9/d3d9_options.cpp @@ -62,6 +62,7 @@ namespace dxvk { this->supportVCache = config.getOption ("d3d9.supportVCache", vendorId == 0x10de); this->enableDialogMode = config.getOption ("d3d9.enableDialogMode", false); this->forceSamplerTypeSpecConstants = config.getOption ("d3d9.forceSamplerTypeSpecConstants", false); + this->forceSwapchainMSAA = config.getOption ("d3d9.forceSwapchainMSAA", -1); this->forceAspectRatio = config.getOption("d3d9.forceAspectRatio", ""); diff --git a/src/d3d9/d3d9_options.h b/src/d3d9/d3d9_options.h index 9e33f482f..e82441e17 100644 --- a/src/d3d9/d3d9_options.h +++ b/src/d3d9/d3d9_options.h @@ -116,6 +116,9 @@ namespace dxvk { /// Always use a spec constant to determine sampler type (instead of just in PS 1.x) /// Works around a game bug in Halo CE where it gives cube textures to 2d/volume samplers bool forceSamplerTypeSpecConstants; + + /// Forces an MSAA level on the swapchain + int32_t forceSwapchainMSAA; }; } \ No newline at end of file diff --git a/src/d3d9/d3d9_swapchain.cpp b/src/d3d9/d3d9_swapchain.cpp index 42d19b7d1..bc04ce13e 100644 --- a/src/d3d9/d3d9_swapchain.cpp +++ b/src/d3d9/d3d9_swapchain.cpp @@ -417,6 +417,12 @@ namespace dxvk { pPresentParams->BackBufferCount = std::max(pPresentParams->BackBufferCount, 1u); + const int32_t forcedMSAA = m_parent->GetOptions()->forceSwapchainMSAA; + if (forcedMSAA != -1) { + pPresentParams->MultiSampleType = D3DMULTISAMPLE_TYPE(forcedMSAA); + pPresentParams->MultiSampleQuality = 0; + } + if (pPresentParams->Windowed) { GetWindowClientSize(pPresentParams->hDeviceWindow, pPresentParams->BackBufferWidth ? nullptr : &pPresentParams->BackBufferWidth,