#[non_exhaustive]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),
}Expand description
Resource to be bound by a BindGroup for use with a pipeline.
The pipeline’s BindGroupLayout must contain a matching BindingType.
Corresponds to WebGPU GPUBindingResource.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Buffer(BufferBinding<'a>)
Binding is backed by a buffer.
Corresponds to wgt::BufferBindingType::Uniform and wgt::BufferBindingType::Storage
with BindGroupLayoutEntry::count set to None.
BufferArray(&'a [BufferBinding<'a>])
Binding is backed by an array of buffers.
Features::BUFFER_BINDING_ARRAY must be supported to use this feature.
Corresponds to wgt::BufferBindingType::Uniform and wgt::BufferBindingType::Storage
with BindGroupLayoutEntry::count set to Some.
Sampler(&'a Sampler)
Binding is a sampler.
Corresponds to wgt::BindingType::Sampler with BindGroupLayoutEntry::count set to None.
SamplerArray(&'a [&'a Sampler])
Binding is backed by an array of samplers.
Features::TEXTURE_BINDING_ARRAY must be supported to use this feature.
Corresponds to wgt::BindingType::Sampler with BindGroupLayoutEntry::count set
to Some.
TextureView(&'a TextureView)
Binding is backed by a texture.
Corresponds to wgt::BindingType::Texture and wgt::BindingType::StorageTexture with
BindGroupLayoutEntry::count set to None.
TextureViewArray(&'a [&'a TextureView])
Binding is backed by an array of textures.
Features::TEXTURE_BINDING_ARRAY must be supported to use this feature.
Corresponds to wgt::BindingType::Texture and wgt::BindingType::StorageTexture with
BindGroupLayoutEntry::count set to Some.
AccelerationStructure(&'a Tlas)
Binding is backed by a top level acceleration structure
Corresponds to wgt::BindingType::AccelerationStructure with BindGroupLayoutEntry::count set to None.
§Validation
When using (e.g. with set_bind_group) a bind group that has been created with one or more of this binding
resource certain checks take place.
- TLAS must have been built, if not a validation error is generated
- All BLASes that were built into the TLAS must be built before the TLAS, if this was not satisfied and TLAS was
built using
build_acceleration_structuresa validation error is generated otherwise this is a part of the safety section ofbuild_acceleration_structures_unsafe_tlasand so undefined behavior occurs.
Trait Implementations§
Source§impl<'a> Clone for BindingResource<'a>
impl<'a> Clone for BindingResource<'a>
Source§fn clone(&self) -> BindingResource<'a>
fn clone(&self) -> BindingResource<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for BindingResource<'a>
impl<'a> Debug for BindingResource<'a>
Source§impl<'a> From<BufferSlice<'a>> for BindingResource<'a>
impl<'a> From<BufferSlice<'a>> for BindingResource<'a>
Source§fn from(value: BufferSlice<'a>) -> Self
fn from(value: BufferSlice<'a>) -> Self
Convert a BufferSlice to an equivalent BindingResource::Buffer,
provided that it will be used without a dynamic offset.