From 6adf53458994982a47c5bf9429b6dc41582f6758 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 15 Nov 2018 09:24:11 +0100 Subject: [PATCH] [dxvk] Add option to set number of pipeline compiler threads --- src/dxvk/dxvk_options.cpp | 3 ++- src/dxvk/dxvk_options.h | 4 ++++ src/dxvk/dxvk_pipemanager.cpp | 2 +- src/dxvk/dxvk_state_cache.cpp | 5 +++++ src/dxvk/dxvk_state_cache.h | 3 +++ 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/dxvk/dxvk_options.cpp b/src/dxvk/dxvk_options.cpp index 51e7140c5..d769ba77d 100644 --- a/src/dxvk/dxvk_options.cpp +++ b/src/dxvk/dxvk_options.cpp @@ -3,7 +3,8 @@ namespace dxvk { DxvkOptions::DxvkOptions(const Config& config) { - allowMemoryOvercommit = config.getOption("dxvk.allowMemoryOvercommit", false); + allowMemoryOvercommit = config.getOption ("dxvk.allowMemoryOvercommit", false); + numCompilerThreads = config.getOption ("dxvk.numCompilerThreads", 0); } } \ No newline at end of file diff --git a/src/dxvk/dxvk_options.h b/src/dxvk/dxvk_options.h index 2547234a0..93fb8ace7 100644 --- a/src/dxvk/dxvk_options.h +++ b/src/dxvk/dxvk_options.h @@ -10,6 +10,10 @@ namespace dxvk { /// Allow allocating more memory from /// a heap than the device supports. bool allowMemoryOvercommit; + + /// Number of compiler threads + /// when using the state cache + int32_t numCompilerThreads; }; } \ No newline at end of file diff --git a/src/dxvk/dxvk_pipemanager.cpp b/src/dxvk/dxvk_pipemanager.cpp index 1e27b8e5e..7ce4574fd 100644 --- a/src/dxvk/dxvk_pipemanager.cpp +++ b/src/dxvk/dxvk_pipemanager.cpp @@ -47,7 +47,7 @@ namespace dxvk { std::string useStateCache = env::getEnvVar(L"DXVK_STATE_CACHE"); if (useStateCache != "0") - m_stateCache = new DxvkStateCache(this, passManager); + m_stateCache = new DxvkStateCache(device, this, passManager); } diff --git a/src/dxvk/dxvk_state_cache.cpp b/src/dxvk/dxvk_state_cache.cpp index 0d8398942..c7efeb6c5 100644 --- a/src/dxvk/dxvk_state_cache.cpp +++ b/src/dxvk/dxvk_state_cache.cpp @@ -1,3 +1,4 @@ +#include "dxvk_device.h" #include "dxvk_pipemanager.h" #include "dxvk_state_cache.h" @@ -29,6 +30,7 @@ namespace dxvk { DxvkStateCache::DxvkStateCache( + const DxvkDevice* device, DxvkPipelineManager* pipeManager, DxvkRenderPassPool* passManager) : m_pipeManager(pipeManager), @@ -65,6 +67,9 @@ namespace dxvk { if (numWorkers < 1) numWorkers = 1; if (numWorkers > 16) numWorkers = 16; + + if (device->config().numCompilerThreads > 0) + numWorkers = device->config().numCompilerThreads; Logger::info(str::format("DXVK: Using ", numWorkers, " compiler threads")); diff --git a/src/dxvk/dxvk_state_cache.h b/src/dxvk/dxvk_state_cache.h index 65daa0537..af8c1a73f 100644 --- a/src/dxvk/dxvk_state_cache.h +++ b/src/dxvk/dxvk_state_cache.h @@ -13,6 +13,8 @@ namespace dxvk { + class DxvkDevice; + /** * \brief State cache entry key * @@ -81,6 +83,7 @@ namespace dxvk { public: DxvkStateCache( + const DxvkDevice* device, DxvkPipelineManager* pipeManager, DxvkRenderPassPool* passManager);