1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use std::fmt::{Debug, Display};
/// ## Unified error enum
#[derive(Debug)]
pub enum GraphicsError {
/// Happens on unexpected library error
ConnotInitLibrary,
/// Happens on software missing support
NotSupportedSystem,
/// Happens on hardware missing support
NotSupportedDevice,
/// Happens on device lack
NoDevice,
/// Happens on hardware missing support or window server missing capability
NotSupportedPresent,
/// Happens on image present error
PresentError,
/// Happens on unified transfer/compute error
TransferError,
/// Happens on rendering error
RenderingError,
/// Happens on GPU sync error
SyncError,
/// Happens on resource error, for example on drop
ResourceError,
/// Happens on shader compilation/capability error
ShaderError,
/// Happens on GPU memory error
MemoryError,
/// Happens on unified shader data error
DataError,
/// Happens on image error
ImageError,
/// Happens on debug error
DebugError,
}
impl Display for GraphicsError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_fmt(format_args!("{self:?}"))
}
}
/// Type contains ```Result``` enum with ```GraphicsError``` on ```Err```
pub type GraphicsResult<T> = Result<T, GraphicsError>;