use thiserror::Error;
#[derive(Error, Debug)]
pub enum RenderError {
#[error("failed to create graphics adapter")]
AdapterCreationFailed,
#[error("failed to create graphics device: {0}")]
DeviceCreationFailed(#[from] wgpu::RequestDeviceError),
#[error("failed to create surface: {0}")]
SurfaceCreationFailed(#[from] wgpu::CreateSurfaceError),
#[error("surface configuration failed")]
SurfaceConfigurationFailed,
#[error("shader compilation failed: {0}")]
ShaderCompilationFailed(String),
#[error("pipeline creation failed: {0}")]
PipelineCreationFailed(String),
#[error("buffer creation failed: {0}")]
BufferCreationFailed(String),
#[error("texture creation failed: {0}")]
TextureCreationFailed(String),
#[error("surface lost")]
SurfaceLost,
#[error("surface outdated")]
SurfaceOutdated,
#[error("out of memory")]
OutOfMemory,
#[error("timeout waiting for GPU")]
Timeout,
}
pub type RenderResult<T> = std::result::Result<T, RenderError>;