mesh_gpu/
error.rs

1//! GPU error types for mesh processing.
2
3use thiserror::Error;
4
5/// Errors that can occur during GPU operations.
6#[derive(Debug, Error)]
7pub enum GpuError {
8    /// GPU device is not available on this system.
9    #[error("GPU not available: no compatible device found")]
10    NotAvailable,
11
12    /// GPU ran out of memory during computation.
13    #[error("GPU out of memory: required {required} bytes, available {available} bytes")]
14    OutOfMemory { required: u64, available: u64 },
15
16    /// Shader compilation failed.
17    #[error("shader compilation failed: {0}")]
18    ShaderCompilation(String),
19
20    /// GPU device was lost during computation.
21    #[error("GPU device lost")]
22    DeviceLost,
23
24    /// GPU execution failed.
25    #[error("GPU execution failed: {0}")]
26    Execution(String),
27
28    /// Buffer mapping failed.
29    #[error("buffer mapping failed: {0}")]
30    BufferMapping(String),
31
32    /// Grid dimensions exceed GPU limits.
33    #[error("grid too large for GPU: {dims:?} voxels ({total} total), max supported: {max}")]
34    GridTooLarge {
35        dims: [usize; 3],
36        total: usize,
37        max: usize,
38    },
39
40    /// Mesh too large for GPU.
41    #[error("mesh too large for GPU: {triangles} triangles, max supported: {max}")]
42    MeshTooLarge { triangles: usize, max: usize },
43}
44
45/// Result type for GPU operations.
46pub type GpuResult<T> = Result<T, GpuError>;