[][src]Module vulkano::pipeline

Describes a graphical or compute operation.

In Vulkan, before you can add a draw or a compute command to a command buffer you have to create a pipeline object that describes this command.

When you create a pipeline object, the implementation will usually generate some GPU machine code that will execute the operation (similar to a compiler that generates an executable for the CPU). Consequently it is a CPU-intensive operation that should be performed at initialization or during a loading screen.

There are two kinds of pipelines:

Creating a compute pipeline.

In order to create a compute pipeline, you first need a shader entry point.

TODO: write the rest For now vulkano has no "clean" way to create shaders ; everything's a bit hacky

Creating a graphics pipeline

A graphics operation takes vertices or vertices and indices as input, and writes pixels to a framebuffer. It consists of multiple steps:

All the sub-modules of this module (with the exception of cache) correspond to the various stages of graphical pipelines.

Note: With the exception of the addition of the tessellation shaders and the geometry shader, these steps haven't changed in the past decade. If you are familiar with shaders in OpenGL 2 for example, don't worry as it works in the same in Vulkan.

Note: All the stages that consist in executing a shader are performed by a microprocessor (unless you happen to use a software implementation of Vulkan). As for the other stages, some hardware (usually desktop graphics cards) have dedicated chips that will execute them while some other hardware (usually mobile) perform them with the microprocessor as well. In the latter situation, the implementation will usually glue these steps to your shaders.

Creating a graphics pipeline follows the same principle as a compute pipeline, except that you must pass multiple shaders alongside with configuration for the other steps.

TODO: add an example

Modules

blend

Defines how the color output of the fragment shader is written to the attachment.

cache

Cache the pipeline objects to disk for faster reloads.

depth_stencil

Depth and stencil operations description.

input_assembly

Assembling vertices into primitives.

multisample

State of multisampling.

raster

Stage when triangles are turned into pixels.

shader

Stage of a graphics pipeline.

vertex

Vertex sources definition

viewport

Viewports and scissor boxes.

Structs

ComputePipeline

A pipeline object that describes to the Vulkan implementation how it should perform compute operations.

ComputePipelineSys

Opaque object that represents the inside of the compute pipeline. Can be made into a trait object.

GraphicsPipeline

Defines how the implementation should perform a draw operation.

GraphicsPipelineBuilder

Prototype for a GraphicsPipeline.

GraphicsPipelineSys

Opaque object that represents the inside of the graphics pipeline.

Enums

ComputePipelineCreationError

Error that can happen when creating a compute pipeline.

GraphicsPipelineCreationError

Error that can happen when creating a graphics pipeline.

Traits

ComputePipelineAbstract

Trait implemented on all compute pipelines.

GraphicsPipelineAbstract

Trait implemented on objects that reference a graphics pipeline. Can be made into a trait object. When using this trait AutoCommandBufferBuilder::draw* calls will need the buffers to be wrapped in a vec!().