pub struct BindingInstanceBuilder<T> { /* private fields */ }Expand description
Builds a BindingInstance<T>. Start from new, chain
the per-kind binding methods below (mirroring how BindGroupBuilder
adds one resource per call), then finish with
build/build_asset. See the
MaterialInstanceBuilder/ComputeInstanceBuilder aliases for the
two concrete instantiations.
Implementations§
Source§impl<T: Asset<WGPUBackend>> BindingInstanceBuilder<T>
impl<T: Asset<WGPUBackend>> BindingInstanceBuilder<T>
Sourcepub fn new(target: Handle<T::Source>) -> Self
pub fn new(target: Handle<T::Source>) -> Self
Start building an instance targeting target — the source handle
for T (e.g. a Handle<Material> for a MaterialInstance),
looked up in ProcessedAssets<T> once that target itself has
finished uploading. Chain the binding methods below to add entries.
Sourcepub fn texture(self, name: &'static str, handle: Handle<Texture>) -> Self
pub fn texture(self, name: &'static str, handle: Handle<Texture>) -> Self
Bind a processed GPUTexture, by its
source handle, under name.
Sourcepub fn texture_array(
self,
name: &'static str,
handle: Handle<TextureArray>,
) -> Self
pub fn texture_array( self, name: &'static str, handle: Handle<TextureArray>, ) -> Self
Bind a processed GPUTextureArray,
by its source handle, under name.
Sourcepub fn cubemap(self, name: &'static str, handle: Handle<Cubemap>) -> Self
pub fn cubemap(self, name: &'static str, handle: Handle<Cubemap>) -> Self
Bind a processed GPUCubemap, by its
source handle, under name.
Sourcepub fn sampler(self, name: &'static str, kind: SamplerKind) -> Self
pub fn sampler(self, name: &'static str, kind: SamplerKind) -> Self
Bind a sampler from the global sampler cache under name.
Sourcepub fn uniform(self, name: &'static str, data: Vec<u8>) -> Self
pub fn uniform(self, name: &'static str, data: Vec<u8>) -> Self
Bind raw bytes as a uniform buffer owned by this instance, under
name — updatable later via GPUBindingInstance::update.
Sourcepub fn storage(self, name: &'static str, data: Vec<u8>) -> Self
pub fn storage(self, name: &'static str, data: Vec<u8>) -> Self
Same as uniform but as a storage buffer.
Sourcepub fn param(self, name: &'static str, entry: BindingInstanceEntry) -> Self
pub fn param(self, name: &'static str, entry: BindingInstanceEntry) -> Self
Sourcepub fn build(self) -> BindingInstance<T>
pub fn build(self) -> BindingInstance<T>
Consume the builder and return the finished BindingInstance value.
Sourcepub fn build_asset(
self,
name: &str,
assets: &mut Assets<BindingInstance<T>>,
) -> Handle<BindingInstance<T>>
pub fn build_asset( self, name: &str, assets: &mut Assets<BindingInstance<T>>, ) -> Handle<BindingInstance<T>>
Consume the builder, insert into assets under name, and return
the resulting Handle<BindingInstance<T>>.
Auto Trait Implementations§
impl<T> Freeze for BindingInstanceBuilder<T>
impl<T> RefUnwindSafe for BindingInstanceBuilder<T>
impl<T> Send for BindingInstanceBuilder<T>
impl<T> Sync for BindingInstanceBuilder<T>
impl<T> Unpin for BindingInstanceBuilder<T>
impl<T> UnsafeUnpin for BindingInstanceBuilder<T>
impl<T> UnwindSafe for BindingInstanceBuilder<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Component for T
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more