34 ReadWrite = Read | Write
52 std::vector<Shader::VertexInput> vertexInputs, std::vector<Shader::Define> defines = {},
53 Mode mode = Mode::Polygon, Depth depth = Depth::ReadWrite,
54 VkPrimitiveTopology topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
55 VkPolygonMode polygonMode = VK_POLYGON_MODE_FILL,
56 VkCullModeFlags cullMode = VK_CULL_MODE_BACK_BIT,
57 VkFrontFace frontFace = VK_FRONT_FACE_CLOCKWISE,
bool pushDescriptors =
false);
73 const Image2D*
GetImage(uint32_t index,
const std::optional<uint32_t>& stage = std::nullopt)
const;
82 const Stage& GetStage()
const
86 const std::vector<VirtualPath>& GetShaderStages()
const
88 return m_ShaderStages;
90 const std::vector<Shader::VertexInput>& GetVertexInputs()
const
92 return m_VertexInputs;
94 const std::vector<Shader::Define>& GetDefines()
const
102 Depth GetDepth()
const
106 VkPrimitiveTopology GetTopology()
const
110 VkPolygonMode GetPolygonMode()
const
112 return m_PolygonMode;
114 VkCullModeFlags GetCullMode()
const
118 VkFrontFace GetFrontFace()
const
122 bool IsPushDescriptors()
const override
124 return m_PushDescriptors;
126 const Shader* GetShader()
const override
128 return m_Shader.get();
130 const VkDescriptorSetLayout& GetDescriptorSetLayout()
const override
132 return m_DescriptorSetLayout;
134 const VkDescriptorPool& GetDescriptorPool()
const override
136 return m_DescriptorPool;
138 const VkPipeline& GetPipeline()
const override
142 const VkPipelineLayout& GetPipelineLayout()
const override
144 return m_PipelineLayout;
146 const VkPipelineBindPoint& GetPipelineBindPoint()
const override
148 return m_PipelineBindPoint;
152 void CreateShaderProgram();
153 void CreateDescriptorLayout();
154 void CreateDescriptorPool();
155 void CreatePipelineLayout();
156 void CreateAttributes();
157 void CreatePipeline();
158 void CreatePipelinePolygon();
159 void CreatePipelineMrt();
163 std::vector<VirtualPath> m_ShaderStages;
164 std::vector<Shader::VertexInput> m_VertexInputs;
165 std::vector<Shader::Define> m_Defines;
168 VkPrimitiveTopology m_Topology;
169 VkPolygonMode m_PolygonMode;
170 VkCullModeFlags m_CullMode;
171 VkFrontFace m_FrontFace;
172 bool m_PushDescriptors;
174 std::unique_ptr<Shader> m_Shader;
176 std::vector<VkDynamicState> m_DynamicStates;
178 std::vector<VkShaderModule> m_Modules;
179 std::vector<VkPipelineShaderStageCreateInfo> m_Stages;
181 VkDescriptorSetLayout m_DescriptorSetLayout = VK_NULL_HANDLE;
182 VkDescriptorPool m_DescriptorPool = VK_NULL_HANDLE;
184 VkPipeline m_Pipeline = VK_NULL_HANDLE;
185 VkPipelineLayout m_PipelineLayout = VK_NULL_HANDLE;
186 VkPipelineBindPoint m_PipelineBindPoint;
188 VkPipelineVertexInputStateCreateInfo m_VertexInputStateCreateInfo = {};
189 VkPipelineInputAssemblyStateCreateInfo m_InputAssemblyState = {};
190 VkPipelineRasterizationStateCreateInfo m_RasterizationState = {};
191 std::array<VkPipelineColorBlendAttachmentState, 1> m_BlendAttachmentStates;
192 VkPipelineColorBlendStateCreateInfo m_ColorBlendState = {};
193 VkPipelineDepthStencilStateCreateInfo m_DepthStencilState = {};
194 VkPipelineViewportStateCreateInfo m_ViewportState = {};
195 VkPipelineMultisampleStateCreateInfo m_MultisampleState = {};
196 VkPipelineDynamicStateCreateInfo m_DynamicState = {};
197 VkPipelineTessellationStateCreateInfo m_TessellationState = {};
204 std::vector<Shader::VertexInput> vertexInputs = {},
205 std::vector<Shader::Define> defines = {},
206 PipelineGraphics::Mode mode = PipelineGraphics::Mode::Polygon,
207 PipelineGraphics::Depth depth = PipelineGraphics::Depth::ReadWrite,
208 VkPrimitiveTopology topology = VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST,
209 VkPolygonMode polygonMode = VK_POLYGON_MODE_FILL,
210 VkCullModeFlags cullMode = VK_CULL_MODE_BACK_BIT,
211 VkFrontFace frontFace = VK_FRONT_FACE_CLOCKWISE,
bool pushDescriptors =
false)
212 : m_ShaderStages(std::move(shaderStages))
213 , m_VertexInputs(std::move(vertexInputs))
214 , m_Defines(std::move(defines))
217 , m_Topology(topology)
218 , m_PolygonMode(polygonMode)
219 , m_CullMode(cullMode)
220 , m_FrontFace(frontFace)
221 , m_PushDescriptors(pushDescriptors)
232 return new PipelineGraphics(pipelineStage, m_ShaderStages, m_VertexInputs, m_Defines, m_Mode, m_Depth,
233 m_Topology, m_PolygonMode, m_CullMode, m_FrontFace, m_PushDescriptors);
238 node[
"shaderStages"] >> pipelineCreate.m_ShaderStages;
239 node[
"vertexInputs"] >> pipelineCreate.m_VertexInputs;
240 node[
"defines"] >> pipelineCreate.m_Defines;
241 node[
"mode"] >> pipelineCreate.m_Mode;
242 node[
"depth"] >> pipelineCreate.m_Depth;
243 node[
"polygonMode"] >> pipelineCreate.m_PolygonMode;
244 node[
"cullMode"] >> pipelineCreate.m_CullMode;
245 node[
"frontFace"] >> pipelineCreate.m_FrontFace;
246 node[
"pushDescriptors"] >> pipelineCreate.m_PushDescriptors;
250 friend Node& operator<<(Node& node,
const PipelineGraphicsCreate& pipelineCreate)
252 node[
"shaderStages"] << pipelineCreate.m_ShaderStages;
253 node[
"vertexInputs"] << pipelineCreate.m_VertexInputs;
254 node[
"defines"] << pipelineCreate.m_Defines;
255 node[
"mode"] << pipelineCreate.m_Mode;
256 node[
"depth"] << pipelineCreate.m_Depth;
257 node[
"polygonMode"] << pipelineCreate.m_PolygonMode;
258 node[
"cullMode"] << pipelineCreate.m_CullMode;
259 node[
"frontFace"] << pipelineCreate.m_FrontFace;
260 node[
"pushDescriptors"] << pipelineCreate.m_PushDescriptors;
264 const std::vector<VirtualPath>& GetShaderStages()
const
266 return m_ShaderStages;
269 const std::vector<Shader::VertexInput>& GetVertexInputs()
const
271 return m_VertexInputs;
273 const std::vector<Shader::Define>& GetDefines()
const
277 PipelineGraphics::Mode GetMode()
const
281 PipelineGraphics::Depth GetDepth()
const
285 VkPrimitiveTopology GetTopology()
const
289 VkPolygonMode GetPolygonMode()
const
291 return m_PolygonMode;
293 VkCullModeFlags GetCullMode()
const
297 VkFrontFace GetFrontFace()
const
301 bool GetPushDescriptors()
const
303 return m_PushDescriptors;
307 std::vector<VirtualPath> m_ShaderStages;
308 std::vector<Shader::VertexInput> m_VertexInputs;
309 std::vector<Shader::Define> m_Defines;
311 PipelineGraphics::Mode m_Mode;
312 PipelineGraphics::Depth m_Depth;
313 VkPrimitiveTopology m_Topology;
314 VkPolygonMode m_PolygonMode;
315 VkCullModeFlags m_CullMode;
316 VkFrontFace m_FrontFace;
317 bool m_PushDescriptors;
PipelineGraphics(Stage stage, std::vector< VirtualPath > shaderStages, std::vector< Shader::VertexInput > vertexInputs, std::vector< Shader::Define > defines={}, Mode mode=Mode::Polygon, Depth depth=Depth::ReadWrite, VkPrimitiveTopology topology=VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST, VkPolygonMode polygonMode=VK_POLYGON_MODE_FILL, VkCullModeFlags cullMode=VK_CULL_MODE_BACK_BIT, VkFrontFace frontFace=VK_FRONT_FACE_CLOCKWISE, bool pushDescriptors=false)
Definition PipelineGraphics.cpp:14