2023-02-06 17:25:06 +11:00
|
|
|
//! Direct3D 12 shader runtime errors.
|
|
|
|
//!
|
2023-02-06 11:58:51 +11:00
|
|
|
use thiserror::Error;
|
2023-01-22 07:34:13 +11:00
|
|
|
|
2023-02-06 11:58:51 +11:00
|
|
|
/// Cumulative error type for Direct3D12 filter chains.
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum FilterChainError {
|
|
|
|
#[error("invariant assumption about d3d11 did not hold. report this as an issue.")]
|
|
|
|
Direct3DOperationError(&'static str),
|
|
|
|
#[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),
|
|
|
|
#[error("heap overflow")]
|
|
|
|
DescriptorHeapOverflow,
|
|
|
|
}
|
|
|
|
|
2023-02-06 17:25:06 +11:00
|
|
|
/// Result type for Direct3D 12 filter chains.
|
2023-02-06 11:58:51 +11:00
|
|
|
pub type Result<T> = std::result::Result<T, FilterChainError>;
|
2023-01-25 15:15:43 +11:00
|
|
|
|
|
|
|
macro_rules! assume_d3d12_init {
|
|
|
|
($value:ident, $call:literal) => {
|
2023-02-06 11:58:51 +11:00
|
|
|
let $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
|
|
|
|
$call,
|
|
|
|
))?;
|
2023-01-25 15:15:43 +11:00
|
|
|
};
|
|
|
|
(mut $value:ident, $call:literal) => {
|
2023-02-06 11:58:51 +11:00
|
|
|
let mut $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
|
|
|
|
$call,
|
|
|
|
))?;
|
2023-01-25 15:15:43 +11:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Macro for unwrapping result of a D3D function.
|
|
|
|
pub(crate) use assume_d3d12_init;
|
2023-02-06 11:58:51 +11:00
|
|
|
use librashader_preprocess::PreprocessError;
|
|
|
|
use librashader_presets::ParsePresetError;
|
|
|
|
use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
|
|
|
|
use librashader_runtime::image::ImageError;
|