diff --git a/librashader-runtime-d3d11/src/framebuffer.rs b/librashader-runtime-d3d11/src/framebuffer.rs index 929fd0b..e9260d5 100644 --- a/librashader-runtime-d3d11/src/framebuffer.rs +++ b/librashader-runtime-d3d11/src/framebuffer.rs @@ -98,6 +98,7 @@ impl OwnedFramebuffer { | D3D11_FORMAT_SUPPORT_RENDER_TARGET.0, ); + // todo: fix mipmap handling let desc = default_desc(size, format, 1); unsafe { let mut texture = self.device.CreateTexture2D(&desc, None)?; diff --git a/librashader-runtime-gl/src/filter_chain/filter_impl.rs b/librashader-runtime-gl/src/filter_chain/filter_impl.rs index ff9b8e8..eb98387 100644 --- a/librashader-runtime-gl/src/filter_chain/filter_impl.rs +++ b/librashader-runtime-gl/src/filter_chain/filter_impl.rs @@ -489,12 +489,14 @@ impl FilterChainImpl { // rescale render buffers to ensure all bindings are valid. for (index, pass) in passes.iter_mut().enumerate() { + // todo: properly check **next** pass for mipmap. self.output_framebuffers[index].scale::( pass.config.scaling.clone(), pass.get_format(), viewport, &original, &source, + pass.config.mipmap_input )?; self.feedback_framebuffers[index].scale::( @@ -503,6 +505,7 @@ impl FilterChainImpl { viewport, &original, &source, + pass.config.mipmap_input )?; } diff --git a/librashader-runtime-gl/src/gl/framebuffer.rs b/librashader-runtime-gl/src/gl/framebuffer.rs index 42b2aa6..9bd0637 100644 --- a/librashader-runtime-gl/src/gl/framebuffer.rs +++ b/librashader-runtime-gl/src/gl/framebuffer.rs @@ -44,8 +44,9 @@ impl Framebuffer { viewport: &Viewport, original: &Texture, source: &Texture, + mipmap: bool ) -> Result> { - T::scale(self, scaling, format, viewport, original, source) + T::scale(self, scaling, format, viewport, original, source, mipmap) } pub fn copy_from(&mut self, image: &GLImage) -> Result<()> { diff --git a/librashader-runtime-gl/src/gl/gl3/framebuffer.rs b/librashader-runtime-gl/src/gl/gl3/framebuffer.rs index 0ef00e6..dbd4ecc 100644 --- a/librashader-runtime-gl/src/gl/gl3/framebuffer.rs +++ b/librashader-runtime-gl/src/gl/gl3/framebuffer.rs @@ -59,6 +59,7 @@ impl FramebufferInterface for Gl3Framebuffer { viewport: &Viewport, _original: &Texture, source: &Texture, + mipmap: bool, ) -> Result> { if fb.is_raw { return Ok(fb.size); diff --git a/librashader-runtime-gl/src/gl/gl46/framebuffer.rs b/librashader-runtime-gl/src/gl/gl46/framebuffer.rs index 527521c..099660f 100644 --- a/librashader-runtime-gl/src/gl/gl46/framebuffer.rs +++ b/librashader-runtime-gl/src/gl/gl46/framebuffer.rs @@ -57,6 +57,7 @@ impl FramebufferInterface for Gl46Framebuffer { viewport: &Viewport, _original: &Texture, source: &Texture, + mipmap: bool, ) -> Result> { if fb.is_raw { return Ok(fb.size); @@ -67,9 +68,15 @@ impl FramebufferInterface for Gl46Framebuffer { .size .scale_viewport(scaling, viewport.output.size); - if fb.size != size { + if fb.size != size || (mipmap && fb.max_levels == 1) || (!mipmap && fb.max_levels != 1) { fb.size = size; + if mipmap { + fb.max_levels = u32::MAX; + } else { + fb.max_levels = 1 + } + Self::init( fb, size, diff --git a/librashader-runtime-gl/src/gl/mod.rs b/librashader-runtime-gl/src/gl/mod.rs index b5876e2..abe54c7 100644 --- a/librashader-runtime-gl/src/gl/mod.rs +++ b/librashader-runtime-gl/src/gl/mod.rs @@ -52,6 +52,7 @@ pub trait FramebufferInterface { viewport: &Viewport, _original: &Texture, source: &Texture, + mipmap: bool, ) -> Result>; fn clear(fb: &Framebuffer); fn copy_from(fb: &mut Framebuffer, image: &GLImage) -> Result<()>;