其他分享
首页 > 其他分享> > Vulkan SDK 之 Graphics Pipeline

Vulkan SDK 之 Graphics Pipeline

作者:互联网

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

 

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);

 

标签:info,Pipeline,NULL,pipeline,State,command,Graphics,Vulkan
来源: https://www.cnblogs.com/khacker/p/12272021.html