#[non_exhaustive]pub enum SurfaceError {
Init(String),
Frame(String),
DeviceLost(String),
}Expand description
A failure creating or driving the wgpu device and surface.
The variants split along the one distinction the event loop acts on: whether retrying is worth
anything. RecoverableError reads that split, and
retroglyph_window::winit::run uses it to decide between logging-and-continuing and exiting.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Init(String)
No adapter, device, or surface could be created for this window.
Treated as fatal: without a device there is nothing to draw with, and retrying the same
request against the same hardware will fail the same way. Usually means the requested
backends are all unavailable (no Vulkan/Metal/D3D12 driver), which
WGPU_BACKEND can sometimes work around.
Frame(String)
Acquiring the next frame from the swap chain failed for a reason reconfiguring can’t fix.
Treated as recoverable so the event loop’s consecutive-failure heuristic can retry: a timed-out or occluded frame usually resolves on its own, and the crate reconfigures the surface itself for the outdated/lost cases before ever returning this.
DeviceLost(String)
The device was lost (a GPU reset, a driver update, or an eviction) and every resource created from it is now invalid.
Treated as recoverable, because the recovery that helps is the one the event loop performs:
after enough consecutive present failures it calls
Presenter::init_surface again, which
rebuilds the adapter, device, surface, and every GPU resource from scratch. Reporting this
as unrecoverable would skip that path, leaving the loop logging the same failure every
frame with nothing rebuilding.
Trait Implementations§
Source§impl Debug for SurfaceError
impl Debug for SurfaceError
Source§impl Display for SurfaceError
impl Display for SurfaceError
Source§impl Error for SurfaceError
impl Error for SurfaceError
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()
Source§impl RecoverableError for SurfaceError
impl RecoverableError for SurfaceError
Source§fn is_recoverable(&self) -> bool
fn is_recoverable(&self) -> bool
Auto Trait Implementations§
impl Freeze for SurfaceError
impl RefUnwindSafe for SurfaceError
impl Send for SurfaceError
impl Sync for SurfaceError
impl Unpin for SurfaceError
impl UnsafeUnpin for SurfaceError
impl UnwindSafe for SurfaceError
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<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.