2024-02-10 00:04:16 -05:00
|
|
|
//! Metal shader runtime errors.
|
2024-02-10 20:59:01 -05:00
|
|
|
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;
|
2024-06-21 20:50:35 -04:00
|
|
|
use objc2::rc::Retained;
|
|
|
|
use objc2_foundation::NSError;
|
2024-02-10 00:04:16 -05:00
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
/// Cumulative error type for Metal filter chains.
|
|
|
|
#[derive(Error, Debug)]
|
2024-08-21 00:37:35 -04:00
|
|
|
#[non_exhaustive]
|
2024-02-10 00:04:16 -05:00
|
|
|
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")]
|
2024-02-10 20:59:01 -05:00
|
|
|
BufferError,
|
|
|
|
#[error("metal error")]
|
2024-06-21 20:50:35 -04:00
|
|
|
MetalError(#[from] Retained<NSError>),
|
2024-02-10 20:59:01 -05:00
|
|
|
#[error("couldn't find entry for shader")]
|
|
|
|
ShaderWrongEntryName,
|
|
|
|
#[error("couldn't create render pass")]
|
|
|
|
FailedToCreateRenderPass,
|
2024-02-11 17:54:13 -05:00
|
|
|
#[error("couldn't create texture")]
|
|
|
|
FailedToCreateTexture,
|
|
|
|
#[error("couldn't create command buffer")]
|
|
|
|
FailedToCreateCommandBuffer,
|
2024-08-02 00:25:54 -04:00
|
|
|
#[error("unreachable")]
|
|
|
|
Infallible(#[from] std::convert::Infallible),
|
2024-02-10 00:04:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Result type for Metal filter chains.
|
|
|
|
pub type Result<T> = std::result::Result<T, FilterChainError>;
|