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

38 lines
1.3 KiB
Rust
Raw Normal View History

2024-02-10 00:04:16 -05:00
//! Metal shader runtime errors.
use icrate::Foundation::NSError;
use librashader_common::{FilterMode, WrapMode};
2024-02-10 00:04:16 -05:00
use librashader_preprocess::PreprocessError;
use librashader_presets::ParsePresetError;
use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
use librashader_runtime::image::ImageError;
use objc2::rc::Id;
2024-02-10 00:04:16 -05:00
use thiserror::Error;
/// Cumulative error type for Metal filter chains.
#[derive(Error, Debug)]
pub enum FilterChainError {
#[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")]
LutLoadError(#[from] ImageError),
#[error("sampler create error")]
SamplerError(WrapMode, FilterMode, FilterMode),
#[error("buffer creation error")]
BufferError,
#[error("metal error")]
MetalError(Id<NSError>),
#[error("couldn't find entry for shader")]
ShaderWrongEntryName,
#[error("couldn't create render pass")]
FailedToCreateRenderPass,
2024-02-10 00:04:16 -05:00
}
/// Result type for Metal filter chains.
pub type Result<T> = std::result::Result<T, FilterChainError>;