When framebuffer allocation fails for MSAA in GLES2 revert to normal without ERR_FAIL
This commit is contained in:
parent
924db5fa58
commit
033ae8a543
1 changed files with 23 additions and 6 deletions
|
@ -4742,16 +4742,33 @@ void RasterizerStorageGLES2::_render_target_allocate(RenderTarget *rt) {
|
||||||
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||||
|
|
||||||
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
if (status != GL_FRAMEBUFFER_COMPLETE) {
|
||||||
|
// Delete allocated resources and default to no MSAA
|
||||||
WARN_PRINT_ONCE("Cannot allocate back framebuffer for MSAA");
|
WARN_PRINT_ONCE("Cannot allocate back framebuffer for MSAA");
|
||||||
printf("err status: %x\n", status);
|
printf("err status: %x\n", status);
|
||||||
_render_target_clear(rt);
|
config.multisample_supported = false;
|
||||||
ERR_FAIL_COND(status != GL_FRAMEBUFFER_COMPLETE);
|
rt->multisample_active = false;
|
||||||
|
|
||||||
|
glDeleteFramebuffers(1, &rt->multisample_fbo);
|
||||||
|
rt->multisample_fbo = 0;
|
||||||
|
|
||||||
|
glDeleteRenderbuffers(1, &rt->multisample_depth);
|
||||||
|
rt->multisample_depth = 0;
|
||||||
|
#ifdef ANDROID_ENABLED
|
||||||
|
glDeleteTextures(1, &rt->multisample_color);
|
||||||
|
#else
|
||||||
|
glDeleteRenderbuffers(1, &rt->multisample_color);
|
||||||
|
#endif
|
||||||
|
rt->multisample_color = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
glBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||||
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
|
#ifdef ANDROID_ENABLED
|
||||||
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif // JAVASCRIPT_ENABLED
|
||||||
{
|
{
|
||||||
rt->multisample_active = false;
|
rt->multisample_active = false;
|
||||||
}
|
}
|
||||||
|
@ -4987,10 +5004,10 @@ void RasterizerStorageGLES2::_render_target_clear(RenderTarget *rt) {
|
||||||
|
|
||||||
glDeleteRenderbuffers(1, &rt->multisample_depth);
|
glDeleteRenderbuffers(1, &rt->multisample_depth);
|
||||||
rt->multisample_depth = 0;
|
rt->multisample_depth = 0;
|
||||||
#ifdef GLES_OVER_GL
|
#ifdef ANDROID_ENABLED
|
||||||
glDeleteRenderbuffers(1, &rt->multisample_color);
|
|
||||||
#else
|
|
||||||
glDeleteTextures(1, &rt->multisample_color);
|
glDeleteTextures(1, &rt->multisample_color);
|
||||||
|
#else
|
||||||
|
glDeleteRenderbuffers(1, &rt->multisample_color);
|
||||||
#endif
|
#endif
|
||||||
rt->multisample_color = 0;
|
rt->multisample_color = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue