librashader/librashader-preprocess/tests/parse_all.rs

25 lines
821 B
Rust
Raw Normal View History

2023-02-08 19:28:27 +11:00
use glob::glob;
2023-02-08 19:37:21 +11:00
use librashader_preprocess::ShaderSource;
2023-02-08 19:28:27 +11:00
use librashader_presets::ShaderPreset;
2023-02-08 19:37:21 +11:00
use rayon::prelude::*;
2023-02-08 19:28:27 +11:00
#[test]
fn preprocess_all_slang_presets_parsed() {
for entry in glob("../test/slang-shaders/**/*.slangp").unwrap() {
if let Ok(path) = entry {
if let Ok(preset) = ShaderPreset::try_parse(&path) {
2023-02-08 19:37:21 +11:00
preset.shaders.into_par_iter().for_each(|shader| {
if let Err(e) = ShaderSource::load(&shader.name) {
println!(
"Failed to preprocess shader {} from preset {}: {:?}",
shader.name.display(),
path.display(),
e
);
}
})
2023-02-08 19:28:27 +11:00
}
}
}
}