pub enum Resource {
Buffer(Buffer),
Texture(Texture),
TextureView(TextureView),
Sampler(Sampler),
Array(ArrayHandle),
BindGroup(BindGroup),
Virtual,
}Expand description
A wgpu resource owned by the graph, or a virtual node standing in for one.
This is the stored form, and the way to name a resource whose kind is only
known at runtime: it is the erased ResHandle’s
kind. Variants are thin — each holds the wgpu handle itself — so callers can
keep working with raw wgpu and use the graph purely for bookkeeping.
Variants§
Buffer(Buffer)
A buffer (vertex, index, uniform or storage).
Texture(Texture)
A texture.
TextureView(TextureView)
A texture view, with the format it views its texture as.
Sampler(Sampler)
A sampler.
Array(ArrayHandle)
A flat array of fixed-size elements, held either in a storage buffer or in a texture.
The two are one kind rather than two because they are one thing to a
caller: which of them an array lives in follows from the device, not
from what the array holds. See
ArrayHandle.
BindGroup(BindGroup)
A bind group.
Virtual
A virtual node: no wgpu handle, purely a graph citizen.
It carries no GPU resource of its own: it is what an id over
Virtual resolves to, and it exists to group or stand in for other
nodes. The edges leaving it express ownership or derivation rather than
handle derivation, which makes it the natural aggregation root for a
group of resources that live and die together (see Retention).
It is an ordinary node otherwise: it takes dependencies like any other, and replacing it swaps one virtual value for another — a node’s kind never changes — while marking the nodes built from it dirty.
Implementations§
Source§impl Resource
impl Resource
Sourcepub fn kind_name(&self) -> &'static str
pub fn kind_name(&self) -> &'static str
The name of this resource’s kind.
The stored form erases the kind, so this is how a caller that only has a
Resource — a graph-wide read, a debug dump — reports which of the
stored kinds it is looking at. The name matches the ResourceKind
type it stands for: "Buffer", "TextureView", "Virtual", and so
on.
Trait Implementations§
Source§impl From<ArrayHandle> for Resource
impl From<ArrayHandle> for Resource
Source§fn from(value: ArrayHandle) -> Self
fn from(value: ArrayHandle) -> Self
Source§impl From<TextureView> for Resource
impl From<TextureView> for Resource
Source§fn from(value: TextureView) -> Self
fn from(value: TextureView) -> Self
Source§impl ResourceKind for Resource
impl ResourceKind for Resource
Source§fn borrow_from(resource: &Resource) -> Option<&Self>
fn borrow_from(resource: &Resource) -> Option<&Self>
Resource, or None when that
resource is of another kind.Source§fn take_from(resource: Resource) -> Option<Self>
fn take_from(resource: Resource) -> Option<Self>
Resource, or None when that
resource is of another kind.Source§fn into_resource(self) -> Resource
fn into_resource(self) -> Resource
Resource.Auto Trait Implementations§
impl !RefUnwindSafe for Resource
impl !UnwindSafe for Resource
impl Forget for Resource
impl Freeze for Resource
impl Send for Resource
impl Sync for Resource
impl Unpin for Resource
impl UnsafeUnpin for Resource
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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