From 4d8e7d71cafd340021d6a965af3bf72e2732bcba Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 28 Sep 2017 08:29:14 -0400 Subject: [PATCH] gsk: Add a profile counter for vulkan render passes This is interesting now that we have multiple render passes. --- gsk/gskvulkanrender.c | 14 ++++++++++++++ gsk/gskvulkanrenderer.c | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c index 06b593c422..cddc331645 100644 --- a/gsk/gskvulkanrender.c +++ b/gsk/gskvulkanrender.c @@ -54,6 +54,8 @@ struct _GskVulkanRender GList *render_passes; GSList *cleanup_images; + + GQuark render_pass_counter; }; static void @@ -204,6 +206,10 @@ gsk_vulkan_render_new (GskRenderer *renderer, self->uploader = gsk_vulkan_uploader_new (self->vulkan, self->command_pool); +#ifdef G_ENABLE_DEBUG + self->render_pass_counter = g_quark_from_static_string ("render-passes"); +#endif + return self; } @@ -284,6 +290,10 @@ gsk_vulkan_render_add_node (GskVulkanRender *self, self->render_passes = g_list_prepend (self->render_passes, pass); +#ifdef G_ENABLE_DEBUG + gsk_profiler_counter_inc (gsk_renderer_get_profiler (self->renderer), self->render_pass_counter); +#endif + gsk_vulkan_render_pass_add (pass, self, node); } @@ -314,6 +324,10 @@ gsk_vulkan_render_add_node_for_texture (GskVulkanRender *self, self->render_passes = g_list_prepend (self->render_passes, pass); +#ifdef G_ENABLE_DEBUG + gsk_profiler_counter_inc (gsk_renderer_get_profiler (self->renderer), self->render_pass_counter); +#endif + gsk_vulkan_render_pass_add (pass, self, node); } diff --git a/gsk/gskvulkanrenderer.c b/gsk/gskvulkanrenderer.c index 661128cc09..7a422dc66d 100644 --- a/gsk/gskvulkanrenderer.c +++ b/gsk/gskvulkanrenderer.c @@ -26,6 +26,7 @@ struct _GskVulkanTextureData { #ifdef G_ENABLE_DEBUG typedef struct { GQuark frames; + GQuark render_passes; GQuark fallback_pixels; } ProfileCounters; @@ -201,6 +202,7 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer, #ifdef G_ENABLE_DEBUG profiler = gsk_renderer_get_profiler (renderer); gsk_profiler_counter_set (profiler, self->profile_counters.fallback_pixels, 0); + gsk_profiler_counter_set (profiler, self->profile_counters.render_passes, 0); gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); #endif @@ -247,6 +249,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer, #ifdef G_ENABLE_DEBUG profiler = gsk_renderer_get_profiler (renderer); gsk_profiler_counter_set (profiler, self->profile_counters.fallback_pixels, 0); + gsk_profiler_counter_set (profiler, self->profile_counters.render_passes, 0); gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); #endif @@ -307,6 +310,7 @@ gsk_vulkan_renderer_init (GskVulkanRenderer *self) #ifdef G_ENABLE_DEBUG self->profile_counters.frames = gsk_profiler_add_counter (profiler, "frames", "Frames", FALSE); + self->profile_counters.render_passes = gsk_profiler_add_counter (profiler, "render-passes", "Render passes", FALSE); self->profile_counters.fallback_pixels = gsk_profiler_add_counter (profiler, "fallback-pixels", "Fallback pixels", TRUE); self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE);