From f42f7cc74364c1829fe293e5f141e4923da02a93 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sun, 13 May 2018 16:02:23 +0200 Subject: [PATCH] [dxvk] Make use of the asynchronous pipeline compiler optional Users can enable this by setting DXVK_USE_PIPECOMPILER=1. --- README.md | 1 + src/dxvk/dxvk_graphics.cpp | 7 +++++-- src/dxvk/dxvk_pipemanager.cpp | 6 ++++-- src/dxvk/dxvk_pipemanager.h | 6 +++--- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 6d3cb1a3f..ceeb3a8c5 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,7 @@ The following environment variables can be used for **debugging** purposes. - `DXVK_CUSTOM_DEVICE_ID=` Specifies a custom PCI device ID - `DXVK_LOG_LEVEL=none|error|warn|info|debug` Controls message logging - `DXVK_FAKE_DX10_SUPPORT=1` Advertizes support for D3D10 interfaces +- `DXVK_USE_PIPECOMPILER=1` Enable asynchronous pipeline compilation. This currently only has an effect on RADV in mesa-git. ## Troubleshooting DXVK requires threading support from your mingw-w64 build environment. If you diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index b1bc125d0..4d2e9f6ed 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -120,7 +120,8 @@ namespace dxvk { // vector, create a new one and add it to the list. VkPipeline newPipelineBase = m_basePipelineBase.load(); VkPipeline newPipelineHandle = this->compilePipeline(state, renderPassHandle, - VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT, newPipelineBase); + m_compiler != nullptr ? VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT : 0, + newPipelineBase); Rc newPipeline = new DxvkGraphicsPipelineInstance(m_device->vkd(), state, @@ -147,7 +148,9 @@ namespace dxvk { m_basePipelineBase.compare_exchange_strong(newPipelineBase, newPipelineHandle); // Compile optimized pipeline asynchronously - m_compiler->queueCompilation(this, newPipeline); + if (m_compiler != nullptr) + m_compiler->queueCompilation(this, newPipeline); + return newPipelineHandle; } diff --git a/src/dxvk/dxvk_pipemanager.cpp b/src/dxvk/dxvk_pipemanager.cpp index ae5da3075..6e8144b8d 100644 --- a/src/dxvk/dxvk_pipemanager.cpp +++ b/src/dxvk/dxvk_pipemanager.cpp @@ -41,8 +41,10 @@ namespace dxvk { DxvkPipelineManager::DxvkPipelineManager(const DxvkDevice* device) : m_device (device), m_cache (new DxvkPipelineCache(device->vkd())), - m_compiler(new DxvkPipelineCompiler()) { - + m_compiler(nullptr) { + // Async shader compilation is opt-in for now + if (env::getEnvVar(L"DXVK_USE_PIPECOMPILER") == "1") + m_compiler = new DxvkPipelineCompiler(); } diff --git a/src/dxvk/dxvk_pipemanager.h b/src/dxvk/dxvk_pipemanager.h index 8da847013..232c13739 100644 --- a/src/dxvk/dxvk_pipemanager.h +++ b/src/dxvk/dxvk_pipemanager.h @@ -97,9 +97,9 @@ namespace dxvk { private: - const DxvkDevice* m_device; - const Rc m_cache; - const Rc m_compiler; + const DxvkDevice* m_device; + Rc m_cache; + Rc m_compiler; std::mutex m_mutex;