1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00
fix #33188 MSAA depth buffer not used for external texture
This commit is contained in:
Rémi Verschelde
2019-11-08 09:53:22 +01:00
committed by GitHub

View File

@@ -5156,6 +5156,17 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
// is there a point to setting the internal formats? we don't know them.. // is there a point to setting the internal formats? we don't know them..
// check if MSAA is active to set the correct depth buffer and target texture for android
if (rt->multisample_active) {
#if defined(GLES_OVER_GL) || defined(IPHONE_ENABLED)
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, p_texture_id);
#elif ANDROID_ENABLED
static const int msaa_value[] = { 0, 2, 4, 8, 16 };
int msaa = msaa_value[rt->msaa];
glFramebufferTexture2DMultisample(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, p_texture_id, 0, msaa);
#endif
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->multisample_depth);
} else {
// set our texture as the destination for our framebuffer // set our texture as the destination for our framebuffer
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, p_texture_id, 0); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, p_texture_id, 0);
@@ -5165,6 +5176,7 @@ void RasterizerStorageGLES2::render_target_set_external_texture(RID p_render_tar
} else { } else {
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth); glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, rt->depth);
} }
}
// check status and unbind // check status and unbind
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);