#[non_exhaustive]pub enum ExecutionPath {
NotRun,
ZeroCopy,
HostCopyElided,
DeviceLocalCopy {
copies: u8,
reason: Option<&'static str>,
},
BrowserGpuCopy,
CacheHit,
CpuBounceFallback {
reason: &'static str,
},
}Expand description
Which path a frame went down. Carried on per-call result types (an interop layer’s import / export results) rather than process-global cells.
The reason in CpuBounceFallback is a &'static str deliberately
— no allocation, no formatting, and CI can assert specific strings
without string-slicing the whole output.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotRun
No run has completed yet — the initial state of a freshly-constructed processor’s metrics. Distinct from every “work happened” path so a caller can tell “no measurement yet” apart from “ran, took the CPU-bounce path”. A metrics record’s default reports this; it never appears after a completed run.
ZeroCopy
The source resource was aliased into a wgpu::Texture / wgpu::Buffer
without any host or device-to-device copy on this frame.
HostCopyElided
A host-side full-buffer copy was elided: the consumer referenced the producer’s existing CPU allocation (a refcount bump) instead of memcpy-ing the payload into its own buffer. No GPU resource was aliased and no device was involved at all.
Deliberately NOT Self::ZeroCopy, which asserts a GPU aliasing import —
conflating the two makes a pure-software path read as GPU zero-copy in
every matrix report. Deliberately NOT Self::CpuBounceFallback either:
no host memcpy ran, so it is not a bounce.
Reported by software-encode input paths that take a new reference to a decoded frame’s existing CPU planes instead of copying them into the encoder’s input frame.
DeviceLocalCopy
Zero-copy modulo a GPU-side staging copy (e.g. the wgpu-GL OES→2D
blit, or a D3D11→D3D12 row-major stage). copies counts how
many on-device copies happened: 1 for the “single staging
copy” case; 2+ for forced bounce-and-rewrap. Distinguished
from ZeroCopy so callers gating on “no driver-side copy at
all” don’t conflate them, and from CpuBounceFallback because
the staging cost is GPU-side.
reason is an optional &'static str tag — same no-alloc,
CI-assertable rule as CpuBounceFallback::reason — naming the
specific GPU-local route that ran (e.g. which bonded CUDA→GPU
path), for diagnostics. None when the path has no finer label
worth pinning. It does not participate in the “how much work
happened” signal — copies does — but it is part of the variant’s
Eq/Hash, so two DeviceLocalCopys with the same copies but
different reason compare unequal.
BrowserGpuCopy
Web only. The operation went through a browser API that is a copy
at the spec surface (copyExternalImageToTexture,
new VideoFrame(canvas)) executed inside the browser —
typically GPU-to-GPU, but unobservable and uncountable from wasm.
Distinct from Self::DeviceLocalCopy (which asserts a counted,
known copy on a device we control) and from
Self::CpuBounceFallback (no CPU memcpy ran on our hot path).
An option that silences cross-backend CPU-bounce warnings should
never silence this — it is the expected default on the web and
exists for visibility, not noise.
CacheHit
A prior import (any path) was reused this frame from the import
cache; no work happened in this call. Distinct from ZeroCopy
because the original import may have been a CPU upload — a
caller gating “is this frame zero-copy aliased?” must not
conflate the two.
CpuBounceFallback
A CPU host memcpy ran on the per-frame hot path. The reason
disambiguates which call site flipped the path so a once-per-
reason bounce logger can warn exactly once per cause.
Trait Implementations§
Source§impl Clone for ExecutionPath
impl Clone for ExecutionPath
impl Copy for ExecutionPath
Source§impl Debug for ExecutionPath
impl Debug for ExecutionPath
impl Eq for ExecutionPath
Source§impl Hash for ExecutionPath
impl Hash for ExecutionPath
Source§impl PartialEq for ExecutionPath
impl PartialEq for ExecutionPath
impl StructuralPartialEq for ExecutionPath
Auto Trait Implementations§
impl Freeze for ExecutionPath
impl RefUnwindSafe for ExecutionPath
impl Send for ExecutionPath
impl Sync for ExecutionPath
impl Unpin for ExecutionPath
impl UnsafeUnpin for ExecutionPath
impl UnwindSafe for ExecutionPath
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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.