librashader/librashader-runtime-gl/src/error.rs

47 lines
1.6 KiB
Rust
Raw Normal View History

2023-01-13 03:19:58 -05:00
//! OpenGL shader runtime errors.
2022-11-21 17:44:38 -05:00
use librashader_preprocess::PreprocessError;
use librashader_presets::ParsePresetError;
use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
2022-12-21 21:39:31 -05:00
use librashader_runtime::image::ImageError;
2022-11-21 17:44:38 -05:00
use thiserror::Error;
2023-01-13 03:19:58 -05:00
/// Cumulative error type for OpenGL filter chains.
2022-11-21 17:44:38 -05:00
#[derive(Error, Debug)]
2024-08-21 00:37:35 -04:00
#[non_exhaustive]
2022-11-21 17:44:38 -05:00
pub enum FilterChainError {
2024-09-24 01:59:01 -04:00
#[error("fbo initialization error {0:x}")]
2024-02-05 18:39:01 -05:00
FramebufferInit(u32),
2022-11-21 17:44:38 -05:00
#[error("SPIRV reflection error")]
2024-09-04 20:49:20 -04:00
SpirvCrossReflectError(#[from] spirv_cross2::SpirvCrossError),
2022-11-21 17:44:38 -05:00
#[error("shader preset parse error")]
ShaderPresetError(#[from] ParsePresetError),
#[error("shader preprocess error")]
ShaderPreprocessError(#[from] PreprocessError),
#[error("shader compile error")]
ShaderCompileError(#[from] ShaderCompileError),
#[error("shader reflect error")]
ShaderReflectError(#[from] ShaderReflectError),
#[error("lut loading error")]
2022-11-30 01:38:05 -05:00
LutLoadError(#[from] ImageError),
2022-12-03 19:07:15 -05:00
#[error("opengl was not initialized")]
2022-12-21 21:39:31 -05:00
GLLoadError,
#[error("opengl could not link program")]
GLLinkError,
2023-01-13 16:10:54 -05:00
#[error("opengl could not compile program")]
2023-01-15 03:06:09 -05:00
GlCompileError,
2024-02-05 18:39:01 -05:00
#[error("opengl could not create samplers")]
GlSamplerError,
#[error("opengl could not create samplers")]
GlProgramError,
#[error("an invalid framebuffer was provided to frame")]
GlInvalidFramebuffer,
2024-02-05 18:39:01 -05:00
#[error("opengl error: {0}")]
GlError(String),
#[error("unreachable")]
Infallible(#[from] std::convert::Infallible),
2022-11-21 17:44:38 -05:00
}
2023-01-13 03:19:58 -05:00
/// Result type for OpenGL filter chains.
2022-11-30 01:38:05 -05:00
pub type Result<T> = std::result::Result<T, FilterChainError>;