[gtk+] vulkan: Add a counter for intermediate textures



commit 4c291027533055dfe49731c45d1be7d16d3359ac
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Sep 30 10:39:04 2017 -0400

    vulkan: Add a counter for intermediate textures
    
    Count how many pixels of intermediate textures we create.
    If we can count it, we can optimize it.

 gsk/gskvulkanrenderer.c   |    4 ++++
 gsk/gskvulkanrenderpass.c |   11 +++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gsk/gskvulkanrenderer.c b/gsk/gskvulkanrenderer.c
index a0e79ab..fcc339f 100644
--- a/gsk/gskvulkanrenderer.c
+++ b/gsk/gskvulkanrenderer.c
@@ -28,6 +28,7 @@ typedef struct {
   GQuark frames;
   GQuark render_passes;
   GQuark fallback_pixels;
+  GQuark texture_pixels;
 } ProfileCounters;
 
 typedef struct {
@@ -174,6 +175,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.texture_pixels, 0);
   gsk_profiler_counter_set (profiler, self->profile_counters.render_passes, 0);
   gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
 #endif
@@ -221,6 +223,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.texture_pixels, 0);
   gsk_profiler_counter_set (profiler, self->profile_counters.render_passes, 0);
   gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time);
 #endif
@@ -284,6 +287,7 @@ gsk_vulkan_renderer_init (GskVulkanRenderer *self)
   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.texture_pixels = gsk_profiler_add_counter (profiler, "texture-pixels", "Texture 
pixels", TRUE);
 
   self->profile_timers.cpu_time = gsk_profiler_add_timer (profiler, "cpu-time", "CPU time", FALSE, TRUE);
   if (GSK_RENDER_MODE_CHECK (SYNC))
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 8c15cba..56fb8b2 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -124,6 +124,7 @@ struct _GskVulkanRenderPass
   GskVulkanBuffer *vertex_data;
 
   GQuark fallback_pixels;
+  GQuark texture_pixels;
 };
 
 GskVulkanRenderPass *
@@ -204,6 +205,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext  *context,
 
 #ifdef G_ENABLE_DEBUG
   self->fallback_pixels = g_quark_from_static_string ("fallback-pixels");
+  self->texture_pixels = g_quark_from_static_string ("texture-pixels");
 #endif
 
   return self;
@@ -694,6 +696,15 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass   *self,
                                                        ceil (view.size.width),
                                                        ceil (view.size.height));
 
+#ifdef G_ENABLE_DEBUG
+            {
+              GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render));
+              gsk_profiler_counter_add (profiler,
+                                        self->texture_pixels,
+                                        ceil (view.size.width) * ceil (view.size.height));
+            }
+#endif
+
             vkCreateSemaphore (gdk_vulkan_context_get_device (self->vulkan),
                                &(VkSemaphoreCreateInfo) {
                                    VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO,


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