[−][src]Module vulkano::pipeline::vertex
Vertex sources definition
When you create a graphics pipeline object, you need to pass an object which indicates the
layout of the vertex buffer(s) that will serve as input for the vertex shader. This is done
by passing an implementation of the VertexDefinition
trait.
In addition to this, the object that you pass when you create the graphics pipeline must also
implement the VertexSource
trait. This trait has a template parameter which corresponds to the
list of vertex buffers.
The vulkano library provides some structs that already implement these traits.
The most common situation is a single vertex buffer and no instancing, in which case you can
pass a SingleBufferDefinition
when you create the pipeline.
Implementing Vertex
The implementations of the VertexDefinition
trait that are provided by vulkano (like
SingleBufferDefinition
) require you to use a buffer whose content is [V]
where V
implements the Vertex
trait.
The Vertex
trait is unsafe, but can be implemented on a struct with the impl_vertex!
macro.
Example
use vulkano::buffer::BufferAccess; use vulkano::buffer::BufferUsage; use vulkano::memory::HostVisible; use vulkano::pipeline::vertex::; struct Vertex { position: [f32; 2] } impl_vertex!(Vertex, position); let usage = BufferUsage { vertex_buffer: true, .. BufferUsage::none() }; let vertex_buffer = BufferAccess::<[Vertex], _>::array(&device, 128, &usage, HostVisible, &queue) .expect("failed to create buffer"); // TODO: finish example
Structs
AttributeInfo | Information about a single attribute within a vertex. TODO: change that API |
BufferlessDefinition | Implementation of |
BufferlessVertices | Value to be passed as the vertex source for bufferless draw commands. |
OneVertexOneInstanceDefinition | Unstable. |
SingleBufferDefinition | Implementation of |
SingleInstanceBufferDefinition | Same as |
TwoBuffersDefinition | Unstable. |
VertexMemberInfo | Information about a member of a vertex struct. |
Enums
IncompatibleVertexDefinitionError | Error that can happen when the vertex definition doesn't match the input of the vertex shader. |
InputRate | How the vertex source should be unrolled. |
VertexMemberTy | Type of a member of a vertex struct. |
Traits
Vertex | Describes an individual |
VertexDefinition | Trait for types that describe the definition of the vertex input used by a graphics pipeline. |
VertexMember | Trait for data types that can be used as vertex members. Used by the |
VertexSource | Extension trait of |