Struct wgpu_core::track::texture::DeviceTextureTracker
source · pub(crate) struct DeviceTextureTracker {
current_state_set: TextureStateSet,
metadata: ResourceMetadata<Weak<Texture>>,
temp: Vec<PendingTransition<TextureUses>>,
}
Expand description
Stores all texture state within a device.
Fields§
§current_state_set: TextureStateSet
§metadata: ResourceMetadata<Weak<Texture>>
§temp: Vec<PendingTransition<TextureUses>>
Implementations§
source§impl DeviceTextureTracker
impl DeviceTextureTracker
pub fn new() -> Self
fn tracker_assert_in_bounds(&self, index: usize)
sourcefn allow_index(&mut self, index: usize)
fn allow_index(&mut self, index: usize)
Extend the vectors to let the given index be valid.
sourcepub fn used_resources(&self) -> impl Iterator<Item = Weak<Texture>> + '_
pub fn used_resources(&self) -> impl Iterator<Item = Weak<Texture>> + '_
Returns a list of all textures tracked.
sourcepub fn insert_single(&mut self, texture: &Arc<Texture>, usage: TextureUses)
pub fn insert_single(&mut self, texture: &Arc<Texture>, usage: TextureUses)
Inserts a single texture and a state into the resource tracker.
If the resource already exists in the tracker, it will be overwritten.
sourcepub fn set_single(
&mut self,
texture: &Arc<Texture>,
selector: TextureSelector,
new_state: TextureUses,
) -> Drain<'_, PendingTransition<TextureUses>>
pub fn set_single( &mut self, texture: &Arc<Texture>, selector: TextureSelector, new_state: TextureUses, ) -> Drain<'_, PendingTransition<TextureUses>>
Sets the state of a single texture.
If a transition is needed to get the texture into the given state, that transition is returned.
sourcepub fn set_from_tracker_and_drain_transitions<'a, 'b: 'a>(
&'a mut self,
tracker: &'a TextureTracker,
snatch_guard: &'b SnatchGuard<'b>,
) -> impl Iterator<Item = TextureBarrier<'a, dyn DynTexture>>
pub fn set_from_tracker_and_drain_transitions<'a, 'b: 'a>( &'a mut self, tracker: &'a TextureTracker, snatch_guard: &'b SnatchGuard<'b>, ) -> impl Iterator<Item = TextureBarrier<'a, dyn DynTexture>>
Sets the given state for all texture in the given tracker.
If a transition is needed to get the texture into the needed state, those transitions are returned.
sourcepub fn set_from_usage_scope_and_drain_transitions<'a, 'b: 'a>(
&'a mut self,
scope: &'a TextureUsageScope,
snatch_guard: &'b SnatchGuard<'b>,
) -> impl Iterator<Item = TextureBarrier<'a, dyn DynTexture>>
pub fn set_from_usage_scope_and_drain_transitions<'a, 'b: 'a>( &'a mut self, scope: &'a TextureUsageScope, snatch_guard: &'b SnatchGuard<'b>, ) -> impl Iterator<Item = TextureBarrier<'a, dyn DynTexture>>
Sets the given state for all textures in the given UsageScope.
If a transition is needed to get the textures into the needed state, those transitions are returned.
sourcepub fn remove(&mut self, index: TrackerIndex) -> bool
pub fn remove(&mut self, index: TrackerIndex) -> bool
Unconditionally removes the given resource from the tracker.
Returns true if the resource was removed.
If the index is higher than the length of internal vectors, false will be returned.