use glClear instead of glInvalidateFrambuffer on desktop

glInvalidateFramebuffer is not available before GL4.3.
This commit is contained in:
Mathias Agopian
2021-08-05 11:52:24 -07:00
committed by Mathias Agopian
parent f804c9e346
commit cf3cc37392

View File

@@ -2232,6 +2232,13 @@ void OpenGLDriver::beginRenderPass(Handle<HwRenderTarget> rth,
}
CHECK_GL_ERROR(utils::slog.e)
}
} else {
// on GL desktop we assume we don't have glInvalidateFramebuffer, but even if the GPU is
// not a tiler, it's important to clear the framebuffer before drawing, as it resets
// the fb to a known state (resets fb compression and possibly other things).
// So we use glClear instead of glInvalidateFramebuffer
gl.disable(GL_SCISSOR_TEST);
clearWithRasterPipe(discardFlags & ~clearFlags, { 0.0f }, 0.0f, 0);
}
if (rt->gl.fbo_read) {
@@ -2262,8 +2269,7 @@ void OpenGLDriver::beginRenderPass(Handle<HwRenderTarget> rth,
#ifndef NDEBUG
// clear the discarded (but not the cleared ones) buffers in debug builds
mContext.bindFramebuffer(GL_FRAMEBUFFER, rt->gl.fbo);
mContext.disable(GL_SCISSOR_TEST);
gl.disable(GL_SCISSOR_TEST);
clearWithRasterPipe(discardFlags & ~clearFlags,
{ 1, 0, 0, 1 }, 1.0, 0);
#endif