mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxvk] Remove all remaining pipecompiler code
This commit is contained in:
parent
18927dc958
commit
364e15d11a
@ -151,25 +151,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxvkGraphicsPipeline::compileInstance(
|
|
||||||
const Rc<DxvkGraphicsPipelineInstance>& 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(
|
DxvkGraphicsPipelineInstance* DxvkGraphicsPipeline::findInstance(
|
||||||
const DxvkGraphicsPipelineStateInfo& state,
|
const DxvkGraphicsPipelineStateInfo& state,
|
||||||
VkRenderPass renderPass) const {
|
VkRenderPass renderPass) const {
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#include "dxvk_binding.h"
|
#include "dxvk_binding.h"
|
||||||
#include "dxvk_constant_state.h"
|
#include "dxvk_constant_state.h"
|
||||||
#include "dxvk_pipecache.h"
|
#include "dxvk_pipecache.h"
|
||||||
#include "dxvk_pipecompiler.h"
|
|
||||||
#include "dxvk_pipelayout.h"
|
#include "dxvk_pipelayout.h"
|
||||||
#include "dxvk_renderpass.h"
|
#include "dxvk_renderpass.h"
|
||||||
#include "dxvk_resource.h"
|
#include "dxvk_resource.h"
|
||||||
@ -201,16 +200,6 @@ namespace dxvk {
|
|||||||
const DxvkRenderPass& renderPass,
|
const DxvkRenderPass& renderPass,
|
||||||
DxvkStatCounters& stats);
|
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<DxvkGraphicsPipelineInstance>& instance);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
struct PipelineStruct {
|
struct PipelineStruct {
|
||||||
|
@ -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<std::mutex> lock(m_compilerLock);
|
|
||||||
m_compilerStop.store(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_compilerCond.notify_all();
|
|
||||||
for (auto& thread : m_compilerThreads)
|
|
||||||
thread.join();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DxvkPipelineCompiler::queueCompilation(
|
|
||||||
const Rc<DxvkGraphicsPipeline>& pipeline,
|
|
||||||
const Rc<DxvkGraphicsPipelineInstance>& instance) {
|
|
||||||
std::unique_lock<std::mutex> 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<std::mutex> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include <atomic>
|
|
||||||
#include <condition_variable>
|
|
||||||
#include <mutex>
|
|
||||||
#include <queue>
|
|
||||||
|
|
||||||
#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<DxvkGraphicsPipeline>& pipeline,
|
|
||||||
const Rc<DxvkGraphicsPipelineInstance>& instance);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
struct PipelineEntry {
|
|
||||||
Rc<DxvkGraphicsPipeline> pipeline;
|
|
||||||
Rc<DxvkGraphicsPipelineInstance> instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
std::atomic<bool> m_compilerStop = { false };
|
|
||||||
std::mutex m_compilerLock;
|
|
||||||
std::condition_variable m_compilerCond;
|
|
||||||
std::queue<PipelineEntry> m_compilerQueue;
|
|
||||||
std::vector<dxvk::thread> m_compilerThreads;
|
|
||||||
|
|
||||||
void runCompilerThread();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "dxvk_compute.h"
|
#include "dxvk_compute.h"
|
||||||
#include "dxvk_graphics.h"
|
#include "dxvk_graphics.h"
|
||||||
#include "dxvk_pipecompiler.h"
|
|
||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
|
@ -59,7 +59,6 @@ dxvk_src = files([
|
|||||||
'dxvk_openvr.cpp',
|
'dxvk_openvr.cpp',
|
||||||
'dxvk_options.cpp',
|
'dxvk_options.cpp',
|
||||||
'dxvk_pipecache.cpp',
|
'dxvk_pipecache.cpp',
|
||||||
'dxvk_pipecompiler.cpp',
|
|
||||||
'dxvk_pipelayout.cpp',
|
'dxvk_pipelayout.cpp',
|
||||||
'dxvk_pipemanager.cpp',
|
'dxvk_pipemanager.cpp',
|
||||||
'dxvk_query.cpp',
|
'dxvk_query.cpp',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user