From 97ad0d64bfea451ea9083b72a360fc116f0ecf75 Mon Sep 17 00:00:00 2001 From: chyyran Date: Tue, 24 Sep 2024 00:49:10 -0400 Subject: [PATCH] rt(gl): make FilterChain::load_from argument order consistent with other runtimes --- librashader-capi/src/runtime/gl/filter_chain.rs | 4 ++-- librashader-runtime-gl/src/filter_chain/mod.rs | 6 +++--- librashader-runtime-gl/tests/triangle.rs | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/librashader-capi/src/runtime/gl/filter_chain.rs b/librashader-capi/src/runtime/gl/filter_chain.rs index 6b0c54f..67be43d 100644 --- a/librashader-capi/src/runtime/gl/filter_chain.rs +++ b/librashader-capi/src/runtime/gl/filter_chain.rs @@ -131,8 +131,8 @@ extern_fn! { let context = glow::Context::from_loader_function_cstr( |proc_name| loader(proc_name.as_ptr())); - let chain = FilterChain::load_from_preset(Arc::new(context), - *preset, options.as_ref())?; + let chain = FilterChain::load_from_preset(*preset, + Arc::new(context), options.as_ref())?; out.write(MaybeUninit::new(NonNull::new(Box::into_raw(Box::new( chain, diff --git a/librashader-runtime-gl/src/filter_chain/mod.rs b/librashader-runtime-gl/src/filter_chain/mod.rs index 5461290..3a87095 100644 --- a/librashader-runtime-gl/src/filter_chain/mod.rs +++ b/librashader-runtime-gl/src/filter_chain/mod.rs @@ -24,8 +24,8 @@ pub struct FilterChainGL { impl FilterChainGL { /// Load a filter chain from a pre-parsed `ShaderPreset`. pub unsafe fn load_from_preset( - ctx: Arc, preset: ShaderPreset, + ctx: Arc, options: Option<&FilterChainOptionsGL>, ) -> Result { let result = catch_unwind(|| { @@ -47,13 +47,13 @@ impl FilterChainGL { /// Load the shader preset at the given path into a filter chain. pub unsafe fn load_from_path( - ctx: Arc, path: impl AsRef, + ctx: Arc, options: Option<&FilterChainOptionsGL>, ) -> Result { // load passes from preset let preset = ShaderPreset::try_parse_with_driver_context(path, VideoDriver::GlCore)?; - unsafe { Self::load_from_preset(ctx, preset, options) } + unsafe { Self::load_from_preset(preset, ctx, options) } } /// Process a frame with the input image. diff --git a/librashader-runtime-gl/tests/triangle.rs b/librashader-runtime-gl/tests/triangle.rs index 38c7eaf..7885c70 100644 --- a/librashader-runtime-gl/tests/triangle.rs +++ b/librashader-runtime-gl/tests/triangle.rs @@ -10,9 +10,9 @@ fn triangle_gl() { unsafe { let mut filter = FilterChainGL::load_from_path( - Arc::clone(&context), // "../test/basic.slangp", "../test/shaders_slang/test/feedback.slangp", + Arc::clone(&context), Some(&FilterChainOptionsGL { glsl_version: 0, use_dsa: false, @@ -31,12 +31,12 @@ fn triangle_gl46() { let (glfw, window, events, shader, vao, context) = hello_triangle::gl46::setup(); unsafe { let mut filter = FilterChainGL::load_from_path( - Arc::clone(&context), // "../test/slang-shaders/vhs/VHSPro.slangp", // "../test/slang-shaders/test/history.slangp", // "../test/basic.slangp", // "../test/shaders_slang/crt/crt-royale.slangp", "../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", + Arc::clone(&context), Some(&FilterChainOptionsGL { glsl_version: 330, use_dsa: true,