Vulkan SDK 之 Graphics Pipeline

Posted khacker

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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);

 

以上是关于Vulkan SDK 之 Graphics Pipeline的主要内容,如果未能解决你的问题,请参考以下文章

Vulkan SDK 之 Instance

Vulkan SDK之 CommandBuff

Vulkan Tutorial 01 开发环境搭建之Windows

Vulkan Tutorial 01 开发环境搭建之Windows

Vulkan SDK Demo 之一 熟悉

使用 CMake、conan 和 Vulkan SDK 的 Github 操作失败,因为找不到 conanfile.py