wgpu/api/
pipeline_layout.rs

1use crate::*;
2
3/// Handle to a pipeline layout.
4///
5/// A `PipelineLayout` object describes the available binding groups of a pipeline.
6/// It can be created with [`Device::create_pipeline_layout`].
7///
8/// Corresponds to [WebGPU `GPUPipelineLayout`](https://gpuweb.github.io/gpuweb/#gpupipelinelayout).
9#[derive(Debug, Clone)]
10pub struct PipelineLayout {
11    pub(crate) inner: dispatch::DispatchPipelineLayout,
12}
13#[cfg(send_sync)]
14static_assertions::assert_impl_all!(PipelineLayout: Send, Sync);
15
16crate::cmp::impl_eq_ord_hash_proxy!(PipelineLayout => .inner);
17
18/// Describes a [`PipelineLayout`].
19///
20/// For use with [`Device::create_pipeline_layout`].
21///
22/// Corresponds to [WebGPU `GPUPipelineLayoutDescriptor`](
23/// https://gpuweb.github.io/gpuweb/#dictdef-gpupipelinelayoutdescriptor).
24#[derive(Clone, Debug, Default)]
25pub struct PipelineLayoutDescriptor<'a> {
26    /// Debug label of the pipeline layout. This will show up in graphics debuggers for easy identification.
27    pub label: Label<'a>,
28    /// Bind groups that this pipeline uses. The first entry will provide all the bindings for
29    /// "set = 0", second entry will provide all the bindings for "set = 1" etc.
30    pub bind_group_layouts: &'a [&'a BindGroupLayout],
31    /// Set of push constant ranges this pipeline uses. Each shader stage that uses push constants
32    /// must define the range in push constant memory that corresponds to its single `var<push_constant>`
33    /// buffer.
34    ///
35    /// If this array is non-empty, the [`Features::PUSH_CONSTANTS`] must be enabled.
36    pub push_constant_ranges: &'a [PushConstantRange],
37}
38#[cfg(send_sync)]
39static_assertions::assert_impl_all!(PipelineLayoutDescriptor<'_>: Send, Sync);