Skip to main content

StreamCaptureState

Enum StreamCaptureState 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> StreamCaptureState

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for StreamCaptureState

Source§

impl Debug for StreamCaptureState

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for StreamCaptureState

Source§

impl PartialEq for StreamCaptureState

Source§

fn eq(&self, other: &StreamCaptureState) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StreamCaptureState

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Sync + Send>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> TuneInputs for T
where T: Clone + Send + Sync + 'static,

Source§

type At<'a> = T

The concrete input type at lifetime 'a.