Struct wgpu_core::track::stateless::StatelessTracker
source · pub(crate) struct StatelessTracker<A: HalApi, T, Id: TypedId> {
metadata: ResourceMetadata<A>,
_phantom: PhantomData<(T, Id)>,
}
Expand description
Stores all resource state within a command buffer or device.
Fields§
§metadata: ResourceMetadata<A>
§_phantom: PhantomData<(T, Id)>
Implementations§
source§impl<A: HalApi, T: Resource, Id: TypedId> StatelessTracker<A, T, Id>
impl<A: HalApi, T: Resource, Id: TypedId> StatelessTracker<A, T, Id>
pub fn new() -> Self
fn tracker_assert_in_bounds(&self, index: usize)
sourcepub fn set_size(&mut self, size: usize)
pub fn set_size(&mut self, size: usize)
Sets the size of all the vectors inside the tracker.
Must be called with the highest possible Resource ID of this type before all unsafe functions are called.
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(&self) -> impl Iterator<Item = Valid<Id>> + '_
pub fn used(&self) -> impl Iterator<Item = Valid<Id>> + '_
Returns a list of all resources tracked.
sourcepub fn insert_single(&mut self, id: Valid<Id>, ref_count: RefCount)
pub fn insert_single(&mut self, id: Valid<Id>, ref_count: RefCount)
Inserts a single resource into the resource tracker.
If the resource already exists in the tracker, it will be overwritten.
If the ID is higher than the length of internal vectors, the vectors will be extended. A call to set_size is not needed.
sourcepub fn add_single<'a>(
&mut self,
storage: &'a Storage<T, Id>,
id: Id
) -> Option<&'a T>
pub fn add_single<'a>( &mut self, storage: &'a Storage<T, Id>, id: Id ) -> Option<&'a T>
Adds the given resource to the tracker.
If the ID is higher than the length of internal vectors, the vectors will be extended. A call to set_size is not needed.
sourcepub fn add_from_tracker(&mut self, other: &Self)
pub fn add_from_tracker(&mut self, other: &Self)
Adds the given resources from the given tracker.
If the ID is higher than the length of internal vectors, the vectors will be extended. A call to set_size is not needed.
sourcepub fn remove_abandoned(&mut self, id: Valid<Id>) -> bool
pub fn remove_abandoned(&mut self, id: Valid<Id>) -> bool
Removes the given resource from the tracker iff we have the last reference to the resource and the epoch matches.
Returns true if the resource was removed.
If the ID is higher than the length of internal vectors, false will be returned.