[patch] boilerplate/gl: use glFlush instead of glFinish

"Henry (Yu) Song - SISA" <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <3955FA337689574EB32F94B12A7E6E9E59F11F00@sisaex01sj>
From 73c77248ed95b3f9f6a777d86c368e464f3b49bb Mon Sep 17 00:00:00 2001
From: Henry Song <[email protected]>
Date: Thu, 29 Aug 2013 13:35:11 -0700
Subject: [PATCH] boilerplate/gl: use glFlush instead of glFinish for
 synchronization

Use glFlush () is a proper way to indicate a surface/frame finish
instead of a glFinish. Applications very rarely use glFinish ().
For offscreen, a glFlush () should be used to indicate finish drawings
onto a surface.  For onscreen, an eglSwapBuffers/glXSwapBuffers should
be used (internal, it calls glFlush).

Using glFlush () computes performance more accurately folllowing app
usage model.
---
 boilerplate/cairo-boilerplate-egl.c | 2 +-
 boilerplate/cairo-boilerplate-glx.c | 2 +-
 boilerplate/cairo-boilerplate-wgl.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/boilerplate/cairo-boilerplate-egl.c b/boilerplate/cairo-boilerplate-egl.c
index 99bee64..3190728 100644
--- a/boilerplate/cairo-boilerplate-egl.c
+++ b/boilerplate/cairo-boilerplate-egl.c
@@ -156,7 +156,7 @@ _cairo_boilerplate_egl_synchronize (void *closure)
     if (cairo_device_acquire (gltc->device))
 	return;
 
-    glFinish ();
+    glFlush ();
 
     cairo_device_release (gltc->device);
 }
diff --git a/boilerplate/cairo-boilerplate-glx.c b/boilerplate/cairo-boilerplate-glx.c
index 0643644..9baca13 100644
--- a/boilerplate/cairo-boilerplate-glx.c
+++ b/boilerplate/cairo-boilerplate-glx.c
@@ -353,7 +353,7 @@ _cairo_boilerplate_gl_synchronize (void *closure)
     if (cairo_device_acquire (gltc->device))
 	return;
 
-    glFinish ();
+    glFlush ();
 
     cairo_device_release (gltc->device);
 }
diff --git a/boilerplate/cairo-boilerplate-wgl.c b/boilerplate/cairo-boilerplate-wgl.c
index 9088177..ae4dcc2 100644
--- a/boilerplate/cairo-boilerplate-wgl.c
+++ b/boilerplate/cairo-boilerplate-wgl.c
@@ -200,7 +200,7 @@ _cairo_boilerplate_wgl_synchronize (void *closure)
     if (cairo_device_acquire (wgltc->device))
 	return;
 
-    glFinish ();
+    glFlush ();
 
     cairo_device_release (wgltc->device);
 }
-- 
1.8.1.2
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.