[−][src]Trait web_glitz::pipeline::resources::ResourceBindings
Encodes a description of how a set of resources is bound to a pipeline, such that the pipeline may access these resources during its execution.
Example
use web_glitz::buffer::Buffer; use web_glitz::image::texture_2d::FloatSampledTexture2D; use web_glitz::pipeline::resources::{ResourceBindings, ResourceBindingsEncodingContext, ResourceBindingsEncoding, StaticResourceBindingsEncoder, BindGroup, BindGroupDescriptor}; struct Resources<T0, T1> { bind_group_0: BindGroup<T0>, bind_group_1: BindGroup<T1>, } impl<T0, T1> ResourceBindings for &'_ Resources<T0, T1> { type BindGroups = [BindGroupDescriptor; 2]; fn encode( self, encoding_context: &mut ResourceBindingsEncodingContext ) -> ResourceBindingsEncoding<Self::BindGroups> { let encoder = StaticResourceBindingsEncoder::new(encoding_context); let encoder = encoder.add_bind_group(0, &self.bind_group_0); let encoder = encoder.add_bind_group(1, &self.bind_group_1); encoder.finish() } }
See also StaticResourceBindingsEncoder.
Note that when multiple bindings of the same type bind to the same slot-index, then only the binding that was added last will be used. However, buffer resources and texture resources belong to distinct bind groups, their slot-indices do not interact.
This trait is automatically implemented for any type that derives the Resources trait.
Associated Types
type BindGroups: Borrow<[BindGroupDescriptor]> + 'static
Type that describes the collection of bindings.
Required methods
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
Encodes a description of how this set of resources is bound to a pipeline.
Implementations on Foreign Types
impl ResourceBindings for ()[src]
type BindGroups = [BindGroupDescriptor; 0]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>)[src]
type BindGroups = [BindGroupDescriptor; 2]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>)[src]
type BindGroups = [BindGroupDescriptor; 3]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>)[src]
type BindGroups = [BindGroupDescriptor; 4]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>)[src]
type BindGroups = [BindGroupDescriptor; 5]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>)[src]
type BindGroups = [BindGroupDescriptor; 6]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>)[src]
type BindGroups = [BindGroupDescriptor; 7]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>)[src]
type BindGroups = [BindGroupDescriptor; 8]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>)[src]
type BindGroups = [BindGroupDescriptor; 9]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>)[src]
type BindGroups = [BindGroupDescriptor; 10]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>, &'_ BindGroup<T10>)[src]
type BindGroups = [BindGroupDescriptor; 11]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>, &'_ BindGroup<T10>, &'_ BindGroup<T11>)[src]
type BindGroups = [BindGroupDescriptor; 12]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>, &'_ BindGroup<T10>, &'_ BindGroup<T11>, &'_ BindGroup<T12>)[src]
type BindGroups = [BindGroupDescriptor; 13]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>, &'_ BindGroup<T10>, &'_ BindGroup<T11>, &'_ BindGroup<T12>, &'_ BindGroup<T13>)[src]
type BindGroups = [BindGroupDescriptor; 14]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>, &'_ BindGroup<T10>, &'_ BindGroup<T11>, &'_ BindGroup<T12>, &'_ BindGroup<T13>, &'_ BindGroup<T14>)[src]
type BindGroups = [BindGroupDescriptor; 15]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_, '_> ResourceBindings for (&'_ BindGroup<T0>, &'_ BindGroup<T1>, &'_ BindGroup<T2>, &'_ BindGroup<T3>, &'_ BindGroup<T4>, &'_ BindGroup<T5>, &'_ BindGroup<T6>, &'_ BindGroup<T7>, &'_ BindGroup<T8>, &'_ BindGroup<T9>, &'_ BindGroup<T10>, &'_ BindGroup<T11>, &'_ BindGroup<T12>, &'_ BindGroup<T13>, &'_ BindGroup<T14>, &'_ BindGroup<T15>)[src]
type BindGroups = [BindGroupDescriptor; 16]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>
Implementors
impl<T0, '_> ResourceBindings for &'_ BindGroup<T0>[src]
type BindGroups = [BindGroupDescriptor; 1]
fn encode(
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>[src]
self,
encoding_context: &mut ResourceBindingsEncodingContext
) -> ResourceBindingsEncoding<'_, Self::BindGroups>