pub struct BindingInstance<T> { /* private fields */ }Expand description
Source data for a GPUBindingInstance<T>: which T (a
GPUMaterial or
GPUCompute) to bind against, and the
concrete resource for each of its named binding entries.
T is a marker only — this holds no T value, just a
RawAssetHandle into whichever ProcessedAssets<T> store T lives
in. See the MaterialInstance/ComputeInstance aliases for the two
concrete instantiations. Fields are private — start from
BindingInstance::new and chain the per-kind binding methods below
(mirroring how BindGroupBuilder adds one resource per call) rather
than constructing one as a struct literal.
Implementations§
Source§impl<T: Asset<WGPUBackend>> BindingInstance<T>
impl<T: Asset<WGPUBackend>> BindingInstance<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) -> Self
pub fn build(self) -> Self
Consume the builder and return the finished BindingInstance value.
Sourcepub fn build_asset(self, name: &str, assets: &mut Assets<Self>) -> Handle<Self>
pub fn build_asset(self, name: &str, assets: &mut Assets<Self>) -> Handle<Self>
Consume the builder, insert into assets under name, and return
the resulting Handle<BindingInstance<T>>.
Auto Trait Implementations§
impl<T> Freeze for BindingInstance<T>
impl<T> RefUnwindSafe for BindingInstance<T>
impl<T> Send for BindingInstance<T>
impl<T> Sync for BindingInstance<T>
impl<T> Unpin for BindingInstance<T>
impl<T> UnsafeUnpin for BindingInstance<T>
impl<T> UnwindSafe for BindingInstance<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