[−][src]Trait wgpu_core::track::ResourceState
The main trait that abstracts away the tracking logic of a particular resource type, like a buffer or a texture.
Associated Types
type Id: Copy + Debug + TypedId
Corresponding HUB identifier.
type Selector: Debug
A type specifying the sub-resources.
type Usage: Debug
Usage type for a Unit of a sub-resource.
Required methods
fn query(&self, selector: Self::Selector) -> Option<Self::Usage>
Check if all the selected sub-resources have the same usage, and return it.
Returns None if no sub-resources
are intersecting with the selector, or their usage
isn't consistent.
fn change(
&mut self,
id: Self::Id,
selector: Self::Selector,
usage: Self::Usage,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
&mut self,
id: Self::Id,
selector: Self::Selector,
usage: Self::Usage,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
Change the last usage of the selected sub-resources.
If output is specified, it's filled with the
PendingTransition objects corresponding to smaller
sub-resource transitions. The old usage is replaced by
the new one.
If output is None, the old usage is extended with
the new usage. The error is returned if it's not possible,
specifying the conflicting transition. Extension can only
be done for read-only usages.
fn merge(
&mut self,
id: Self::Id,
other: &Self,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
&mut self,
id: Self::Id,
other: &Self,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
Merge the state of this resource tracked by a different instance with the current one.
Same rules for output apply as with change(): last usage state
is either replaced (when output is provided) with a
PendingTransition pushed to this vector, or extended with the
other read-only usage, unless there is a usage conflict, and
the error is generated (returning the conflict).
fn optimize(&mut self)
Try to optimize the internal representation.
Implementations on Foreign Types
impl<I: Copy + Debug + TypedId> ResourceState for PhantomData<I>[src]
type Id = I
type Selector = ()
type Usage = ()
fn query(&self, _selector: Self::Selector) -> Option<Self::Usage>[src]
fn change(
&mut self,
_id: Self::Id,
_selector: Self::Selector,
_usage: Self::Usage,
_output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>[src]
&mut self,
_id: Self::Id,
_selector: Self::Selector,
_usage: Self::Usage,
_output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
fn merge(
&mut self,
_id: Self::Id,
_other: &Self,
_output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>[src]
&mut self,
_id: Self::Id,
_other: &Self,
_output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
fn optimize(&mut self)[src]
Implementors
impl ResourceState for TextureState[src]
type Id = TextureId
type Selector = SubresourceRange
type Usage = TextureUsage
fn query(&self, selector: Self::Selector) -> Option<Self::Usage>[src]
fn change(
&mut self,
id: Self::Id,
selector: Self::Selector,
usage: Self::Usage,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>[src]
&mut self,
id: Self::Id,
selector: Self::Selector,
usage: Self::Usage,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
fn merge(
&mut self,
id: Self::Id,
other: &Self,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>[src]
&mut self,
id: Self::Id,
other: &Self,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
fn optimize(&mut self)[src]
impl ResourceState for BufferState[src]
type Id = BufferId
type Selector = ()
type Usage = BufferUsage
fn query(&self, _selector: Self::Selector) -> Option<Self::Usage>[src]
fn change(
&mut self,
id: Self::Id,
_selector: Self::Selector,
usage: Self::Usage,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>[src]
&mut self,
id: Self::Id,
_selector: Self::Selector,
usage: Self::Usage,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>
fn merge(
&mut self,
id: Self::Id,
other: &Self,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>[src]
&mut self,
id: Self::Id,
other: &Self,
output: Option<&mut Vec<PendingTransition<Self>>>
) -> Result<(), PendingTransition<Self>>