This commit is contained in:
Lynix 2020-03-01 20:31:48 +01:00
parent 7180a8d94e
commit 287be5d9b6
2 changed files with 31 additions and 4 deletions

View File

@ -11,22 +11,36 @@
#include <Nazara/Renderer/RenderPipeline.hpp> #include <Nazara/Renderer/RenderPipeline.hpp>
#include <Nazara/VulkanRenderer/Config.hpp> #include <Nazara/VulkanRenderer/Config.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp> #include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
#include <vector>
namespace Nz namespace Nz
{ {
class NAZARA_VULKANRENDERER_API VulkanRenderPipeline : public RenderPipeline class NAZARA_VULKANRENDERER_API VulkanRenderPipeline : public RenderPipeline
{ {
public: public:
struct CreateInfo;
VulkanRenderPipeline(Vk::DeviceHandle device, RenderPipelineInfo pipelineInfo); VulkanRenderPipeline(Vk::DeviceHandle device, RenderPipelineInfo pipelineInfo);
~VulkanRenderPipeline() = default; ~VulkanRenderPipeline() = default;
static VkPipelineColorBlendAttachmentState BuildColorBlendState(const RenderPipelineInfo& pipelineInfo); static std::vector<VkPipelineColorBlendAttachmentState> BuildColorBlendAttachmentState(const RenderPipelineInfo& pipelineInfo);
static VkPipelineDepthStencilStateCreateInfo BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo); static VkPipelineDepthStencilStateCreateInfo BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo);
static VkPipelineInputAssemblyStateCreateInfo BuildInputAssemblyInfo(const RenderPipelineInfo& pipelineInfo); static VkPipelineInputAssemblyStateCreateInfo BuildInputAssemblyInfo(const RenderPipelineInfo& pipelineInfo);
static VkPipelineRasterizationStateCreateInfo BuildRasterizationInfo(const RenderPipelineInfo& pipelineInfo); static VkPipelineRasterizationStateCreateInfo BuildRasterizationInfo(const RenderPipelineInfo& pipelineInfo);
static VkStencilOpState BuildStencilOp(const RenderPipelineInfo& pipelineInfo, bool front); static VkStencilOpState BuildStencilOp(const RenderPipelineInfo& pipelineInfo, bool front);
static std::vector<VkPipelineShaderStageCreateInfo> BuildShaderStageInfo(const RenderPipelineInfo& pipelineInfo);
static CreateInfo BuildCreateInfo(const RenderPipelineInfo& pipelineInfo);
struct CreateInfo
{
std::vector<VkPipelineColorBlendAttachmentState> colorBlendAttachmentState;
std::vector<VkPipelineShaderStageCreateInfo> shaderStages;
VkGraphicsPipelineCreateInfo createInfo;
};
private: private:
Vk::DeviceHandle m_device; Vk::DeviceHandle m_device;
RenderPipelineInfo m_pipelineInfo; RenderPipelineInfo m_pipelineInfo;
}; };

View File

@ -16,7 +16,7 @@ namespace Nz
{ {
} }
VkPipelineColorBlendAttachmentState VulkanRenderPipeline::BuildColorBlendState(const RenderPipelineInfo& pipelineInfo) /*VkPipelineColorBlendAttachmentState VulkanRenderPipeline::BuildColorBlendAttachmentState(const RenderPipelineInfo& pipelineInfo)
{ {
VkPipelineColorBlendAttachmentState colorBlendStates; VkPipelineColorBlendAttachmentState colorBlendStates;
colorBlendStates.blendEnable = pipelineInfo.blending; colorBlendStates.blendEnable = pipelineInfo.blending;
@ -29,7 +29,7 @@ namespace Nz
{ {
blendState.dstAlphaBlendFactor blendState.dstAlphaBlendFactor
}*/ }*/
} /*}
else else
{ {
colorBlendStates.srcColorBlendFactor = VK_BLEND_FACTOR_ONE; colorBlendStates.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
@ -40,7 +40,7 @@ namespace Nz
colorBlendStates.alphaBlendOp = VK_BLEND_OP_ADD; colorBlendStates.alphaBlendOp = VK_BLEND_OP_ADD;
} }
return colorBlendStates; return colorBlendStates;
} }*/
VkPipelineDepthStencilStateCreateInfo VulkanRenderPipeline::BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo) VkPipelineDepthStencilStateCreateInfo VulkanRenderPipeline::BuildDepthStencilInfo(const RenderPipelineInfo& pipelineInfo)
{ {
@ -92,4 +92,17 @@ namespace Nz
return stencilStates; return stencilStates;
} }
std::vector<VkPipelineShaderStageCreateInfo> VulkanRenderPipeline::BuildShaderStageInfo(const RenderPipelineInfo& pipelineInfo)
{
std::vector<VkPipelineShaderStageCreateInfo> shaderStageCreateInfos;
for (auto&& stagePtr : pipelineInfo.shaderStages)
{
VkPipelineShaderStageCreateInfo& createInfo = shaderStageCreateInfos.emplace_back();
//createInfo.
}
return shaderStageCreateInfos;
}
} }