synvael/crates/renderer/src/error.rs

35 lines
1.2 KiB
Rust

// SPDX-License-Identifier: AGPL-3.0-only
//! Error types for the renderer crate.
use thiserror::Error;
#[derive(Debug, Error)]
/// Enumerates all possible errors that can occur during rendering operations.
pub enum RendererError {
/// The Vulkan library could not be loaded from the system.
#[error("Failed to load Vulkan library")]
LoadFailed(#[from] ash::LoadingError),
/// A raw Vulkan result indicated a failure.
#[error("Vulkan error")]
VulkanError(#[from] ash::vk::Result),
/// No GPU was found that meets the engine's requirements.
#[error("No suitable GPU found")]
NoSuitableGpu,
/// An error occurred during GPU memory allocation.
#[error("GPU allocation error")]
AllocationError(#[from] gpu_allocator::AllocationError),
/// An I/O error occurred (e.g. reading a shader).
#[error("I/O error")]
IoError(#[from] std::io::Error),
/// An invalid string was encountered.
#[error("Invalid string")]
InvalidString,
/// The renderer's synchronization primitives were unavailable.
#[error("Synchronization primitives missing")]
SyncPrimitivesMissing,
/// The renderer's GPU memory allocator was unavailable.
#[error("GPU allocator missing")]
AllocatorMissing,
}