1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00
OpenDX/src/dxvk/dxvk_pipecompiler.h

59 lines
1.4 KiB
C
Raw Normal View History

2018-05-10 14:29:13 +02:00
#pragma once
#include <atomic>
#include <condition_variable>
#include <mutex>
#include <queue>
#include <thread>
#include "dxvk_include.h"
2018-05-10 14:29:13 +02:00
namespace dxvk {
class DxvkGraphicsPipeline;
class DxvkGraphicsPipelineInstance;
2018-05-10 14:29:13 +02:00
/**
* \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<std::thread> m_compilerThreads;
void runCompilerThread();
2018-05-10 14:29:13 +02:00
};
}