[PATCH] winemac: Add +fps support for Vulkan.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] winemac: Add +fps support for Vulkan.

Stefan Dösinger-2
Signed-off-by: Stefan Dösinger <[hidden email]>

---

I guess we could also move this to winevulkan by moving the
vkQueuePresentKHR thunk out of the autogenerated .c file. I am not 100%
sure if that works in all cases though, like using a different loader.
---
 dlls/winemac.drv/vulkan.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/dlls/winemac.drv/vulkan.c b/dlls/winemac.drv/vulkan.c
index d49c9a1ab2..ea785c992d 100644
--- a/dlls/winemac.drv/vulkan.c
+++ b/dlls/winemac.drv/vulkan.c
@@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(vulkan);
 
 #ifdef SONAME_LIBMOLTENVK
 
+WINE_DECLARE_DEBUG_CHANNEL(fps);
+
 typedef VkFlags VkMacOSSurfaceCreateFlagsMVK;
 #define VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK 1000123000
 
@@ -463,7 +465,30 @@ static VkResult macdrv_vkGetSwapchainImagesKHR(VkDevice device,
 static VkResult macdrv_vkQueuePresentKHR(VkQueue queue, const VkPresentInfoKHR *present_info)
 {
     TRACE("%p, %p\n", queue, present_info);
-    return pvkQueuePresentKHR(queue, present_info);
+    VkResult 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.20.1 (Apple Git-117)



Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] winemac: Add +fps support for Vulkan.

Ken Thomases
Signed-off-by: Ken Thomases <[hidden email]>