[dxvk] Added graphics pipeline stub

This commit is contained in:
Philip Rebohle 2017-10-15 13:02:59 +02:00
parent bccf3d254c
commit e9eefbb3e7
4 changed files with 94 additions and 2 deletions

View File

@ -37,7 +37,7 @@ namespace dxvk {
* \brief Pipeline handle
* \returns Pipeline handle
*/
VkPipeline handle() const {
VkPipeline getPipelineHandle() const {
return m_pipeline;
}

View File

@ -144,7 +144,7 @@ namespace dxvk {
&& m_state.c.pipeline != nullptr) {
m_cmd->cmdBindPipeline(
VK_PIPELINE_BIND_POINT_COMPUTE,
m_state.c.pipeline->handle());
m_state.c.pipeline->getPipelineHandle());
}
m_state.c.flags.clr(

View File

@ -0,0 +1,57 @@
#include "dxvk_graphics.h"
namespace dxvk {
size_t DxvkGraphicsPipelineState::hash() const {
// TODO implement
}
bool DxvkGraphicsPipelineState::operator == (const DxvkGraphicsPipelineState& other) const {
// TODO implement
}
bool DxvkGraphicsPipelineState::operator != (const DxvkGraphicsPipelineState& other) const {
return !this->operator == (other);
}
DxvkGraphicsPipeline::DxvkGraphicsPipeline(
const Rc<vk::DeviceFn>& vkd,
const Rc<DxvkShader>& vs,
const Rc<DxvkShader>& tcs,
const Rc<DxvkShader>& tes,
const Rc<DxvkShader>& gs,
const Rc<DxvkShader>& fs)
: m_vkd(vkd), m_vs(vs), m_tcs(tcs),
m_tes(tes), m_gs(gs), m_fs(fs) {
}
DxvkGraphicsPipeline::~DxvkGraphicsPipeline() {
}
VkPipeline DxvkGraphicsPipeline::getPipelineHandle(
const DxvkGraphicsPipelineState& state) {
std::lock_guard<std::mutex> lock(m_mutex);
auto pair = m_pipelines.find(state);
if (pair != m_pipelines.end())
return pair->second;
VkPipeline pipeline = this->compilePipeline(state);
m_pipelines.insert(std::make_pair(state, pipeline));
return pipeline;
}
VkPipeline DxvkGraphicsPipeline::compilePipeline(
const DxvkGraphicsPipelineState& state) const {
}
}

View File

@ -1,12 +1,23 @@
#pragma once
#include <mutex>
#include <unordered_map>
#include "dxvk_hash.h"
#include "dxvk_shader.h"
#include "dxvk_resource.h"
namespace dxvk {
struct DxvkGraphicsPipelineState {
VkRenderPass renderPass;
size_t hash() const;
bool operator == (const DxvkGraphicsPipelineState& other) const;
bool operator != (const DxvkGraphicsPipelineState& other) const;
};
/**
* \brief Graphics pipeline
*
@ -27,10 +38,34 @@ namespace dxvk {
const Rc<DxvkShader>& fs);
~DxvkGraphicsPipeline();
VkDescriptorSetLayout descriptorSetLayout() const {
return m_descriptorSetLayout;
}
VkPipeline getPipelineHandle(
const DxvkGraphicsPipelineState& state);
private:
Rc<vk::DeviceFn> m_vkd;
Rc<DxvkShader> m_vs;
Rc<DxvkShader> m_tcs;
Rc<DxvkShader> m_tes;
Rc<DxvkShader> m_gs;
Rc<DxvkShader> m_fs;
VkDescriptorSetLayout m_descriptorSetLayout = VK_NULL_HANDLE;
VkPipelineLayout m_pipelineLayout = VK_NULL_HANDLE;
std::mutex m_mutex;
std::unordered_map<
DxvkGraphicsPipelineState,
VkPipeline, DxvkHash> m_pipelines;
VkPipeline compilePipeline(
const DxvkGraphicsPipelineState& state) const;
};
}