vulkan: Make quarks global variables
authorBenjamin Otte <otte@redhat.com>
Tue, 9 May 2023 20:30:49 +0000 (22:30 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 4 Jun 2023 17:42:01 +0000 (19:42 +0200)
I don't want to ensure there's a RenderPass available everywhere and
recreate the quarks in each, I just want to use them.

gsk/vulkan/gskvulkanrenderpass.c

index ab2713c6990d67f09e279885045274dc2d1342f9..0710222dc44c88baf526a51f5cb3e52216bac7f4 100644 (file)
@@ -125,11 +125,13 @@ struct _GskVulkanRenderPass
   VkSemaphore signal_semaphore;
   GArray *wait_semaphores;
   GskVulkanBuffer *vertex_data;
-
-  GQuark fallback_pixels;
-  GQuark texture_pixels;
 };
 
+#ifdef G_ENABLE_DEBUG
+static GQuark fallback_pixels_quark;
+static GQuark texture_pixels_quark;
+#endif
+
 GskVulkanRenderPass *
 gsk_vulkan_render_pass_new (GdkVulkanContext  *context,
                             GskVulkanImage    *target,
@@ -209,8 +211,11 @@ gsk_vulkan_render_pass_new (GdkVulkanContext  *context,
   self->vertex_data = NULL;
 
 #ifdef G_ENABLE_DEBUG
-  self->fallback_pixels = g_quark_from_static_string ("fallback-pixels");
-  self->texture_pixels = g_quark_from_static_string ("texture-pixels");
+  if (fallback_pixels_quark == 0)
+    {
+      fallback_pixels_quark = g_quark_from_static_string ("fallback-pixels");
+      texture_pixels_quark = g_quark_from_static_string ("texture-pixels");
+    }
 #endif
 
   return self;
@@ -1033,7 +1038,7 @@ gsk_vulkan_render_pass_render_offscreen (GdkVulkanContext      *vulkan,
   {
     GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render));
     gsk_profiler_counter_add (profiler,
-                              g_quark_from_static_string ("texture-pixels"),
+                              texture_pixels_quark,
                               view.size.width * view.size.height);
   }
 #endif
@@ -1141,7 +1146,7 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass   *self,
   {
     GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render));
     gsk_profiler_counter_add (profiler,
-                              self->fallback_pixels,
+                              fallback_pixels_quark,
                               ceil (node->bounds.size.width) * ceil (node->bounds.size.height));
   }
 #endif
@@ -1195,7 +1200,7 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass  *self,
   {
     GskProfiler *profiler = gsk_renderer_get_profiler (gsk_vulkan_render_get_renderer (render));
     gsk_profiler_counter_add (profiler,
-                              self->fallback_pixels,
+                              fallback_pixels_quark,
                               ceil (node->bounds.size.width) * ceil (node->bounds.size.height));
   }
 #endif