[4/15] WineD3D: Count the framerate per swapchain, not globally

Stefan Dösinger stefan at codeweavers.com
Wed Jan 10 04:27:26 CST 2007


Otherwise we get a double framerate in a dual swapchain environment
-------------- next part --------------
From 66cc656c02262b0a2e382e16ca17b3411e8fd1f5 Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Sat, 6 Jan 2007 22:00:50 +0100
Subject: [PATCH] WineD3D: Count the framerate per swapchain, not globally

---
 dlls/wined3d/swapchain.c       |   12 +++++-------
 dlls/wined3d/wined3d_private.h |    2 ++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 6183718..d975f26 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -307,15 +307,13 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
     /* FPS support */
     if (TRACE_ON(fps))
     {
-        static long prev_time, frames;
-
         DWORD time = GetTickCount();
-        frames++;
+        This->frames++;
         /* every 1.5 seconds */
-        if (time - prev_time > 1500) {
-            TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
-            prev_time = time;
-            frames = 0;
+        if (time - This->prev_time > 1500) {
+            TRACE_(fps)("%p @ approx %.2ffps\n", This, 1000.0*This->frames/(time - This->prev_time));
+            This->prev_time = time;
+            This->frames = 0;
         }
     }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index c018c27..323fa38 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1313,6 +1313,8 @@ typedef struct IWineD3DSwapChainImpl
     D3DPRESENT_PARAMETERS     presentParms;
     DWORD                     orig_width, orig_height;
 
+    long prev_time, frames;   /* Performance tracking */
+
     /* TODO: move everything up to drawable off into a context manager
       and store the 'data' in the contextManagerData interface.
     IUnknown                  *contextManagerData;
-- 
1.4.4.3



More information about the wine-patches mailing list