diff --git a/librashader-runtime-gl/src/filter_pass.rs b/librashader-runtime-gl/src/filter_pass.rs index f07046e..bb3a995 100644 --- a/librashader-runtime-gl/src/filter_pass.rs +++ b/librashader-runtime-gl/src/filter_pass.rs @@ -253,6 +253,9 @@ impl FilterPass { } for (index, output) in parent.history_textures.iter().enumerate() { + if !output.is_bound() { + continue; + } if let Some(binding) = self .reflection .meta @@ -274,6 +277,9 @@ impl FilterPass { // PassOutput for (index, output) in parent.output_textures.iter().enumerate() { + if !output.is_bound() { + continue; + } if let Some(binding) = self .reflection .meta @@ -294,6 +300,9 @@ impl FilterPass { // PassFeedback for (index, feedback) in parent.feedback_textures.iter().enumerate() { + if !feedback.is_bound() { + continue; + } if let Some(binding) = self .reflection .meta diff --git a/librashader-runtime-gl/src/framebuffer.rs b/librashader-runtime-gl/src/framebuffer.rs index d52286e..68abd8f 100644 --- a/librashader-runtime-gl/src/framebuffer.rs +++ b/librashader-runtime-gl/src/framebuffer.rs @@ -13,7 +13,7 @@ pub struct Framebuffer { pub size: Size, pub format: GLenum, pub max_levels: u32, - pub levels: u32, + pub mip_levels: u32, is_raw: bool, } @@ -34,7 +34,7 @@ impl Framebuffer { }, format: 0, max_levels, - levels: 0, + mip_levels: 0, handle: framebuffer, is_raw: false, } @@ -52,7 +52,7 @@ impl Framebuffer { size, format, max_levels: miplevels, - levels: miplevels, + mip_levels: miplevels, handle, is_raw: true, } @@ -250,17 +250,17 @@ impl Framebuffer { size.height = 1; } - self.levels = util::calc_miplevel(size); - if self.levels > self.max_levels { - self.levels = self.max_levels; + self.mip_levels = util::calc_miplevel(size); + if self.mip_levels > self.max_levels { + self.mip_levels = self.max_levels; } - if self.levels == 0 { - self.levels = 1; + if self.mip_levels == 0 { + self.mip_levels = 1; } gl::TexStorage2D( gl::TEXTURE_2D, - self.levels as GLsizei, + self.mip_levels as GLsizei, self.format, size.width as GLsizei, size.height as GLsizei, @@ -291,17 +291,17 @@ impl Framebuffer { gl::GenTextures(1, &mut self.image); gl::BindTexture(gl::TEXTURE_2D, self.image); - self.levels = util::calc_miplevel(size); - if self.levels > self.max_levels { - self.levels = self.max_levels; + self.mip_levels = util::calc_miplevel(size); + if self.mip_levels > self.max_levels { + self.mip_levels = self.max_levels; } - if self.levels == 0 { - self.levels = 1; + if self.mip_levels == 0 { + self.mip_levels = 1; } gl::TexStorage2D( gl::TEXTURE_2D, - self.levels as GLsizei, + self.mip_levels as GLsizei, ImageFormat::R8G8B8A8Unorm.into(), size.width as GLsizei, size.height as GLsizei, diff --git a/librashader-runtime-gl/src/lib.rs b/librashader-runtime-gl/src/lib.rs index fdfa43e..4532369 100644 --- a/librashader-runtime-gl/src/lib.rs +++ b/librashader-runtime-gl/src/lib.rs @@ -31,7 +31,8 @@ mod tests { fn triangle_gl() { let (glfw, window, events, shader, vao) = hello_triangle::setup(); let mut filter = - FilterChain::load_from_path("../test/slang-shaders/vhs/VHSPro.slangp", None) +// FilterChain::load_from_path("../test/slang-shaders/vhs/VHSPro.slangp", None) + FilterChain::load_from_path("../test/slang-shaders/bezel/Mega_Bezel/Presets/MBZ__0__SMOOTH-ADV.slangp", None) .unwrap(); hello_triangle::do_loop(glfw, window, events, shader, vao, &mut filter); } diff --git a/librashader-runtime-gl/src/texture.rs b/librashader-runtime-gl/src/texture.rs index c621f55..e268567 100644 --- a/librashader-runtime-gl/src/texture.rs +++ b/librashader-runtime-gl/src/texture.rs @@ -8,3 +8,9 @@ pub struct Texture { pub mip_filter: FilterMode, pub wrap_mode: WrapMode, } + +impl Texture { + pub fn is_bound(&self) -> bool { + return self.image.handle != 0 + } +} \ No newline at end of file diff --git a/librashader-runtime-gl46/src/filter_pass.rs b/librashader-runtime-gl46/src/filter_pass.rs index 6d67d44..6ae26ac 100644 --- a/librashader-runtime-gl46/src/filter_pass.rs +++ b/librashader-runtime-gl46/src/filter_pass.rs @@ -242,6 +242,9 @@ impl FilterPass { } for (index, output) in parent.history_textures.iter().enumerate() { + if !output.is_bound() { + continue; + } if let Some(binding) = self .reflection .meta @@ -263,6 +266,9 @@ impl FilterPass { // PassOutput for (index, output) in parent.output_textures.iter().enumerate() { + if !output.is_bound() { + continue; + } if let Some(binding) = self .reflection .meta @@ -283,6 +289,9 @@ impl FilterPass { // PassFeedback for (index, feedback) in parent.feedback_textures.iter().enumerate() { + if !feedback.is_bound() { + continue; + } if let Some(binding) = self .reflection .meta diff --git a/librashader-runtime-gl46/src/texture.rs b/librashader-runtime-gl46/src/texture.rs index c621f55..e268567 100644 --- a/librashader-runtime-gl46/src/texture.rs +++ b/librashader-runtime-gl46/src/texture.rs @@ -8,3 +8,9 @@ pub struct Texture { pub mip_filter: FilterMode, pub wrap_mode: WrapMode, } + +impl Texture { + pub fn is_bound(&self) -> bool { + return self.image.handle != 0 + } +} \ No newline at end of file