Skip to main content

crush_gpu/
error.rs

1//! GPU-specific error types for the crush-gpu crate
2
3use thiserror::Error;
4
5/// Errors originating from GPU backend operations.
6#[derive(Error, Debug)]
7pub enum GpuError {
8    /// No compatible GPU was found during backend discovery.
9    #[error("no compatible GPU found: {0}")]
10    NoGpuAvailable(String),
11
12    /// GPU backend failed to initialize (driver/API issue).
13    #[error("GPU backend initialization failed: {0}")]
14    BackendInit(String),
15
16    /// A compute shader failed to compile.
17    #[error("shader compilation failed: {0}")]
18    ShaderCompilation(String),
19
20    /// GPU ran out of memory during decompression dispatch.
21    #[error(
22        "GPU memory exceeded: requested {requested_bytes} bytes, available {available_bytes} bytes"
23    )]
24    MemoryExceeded {
25        requested_bytes: u64,
26        available_bytes: u64,
27    },
28
29    /// Tile version in the archive is not supported by this engine.
30    #[error("unsupported tile version {version}; expected {expected}")]
31    TileVersionMismatch { version: u8, expected: u8 },
32
33    /// Generic GPU dispatch failure.
34    #[error("GPU dispatch failed: {0}")]
35    DispatchFailed(String),
36
37    /// Data transfer between host and device failed.
38    #[error("host ↔ device transfer failed: {0}")]
39    TransferFailed(String),
40}