2017-10-13 03:19:23 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-01 16:45:28 +02:00
|
|
|
#include <vector>
|
|
|
|
|
2018-09-17 10:40:57 +02:00
|
|
|
#include "dxvk_bind_mask.h"
|
2018-01-13 22:18:32 +01:00
|
|
|
#include "dxvk_pipecache.h"
|
2017-12-07 09:38:31 +01:00
|
|
|
#include "dxvk_pipelayout.h"
|
2017-10-14 23:52:47 +02:00
|
|
|
#include "dxvk_resource.h"
|
2017-12-03 00:40:58 +01:00
|
|
|
#include "dxvk_shader.h"
|
2018-04-03 15:52:39 +02:00
|
|
|
#include "dxvk_stats.h"
|
2017-10-13 03:19:23 +02:00
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
2018-01-16 15:00:19 +01:00
|
|
|
class DxvkDevice;
|
2018-09-21 19:42:48 +02:00
|
|
|
class DxvkPipelineManager;
|
2018-01-16 15:00:19 +01:00
|
|
|
|
2018-02-14 17:54:35 +01:00
|
|
|
/**
|
|
|
|
* \brief Compute pipeline state info
|
|
|
|
*/
|
|
|
|
struct DxvkComputePipelineStateInfo {
|
|
|
|
bool operator == (const DxvkComputePipelineStateInfo& other) const;
|
|
|
|
bool operator != (const DxvkComputePipelineStateInfo& other) const;
|
|
|
|
|
2018-09-17 10:40:57 +02:00
|
|
|
DxvkBindingMask bsBindingMask;
|
2018-02-14 17:54:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
/**
|
|
|
|
* \brief Compute pipeline
|
|
|
|
*
|
2017-10-14 13:45:00 +02:00
|
|
|
* Stores a compute pipeline object and the corresponding
|
|
|
|
* pipeline layout. Unlike graphics pipelines, compute
|
|
|
|
* pipelines do not need to be recompiled against any sort
|
|
|
|
* of pipeline state.
|
2017-10-13 03:19:23 +02:00
|
|
|
*/
|
2017-10-14 23:52:47 +02:00
|
|
|
class DxvkComputePipeline : public DxvkResource {
|
2017-10-13 03:19:23 +02:00
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-10-14 23:52:47 +02:00
|
|
|
DxvkComputePipeline(
|
2018-09-21 19:42:48 +02:00
|
|
|
DxvkPipelineManager* pipeMgr,
|
2018-01-13 22:18:32 +01:00
|
|
|
const Rc<DxvkShader>& cs);
|
2017-10-13 03:19:23 +02:00
|
|
|
~DxvkComputePipeline();
|
|
|
|
|
2017-10-14 23:52:47 +02:00
|
|
|
/**
|
2017-12-03 20:23:26 +01:00
|
|
|
* \brief Pipeline layout
|
2017-10-14 23:52:47 +02:00
|
|
|
*
|
2017-12-03 20:23:26 +01:00
|
|
|
* Stores the pipeline layout and the descriptor set
|
|
|
|
* layout, as well as information on the resource
|
|
|
|
* slots used by the pipeline.
|
|
|
|
* \returns Pipeline layout
|
2017-10-14 23:52:47 +02:00
|
|
|
*/
|
2018-06-22 00:33:47 +02:00
|
|
|
DxvkPipelineLayout* layout() const {
|
|
|
|
return m_layout.ptr();
|
2017-10-15 19:23:10 +02:00
|
|
|
}
|
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
/**
|
|
|
|
* \brief Pipeline handle
|
2018-02-14 17:54:35 +01:00
|
|
|
*
|
|
|
|
* \param [in] state Pipeline state
|
2017-10-13 03:19:23 +02:00
|
|
|
* \returns Pipeline handle
|
|
|
|
*/
|
2018-02-14 17:54:35 +01:00
|
|
|
VkPipeline getPipelineHandle(
|
2018-04-03 15:52:39 +02:00
|
|
|
const DxvkComputePipelineStateInfo& state,
|
|
|
|
DxvkStatCounters& stats);
|
2017-10-13 03:19:23 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
2018-03-16 01:24:03 +01:00
|
|
|
struct PipelineStruct {
|
|
|
|
DxvkComputePipelineStateInfo stateVector;
|
|
|
|
VkPipeline pipeline;
|
|
|
|
};
|
|
|
|
|
2018-09-21 19:42:48 +02:00
|
|
|
Rc<vk::DeviceFn> m_vkd;
|
|
|
|
DxvkPipelineManager* m_pipeMgr;
|
2018-01-16 15:00:19 +01:00
|
|
|
|
2018-02-14 17:54:35 +01:00
|
|
|
Rc<DxvkPipelineLayout> m_layout;
|
|
|
|
Rc<DxvkShaderModule> m_cs;
|
2017-10-14 23:52:47 +02:00
|
|
|
|
2018-05-01 16:45:28 +02:00
|
|
|
sync::Spinlock m_mutex;
|
2018-03-16 01:24:03 +01:00
|
|
|
std::vector<PipelineStruct> m_pipelines;
|
|
|
|
|
|
|
|
VkPipeline m_basePipeline = VK_NULL_HANDLE;
|
|
|
|
|
2018-05-01 16:45:28 +02:00
|
|
|
bool findPipeline(
|
|
|
|
const DxvkComputePipelineStateInfo& state,
|
|
|
|
VkPipeline& pipeline) const;
|
|
|
|
|
2018-03-16 01:24:03 +01:00
|
|
|
VkPipeline compilePipeline(
|
|
|
|
const DxvkComputePipelineStateInfo& state,
|
|
|
|
VkPipeline baseHandle) const;
|
2017-10-13 03:19:23 +02:00
|
|
|
|
2018-03-16 01:24:03 +01:00
|
|
|
void destroyPipelines();
|
2017-12-07 09:38:31 +01:00
|
|
|
|
2017-10-13 03:19:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|