wgpu/api/
bind_group_layout.rs

1use crate::*;
2
3/// Handle to a binding group layout.
4///
5/// A `BindGroupLayout` is a handle to the GPU-side layout of a binding group. It can be used to
6/// create a [`BindGroupDescriptor`] object, which in turn can be used to create a [`BindGroup`]
7/// object with [`Device::create_bind_group`]. A series of `BindGroupLayout`s can also be used to
8/// create a [`PipelineLayoutDescriptor`], which can be used to create a [`PipelineLayout`].
9///
10/// It can be created with [`Device::create_bind_group_layout`].
11///
12/// Corresponds to [WebGPU `GPUBindGroupLayout`](
13/// https://gpuweb.github.io/gpuweb/#gpubindgrouplayout).
14#[derive(Debug, Clone)]
15pub struct BindGroupLayout {
16    pub(crate) inner: dispatch::DispatchBindGroupLayout,
17}
18#[cfg(send_sync)]
19static_assertions::assert_impl_all!(BindGroupLayout: Send, Sync);
20
21crate::cmp::impl_eq_ord_hash_proxy!(BindGroupLayout => .inner);
22
23/// Describes a [`BindGroupLayout`].
24///
25/// For use with [`Device::create_bind_group_layout`].
26///
27/// Corresponds to [WebGPU `GPUBindGroupLayoutDescriptor`](
28/// https://gpuweb.github.io/gpuweb/#dictdef-gpubindgrouplayoutdescriptor).
29#[derive(Clone, Debug)]
30pub struct BindGroupLayoutDescriptor<'a> {
31    /// Debug label of the bind group layout. This will show up in graphics debuggers for easy identification.
32    pub label: Label<'a>,
33
34    /// Array of entries in this BindGroupLayout
35    pub entries: &'a [BindGroupLayoutEntry],
36}
37static_assertions::assert_impl_all!(BindGroupLayoutDescriptor<'_>: Send, Sync);