diff --git a/BROKEN_SHADERS.md b/BROKEN_SHADERS.md index 632b2e2..0e2d70d 100644 --- a/BROKEN_SHADERS.md +++ b/BROKEN_SHADERS.md @@ -5,7 +5,7 @@ The following shaders are known to be broken due to various issues. This list is updated as of [slang-shaders@`356678e`](https://github.com/libretro/slang-shaders/commit/356678ec53ca940a53fa509eff0b65bb63a403bb) -## Parsing errors +## Broken due to parsing errors librashader's preset parser is somewhat stricter than RetroArch in what it accepts. All shaders and textures in a preset must resolve to a fully canonical path to properly parse. The following shaders have broken paths. @@ -40,3 +40,9 @@ librashader's parser is fuzzed with slang-shaders and will accept invalid keys l to account for shader presets that use these invalid constructs. No known shader presets fail to parse due to syntax errors that haven't already been accounted for. +## Broken due to preprocessing errors + +The preprocessor resolves `#include` pragmas in each `.slang` shader and recursively flattens files into a single compute unit. + +* `misc/shaders/glass.slang`: Missing `misc/include/img/param_floats.h`. + * Looks like this was moved too deep, it references `../include/img/param_floats.h`, but the shader lives in the `misc/shaders/` folder. \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 6a4be07..0c0088e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -793,6 +793,7 @@ dependencies = [ "librashader-common", "librashader-presets", "nom", + "rayon", "rustc-hash", "thiserror", ] diff --git a/librashader-preprocess/Cargo.toml b/librashader-preprocess/Cargo.toml index 6bfe47d..5e78055 100644 --- a/librashader-preprocess/Cargo.toml +++ b/librashader-preprocess/Cargo.toml @@ -24,4 +24,5 @@ line_directives = [] [dev-dependencies] glob = "0.3.1" -librashader-presets = { version = "0.1.0-beta.16", path = "../librashader-presets"} \ No newline at end of file +librashader-presets = { version = "0.1.0-beta.16", path = "../librashader-presets"} +rayon = "1.6.1" \ No newline at end of file diff --git a/librashader-preprocess/tests/parse_all.rs b/librashader-preprocess/tests/parse_all.rs index 8ea0991..fe45162 100644 --- a/librashader-preprocess/tests/parse_all.rs +++ b/librashader-preprocess/tests/parse_all.rs @@ -1,18 +1,23 @@ use glob::glob; -use librashader_preprocess::{PreprocessError, ShaderSource}; +use librashader_preprocess::ShaderSource; use librashader_presets::ShaderPreset; +use rayon::prelude::*; + #[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) { - for shader in preset.shaders { - ShaderSource::load(&shader.name).expect(&format!( - "Failed to preprocess shader {} from preset {}", - shader.name.display(), - path.display() - )); - } + 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 + ); + } + }) } } }