2017-10-13 03:19:23 +02:00
|
|
|
#include "dxvk_compute.h"
|
|
|
|
|
|
|
|
namespace dxvk {
|
|
|
|
|
|
|
|
DxvkComputePipeline::DxvkComputePipeline(
|
2017-12-03 00:40:58 +01:00
|
|
|
const Rc<vk::DeviceFn>& vkd,
|
|
|
|
const Rc<DxvkBindingLayout>& layout,
|
|
|
|
const Rc<DxvkShader>& cs)
|
|
|
|
: m_vkd(vkd), m_layout(layout), m_cs(cs) {
|
2017-10-14 23:52:47 +02:00
|
|
|
std::vector<VkDescriptorSetLayoutBinding> bindings;
|
|
|
|
|
|
|
|
VkComputePipelineCreateInfo info;
|
|
|
|
info.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
|
|
|
info.pNext = nullptr;
|
|
|
|
info.flags = 0;
|
2017-12-03 00:40:58 +01:00
|
|
|
info.stage = cs->stageInfo();
|
2017-12-03 20:23:26 +01:00
|
|
|
info.layout = m_layout->pipelineLayout();
|
2017-10-14 23:52:47 +02:00
|
|
|
info.basePipelineHandle = VK_NULL_HANDLE;
|
|
|
|
info.basePipelineIndex = 0;
|
|
|
|
|
|
|
|
if (m_vkd->vkCreateComputePipelines(m_vkd->device(),
|
2017-12-03 00:40:58 +01:00
|
|
|
VK_NULL_HANDLE, 1, &info, nullptr, &m_pipeline) != VK_SUCCESS)
|
2017-11-20 13:21:27 +01:00
|
|
|
throw DxvkError("DxvkComputePipeline::DxvkComputePipeline: Failed to compile pipeline");
|
2017-10-13 03:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DxvkComputePipeline::~DxvkComputePipeline() {
|
2017-10-14 23:52:47 +02:00
|
|
|
if (m_pipeline != VK_NULL_HANDLE)
|
|
|
|
m_vkd->vkDestroyPipeline(m_vkd->device(), m_pipeline, nullptr);
|
2017-10-13 03:19:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|