use super::texture::TextureFormat;
use crate::device::Device;
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub enum CompareFunction {
GreaterEqual,
Greater,
LessEqual,
Always,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub enum BlendMode {
#[default]
Replace,
Alpha,
Additive,
ReverseMultiply,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct ColorTarget {
pub format: TextureFormat,
pub blend: BlendMode,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct DepthState {
pub format: TextureFormat,
pub write: bool,
pub compare: CompareFunction,
}
#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
pub enum PrimitiveTopology {
#[default]
TriangleList,
}
#[derive(Debug)]
pub struct RenderPipelineDesc<'a, D: Device> {
pub label: &'static str,
pub layouts: &'a [Option<&'a D::BindGroupLayout>],
pub shader: &'a D::ShaderModule,
pub vs_entry: &'static str,
pub fs_entry: Option<&'static str>,
pub color_targets: &'a [ColorTarget],
pub depth: Option<DepthState>,
pub topology: PrimitiveTopology,
pub constants: &'a [(&'static str, f64)],
}
#[derive(Debug)]
pub struct ComputePipelineDesc<'a, D: Device> {
pub label: &'static str,
pub layouts: &'a [Option<&'a D::BindGroupLayout>],
pub shader: &'a D::ShaderModule,
pub entry: &'static str,
}