[gtk+/wip/matthiasc/renderpasses] gsk: Add a profile counter for vulkan render passes



commit cf687b8d4dacf6046e59646834948d76f47cfc79
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Sep 27 17:58:02 2017 -0400

    gsk: Add a profile counter for vulkan render passes

 gsk/gskvulkanrender.c   |   14 ++++++++++++++
 gsk/gskvulkanrenderer.c |    5 +++++
 2 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskvulkanrender.c b/gsk/gskvulkanrender.c
index 5d7ba45..dd84e68 100644
--- a/gsk/gskvulkanrender.c
+++ b/gsk/gskvulkanrender.c
@@ -59,6 +59,8 @@ struct _GskVulkanRender
 
   GList *render_passes;
   GSList *cleanup_images;
+
+  GQuark render_pass_counter;
 };
 
 typedef struct {
@@ -258,6 +260,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;
 }
 
@@ -340,6 +346,10 @@ gsk_vulkan_render_add_node (GskVulkanRender *self,
 
   self->render_passes = g_list_prepend (self->render_passes, data);
 
+#ifdef G_ENABLE_DEBUG
+  gsk_profiler_counter_inc (gsk_renderer_get_profiler (self->renderer), self->render_pass_counter);
+#endif
+
   gsk_vulkan_render_pass_add (data->pass,
                               self,
                               &data->mvp,
@@ -455,6 +465,10 @@ gsk_vulkan_render_add_node_for_texture (GskVulkanRender     *self,
 
   self->render_passes = g_list_prepend (self->render_passes, data);
 
+#ifdef G_ENABLE_DEBUG
+  gsk_profiler_counter_inc (gsk_renderer_get_profiler (self->renderer), self->render_pass_counter);
+#endif
+
   gsk_vulkan_render_pass_add (data->pass,
                               self,
                               &data->mvp,
diff --git a/gsk/gskvulkanrenderer.c b/gsk/gskvulkanrenderer.c
index 6666880..7a422dc 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
 
@@ -246,6 +248,8 @@ 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
 
@@ -306,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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]