librashader_runtime_d3d12/
error.rs1use d3d12_descriptor_heap::D3D12DescriptorHeapError;
5use thiserror::Error;
6use windows::Win32::Graphics::Direct3D12::D3D12_RESOURCE_DIMENSION;
7
8#[derive(Error, Debug)]
10#[non_exhaustive]
11pub enum FilterChainError {
12 #[error("invariant assumption about d3d12 did not hold. report this as an issue.")]
13 Direct3DOperationError(&'static str),
14 #[error("direct3d driver error")]
15 Direct3DError(#[from] windows::core::Error),
16 #[error("shader preset parse error")]
17 ShaderPresetError(#[from] ParsePresetError),
18 #[error("shader preprocess error")]
19 ShaderPreprocessError(#[from] PreprocessError),
20 #[error("shader compile error")]
21 ShaderCompileError(#[from] ShaderCompileError),
22 #[error("shader reflect error")]
23 ShaderReflectError(#[from] ShaderReflectError),
24 #[error("lut loading error")]
25 LutLoadError(#[from] ImageError),
26 #[error("heap error")]
27 HeapError(#[from] D3D12DescriptorHeapError),
28 #[error("allocation error")]
29 AllocationError(#[from] gpu_allocator::AllocationError),
30 #[error("invalid resource dimension {0:?}")]
31 InvalidDimensionError(D3D12_RESOURCE_DIMENSION),
32 #[error("unreachable")]
33 Infallible(#[from] std::convert::Infallible),
34}
35
36pub type Result<T> = std::result::Result<T, FilterChainError>;
38
39macro_rules! assume_d3d12_init {
40 ($value:ident, $call:literal) => {
41 let $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
42 $call,
43 ))?;
44 };
45 (mut $value:ident, $call:literal) => {
46 let mut $value = $value.ok_or($crate::error::FilterChainError::Direct3DOperationError(
47 $call,
48 ))?;
49 };
50}
51
52pub(crate) use assume_d3d12_init;
54use librashader_preprocess::PreprocessError;
55use librashader_presets::ParsePresetError;
56use librashader_reflect::error::{ShaderCompileError, ShaderReflectError};
57use librashader_runtime::image::ImageError;