Avoid leaking fences during re-presentation (#5713)
* Avoid leaking fences during re-presentation
This commit is contained in:
parent
5776bdda82
commit
2ddecf35d2
|
@ -1107,6 +1107,11 @@ void RendererOpenGL::TryPresent(int timeout_ms) {
|
||||||
glBlitFramebuffer(0, 0, frame->width, frame->height, 0, 0, layout.width, layout.height,
|
glBlitFramebuffer(0, 0, frame->width, frame->height, 0, 0, layout.width, layout.height,
|
||||||
GL_COLOR_BUFFER_BIT, GL_LINEAR);
|
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 */
|
/* insert fence for the main thread to block on */
|
||||||
frame->present_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
frame->present_fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
Reference in New Issue