diff options
author | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
---|---|---|
committer | tcmal <me@aria.rip> | 2024-08-25 17:44:22 +0100 |
commit | 10b3d4ac59e826b31d2114999e31893390acfb9c (patch) | |
tree | 0dd47e2dda5c346cadf15c8e21a53d3a39c00238 /stockton-render/src/types.rs | |
parent | 5da588c6223e4c30cc5ec349f318aa5203cb0ce7 (diff) |
feat(render): WIP switch to anyhow for errors
Diffstat (limited to 'stockton-render/src/types.rs')
-rw-r--r-- | stockton-render/src/types.rs | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/stockton-render/src/types.rs b/stockton-render/src/types.rs index d37d5b6..4a79602 100644 --- a/stockton-render/src/types.rs +++ b/stockton-render/src/types.rs @@ -1,5 +1,7 @@ //! Convenience module to reference types that are stored in the backend's enum +use thiserror::Error; + pub type Device = <back::Backend as hal::Backend>::Device; pub type Gpu = hal::adapter::Gpu<back::Backend>; pub type Buffer = <back::Backend as hal::Backend>::Buffer; @@ -30,3 +32,45 @@ pub type DynamicAllocator = rendy_memory::DynamicAllocator<back::Backend>; pub type DynamicBlock = rendy_memory::DynamicBlock<back::Backend>; pub type RDescriptorSet = rendy_descriptor::DescriptorSet<back::Backend>; + +#[derive(Error, Debug)] +pub enum LockPoisoned { + #[error("Device lock poisoned")] + Device, + + #[error("Map lock poisoned")] + Map, + + #[error("Other lock poisoned")] + Other, +} + +#[derive(Error, Debug)] +pub enum HalErrorWrapper { + #[error("Device Creation Error: {0}")] + DeviceCreationError(#[from] hal::device::CreationError), + + #[error("Buffer Creation Error: {0}")] + BufferCreationError(#[from] hal::buffer::CreationError), + + #[error("Image Creation Error: {0}")] + ImageCreationError(#[from] hal::image::CreationError), + + #[error("View Error: {0}")] + ImageViewError(#[from] hal::image::ViewError), + + #[error("Out of memory on {0}")] + OutOfMemory(#[from] hal::device::OutOfMemory), + + #[error("Device Lost: {0}")] + DeviceLost(#[from] hal::device::DeviceLost), + + #[error("Allocation Error: {0}")] + AllocationError(#[from] hal::device::AllocationError), + + #[error("Bind Error: {0}")] + BindError(#[from] hal::device::BindError), + + #[error("Map Error: {0}")] + MapError(#[from] hal::device::MapError), +} |