gsk: Add a profile counter for vulkan render passes

This is interesting now that we have multiple render passes.
This commit is contained in:
Matthias Clasen 2017-09-28 08:29:14 -04:00
parent d61a715909
commit 4d8e7d71ca
2 changed files with 18 additions and 0 deletions

View File

@ -54,6 +54,8 @@ struct _GskVulkanRender
GList *render_passes; GList *render_passes;
GSList *cleanup_images; GSList *cleanup_images;
GQuark render_pass_counter;
}; };
static void static void
@ -204,6 +206,10 @@ gsk_vulkan_render_new (GskRenderer *renderer,
self->uploader = gsk_vulkan_uploader_new (self->vulkan, self->command_pool); 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; return self;
} }
@ -284,6 +290,10 @@ gsk_vulkan_render_add_node (GskVulkanRender *self,
self->render_passes = g_list_prepend (self->render_passes, pass); 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); 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); 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); gsk_vulkan_render_pass_add (pass, self, node);
} }

View File

@ -26,6 +26,7 @@ struct _GskVulkanTextureData {
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
typedef struct { typedef struct {
GQuark frames; GQuark frames;
GQuark render_passes;
GQuark fallback_pixels; GQuark fallback_pixels;
} ProfileCounters; } ProfileCounters;
@ -201,6 +202,7 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer,
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
profiler = gsk_renderer_get_profiler (renderer); 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.fallback_pixels, 0);
gsk_profiler_counter_set (profiler, self->profile_counters.render_passes, 0);
gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
#endif #endif
@ -247,6 +249,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer,
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
profiler = gsk_renderer_get_profiler (renderer); 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.fallback_pixels, 0);
gsk_profiler_counter_set (profiler, self->profile_counters.render_passes, 0);
gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
#endif #endif
@ -307,6 +310,7 @@ gsk_vulkan_renderer_init (GskVulkanRenderer *self)
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
self->profile_counters.frames = gsk_profiler_add_counter (profiler, "frames", "Frames", FALSE); 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_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); self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE);