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>
This commit is contained in:
Józef Kucia 2018-08-15 10:43:23 +02:00 committed by Alexandre Julliard
parent 4b90a46e36
commit ed80907152
1 changed files with 28 additions and 1 deletions

View File

@ -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 =