diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 8ed2a0e110b..eb24b0f8634 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 281c17e74ab..eb9cd7f291a 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; }