Skip to content

Commit c71397c

Browse files
committed
Use vk::StructureChain on pipeline creation.
1 parent ceb854b commit c71397c

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

attachments/12_graphics_pipeline_complete.cpp

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,22 @@ class HelloTriangleApplication {
326326

327327
pipelineLayout = vk::raii::PipelineLayout( device, pipelineLayoutInfo );
328328

329-
vk::PipelineRenderingCreateInfo pipelineRenderingCreateInfo{ .colorAttachmentCount = 1, .pColorAttachmentFormats = &swapChainSurfaceFormat.format };
330-
vk::GraphicsPipelineCreateInfo pipelineInfo{ .pNext = &pipelineRenderingCreateInfo,
331-
.stageCount = 2, .pStages = shaderStages,
332-
.pVertexInputState = &vertexInputInfo, .pInputAssemblyState = &inputAssembly,
333-
.pViewportState = &viewportState, .pRasterizationState = &rasterizer,
334-
.pMultisampleState = &multisampling, .pColorBlendState = &colorBlending,
335-
.pDynamicState = &dynamicState, .layout = pipelineLayout, .renderPass = nullptr };
336-
337-
graphicsPipeline = vk::raii::Pipeline(device, nullptr, pipelineInfo);
329+
vk::StructureChain<vk::GraphicsPipelineCreateInfo, vk::PipelineRenderingCreateInfo> pipelineCreateInfoChain = {
330+
{ .stageCount = 2,
331+
.pStages = shaderStages,
332+
.pVertexInputState = &vertexInputInfo,
333+
.pInputAssemblyState = &inputAssembly,
334+
.pViewportState = &viewportState,
335+
.pRasterizationState = &rasterizer,
336+
.pMultisampleState = &multisampling,
337+
.pColorBlendState = &colorBlending,
338+
.pDynamicState = &dynamicState,
339+
.layout = pipelineLayout,
340+
.renderPass = nullptr },
341+
{.colorAttachmentCount = 1, .pColorAttachmentFormats = &swapChainSurfaceFormat.format }
342+
};
343+
344+
graphicsPipeline = vk::raii::Pipeline(device, nullptr, pipelineCreateInfoChain.get<vk::GraphicsPipelineCreateInfo>());
338345
}
339346

340347
[[nodiscard]] vk::raii::ShaderModule createShaderModule(const std::vector<char>& code) const {

0 commit comments

Comments
 (0)