Stefan Dösinger : Add a common fps counter channel to ddraw, opengl and d3d.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jul 7 11:10:43 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: eb527c82e232d4fe93d498715de9a8bce0e1f36e
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=eb527c82e232d4fe93d498715de9a8bce0e1f36e
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Wed Jul 5 18:35:21 2006 +0200
Add a common fps counter channel to ddraw, opengl and d3d.
---
dlls/wined3d/surface_gdi.c | 16 ++++++++++++++++
dlls/wined3d/swapchain.c | 6 +++---
dlls/winex11.drv/opengl.c | 16 ++++++++++++++++
3 files changed, 35 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/surface_gdi.c b/dlls/wined3d/surface_gdi.c
index ddea727..bb07afa 100644
--- a/dlls/wined3d/surface_gdi.c
+++ b/dlls/wined3d/surface_gdi.c
@@ -34,6 +34,7 @@ #include <stdio.h>
/* Use the d3d_surface debug channel to have one channel for all surfaces */
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
+WINE_DECLARE_DEBUG_CHANNEL(fps);
/*****************************************************************************
* x11_copy_to_screen
@@ -379,6 +380,21 @@ #endif
/* Update the screen */
x11_copy_to_screen(This, NULL);
+ /* FPS support */
+ if (TRACE_ON(fps))
+ {
+ static long prev_time, frames;
+
+ DWORD time = GetTickCount();
+ 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;
+ }
+ }
+
return WINED3D_OK;
}
diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index e7fd2b3..3585ee3 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -51,7 +51,7 @@ inline static Display *get_display( HDC
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
-WINE_DECLARE_DEBUG_CHANNEL(d3d_fps);
+WINE_DECLARE_DEBUG_CHANNEL(fps);
/* IDirect3DSwapChain IUnknown parts follow: */
@@ -265,7 +265,7 @@ #endif
TRACE("glXSwapBuffers called, Starting new frame\n");
/* FPS support */
- if (TRACE_ON(d3d_fps))
+ if (TRACE_ON(fps))
{
static long prev_time, frames;
@@ -273,7 +273,7 @@ #endif
frames++;
/* every 1.5 seconds */
if (time - prev_time > 1500) {
- TRACE_(d3d_fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
+ TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
prev_time = time;
frames = 0;
}
diff --git a/dlls/winex11.drv/opengl.c b/dlls/winex11.drv/opengl.c
index 2fe6c9d..486f7db 100644
--- a/dlls/winex11.drv/opengl.c
+++ b/dlls/winex11.drv/opengl.c
@@ -30,6 +30,7 @@ #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
WINE_DECLARE_DEBUG_CHANNEL(opengl);
+WINE_DECLARE_DEBUG_CHANNEL(fps);
#if defined(HAVE_GL_GL_H) && defined(HAVE_GL_GLX_H)
@@ -593,6 +594,21 @@ BOOL X11DRV_SwapBuffers(X11DRV_PDEVICE *
pglXSwapBuffers(gdi_display, drawable);
wine_tsx11_unlock();
+ /* FPS support */
+ if (TRACE_ON(fps))
+ {
+ static long prev_time, frames;
+
+ DWORD time = GetTickCount();
+ 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;
+ }
+ }
+
return TRUE;
}
More information about the wine-cvs
mailing list