pub struct BarrierManager { /* private fields */ }Expand description
Manages barriers for a set of GPU resources.
The barrier manager tracks current access states and automatically determines which barriers are needed when a resource transitions to a new access pattern.
Implementations§
Source§impl BarrierManager
impl BarrierManager
Sourcepub fn register_resource(
&mut self,
id: ResourceId,
initial_access: AccessType,
stage: PipelineStage,
)
pub fn register_resource( &mut self, id: ResourceId, initial_access: AccessType, stage: PipelineStage, )
Register a new resource with an initial access type.
Sourcepub fn transition(
&mut self,
id: ResourceId,
new_access: AccessType,
new_stage: PipelineStage,
) -> bool
pub fn transition( &mut self, id: ResourceId, new_access: AccessType, new_stage: PipelineStage, ) -> bool
Transition a resource to a new access type, emitting a barrier if needed.
Returns true if a barrier was emitted, false if the transition
was redundant (same access/stage).
Sourcepub fn flush(&mut self) -> Vec<BarrierDesc>
pub fn flush(&mut self) -> Vec<BarrierDesc>
Drain all pending barriers, returning them.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get the number of pending barriers.
Sourcepub fn total_barriers(&self) -> u64
pub fn total_barriers(&self) -> u64
Get the total number of barriers emitted since creation.
Sourcepub fn optimized_away(&self) -> u64
pub fn optimized_away(&self) -> u64
Get the number of barriers that were optimized away.
Sourcepub fn current_access(&self, id: ResourceId) -> Option<AccessType>
pub fn current_access(&self, id: ResourceId) -> Option<AccessType>
Get the current access state of a resource.
Sourcepub fn current_stage(&self, id: ResourceId) -> Option<PipelineStage>
pub fn current_stage(&self, id: ResourceId) -> Option<PipelineStage>
Get the current pipeline stage of a resource.
Sourcepub fn unregister_resource(&mut self, id: ResourceId) -> bool
pub fn unregister_resource(&mut self, id: ResourceId) -> bool
Remove a resource from tracking.
Sourcepub fn resource_count(&self) -> usize
pub fn resource_count(&self) -> usize
Get the number of tracked resources.
Sourcepub fn batch_transition(
&mut self,
transitions: &[(ResourceId, AccessType, PipelineStage)],
) -> usize
pub fn batch_transition( &mut self, transitions: &[(ResourceId, AccessType, PipelineStage)], ) -> usize
Batch-transition multiple resources at once.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BarrierManager
impl RefUnwindSafe for BarrierManager
impl Send for BarrierManager
impl Sync for BarrierManager
impl Unpin for BarrierManager
impl UnsafeUnpin for BarrierManager
impl UnwindSafe for BarrierManager
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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