pub struct TimelineSemaphore {
pub value: u64,
/* private fields */
}Expand description
A mock GPU timeline semaphore for synchronising multi-pass GPU work.
On real GPU APIs (Vulkan, D3D12), timeline semaphores allow the CPU to wait for a specific GPU progress point. This mock records signal and wait operations for testing.
Fields§
§value: u64Current value of the semaphore counter.
Implementations§
Source§impl TimelineSemaphore
impl TimelineSemaphore
Sourcepub fn signal(&mut self, new_value: u64)
pub fn signal(&mut self, new_value: u64)
Signal the semaphore to new_value. Value must be monotonically increasing.
Sourcepub fn wait(&mut self, wait_value: u64) -> bool
pub fn wait(&mut self, wait_value: u64) -> bool
Record a wait-for request. In a mock, this checks wait_value <= current.
Returns true if the semaphore has already reached wait_value.
Sourcepub fn current_value(&self) -> u64
pub fn current_value(&self) -> u64
Return the current semaphore value.
Sourcepub fn signal_count(&self) -> usize
pub fn signal_count(&self) -> usize
Number of times the semaphore has been signalled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TimelineSemaphore
impl RefUnwindSafe for TimelineSemaphore
impl Send for TimelineSemaphore
impl Sync for TimelineSemaphore
impl Unpin for TimelineSemaphore
impl UnsafeUnpin for TimelineSemaphore
impl UnwindSafe for TimelineSemaphore
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
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>
Converts
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>
Converts
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