presets: properly trim shader name if given through pragma
This commit is contained in:
parent
e0c97f77b4
commit
87e0405675
|
@ -81,6 +81,7 @@ impl SourceOutput for String {
|
|||
pub(crate) fn load_shader_source(path: impl AsRef<Path>) -> Result<ShaderSource, PreprocessError> {
|
||||
let source = read_source(path)?;
|
||||
let meta = pragma::parse_pragma_meta(&source)?;
|
||||
|
||||
let text = stage::process_stages(&source)?;
|
||||
let parameters = FastHashMap::from_iter(meta.parameters.into_iter().map(|p| (p.id.clone(), p)));
|
||||
|
||||
|
|
|
@ -110,12 +110,12 @@ pub(crate) fn parse_pragma_meta(source: impl AsRef<str>) -> Result<ShaderMeta, P
|
|||
}
|
||||
}
|
||||
|
||||
if line.starts_with("#pragma name ") {
|
||||
if let Some(pragma_name) = line.strip_prefix("#pragma name ") {
|
||||
if name.is_some() {
|
||||
return Err(PreprocessError::DuplicatePragmaError(line.into()));
|
||||
}
|
||||
|
||||
name = Some(ShortString::from(line.trim()))
|
||||
name = Some(ShortString::from(pragma_name.trim()))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue