//! Utilities for creating shader states.
/// Describes how the vertex buffer is interpreted.
#[derive(Clone, Debug)]
pub struct VertexBufferLayout {
/// The stride, in bytes, between elements of this buffer.
pub array_stride: wgpu::BufferAddress,
/// How often this vertex buffer is "stepped" forward.
pub step_mode: wgpu::VertexStepMode,
/// The list of attributes which comprise a single vertex.
pub attributes: Vec<wgpu::VertexAttribute>,
}
/// Describes the fragment process in a render pipeline.
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FragmentState {
/// The shader source
pub source: &'static str,
/// The name of the entry point in the compiled shader. There must be a
/// function with this name in the shader.
pub entry_point: &'static str,
/// The color state of the render targets.
pub targets: Vec<Option<wgpu::ColorTargetState>>,
}
#[derive(Clone, Debug)]
pub struct VertexState {
/// The shader source
pub source: &'static str,
/// The name of the entry point in the compiled shader. There must be a
/// function with this name in the shader.
pub entry_point: &'static str,
/// The format of any vertex buffers used with this pipeline.
pub buffers: Vec<VertexBufferLayout>,
}