mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 20:14:17 +01:00
OpenGL: Ensure framebuffer binding is restored if completion check fails
This commit is contained in:
parent
ba7f213655
commit
2600633b89
@ -158,24 +158,21 @@ bool RasterizerCacheOpenGL::BlitTextures(GLuint src_tex, GLuint dst_tex,
|
|||||||
buffers = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
buffers = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OpenGLState::CheckFBStatus(GL_READ_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
bool can_blit = OpenGLState::CheckFBStatus(GL_READ_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE &&
|
||||||
return false;
|
OpenGLState::CheckFBStatus(GL_DRAW_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE;
|
||||||
}
|
|
||||||
|
|
||||||
if (OpenGLState::CheckFBStatus(GL_DRAW_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
|
if (can_blit) {
|
||||||
return false;
|
glBlitFramebuffer(src_rect.left, src_rect.top, src_rect.right, src_rect.bottom,
|
||||||
|
dst_rect.left, dst_rect.top, dst_rect.right, dst_rect.bottom, buffers,
|
||||||
|
buffers == GL_COLOR_BUFFER_BIT ? GL_LINEAR : GL_NEAREST);
|
||||||
}
|
}
|
||||||
|
|
||||||
glBlitFramebuffer(src_rect.left, src_rect.top, src_rect.right, src_rect.bottom, dst_rect.left,
|
|
||||||
dst_rect.top, dst_rect.right, dst_rect.bottom, buffers,
|
|
||||||
buffers == GL_COLOR_BUFFER_BIT ? GL_LINEAR : GL_NEAREST);
|
|
||||||
|
|
||||||
// Restore previous framebuffer bindings
|
// Restore previous framebuffer bindings
|
||||||
cur_state.draw.read_framebuffer = old_fbs[0];
|
cur_state.draw.read_framebuffer = old_fbs[0];
|
||||||
cur_state.draw.draw_framebuffer = old_fbs[1];
|
cur_state.draw.draw_framebuffer = old_fbs[1];
|
||||||
cur_state.Apply();
|
cur_state.Apply();
|
||||||
|
|
||||||
return true;
|
return can_blit;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RasterizerCacheOpenGL::TryBlitSurfaces(CachedSurface* src_surface,
|
bool RasterizerCacheOpenGL::TryBlitSurfaces(CachedSurface* src_surface,
|
||||||
|
Loading…
Reference in New Issue
Block a user