2023-02-06 17:25:06 +11:00
|
|
|
//! Direct3D 11 shader runtime errors.
|
2023-01-13 19:19:58 +11:00
|
|
|
//!
|
2022-12-01 09:59:55 +11:00
|
|
|
use librashader_preprocess::PreprocessError;
|
|
|
|
use librashader_presets::ParsePresetError;
|
|
|
|
use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
|
2022-12-22 13:39:31 +11:00
|
|
|
use librashader_runtime::image::ImageError;
|
2022-12-01 09:59:55 +11:00
|
|
|
use thiserror::Error;
|
|
|
|
|
2023-01-13 19:19:58 +11:00
|
|
|
/// Cumulative error type for Direct3D11 filter chains.
|
2022-12-01 09:59:55 +11:00
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum FilterChainError {
|
2023-01-17 10:45:02 +11:00
|
|
|
#[error("invariant assumption about d3d11 did not hold. report this as an issue.")]
|
|
|
|
Direct3DOperationError(&'static str),
|
2022-12-01 09:59:55 +11:00
|
|
|
#[error("direct3d driver error")]
|
|
|
|
Direct3DError(#[from] windows::core::Error),
|
|
|
|
#[error("SPIRV reflection error")]
|
|
|
|
SpirvCrossReflectError(#[from] spirv_cross::ErrorCode),
|
|
|
|
#[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),
|
|
|
|
}
|
2022-12-01 11:05:12 +11:00
|
|
|
|
2023-01-17 10:45:02 +11:00
|
|
|
macro_rules! assume_d3d11_init {
|
|
|
|
($value:ident, $call:literal) => {
|
|
|
|
let $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
|
|
|
|
$call,
|
|
|
|
))?;
|
|
|
|
};
|
|
|
|
(mut $value:ident, $call:literal) => {
|
|
|
|
let mut $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
|
|
|
|
$call,
|
|
|
|
))?;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Macro for unwrapping result of a D3D function.
|
|
|
|
pub(crate) use assume_d3d11_init;
|
|
|
|
|
2023-02-06 17:25:06 +11:00
|
|
|
/// Result type for Direct3D 11 filter chains.
|
2022-12-01 11:05:12 +11:00
|
|
|
pub type Result<T> = std::result::Result<T, FilterChainError>;
|