Vulkan SDK 之 Graphics Pipeline

A graphics pipeline consists of shader stages, a pipeline layout, a render pass, and fixed-function pipeline stages. 

Vulkan SDK 之 Graphics Pipeline

 

Dynamic State

A dynamic pipeline state is a state that can be changed by a command buffer command during the execution of a command buffer. Advance notification of what states are dynamic during command buffer execution may be useful for a driver as it sets up the GPU for command buffer execution.

 

Pipeline Vertex Input State

Pipeline Vertex Input Assembly State

The input assembly state is basically where you declare how your vertices form the geometry you want to draw. 

Pipeline Rasterization State

Pipeline Color Blend State

Pipeline Viewport State

Pipeline Depth Stencil State

Pipeline Multisample State

Pulling It All Together - Create Graphics Pipeline

VkGraphicsPipelineCreateInfo pipeline;
pipeline.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
pipeline.pNext = NULL;
pipeline.layout = info.pipeline_layout;
pipeline.basePipelineHandle = VK_NULL_HANDLE;
pipeline.basePipelineIndex = 0;
pipeline.flags = 0;
pipeline.pVertexInputState = &vi;
pipeline.pInputAssemblyState = &ia;
pipeline.pRasterizationState = &rs;
pipeline.pColorBlendState = &cb;
pipeline.pTessellationState = NULL;
pipeline.pMultisampleState = &ms;
pipeline.pDynamicState = &dynamicState;
pipeline.pViewportState = &vp;
pipeline.pDepthStencilState = &ds;
pipeline.pStages = info.shaderStages;
pipeline.stageCount = 2;
pipeline.renderPass = info.render_pass;
pipeline.subpass = 0;

res = vkCreateGraphicsPipelines(info.device, NULL, 1,
                                &pipeline, NULL, &info.pipeline);

 

上一篇:关于打包ComputeShader遇到的一个坑


下一篇:几种开源许可证的区别