2022-10-22 14:37:47 +11:00
|
|
|
use std::convert::Infallible;
|
2022-10-21 16:12:17 +11:00
|
|
|
use std::path::PathBuf;
|
|
|
|
use thiserror::Error;
|
2022-10-22 14:37:47 +11:00
|
|
|
use librashader::ShaderParameter;
|
2022-10-21 16:12:17 +11:00
|
|
|
|
|
|
|
#[derive(Error, Debug)]
|
|
|
|
pub enum PreprocessError {
|
|
|
|
#[error("the version header was missing")]
|
|
|
|
MissingVersionHeader,
|
|
|
|
#[error("the file was not found during resolution")]
|
|
|
|
IOError(PathBuf, std::io::Error),
|
|
|
|
#[error("unexpected end of file")]
|
|
|
|
UnexpectedEof,
|
|
|
|
#[error("unexpected end of line")]
|
|
|
|
UnexpectedEol(usize),
|
2022-10-22 14:37:47 +11:00
|
|
|
#[error("error parsing pragma")]
|
|
|
|
PragmaParseError(String),
|
2022-10-22 17:54:06 +11:00
|
|
|
#[error("duplicate pragma found")]
|
|
|
|
DuplicatePragmaError(String),
|
2022-10-22 14:37:47 +11:00
|
|
|
#[error("shader format is unknown or not found")]
|
|
|
|
UnknownShaderFormat,
|
2022-10-22 17:54:06 +11:00
|
|
|
#[error("stage must be either vertex or fragment")]
|
|
|
|
InvalidStage,
|
2022-10-21 16:12:17 +11:00
|
|
|
}
|
2022-10-22 14:37:47 +11:00
|
|
|
|
|
|
|
impl From<Infallible> for PreprocessError {
|
|
|
|
fn from(_: Infallible) -> Self {
|
|
|
|
unreachable!()
|
|
|
|
}
|
|
|
|
}
|