use crate::*;
#[derive(Debug, Clone)]
pub struct BindGroup {
pub(crate) inner: dispatch::DispatchBindGroup,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(BindGroup: Send, Sync);
crate::cmp::impl_eq_ord_hash_proxy!(BindGroup => .inner);
impl BindGroup {
#[cfg(custom)]
pub fn as_custom<T: custom::BindGroupInterface>(&self) -> Option<&T> {
self.inner.as_custom()
}
}
#[non_exhaustive]
#[derive(Clone, Debug)]
pub enum BindingResource<'a> {
Buffer(BufferBinding<'a>),
BufferArray(&'a [BufferBinding<'a>]),
Sampler(&'a Sampler),
SamplerArray(&'a [&'a Sampler]),
TextureView(&'a TextureView),
TextureViewArray(&'a [&'a TextureView]),
AccelerationStructure(&'a Tlas),
ExternalTexture(&'a ExternalTexture),
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(BindingResource<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct BufferBinding<'a> {
pub buffer: &'a Buffer,
pub offset: BufferAddress,
pub size: Option<BufferSize>,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(BufferBinding<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct BindGroupEntry<'a> {
pub binding: u32,
pub resource: BindingResource<'a>,
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(BindGroupEntry<'_>: Send, Sync);
#[derive(Clone, Debug)]
pub struct BindGroupDescriptor<'a> {
pub label: Label<'a>,
pub layout: &'a BindGroupLayout,
pub entries: &'a [BindGroupEntry<'a>],
}
#[cfg(send_sync)]
static_assertions::assert_impl_all!(BindGroupDescriptor<'_>: Send, Sync);