From ed80907152a2e76a9878c4283899b79ab94d1971 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B3zef=20Kucia?= Date: Wed, 15 Aug 2018 10:43:23 +0200 Subject: [PATCH] winex11: Add simple fps counter for Vulkan. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The fps counter is implemented in winex11 because winevulkan thunks can be bypassed. Signed-off-by: Józef Kucia Signed-off-by: Alexandre Julliard --- dlls/winex11.drv/vulkan.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c index 5de855715f3..063281d3d54 100644 --- a/dlls/winex11.drv/vulkan.c +++ b/dlls/winex11.drv/vulkan.c @@ -41,6 +41,7 @@ #include "wine/vulkan_driver.h" WINE_DEFAULT_DEBUG_CHANNEL(vulkan); +WINE_DECLARE_DEBUG_CHANNEL(fps); #ifdef SONAME_LIBVULKAN @@ -513,8 +514,34 @@ static VkResult X11DRV_vkGetSwapchainImagesKHR(VkDevice device, static VkResult X11DRV_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *present_info) { + VkResult res; + TRACE("%p, %p\n", queue, present_info); - return pvkQueuePresentKHR(queue, present_info); + + res = pvkQueuePresentKHR(queue, present_info); + + if (TRACE_ON(fps)) + { + static unsigned long frames, frames_total; + static long prev_time, start_time; + DWORD time; + + time = GetTickCount(); + frames++; + frames_total++; + if (time - prev_time > 1500) + { + TRACE_(fps)("%p @ approx %.2ffps, total %.2ffps\n", + queue, 1000.0 * frames / (time - prev_time), + 1000.0 * frames_total / (time - start_time)); + prev_time = time; + frames = 0; + if (!start_time) + start_time = time; + } + } + + return res; } static const struct vulkan_funcs vulkan_funcs = -- 2.11.4.GIT