Avoid leaking fences during re-presentation (#5713)

* Avoid leaking fences during re-presentation
This commit is contained in:
xperia64 2021-02-09 16:32:48 +00:00 committed by GitHub
parent 5776bdda82
commit 2ddecf35d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1107,6 +1107,11 @@ void RendererOpenGL::TryPresent(int timeout_ms) {
glBlitFramebuffer(0, 0, frame->width, frame->height, 0, 0, layout.width, layout.height,
GL_COLOR_BUFFER_BIT, GL_LINEAR);
// Delete the fence if we're re-presenting to avoid leaking fences
if (frame->present_fence) {
glDeleteSync(frame->present_fence);
}
/* insert fence for the main thread to block on */
frame->present_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
glFlush();