From 220c3301cfae7a28bb092b07f0af7a4a3b478988 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 9 Mar 2018 12:31:35 +0100 Subject: [PATCH] [dxvk] Tweaked command stream chunk sizes and submission Improves overall frame rate and latency in situations where the application's render thread cannot keep up with the CS thread. Considerable frametime improvements in NieR:Automata and slightly higher frame rates in The Witcher 3. --- src/dxvk/dxvk_cs.cpp | 7 ++----- src/dxvk/dxvk_cs.h | 4 ++-- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/dxvk/dxvk_cs.cpp b/src/dxvk/dxvk_cs.cpp index 24ad6a850..dd237758e 100644 --- a/src/dxvk/dxvk_cs.cpp +++ b/src/dxvk/dxvk_cs.cpp @@ -57,12 +57,9 @@ namespace dxvk { m_chunksQueued.push(std::move(chunk)); m_chunksPending += 1; - // If a large number of chunks are queued up, wait for - // some of them to be processed in order to avoid memory - // leaks, stuttering, input lag and similar issues. - if (m_chunksPending >= MaxChunksInFlight) { + if (m_chunksPending > MaxChunksInFlight) { m_condOnSync.wait(lock, [this] { - return (m_chunksPending < MaxChunksInFlight / 2) + return (m_chunksPending <= MaxChunksInFlight ) || (m_stopped.load()); }); } diff --git a/src/dxvk/dxvk_cs.h b/src/dxvk/dxvk_cs.h index 13c800ad0..a1b32d826 100644 --- a/src/dxvk/dxvk_cs.h +++ b/src/dxvk/dxvk_cs.h @@ -88,7 +88,7 @@ namespace dxvk { * Stores a list of commands. */ class DxvkCsChunk : public RcObject { - constexpr static size_t MaxBlockSize = 65536; + constexpr static size_t MaxBlockSize = 16384; public: DxvkCsChunk(); @@ -168,7 +168,7 @@ namespace dxvk { class DxvkCsThread { // Limit the number of chunks in the queue // to prevent memory leaks, stuttering etc. - constexpr static uint32_t MaxChunksInFlight = 16; + constexpr static uint32_t MaxChunksInFlight = 32; public: DxvkCsThread(const Rc& context);