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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
//! Contains all possible errors that may occur during rendering, initialization of //! renderer structures, or GAPI. use crate::ContextError; use std::ffi::NulError; /// Set of possible renderer errors. #[derive(Debug)] pub enum RendererError { /// Compilation of a shader has failed. ShaderCompilationFailed { /// Name of shader. shader_name: String, /// Compilation error message. error_message: String, }, /// Means that shader link stage failed, exact reason is inside `error_message` ShaderLinkingFailed { /// Name of shader. shader_name: String, /// Linking error message. error_message: String, }, /// Shader source contains invalid characters. FaultyShaderSource, /// There is no such shader uniform (could be optimized out). UnableToFindShaderUniform(String), /// Texture has invalid data - insufficient size. InvalidTextureData { /// Expected data size in bytes. expected_data_size: usize, /// Actual data size in bytes. actual_data_size: usize, }, /// Means that you tried to draw element range from GeometryBuffer that /// does not have enough elements. InvalidElementRange { /// First index. start: usize, /// Last index. end: usize, /// Total amount of triangles. total: usize, }, /// Means that attribute descriptor tries to define an attribute that does /// not exists in vertex, or it does not match size. For example you have vertex: /// pos: float2, /// normal: float3 /// But you described second attribute as Float4, then you'll get this error. InvalidAttributeDescriptor, /// Framebuffer is invalid. InvalidFrameBuffer, /// OpenGL failed to construct framebuffer. FailedToConstructFBO, /// Internal context error. Context(ContextError), } impl From<NulError> for RendererError { fn from(_: NulError) -> Self { Self::FaultyShaderSource } } impl From<ContextError> for RendererError { fn from(err: ContextError) -> Self { Self::Context(err) } }