Mesa (mesa_7_5_branch): mesa/st: short-circuit glFinish calls on WIN32 only

Keith Whitwell keithw at kemper.freedesktop.org
Wed Jul 29 11:48:13 UTC 2009


Module: Mesa
Branch: mesa_7_5_branch
Commit: 684282953937a37541f26c6e51ceec4134c62dfb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=684282953937a37541f26c6e51ceec4134c62dfb

Author: Keith Whitwell <keithw at vmware.com>
Date:   Wed Jul 29 12:47:23 2009 +0100

mesa/st: short-circuit glFinish calls on WIN32 only

Windows opengl32.dll calls glFinish prior to every swapbuffers, which
makes it pretty hard to get decent performance...

Work around by mapping finish to flush on PIPE_OS_WINDOWS.  This is
conformant, though it might confuse poorly-written benchmarks which
attempt to measure a single event rather than figuring out the rate of
continuous processing.

---

 src/mesa/state_tracker/st_cb_flush.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_flush.c b/src/mesa/state_tracker/st_cb_flush.c
index fbaffd1..f7de4e7 100644
--- a/src/mesa/state_tracker/st_cb_flush.c
+++ b/src/mesa/state_tracker/st_cb_flush.c
@@ -152,4 +152,16 @@ void st_init_flush_functions(struct dd_function_table *functions)
 {
    functions->Flush = st_glFlush;
    functions->Finish = st_glFinish;
+
+   /* Windows opengl32.dll calls glFinish prior to every swapbuffers.
+    * This is unnecessary and degrades performance.  Luckily we have some
+    * scope to work around this, as the externally-visible behaviour of
+    * Finish() is identical to Flush() in all cases - no differences in
+    * rendering or ReadPixels are visible if we opt not to wait here.
+    *
+    * Only set this up on windows to avoid suprise elsewhere.
+    */
+#ifdef PIPE_OS_WINDOWS
+   functions->Finish = st_glFlush;
+#endif
 }




More information about the mesa-commit mailing list