Struct FlushError
#[non_exhaustive]pub struct FlushError {
pub submitted: GrSemaphoresSubmitted,
}Expand description
A Ganesh flush failed.
This type is not part of Skia’s C++ API. The native GrDirectContext::FlushResult reports
whether the flush succeeded and whether semaphores were submitted as two independent fields,
which makes a failure easy to overlook: inspecting it reads like an ordinary status check, and
nothing draws attention to the flush having failed. The Rust flush methods therefore map a
failed flush to Err so that the failure has to be handled explicitly, and this type carries
the one piece of information that still has to be acted on.
A flush fails in the following situations:
- The context was abandoned, for example after a device loss or a call to
crate::gpu::DirectContext::abandon(). - The flush is reentrant: it was issued from an on-flush callback or a finished proc while another flush was still in progress.
- The flushed
crate::Imageorcrate::Surfaceis not backed by this context, is not GPU-backed (a CPU-backed surface has no effect), or is null. - An on-flush callback’s
preFlushfailed, in which case the render tasks were never executed. - Uploading pending data to the GPU failed, for example because a vertex, index or draw-indirect buffer could not be unmapped.
- A GPU resource could not be allocated or instantiated, for example when the device ran out of memory.
- A render task failed, for example because a stencil buffer could not be attached, a render pass could not be created, or a pixel transfer failed.
- An intermediate submit issued while flushing failed.
- For the
flush_and_submit*methods, the submit that follows the flush failed.
Handling a failure is not optional:
- The rendering results of a failed flush are undefined and must be discarded. Presenting them or reading them back yields undefined output.
- The semaphores reported by
Self::submittedmay still have been submitted to the GPU, so the client must still keep them alive and wait on them (or perform an equivalent global synchronization) before deleting them. Ignoring them leads to a use-after-free or a hang.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.submitted: GrSemaphoresSubmittedWhether any semaphores were submitted during the flush process.
Will be SemaphoresSubmitted::No if no semaphores were specified. If it is
SemaphoresSubmitted::Yes, the semaphores were submitted even though the flush failed,
so they must be waited on before they are deleted.
Trait Implementations§
§impl Clone for FlushError
impl Clone for FlushError
§fn clone(&self) -> FlushError
fn clone(&self) -> FlushError
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 FlushError
§impl Debug for FlushError
impl Debug for FlushError
§impl Display for FlushError
impl Display for FlushError
impl Eq for FlushError
§impl Error for FlushError
impl Error for FlushError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
§impl PartialEq for FlushError
impl PartialEq for FlushError
impl StructuralPartialEq for FlushError
Auto Trait Implementations§
impl Freeze for FlushError
impl RefUnwindSafe for FlushError
impl Send for FlushError
impl Sync for FlushError
impl Unpin for FlushError
impl UnsafeUnpin for FlushError
impl UnwindSafe for FlushError
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§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>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<T> ToSmolStr for T
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
Source§impl<T> ToStringLocalized for Twhere
T: ToString,
impl<T> ToStringLocalized for Twhere
T: ToString,
Source§fn to_string_local(&self, _cx: &impl DataContext) -> String
fn to_string_local(&self, _cx: &impl DataContext) -> String
String via a translation using fluent.