Module: wine Branch: master Commit: ed80907152a2e76a9878c4283899b79ab94d1971 URL: https://source.winehq.org/git/wine.git/?a=commit;h=ed80907152a2e76a9878c4283...
Author: Józef Kucia jkucia@codeweavers.com Date: Wed Aug 15 10:43:23 2018 +0200
winex11: Add simple fps counter for Vulkan.
The fps counter is implemented in winex11 because winevulkan thunks can be bypassed.
Signed-off-by: Józef Kucia jkucia@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 5de8557..063281d 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 =