From 350508a7aabfc6a3377fb7c9921da52b200bf17b Mon Sep 17 00:00:00 2001 From: chyyran Date: Thu, 15 Feb 2024 01:05:01 -0500 Subject: [PATCH] preprocess: strip #pragma parameter --- librashader-preprocess/src/pragma.rs | 12 ++++++++++++ librashader-preprocess/src/stage.rs | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/librashader-preprocess/src/pragma.rs b/librashader-preprocess/src/pragma.rs index 4ee34dc..b5a82b8 100644 --- a/librashader-preprocess/src/pragma.rs +++ b/librashader-preprocess/src/pragma.rs @@ -132,4 +132,16 @@ mod test { step: 0.25 }, parse_parameter_string(r#"#pragma parameter exc "orizontal correction hack (games where players stay at center)" 0.0 -10.0 10.0 0.25"#).unwrap()) } + + #[test] + fn parses_parameter_pragma_test() { + assert_eq!(ShaderParameter { + id: "HSM_CORE_RES_SAMPLING_MULT_SCANLINE_DIR".to_string(), + description: " Scanline Dir Multiplier".to_string(), + initial: 100.0, + minimum: 25.0, + maximum: 1600.0, + step: 25.0 + }, parse_parameter_string(r#"#pragma parameter HSM_CORE_RES_SAMPLING_MULT_SCANLINE_DIR " Scanline Dir Multiplier" 100 25 1600 25"#).unwrap()) + } } diff --git a/librashader-preprocess/src/stage.rs b/librashader-preprocess/src/stage.rs index ba32590..e378ab3 100644 --- a/librashader-preprocess/src/stage.rs +++ b/librashader-preprocess/src/stage.rs @@ -36,7 +36,10 @@ pub(crate) fn process_stages(source: &str) -> Result