shdrlib 0.1.2

A three-tiered Vulkan shader compilation and rendering framework built in pure Rust
Documentation
//! EZ tier error types with user-friendly messages

use thiserror::Error;

/// EZ tier error with helpful recovery suggestions
#[derive(Debug, Error)]
pub enum EzError {
    /// RuntimeManager creation failed
    #[error("Failed to initialize renderer: {0}\n\nSuggestion: Check that Vulkan is installed and your GPU drivers are up to date.")]
    InitializationFailed(String),

    /// Shader compilation failed
    #[error("Shader compilation failed: {0}\n\nSuggestion: Check your GLSL syntax. Line numbers are shown above.")]
    ShaderCompilationFailed(String),

    /// Pipeline creation failed
    #[error("Pipeline creation failed: {0}\n\nSuggestion: Ensure shaders are compatible and all required attachments are specified.")]
    PipelineCreationFailed(String),

    /// Invalid shader stage combination
    #[error("Invalid shader stages: {0}\n\nSuggestion: Graphics pipelines need at least a vertex shader. Fragment shaders are optional but recommended.")]
    InvalidShaderStages(String),

    /// Frame operation failed
    #[error("Frame rendering failed: {0}\n\nSuggestion: Ensure device is not lost. Check for validation layer messages.")]
    FrameFailed(String),

    /// Generic runtime error
    #[error("Runtime error: {0}")]
    RuntimeError(String),
}

// Implement From conversions for lower tier errors
impl From<crate::ex::RuntimeError> for EzError {
    fn from(err: crate::ex::RuntimeError) -> Self {
        EzError::RuntimeError(err.to_string())
    }
}

impl From<crate::ex::ShaderManagerError> for EzError {
    fn from(err: crate::ex::ShaderManagerError) -> Self {
        EzError::ShaderCompilationFailed(err.to_string())
    }
}

impl From<crate::core::ShaderError> for EzError {
    fn from(err: crate::core::ShaderError) -> Self {
        EzError::ShaderCompilationFailed(err.to_string())
    }
}

impl From<crate::core::PipelineError> for EzError {
    fn from(err: crate::core::PipelineError) -> Self {
        EzError::PipelineCreationFailed(err.to_string())
    }
}