gl: kind of fix mipmap handling needs to check next frame

This commit is contained in:
chyyran 2023-01-11 19:09:15 -05:00
parent 8047bf80c8
commit 23458917f3
6 changed files with 16 additions and 2 deletions

View file

@ -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)?;

View file

@ -489,12 +489,14 @@ impl<T: GLInterface> FilterChainImpl<T> {
// 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::<T::FramebufferInterface>(
pass.config.scaling.clone(),
pass.get_format(),
viewport,
&original,
&source,
pass.config.mipmap_input
)?;
self.feedback_framebuffers[index].scale::<T::FramebufferInterface>(
@ -503,6 +505,7 @@ impl<T: GLInterface> FilterChainImpl<T> {
viewport,
&original,
&source,
pass.config.mipmap_input
)?;
}

View file

@ -44,8 +44,9 @@ impl Framebuffer {
viewport: &Viewport,
original: &Texture,
source: &Texture,
mipmap: bool
) -> Result<Size<u32>> {
T::scale(self, scaling, format, viewport, original, source)
T::scale(self, scaling, format, viewport, original, source, mipmap)
}
pub fn copy_from<T: FramebufferInterface>(&mut self, image: &GLImage) -> Result<()> {

View file

@ -59,6 +59,7 @@ impl FramebufferInterface for Gl3Framebuffer {
viewport: &Viewport,
_original: &Texture,
source: &Texture,
mipmap: bool,
) -> Result<Size<u32>> {
if fb.is_raw {
return Ok(fb.size);

View file

@ -57,6 +57,7 @@ impl FramebufferInterface for Gl46Framebuffer {
viewport: &Viewport,
_original: &Texture,
source: &Texture,
mipmap: bool,
) -> Result<Size<u32>> {
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,

View file

@ -52,6 +52,7 @@ pub trait FramebufferInterface {
viewport: &Viewport,
_original: &Texture,
source: &Texture,
mipmap: bool,
) -> Result<Size<u32>>;
fn clear<const REBIND: bool>(fb: &Framebuffer);
fn copy_from(fb: &mut Framebuffer, image: &GLImage) -> Result<()>;