diff options
author | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2023-05-31 16:57:34 +0300 |
---|---|---|
committer | Philip Rebohle <philip.rebohle@tu-dortmund.de> | 2023-05-31 18:09:41 +0300 |
commit | 98f8b289d5e97e26fbecc806d35e84449a20fc51 (patch) | |
tree | 9f16de30a3167910a9a6d01b6a18230d5ca55b02 | |
parent | 78a5723116939295ccbc6bd106e512dd64ec5bb7 (diff) |
[dxvk] Introduce dxvk.tearFree optionswapchain-rework
And replace the old frontend-specific options.
-rw-r--r-- | dxvk.conf | 3 | ||||
-rw-r--r-- | src/d3d11/d3d11_options.cpp | 1 | ||||
-rw-r--r-- | src/d3d11/d3d11_options.h | 4 | ||||
-rw-r--r-- | src/d3d9/d3d9_options.cpp | 1 | ||||
-rw-r--r-- | src/d3d9/d3d9_options.h | 4 | ||||
-rw-r--r-- | src/dxvk/dxvk_options.cpp | 1 | ||||
-rw-r--r-- | src/dxvk/dxvk_options.h | 4 | ||||
-rw-r--r-- | src/dxvk/dxvk_presenter.cpp | 8 |
8 files changed, 13 insertions, 13 deletions
@@ -122,8 +122,7 @@ # # Supported values: Auto, True, False -# dxgi.tearFree = Auto -# d3d9.tearFree = Auto +# dxvk.tearFree = Auto # Assume single-use mode for command lists created on deferred contexts. diff --git a/src/d3d11/d3d11_options.cpp b/src/d3d11/d3d11_options.cpp index bcac396b..7c33c88b 100644 --- a/src/d3d11/d3d11_options.cpp +++ b/src/d3d11/d3d11_options.cpp @@ -31,7 +31,6 @@ namespace dxvk { this->maxFrameLatency = config.getOption<int32_t>("dxgi.maxFrameLatency", 0); this->maxFrameRate = config.getOption<int32_t>("dxgi.maxFrameRate", 0); this->syncInterval = config.getOption<int32_t>("dxgi.syncInterval", -1); - this->tearFree = config.getOption<Tristate>("dxgi.tearFree", Tristate::Auto); // Clamp LOD bias so that people don't abuse this in unintended ways this->samplerLodBias = dxvk::fclamp(this->samplerLodBias, -2.0f, 1.0f); diff --git a/src/d3d11/d3d11_options.h b/src/d3d11/d3d11_options.h index 99bca076..a0586f6b 100644 --- a/src/d3d11/d3d11_options.h +++ b/src/d3d11/d3d11_options.h @@ -77,10 +77,6 @@ namespace dxvk { /// passed to IDXGISwapChain::Present. int32_t syncInterval; - /// Tear-free mode if vsync is disabled - /// Tearing mode if vsync is enabled - Tristate tearFree; - /// Override maximum frame latency if the app specifies /// a higher value. May help with frame timing issues. int32_t maxFrameLatency; diff --git a/src/d3d9/d3d9_options.cpp b/src/d3d9/d3d9_options.cpp index 87b87828..83a23e55 100644 --- a/src/d3d9/d3d9_options.cpp +++ b/src/d3d9/d3d9_options.cpp @@ -67,7 +67,6 @@ namespace dxvk { this->allowDiscard = config.getOption<bool> ("d3d9.allowDiscard", true); this->enumerateByDisplays = config.getOption<bool> ("d3d9.enumerateByDisplays", true); this->longMad = config.getOption<bool> ("d3d9.longMad", false); - this->tearFree = config.getOption<Tristate> ("d3d9.tearFree", Tristate::Auto); this->apitraceMode = config.getOption<bool> ("d3d9.apitraceMode", false); this->deviceLocalConstantBuffers = config.getOption<bool> ("d3d9.deviceLocalConstantBuffers", false); this->allowDirectBufferMapping = config.getOption<bool> ("d3d9.allowDirectBufferMapping", true); diff --git a/src/d3d9/d3d9_options.h b/src/d3d9/d3d9_options.h index 13458104..923245ed 100644 --- a/src/d3d9/d3d9_options.h +++ b/src/d3d9/d3d9_options.h @@ -127,10 +127,6 @@ namespace dxvk { /// don't match entirely to the regular vertex shader in this way. bool longMad; - /// Tear-free mode if vsync is disabled - /// Tearing mode if vsync is enabled - Tristate tearFree; - /// Apitrace mode: Maps all buffers in cached memory. bool apitraceMode; diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index 373db325..9c4a8355 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -11,6 +11,7 @@ namespace dxvk { useRawSsbo = config.getOption<Tristate>("dxvk.useRawSsbo", Tristate::Auto); maxChunkSize = config.getOption<int32_t> ("dxvk.maxChunkSize", 0); hud = config.getOption<std::string>("dxvk.hud", ""); + tearFree = config.getOption<Tristate>("dxvk.tearFree", Tristate::Auto); } } diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index fe4e903d..f367e5c6 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -32,6 +32,10 @@ namespace dxvk { /// HUD elements std::string hud; + + /// Forces swap chain into MAILBOX (if true) + /// or FIFO_RELAXED (if false) present mode + Tristate tearFree; }; } diff --git a/src/dxvk/dxvk_presenter.cpp b/src/dxvk/dxvk_presenter.cpp index b6ea8d57..6eca13de 100644 --- a/src/dxvk/dxvk_presenter.cpp +++ b/src/dxvk/dxvk_presenter.cpp @@ -518,9 +518,15 @@ namespace dxvk { std::array<VkPresentModeKHR, 2> desired = { }; uint32_t numDesired = 0; + Tristate tearFree = m_device->config().tearFree; + if (!syncInterval) { - desired[numDesired++] = VK_PRESENT_MODE_IMMEDIATE_KHR; + if (tearFree != Tristate::True) + desired[numDesired++] = VK_PRESENT_MODE_IMMEDIATE_KHR; desired[numDesired++] = VK_PRESENT_MODE_MAILBOX_KHR; + } else { + if (tearFree == Tristate::False) + desired[numDesired++] = VK_PRESENT_MODE_FIFO_RELAXED_KHR; } // Just pick the first desired and supported mode |