| Fling Engine 0.00.1 Fling Engine is a game engine written in Vulkan

GraphicsPipeline.h
Go to the documentation of this file.
1 #pragma once
2 #include "FlingVulkan.h"
3 #include "Shader.h"
4 #include "Vertex.h"
5 #include "MultiSampler.h"
6
7 namespace Fling
8 {
9 class GraphicsPipeline
10 {
11 public:
12 enum class Depth
13 {
14 None = 0,
15 Read = 1,
16 Write = 2,
17 ReadWrite = Read | Write,
18 };
19
20 GraphicsPipeline(
21 std::vector<Shader*> t_Shaders,
22 VkDevice t_LogicalDevice,
23 VkPolygonMode t_Mode = VK_POLYGON_MODE_FILL,
24 Depth t_Depth = Depth::ReadWrite,
25 VkPrimitiveTopology t_Topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
26 VkCullModeFlags t_CullMode = VK_CULL_MODE_BACK_BIT,
27 VkFrontFace t_FrontFace = VK_FRONT_FACE_COUNTER_CLOCKWISE);
28
29 void BindGraphicsPipeline(const VkCommandBuffer& t_CommandBuffer);
30 void CreateGraphicsPipeline(VkRenderPass& t_RenderPass, Multisampler* t_Sampler);
31
32 const std::vector<Shader*> GetShaders() const { return m_Shaders; }
33
34 Depth GetDepth() const { return m_Depth; }
35 VkPrimitiveTopology GetTopology() const { return m_Topology; }
36 VkPolygonMode GetPolygonMode() const { return m_PolygonMode; }
37 VkCullModeFlags GetCullMode() const { return m_CullMode; }
38 VkFrontFace GetFrontFace() const { return m_FrontFace; }
39 const VkDescriptorSetLayout& GetDescriptorSetLayout() const { return m_DescriptorSetLayout; }
40 const VkPipeline& GetPipeline() const { return m_Pipeline; }
41 const VkPipelineLayout& GetPipelineLayout() const { return m_PipelineLayout; }
42 const VkPipelineBindPoint& GetPipelineBindPoint() const { return m_PipelineBindPoint; }
43
44 ~GraphicsPipeline();
45
46 void CreateAttributes(Multisampler* t_Sampler);
47
48 std::vector<Shader*> m_Shaders;
49
50 VkDevice m_Device;
51
52 Depth m_Depth;
53 VkPrimitiveTopology m_Topology;
54 VkPolygonMode m_PolygonMode;
55 VkCullModeFlags m_CullMode;
56 VkFrontFace m_FrontFace;
57
58 VkPipeline m_Pipeline = VK_NULL_HANDLE;
59 VkPipelineCache m_PipelineCache = VK_NULL_HANDLE;
60 VkPipelineLayout m_PipelineLayout = VK_NULL_HANDLE;
61 VkPipelineBindPoint m_PipelineBindPoint;
62
63 VkGraphicsPipelineCreateInfo m_PipelineCreateInfo = {};
64
65 VkDescriptorSetLayout m_DescriptorSetLayout;
66 VkPipelineVertexInputStateCreateInfo m_VertexInputStateCreateInfo = {};
67 VkPipelineInputAssemblyStateCreateInfo m_InputAssemblyState = {};
68 VkPipelineRasterizationStateCreateInfo m_RasterizationState = {};
69 std::vector<VkPipelineColorBlendAttachmentState> m_ColorBlendAttachmentStates;
70 VkPipelineColorBlendStateCreateInfo m_ColorBlendState = {};
71 VkPipelineDepthStencilStateCreateInfo m_DepthStencilState = {};
72 VkPipelineViewportStateCreateInfo m_ViewportState = {};
73 VkPipelineMultisampleStateCreateInfo m_MultisampleState = {};
74 VkPipelineDynamicStateCreateInfo m_DynamicState = {};
75 VkPipelineTessellationStateCreateInfo m_TessellationState = {};
76 };
77
78 }
Fling::GraphicsPipeline::GetDescriptorSetLayout
const VkDescriptorSetLayout & GetDescriptorSetLayout() const
Definition: GraphicsPipeline.h:39
Fling::GraphicsPipeline::Depth::None
Fling::GraphicsPipeline::m_TessellationState
VkPipelineTessellationStateCreateInfo m_TessellationState
Definition: GraphicsPipeline.h:75
Fling::GraphicsPipeline::GetPipelineBindPoint
const VkPipelineBindPoint & GetPipelineBindPoint() const
Definition: GraphicsPipeline.h:42
FlingVulkan.h
Fling::GraphicsPipeline::m_Pipeline
VkPipeline m_Pipeline
Definition: GraphicsPipeline.h:58
Fling::GraphicsPipeline::m_ColorBlendAttachmentStates
std::vector< VkPipelineColorBlendAttachmentState > m_ColorBlendAttachmentStates
Definition: GraphicsPipeline.h:69
Fling::GraphicsPipeline::m_ColorBlendState
VkPipelineColorBlendStateCreateInfo m_ColorBlendState
Definition: GraphicsPipeline.h:70
Fling::GraphicsPipeline::m_Topology
VkPrimitiveTopology m_Topology
Definition: GraphicsPipeline.h:53
Fling::GraphicsPipeline::Depth::ReadWrite
Fling::GraphicsPipeline
Definition: GraphicsPipeline.h:9
Fling::GraphicsPipeline::m_PipelineCache
VkPipelineCache m_PipelineCache
Definition: GraphicsPipeline.h:59
Fling::GraphicsPipeline::m_DepthStencilState
VkPipelineDepthStencilStateCreateInfo m_DepthStencilState
Definition: GraphicsPipeline.h:71
Fling::GraphicsPipeline::m_MultisampleState
VkPipelineMultisampleStateCreateInfo m_MultisampleState
Definition: GraphicsPipeline.h:73
Fling::GraphicsPipeline::GetDepth
Depth GetDepth() const
Definition: GraphicsPipeline.h:34
Fling::GraphicsPipeline::m_DescriptorSetLayout
VkDescriptorSetLayout m_DescriptorSetLayout
Definition: GraphicsPipeline.h:65
Fling::GraphicsPipeline::m_InputAssemblyState
VkPipelineInputAssemblyStateCreateInfo m_InputAssemblyState
Definition: GraphicsPipeline.h:67
Fling::GraphicsPipeline::CreateAttributes
void CreateAttributes(Multisampler *t_Sampler)
Definition: GraphicsPipeline.cpp:35
Fling::GraphicsPipeline::m_Depth
Depth m_Depth
Definition: GraphicsPipeline.h:52
Fling::GraphicsPipeline::m_PipelineBindPoint
VkPipelineBindPoint m_PipelineBindPoint
Definition: GraphicsPipeline.h:61
MultiSampler.h
Shader.h
Fling::GraphicsPipeline::Depth::Read
Fling::Multisampler
A multi-sampler will allow us to enable MSAA.
Definition: MultiSampler.h:14
Fling::GraphicsPipeline::GetCullMode
VkCullModeFlags GetCullMode() const
Definition: GraphicsPipeline.h:37
Fling::GraphicsPipeline::GetTopology
VkPrimitiveTopology GetTopology() const
Definition: GraphicsPipeline.h:35
Fling::GraphicsPipeline::GetFrontFace
VkFrontFace GetFrontFace() const
Definition: GraphicsPipeline.h:38
Fling::GraphicsPipeline::m_ViewportState
VkPipelineViewportStateCreateInfo m_ViewportState
Definition: GraphicsPipeline.h:72
Fling::GraphicsPipeline::Depth
Depth
Definition: GraphicsPipeline.h:12
Fling::GraphicsPipeline::GetPipelineLayout
const VkPipelineLayout & GetPipelineLayout() const
Definition: GraphicsPipeline.h:41
Fling::GraphicsPipeline::m_Shaders
std::vector< Shader * > m_Shaders
Definition: GraphicsPipeline.h:48
Fling::GraphicsPipeline::GraphicsPipeline
GraphicsPipeline(std::vector< Shader *> t_Shaders, VkDevice t_LogicalDevice, VkPolygonMode t_Mode=VK_POLYGON_MODE_FILL, Depth t_Depth=Depth::ReadWrite, VkPrimitiveTopology t_Topology=VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, VkCullModeFlags t_CullMode=VK_CULL_MODE_BACK_BIT, VkFrontFace t_FrontFace=VK_FRONT_FACE_COUNTER_CLOCKWISE)
Definition: GraphicsPipeline.cpp:8
Fling::GraphicsPipeline::Depth::Write
Fling::GraphicsPipeline::GetShaders
const std::vector< Shader * > GetShaders() const
Definition: GraphicsPipeline.h:32
Fling::GraphicsPipeline::m_PipelineLayout
VkPipelineLayout m_PipelineLayout
Definition: GraphicsPipeline.h:60
Vertex.h
Fling::GraphicsPipeline::m_PipelineCreateInfo
VkGraphicsPipelineCreateInfo m_PipelineCreateInfo
Definition: GraphicsPipeline.h:63
Fling::GraphicsPipeline::m_FrontFace
VkFrontFace m_FrontFace
Definition: GraphicsPipeline.h:56
Fling::GraphicsPipeline::m_VertexInputStateCreateInfo
VkPipelineVertexInputStateCreateInfo m_VertexInputStateCreateInfo
Definition: GraphicsPipeline.h:66
Fling::GraphicsPipeline::m_RasterizationState
VkPipelineRasterizationStateCreateInfo m_RasterizationState
Definition: GraphicsPipeline.h:68
Fling::GraphicsPipeline::GetPipeline
const VkPipeline & GetPipeline() const
Definition: GraphicsPipeline.h:40
Fling::GraphicsPipeline::CreateGraphicsPipeline
void CreateGraphicsPipeline(VkRenderPass &t_RenderPass, Multisampler *t_Sampler)
Definition: GraphicsPipeline.cpp:96
Fling::GraphicsPipeline::m_CullMode
VkCullModeFlags m_CullMode
Definition: GraphicsPipeline.h:55
Fling::GraphicsPipeline::GetPolygonMode
VkPolygonMode GetPolygonMode() const
Definition: GraphicsPipeline.h:36
Fling
Definition: Engine.h:29
Fling::GraphicsPipeline::m_DynamicState
VkPipelineDynamicStateCreateInfo m_DynamicState
Definition: GraphicsPipeline.h:74
Fling::GraphicsPipeline::BindGraphicsPipeline
void BindGraphicsPipeline(const VkCommandBuffer &t_CommandBuffer)
Definition: GraphicsPipeline.cpp:30
Fling::GraphicsPipeline::m_PolygonMode
VkPolygonMode m_PolygonMode
Definition: GraphicsPipeline.h:54
Fling::GraphicsPipeline::~GraphicsPipeline
~GraphicsPipeline()
Definition: GraphicsPipeline.cpp:151
Fling::GraphicsPipeline::m_Device
VkDevice m_Device
Definition: GraphicsPipeline.h:50