Add a common fps counter channel to ddraw, opengl and d3d.
This commit is contained in:
parent
bb64efaf77
commit
eb527c82e2
|
@ -34,6 +34,7 @@
|
|||
|
||||
/* 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 @@ IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
|
|||
/* 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ inline static Display *get_display( HDC 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 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||
|
||||
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 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
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 *physDev)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue