Struct wgpu_core::track::buffer::DeviceBufferTracker
source · pub(crate) struct DeviceBufferTracker {
current_states: Vec<BufferUses>,
metadata: ResourceMetadata<Weak<Buffer>>,
temp: Vec<PendingTransition<BufferUses>>,
}
Expand description
Stores all buffer state within a device.
Fields§
§current_states: Vec<BufferUses>
§metadata: ResourceMetadata<Weak<Buffer>>
§temp: Vec<PendingTransition<BufferUses>>
Implementations§
source§impl DeviceBufferTracker
impl DeviceBufferTracker
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<Buffer>> + '_
pub fn used_resources(&self) -> impl Iterator<Item = &Weak<Buffer>> + '_
Returns a list of all buffers tracked.
sourcepub fn insert_single(&mut self, buffer: &Arc<Buffer>, state: BufferUses)
pub fn insert_single(&mut self, buffer: &Arc<Buffer>, state: BufferUses)
Inserts a single buffer and its state into the resource tracker.
If the resource already exists in the tracker, it will be overwritten.
sourcepub fn set_single(
&mut self,
buffer: &Arc<Buffer>,
state: BufferUses,
) -> Option<PendingTransition<BufferUses>>
pub fn set_single( &mut self, buffer: &Arc<Buffer>, state: BufferUses, ) -> Option<PendingTransition<BufferUses>>
Sets the state of a single buffer.
If a transition is needed to get the buffer into the given state, that transition is returned. No more than one transition is needed.
sourcepub fn set_from_tracker_and_drain_transitions<'a, 'b: 'a>(
&'a mut self,
tracker: &'a BufferTracker,
snatch_guard: &'b SnatchGuard<'b>,
) -> impl Iterator<Item = BufferBarrier<'a, dyn DynBuffer>>
pub fn set_from_tracker_and_drain_transitions<'a, 'b: 'a>( &'a mut self, tracker: &'a BufferTracker, snatch_guard: &'b SnatchGuard<'b>, ) -> impl Iterator<Item = BufferBarrier<'a, dyn DynBuffer>>
Sets the given state for all buffers in the given tracker.
If a transition is needed to get the buffers into the needed state, those transitions are returned.
Auto Trait Implementations§
impl Freeze for DeviceBufferTracker
impl !RefUnwindSafe for DeviceBufferTracker
impl Send for DeviceBufferTracker
impl Sync for DeviceBufferTracker
impl Unpin for DeviceBufferTracker
impl !UnwindSafe for DeviceBufferTracker
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
Mutably borrows from an owned value. Read more