rt(gl): make FilterChain::load_from argument order consistent with other runtimes
This commit is contained in:
parent
feaebc5f44
commit
97ad0d64bf
|
@ -131,8 +131,8 @@ extern_fn! {
|
||||||
let context = glow::Context::from_loader_function_cstr(
|
let context = glow::Context::from_loader_function_cstr(
|
||||||
|proc_name| loader(proc_name.as_ptr()));
|
|proc_name| loader(proc_name.as_ptr()));
|
||||||
|
|
||||||
let chain = FilterChain::load_from_preset(Arc::new(context),
|
let chain = FilterChain::load_from_preset(*preset,
|
||||||
*preset, options.as_ref())?;
|
Arc::new(context), options.as_ref())?;
|
||||||
|
|
||||||
out.write(MaybeUninit::new(NonNull::new(Box::into_raw(Box::new(
|
out.write(MaybeUninit::new(NonNull::new(Box::into_raw(Box::new(
|
||||||
chain,
|
chain,
|
||||||
|
|
|
@ -24,8 +24,8 @@ pub struct FilterChainGL {
|
||||||
impl FilterChainGL {
|
impl FilterChainGL {
|
||||||
/// Load a filter chain from a pre-parsed `ShaderPreset`.
|
/// Load a filter chain from a pre-parsed `ShaderPreset`.
|
||||||
pub unsafe fn load_from_preset(
|
pub unsafe fn load_from_preset(
|
||||||
ctx: Arc<glow::Context>,
|
|
||||||
preset: ShaderPreset,
|
preset: ShaderPreset,
|
||||||
|
ctx: Arc<glow::Context>,
|
||||||
options: Option<&FilterChainOptionsGL>,
|
options: Option<&FilterChainOptionsGL>,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
let result = catch_unwind(|| {
|
let result = catch_unwind(|| {
|
||||||
|
@ -47,13 +47,13 @@ impl FilterChainGL {
|
||||||
|
|
||||||
/// Load the shader preset at the given path into a filter chain.
|
/// Load the shader preset at the given path into a filter chain.
|
||||||
pub unsafe fn load_from_path(
|
pub unsafe fn load_from_path(
|
||||||
ctx: Arc<glow::Context>,
|
|
||||||
path: impl AsRef<Path>,
|
path: impl AsRef<Path>,
|
||||||
|
ctx: Arc<glow::Context>,
|
||||||
options: Option<&FilterChainOptionsGL>,
|
options: Option<&FilterChainOptionsGL>,
|
||||||
) -> Result<Self> {
|
) -> Result<Self> {
|
||||||
// load passes from preset
|
// load passes from preset
|
||||||
let preset = ShaderPreset::try_parse_with_driver_context(path, VideoDriver::GlCore)?;
|
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.
|
/// Process a frame with the input image.
|
||||||
|
|
|
@ -10,9 +10,9 @@ fn triangle_gl() {
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut filter = FilterChainGL::load_from_path(
|
let mut filter = FilterChainGL::load_from_path(
|
||||||
Arc::clone(&context),
|
|
||||||
// "../test/basic.slangp",
|
// "../test/basic.slangp",
|
||||||
"../test/shaders_slang/test/feedback.slangp",
|
"../test/shaders_slang/test/feedback.slangp",
|
||||||
|
Arc::clone(&context),
|
||||||
Some(&FilterChainOptionsGL {
|
Some(&FilterChainOptionsGL {
|
||||||
glsl_version: 0,
|
glsl_version: 0,
|
||||||
use_dsa: false,
|
use_dsa: false,
|
||||||
|
@ -31,12 +31,12 @@ fn triangle_gl46() {
|
||||||
let (glfw, window, events, shader, vao, context) = hello_triangle::gl46::setup();
|
let (glfw, window, events, shader, vao, context) = hello_triangle::gl46::setup();
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut filter = FilterChainGL::load_from_path(
|
let mut filter = FilterChainGL::load_from_path(
|
||||||
Arc::clone(&context),
|
|
||||||
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
// "../test/slang-shaders/vhs/VHSPro.slangp",
|
||||||
// "../test/slang-shaders/test/history.slangp",
|
// "../test/slang-shaders/test/history.slangp",
|
||||||
// "../test/basic.slangp",
|
// "../test/basic.slangp",
|
||||||
// "../test/shaders_slang/crt/crt-royale.slangp",
|
// "../test/shaders_slang/crt/crt-royale.slangp",
|
||||||
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
"../test/shaders_slang/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp",
|
||||||
|
Arc::clone(&context),
|
||||||
Some(&FilterChainOptionsGL {
|
Some(&FilterChainOptionsGL {
|
||||||
glsl_version: 330,
|
glsl_version: 330,
|
||||||
use_dsa: true,
|
use_dsa: true,
|
||||||
|
|
Loading…
Reference in a new issue