Alexandre Julliard : winex11: Move the fps tracing to opengl32.

Alexandre Julliard julliard at winehq.org
Mon Sep 10 15:22:09 CDT 2012


Module: wine
Branch: master
Commit: 025f4aed1ed67528141f8d709ec1aca76690279a
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=025f4aed1ed67528141f8d709ec1aca76690279a

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Sep  7 21:28:15 2012 +0200

winex11: Move the fps tracing to opengl32.

---

 dlls/opengl32/wgl.c       |   23 ++++++++++++++++++++++-
 dlls/winex11.drv/opengl.c |   20 --------------------
 2 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c
index 8ed2a0e..eb24b0f 100644
--- a/dlls/opengl32/wgl.c
+++ b/dlls/opengl32/wgl.c
@@ -41,6 +41,7 @@
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(wgl);
+WINE_DECLARE_DEBUG_CHANNEL(fps);
 
 static HMODULE opengl32_handle;
 
@@ -603,7 +604,27 @@ BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers( HDC hdc )
     const struct opengl_funcs *funcs = get_dc_funcs( hdc );
 
     if (!funcs || !funcs->wgl.p_wglSwapBuffers) return FALSE;
-    return funcs->wgl.p_wglSwapBuffers( hdc );
+    if (!funcs->wgl.p_wglSwapBuffers( hdc )) return FALSE;
+
+    if (TRACE_ON(fps))
+    {
+        static long prev_time, start_time;
+        static unsigned long frames, frames_total;
+
+        DWORD time = GetTickCount();
+        frames++;
+        frames_total++;
+        /* every 1.5 seconds */
+        if (time - prev_time > 1500)
+        {
+            TRACE_(fps)("@ approx %.2ffps, total %.2ffps\n",
+                        1000.0*frames/(time - prev_time), 1000.0*frames_total/(time - start_time));
+            prev_time = time;
+            frames = 0;
+            if (start_time == 0) start_time = time;
+        }
+    }
+    return TRUE;
 }
 
 /***********************************************************************
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 281c17e..eb9cd7f 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -57,7 +57,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wgl);
 #ifdef SONAME_LIBGL
 
 WINE_DECLARE_DEBUG_CHANNEL(winediag);
-WINE_DECLARE_DEBUG_CHANNEL(fps);
 
 #include "wine/wgl_driver.h"
 #include "wine/wglext.h"
@@ -3067,25 +3066,6 @@ static BOOL glxdrv_wglSwapBuffers( HDC hdc )
 
     ExtEscape( hdc, X11DRV_ESCAPE, sizeof(code), (LPSTR)&code, 0, NULL );
 
-  /* FPS support */
-  if (TRACE_ON(fps))
-  {
-      static long prev_time, start_time;
-      static unsigned long frames, frames_total;
-
-      DWORD time = GetTickCount();
-      frames++;
-      frames_total++;
-      /* every 1.5 seconds */
-      if (time - prev_time > 1500) {
-          TRACE_(fps)("@ approx %.2ffps, total %.2ffps\n",
-                      1000.0*frames/(time - prev_time), 1000.0*frames_total/(time - start_time));
-          prev_time = time;
-          frames = 0;
-          if(start_time == 0) start_time = time;
-      }
-  }
-
     return ret;
 }
 




More information about the wine-cvs mailing list