diff --git a/src/dxgi/dxgi_options.cpp b/src/dxgi/dxgi_options.cpp index 033e4d5a..4d04e5f0 100644 --- a/src/dxgi/dxgi_options.cpp +++ b/src/dxgi/dxgi_options.cpp @@ -38,6 +38,8 @@ namespace dxvk { // Interpret the memory limits as Megabytes this->maxDeviceMemory = VkDeviceSize(config.getOption("dxgi.maxDeviceMemory", 0)) << 20; this->maxSharedMemory = VkDeviceSize(config.getOption("dxgi.maxSharedMemory", 0)) << 20; + + this->numBackBuffers = config.getOption("dxgi.numBackBuffers", 0); } } \ No newline at end of file diff --git a/src/dxgi/dxgi_options.h b/src/dxgi/dxgi_options.h index b078eb05..c7baa945 100644 --- a/src/dxgi/dxgi_options.h +++ b/src/dxgi/dxgi_options.h @@ -37,6 +37,10 @@ namespace dxvk { /// more than 4 GiB of VRAM. VkDeviceSize maxDeviceMemory; VkDeviceSize maxSharedMemory; + + /// Back buffer count for the Vulkan swap chain. + /// Overrides DXGI_SWAP_CHAIN_DESC::BufferCount. + int32_t numBackBuffers; }; } diff --git a/src/dxgi/dxgi_swapchain.cpp b/src/dxgi/dxgi_swapchain.cpp index 999b0d35..c84570c9 100644 --- a/src/dxgi/dxgi_swapchain.cpp +++ b/src/dxgi/dxgi_swapchain.cpp @@ -272,10 +272,16 @@ namespace dxvk { std::lock_guard lockWin(m_lockWindow); std::lock_guard lockBuf(m_lockBuffer); + // We'll apply certainl user options to the presenter + const DxgiOptions* options = m_factory->GetOptions(); + // Retrieve the number of back buffers. If this option // was defined by the user, it overrides app settings. uint32_t bufferCount = m_desc.BufferCount; + if (options->numBackBuffers > 0) + bufferCount = options->numBackBuffers; + // Higher values are not allowed according to the Microsoft documentation: // // "1 through 4 - Synchronize presentation after the nth vertical blank."