pub enum StreamCaptureState {
NoCapture,
Prepare,
Capture,
}Expand description
Where a stream sits in the graph-capture lifecycle, and the only thing
allowed to move it. Capture is a strict NoCapture → Prepare → Capture → NoCapture progression, driven by prepare,
begin and end; each rejects an out-of-order
call, so a capture can never start unprepared and two captures can never
overlap on one stream.
The transitions live here rather than in each backend server because the rule is the same on every one of them — a backend supplies only the work a transition brackets (arming its pools, opening the driver’s capture), never the ordering rule itself.
Variants§
NoCapture
No capture is prepared or recording.
Prepare
graph_prepare has armed the persistent pools for the warmup run;
begin_capture may now open the window. Slices the warmup run reserves
are retained by the memory manager’s priming until begin_capture calls
capture_priming_end,
so the pool ends up owning the capture run’s full working set.
Capture
Launches are being recorded into a graph instead of executing. On a
hardware-graph backend (CUDA, HIP) a host sync issued now aborts the
driver capture, so the execution path defers fenced flushes until
end_capture. A software-graph backend (wgpu) has no driver capture to
abort and instead refuses the operations it cannot record: a read, sync
or profile fails on the spot, while a write is rejected lazily — queued
as an error that fails end_capture, since a graph missing an operation
is worse than a late diagnostic.
Implementations§
Source§impl StreamCaptureState
impl StreamCaptureState
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Whether launches on the stream are being recorded into a graph right now — the window during which a host sync would abort (or is rejected by) the capture.
Sourcepub fn cache_mode(&self) -> CacheMode
pub fn cache_mode(&self) -> CacheMode
The CacheMode the metadata info cache should run in at this lifecycle
position. Both while a graph is being prepared (warmup, which primes
the cache) and while it is being recorded the cache runs in
CacheMode::Capture — caching every buffer and invalidating none — so
the capture window finds every info buffer warm and drops none out from
under a recorded launch. Normal operation uses CacheMode::Normal.
Sourcepub fn prepare(&mut self) -> Result<(), ServerError>
pub fn prepare(&mut self) -> Result<(), ServerError>
NoCapture → Prepare, for graph_prepare. Call before arming the
pools; the caller owns the arming, this owns the rule that it happens
exactly once per capture.
§Errors
Fails when a capture is already prepared or already recording on this
stream, leaving the state untouched — two captures may never overlap on
one stream. The caller can retry after end_capture.
Sourcepub fn begin(&mut self) -> Result<(), ServerError>
pub fn begin(&mut self) -> Result<(), ServerError>
Prepare → Capture, for begin_capture. Call before the work that
opens the window (ending the priming phase, starting the driver’s
capture) so a rejected call cannot run any of it: on a stream that is
already recording, a drop-queue flush issued on the way to the rejection
would abort the live capture.
Since the state moves before that work, a backend whose window fails to
open must undo it with abort.
§Errors
Fails when prepare has not run — the persistent pools
have to be primed by a warmup run first — or when a capture is already
recording. The state is left untouched.
Sourcepub fn end(&mut self) -> Result<(), ServerError>
pub fn end(&mut self) -> Result<(), ServerError>
Capture → NoCapture, for end_capture. Call before closing the
window, so the stream leaves capture state even if sealing the graph
then fails — a backend that returned an error with the state still set
would wedge the stream in capture mode forever.
§Errors
Fails when no capture is recording (nothing prepared or started, or the
capture already ended), leaving the state untouched — a stray
end_capture must not close a window that was never opened.
Sourcepub fn abort(&mut self)
pub fn abort(&mut self)
Return to NoCapture from anywhere, for the failure path of a
transition’s own work: the window never opened, so the stream must be
left fully usable and re-capturable rather than stuck arming its
persistent pools forever. Unlike end this asserts
nothing, because the state it is recovering from is precisely the one
that could not be completed.
Trait Implementations§
Source§impl Clone for StreamCaptureState
impl Clone for StreamCaptureState
Source§fn clone(&self) -> StreamCaptureState
fn clone(&self) -> StreamCaptureState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for StreamCaptureState
Source§impl Debug for StreamCaptureState
impl Debug for StreamCaptureState
impl Eq for StreamCaptureState
Source§impl PartialEq for StreamCaptureState
impl PartialEq for StreamCaptureState
impl StructuralPartialEq for StreamCaptureState
Auto Trait Implementations§
impl Freeze for StreamCaptureState
impl RefUnwindSafe for StreamCaptureState
impl Send for StreamCaptureState
impl Sync for StreamCaptureState
impl Unpin for StreamCaptureState
impl UnsafeUnpin for StreamCaptureState
impl UnwindSafe for StreamCaptureState
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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