gl: kind of fix mipmap handlingneeds to check next frame
This commit is contained in:
parent
8047bf80c8
commit
23458917f3
|
@ -98,6 +98,7 @@ impl OwnedFramebuffer {
|
||||||
| D3D11_FORMAT_SUPPORT_RENDER_TARGET.0,
|
| D3D11_FORMAT_SUPPORT_RENDER_TARGET.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// todo: fix mipmap handling
|
||||||
let desc = default_desc(size, format, 1);
|
let desc = default_desc(size, format, 1);
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut texture = self.device.CreateTexture2D(&desc, None)?;
|
let mut texture = self.device.CreateTexture2D(&desc, None)?;
|
||||||
|
|
|
@ -489,12 +489,14 @@ impl<T: GLInterface> FilterChainImpl<T> {
|
||||||
|
|
||||||
// rescale render buffers to ensure all bindings are valid.
|
// rescale render buffers to ensure all bindings are valid.
|
||||||
for (index, pass) in passes.iter_mut().enumerate() {
|
for (index, pass) in passes.iter_mut().enumerate() {
|
||||||
|
// todo: properly check **next** pass for mipmap.
|
||||||
self.output_framebuffers[index].scale::<T::FramebufferInterface>(
|
self.output_framebuffers[index].scale::<T::FramebufferInterface>(
|
||||||
pass.config.scaling.clone(),
|
pass.config.scaling.clone(),
|
||||||
pass.get_format(),
|
pass.get_format(),
|
||||||
viewport,
|
viewport,
|
||||||
&original,
|
&original,
|
||||||
&source,
|
&source,
|
||||||
|
pass.config.mipmap_input
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
self.feedback_framebuffers[index].scale::<T::FramebufferInterface>(
|
self.feedback_framebuffers[index].scale::<T::FramebufferInterface>(
|
||||||
|
@ -503,6 +505,7 @@ impl<T: GLInterface> FilterChainImpl<T> {
|
||||||
viewport,
|
viewport,
|
||||||
&original,
|
&original,
|
||||||
&source,
|
&source,
|
||||||
|
pass.config.mipmap_input
|
||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,9 @@ impl Framebuffer {
|
||||||
viewport: &Viewport,
|
viewport: &Viewport,
|
||||||
original: &Texture,
|
original: &Texture,
|
||||||
source: &Texture,
|
source: &Texture,
|
||||||
|
mipmap: bool
|
||||||
) -> Result<Size<u32>> {
|
) -> 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<()> {
|
pub fn copy_from<T: FramebufferInterface>(&mut self, image: &GLImage) -> Result<()> {
|
||||||
|
|
|
@ -59,6 +59,7 @@ impl FramebufferInterface for Gl3Framebuffer {
|
||||||
viewport: &Viewport,
|
viewport: &Viewport,
|
||||||
_original: &Texture,
|
_original: &Texture,
|
||||||
source: &Texture,
|
source: &Texture,
|
||||||
|
mipmap: bool,
|
||||||
) -> Result<Size<u32>> {
|
) -> Result<Size<u32>> {
|
||||||
if fb.is_raw {
|
if fb.is_raw {
|
||||||
return Ok(fb.size);
|
return Ok(fb.size);
|
||||||
|
|
|
@ -57,6 +57,7 @@ impl FramebufferInterface for Gl46Framebuffer {
|
||||||
viewport: &Viewport,
|
viewport: &Viewport,
|
||||||
_original: &Texture,
|
_original: &Texture,
|
||||||
source: &Texture,
|
source: &Texture,
|
||||||
|
mipmap: bool,
|
||||||
) -> Result<Size<u32>> {
|
) -> Result<Size<u32>> {
|
||||||
if fb.is_raw {
|
if fb.is_raw {
|
||||||
return Ok(fb.size);
|
return Ok(fb.size);
|
||||||
|
@ -67,9 +68,15 @@ impl FramebufferInterface for Gl46Framebuffer {
|
||||||
.size
|
.size
|
||||||
.scale_viewport(scaling, viewport.output.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;
|
fb.size = size;
|
||||||
|
|
||||||
|
if mipmap {
|
||||||
|
fb.max_levels = u32::MAX;
|
||||||
|
} else {
|
||||||
|
fb.max_levels = 1
|
||||||
|
}
|
||||||
|
|
||||||
Self::init(
|
Self::init(
|
||||||
fb,
|
fb,
|
||||||
size,
|
size,
|
||||||
|
|
|
@ -52,6 +52,7 @@ pub trait FramebufferInterface {
|
||||||
viewport: &Viewport,
|
viewport: &Viewport,
|
||||||
_original: &Texture,
|
_original: &Texture,
|
||||||
source: &Texture,
|
source: &Texture,
|
||||||
|
mipmap: bool,
|
||||||
) -> Result<Size<u32>>;
|
) -> Result<Size<u32>>;
|
||||||
fn clear<const REBIND: bool>(fb: &Framebuffer);
|
fn clear<const REBIND: bool>(fb: &Framebuffer);
|
||||||
fn copy_from(fb: &mut Framebuffer, image: &GLImage) -> Result<()>;
|
fn copy_from(fb: &mut Framebuffer, image: &GLImage) -> Result<()>;
|
||||||
|
|
Loading…
Reference in a new issue