gfx_hal/pso/
compute.rs

1//! Compute pipeline descriptor.
2
3use crate::{
4    pso::{BasePipeline, EntryPoint, PipelineCreationFlags},
5    Backend,
6};
7
8/// A description of the data needed to construct a compute pipeline.
9#[derive(Debug)]
10pub struct ComputePipelineDesc<'a, B: Backend> {
11    /// Pipeline label
12    pub label: Option<&'a str>,
13    /// The shader entry point that performs the computation.
14    pub shader: EntryPoint<'a, B>,
15    /// Pipeline layout.
16    pub layout: &'a B::PipelineLayout,
17    /// Any flags necessary for the pipeline creation.
18    pub flags: PipelineCreationFlags,
19    /// The parent pipeline to this one, if any.
20    pub parent: BasePipeline<'a, B::ComputePipeline>,
21}
22
23impl<'a, B: Backend> ComputePipelineDesc<'a, B> {
24    /// Create a new empty PSO descriptor.
25    pub fn new(shader: EntryPoint<'a, B>, layout: &'a B::PipelineLayout) -> Self {
26        ComputePipelineDesc {
27            label: None,
28            shader,
29            layout,
30            flags: PipelineCreationFlags::empty(),
31            parent: BasePipeline::None,
32        }
33    }
34}