From 218ecc07c10d451c80e96e664e0eaba6b5a1171c Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sat, 21 May 2016 12:13:46 +0200 Subject: [PATCH] Add perf counter to fence waits. Makes it easy to check if we're GPU bound or not. --- gfx/common/vulkan_common.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gfx/common/vulkan_common.c b/gfx/common/vulkan_common.c index 6a205c6638..c56bc8c778 100644 --- a/gfx/common/vulkan_common.c +++ b/gfx/common/vulkan_common.c @@ -27,6 +27,7 @@ #include #include "vulkan_common.h" +#include "../../performance_counters.h" vulkan_context_fp_t vkcfp; @@ -1672,7 +1673,13 @@ void vulkan_acquire_next_image(gfx_ctx_vulkan_data_t *vk) if (*next_fence != VK_NULL_HANDLE) { + static struct retro_perf_counter fence_wait = {0}; + rarch_perf_init(&fence_wait, "fence_wait"); + + retro_perf_start(&fence_wait); VKFUNC(vkWaitForFences)(vk->context.device, 1, next_fence, true, UINT64_MAX); + retro_perf_stop(&fence_wait); + VKFUNC(vkResetFences)(vk->context.device, 1, next_fence); } else @@ -1738,7 +1745,7 @@ bool vulkan_create_swapchain(gfx_ctx_vulkan_data_t *vk, else swapchain_size = surface_properties.currentExtent; - desired_swapchain_images = surface_properties.minImageCount + 1; + desired_swapchain_images = surface_properties.minImageCount + 1; /* Limit latency. */ if (desired_swapchain_images > 3)