VenomEngine
Cross-Platform Modern Graphics Engine
Loading...
Searching...
No Matches
ShaderPipeline.h
Go to the documentation of this file.
1
8#pragma once
9
11
14#include <venom/vulkan/plugin/graphics/RenderPass.h>
18
20
21namespace venom
22{
23namespace vulkan
24{
25enum class PipelineType : uint32_t
26{
27 Graphics = 0,
28 Compute = 1,
29 RayTracing = 2
30};
31
32class VulkanShaderResource : public vc::ShaderResource
33{
34public:
35 VulkanShaderResource(vc::GraphicsCachedResourceHolder * h);
36 ~VulkanShaderResource() override;
37
38 void DestroyShaderModules();
39public:
40 VkPipeline pipeline;
41 VkPipelineLayout pipelineLayout;
42
43 vc::Vector<VkVertexInputBindingDescription> bindingDescriptions;
44 vc::Vector<VkVertexInputAttributeDescription> attributeDescriptions;
45
46 VkPipelineMultisampleStateCreateInfo multisamplingCreateInfo;
47 VkPipelineRasterizationStateCreateInfo rasterizerCreateInfo;
48 VkPipelineDepthStencilStateCreateInfo depthStencilCreateInfo;
49
50 vc::Vector<VkPipelineShaderStageCreateInfo> shaderStages;
51
52 bool shaderDirty;
53 PipelineType pipelineType;
54};
55
56class VulkanShaderPipeline : public vc::ShaderPipelineImpl
57{
58public:
59 VulkanShaderPipeline();
60 ~VulkanShaderPipeline() override;
61 VulkanShaderPipeline(const VulkanShaderPipeline&) = delete;
62 VulkanShaderPipeline& operator=(const VulkanShaderPipeline&) = delete;
63 VulkanShaderPipeline(VulkanShaderPipeline&& other) noexcept;
64 VulkanShaderPipeline& operator=(VulkanShaderPipeline&& other) noexcept;
65
66 void _ResetResource() override;
67 vc::Error _LoadShader(const vc::String & path) override;
68 void _SetMultiSamplingCount(const int samples) override;
69 void _SetLineWidth(const float width) override;
70 void _SetDepthTest(const bool enable) override;
71 void _SetDepthWrite(const bool enable) override;
72 vc::Error _OpenShaders() override;
73 vc::Error _ReloadShader() override;
74
75 void _AddVertexBufferToLayout(const uint32_t vertexSize, const uint32_t binding, const uint32_t location, const uint32_t offset, const vc::ShaderVertexFormat format) override;
76 vc::Error LoadShaders();
77 VkPipeline GetPipeline() const;
78 VkPipelineLayout GetPipelineLayout() const;
79 const VkDescriptorSetLayout & GetDescriptorSetLayout() const;
80private:
81 vc::Error LoadShader(const vc::String& shaderPath, VkPipelineShaderStageCreateInfo * pipelineCreateInfo);
82};
83
84}
85}
Base class for cached resource holders.
Definition GraphicsPluginObject.h:63
Definition ShaderPipeline.h:45
Definition ShaderPipeline.h:18
void _ResetResource() override
Resets the resource, should be implemented by the final class, i.e. VulkanTextureResource.
Definition ShaderPipeline.cc:120
Encapsulation of Vulkan for the front end of VenomEngine.
Definition Allocator.h:18
Contains the entirety of the code of the VenomEngine project.
Definition Callback.h:13