diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 8b42ca0f..1b99aefa 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -151,25 +151,6 @@ namespace dxvk { } - void DxvkGraphicsPipeline::compileInstance( - const Rc& instance) { - // Compile an optimized version of the pipeline - VkPipeline newPipelineBase = m_basePipeline.load(); - VkPipeline newPipelineHandle = this->compilePipeline( - instance->m_stateVector, instance->m_renderPass, - newPipelineBase); - - if (!instance->setPipeline(newPipelineHandle)) { - // If another thread finished compiling an optimized version of this - // pipeline before this one finished, discard the new pipeline object. - m_vkd->vkDestroyPipeline(m_vkd->device(), newPipelineHandle, nullptr); - } else if (newPipelineBase == VK_NULL_HANDLE && newPipelineHandle != VK_NULL_HANDLE) { - // Use the new pipeline as the base pipeline for derivative pipelines. - m_basePipeline.compare_exchange_strong(newPipelineBase, newPipelineHandle); - } - } - - DxvkGraphicsPipelineInstance* DxvkGraphicsPipeline::findInstance( const DxvkGraphicsPipelineStateInfo& state, VkRenderPass renderPass) const { diff --git a/src/dxvk/dxvk_graphics.h b/src/dxvk/dxvk_graphics.h index 9ed26194..217e7f17 100644 --- a/src/dxvk/dxvk_graphics.h +++ b/src/dxvk/dxvk_graphics.h @@ -5,7 +5,6 @@ #include "dxvk_binding.h" #include "dxvk_constant_state.h" #include "dxvk_pipecache.h" -#include "dxvk_pipecompiler.h" #include "dxvk_pipelayout.h" #include "dxvk_renderpass.h" #include "dxvk_resource.h" @@ -201,16 +200,6 @@ namespace dxvk { const DxvkRenderPass& renderPass, DxvkStatCounters& stats); - /** - * \brief Compiles optimized pipeline - * - * Compiles an optimized version of a pipeline - * and makes it available to the system. - * \param [in] instance The pipeline instance - */ - void compileInstance( - const Rc& instance); - private: struct PipelineStruct { diff --git a/src/dxvk/dxvk_pipecompiler.cpp b/src/dxvk/dxvk_pipecompiler.cpp deleted file mode 100644 index 0a18211e..00000000 --- a/src/dxvk/dxvk_pipecompiler.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "dxvk_graphics.h" -#include "dxvk_pipecompiler.h" - -namespace dxvk { - - DxvkPipelineCompiler::DxvkPipelineCompiler() { - uint32_t sysCpuCount = dxvk::thread::hardware_concurrency(); - uint32_t threadCount = sysCpuCount > 2 ? sysCpuCount - 2 : 1; - - Logger::info(str::format( - "DxvkPipelineCompiler: Using ", - threadCount, " workers")); - - // Start the compiler threads - m_compilerThreads.resize(threadCount); - - for (uint32_t i = 0; i < threadCount; i++) { - m_compilerThreads.at(i) = dxvk::thread( - [this] { this->runCompilerThread(); }); - } - } - - - DxvkPipelineCompiler::~DxvkPipelineCompiler() { - { std::unique_lock lock(m_compilerLock); - m_compilerStop.store(true); - } - - m_compilerCond.notify_all(); - for (auto& thread : m_compilerThreads) - thread.join(); - } - - - void DxvkPipelineCompiler::queueCompilation( - const Rc& pipeline, - const Rc& instance) { - std::unique_lock lock(m_compilerLock); - m_compilerQueue.push({ pipeline, instance }); - m_compilerCond.notify_one(); - } - - - void DxvkPipelineCompiler::runCompilerThread() { - env::setThreadName(L"dxvk-pcompiler"); - - while (!m_compilerStop.load()) { - PipelineEntry entry; - - { std::unique_lock lock(m_compilerLock); - - m_compilerCond.wait(lock, [this] { - return m_compilerStop.load() - || m_compilerQueue.size() != 0; - }); - - if (m_compilerQueue.size() != 0) { - entry = std::move(m_compilerQueue.front()); - m_compilerQueue.pop(); - } - } - - if (entry.pipeline != nullptr && entry.instance != nullptr) - entry.pipeline->compileInstance(entry.instance); - } - } - -} diff --git a/src/dxvk/dxvk_pipecompiler.h b/src/dxvk/dxvk_pipecompiler.h deleted file mode 100644 index 4803caa6..00000000 --- a/src/dxvk/dxvk_pipecompiler.h +++ /dev/null @@ -1,58 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "../util/thread.h" -#include "dxvk_include.h" - -namespace dxvk { - - class DxvkGraphicsPipeline; - class DxvkGraphicsPipelineInstance; - - /** - * \brief Pipeline compiler - * - * asynchronous pipeline compiler, which is used - * to compile optimized versions of pipelines. - */ - class DxvkPipelineCompiler : public RcObject { - - public: - - DxvkPipelineCompiler(); - ~DxvkPipelineCompiler(); - - /** - * \brief Compiles a pipeline asynchronously - * - * This should be used to compile optimized - * graphics pipeline instances asynchronously. - * \param [in] pipeline The pipeline object - * \param [in] instance The pipeline instance - */ - void queueCompilation( - const Rc& pipeline, - const Rc& instance); - - private: - - struct PipelineEntry { - Rc pipeline; - Rc instance; - }; - - std::atomic m_compilerStop = { false }; - std::mutex m_compilerLock; - std::condition_variable m_compilerCond; - std::queue m_compilerQueue; - std::vector m_compilerThreads; - - void runCompilerThread(); - - }; - -} diff --git a/src/dxvk/dxvk_pipemanager.h b/src/dxvk/dxvk_pipemanager.h index 11cc51cf..f7d05536 100644 --- a/src/dxvk/dxvk_pipemanager.h +++ b/src/dxvk/dxvk_pipemanager.h @@ -5,7 +5,6 @@ #include "dxvk_compute.h" #include "dxvk_graphics.h" -#include "dxvk_pipecompiler.h" namespace dxvk { diff --git a/src/dxvk/meson.build b/src/dxvk/meson.build index c913ecad..5be8beaa 100644 --- a/src/dxvk/meson.build +++ b/src/dxvk/meson.build @@ -59,7 +59,6 @@ dxvk_src = files([ 'dxvk_openvr.cpp', 'dxvk_options.cpp', 'dxvk_pipecache.cpp', - 'dxvk_pipecompiler.cpp', 'dxvk_pipelayout.cpp', 'dxvk_pipemanager.cpp', 'dxvk_query.cpp',