pub struct GpuSync { /* private fields */ }Expand description
A simulated GPU synchronisation object.
In a real driver backend this would wrap an underlying API object
(VkSemaphore, VkFence, MTLEvent, etc.). Here we simulate
the state machine for testing and integration purposes.
Implementations§
Source§impl GpuSync
impl GpuSync
Sourcepub fn new(sync_type: SyncType, label: impl Into<String>) -> Self
pub fn new(sync_type: SyncType, label: impl Into<String>) -> Self
Create a new sync primitive in the Unsignaled state.
Sourcepub fn signal(&mut self)
pub fn signal(&mut self)
Signal the primitive (simulates GPU work completing).
Transitions Unsignaled → Pending → Signaled, or moves
directly from Pending to Signaled.
Sourcepub fn wait(&self) -> bool
pub fn wait(&self) -> bool
Block (simulate) until the primitive is signaled.
In this simulation, we simply check the current state. Returns
true if the primitive is (or was already) signaled, false
if it is still Unsignaled (nothing was enqueued).
Sourcepub fn reset(&mut self) -> bool
pub fn reset(&mut self) -> bool
Reset the primitive back to Unsignaled so it can be re-used.
Returns false if the primitive is still Pending (cannot safely
reset GPU-side work that may be in flight).
Sourcepub fn signal_count(&self) -> u64
pub fn signal_count(&self) -> u64
Number of times this primitive has been signaled over its lifetime.
Auto Trait Implementations§
impl Freeze for GpuSync
impl RefUnwindSafe for GpuSync
impl Send for GpuSync
impl Sync for GpuSync
impl Unpin for GpuSync
impl UnsafeUnpin for GpuSync
impl UnwindSafe for GpuSync
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