From 119a07e0550cf0e309804bc7e321a77203619a90 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 29 Apr 2024 22:43:31 -0400 Subject: [PATCH 1/2] vulkan: Add a profiler mark for pipeline cache save This is a rare event, and the file isn't small, so show it in profiles. --- gdk/gdkvulkancontext.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c index dca58c0646..a2a93ce861 100644 --- a/gdk/gdkvulkancontext.c +++ b/gdk/gdkvulkancontext.c @@ -1111,6 +1111,7 @@ gdk_display_load_pipeline_cache (GdkDisplay *display) static gboolean gdk_vulkan_save_pipeline_cache (GdkDisplay *display) { + G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME; GError *error = NULL; VkDevice device; VkPipelineCache cache; @@ -1167,7 +1168,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display) if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WRONG_ETAG)) { VkPipelineCache new_cache; - + GDK_DEBUG (VULKAN, "Pipeline cache file modified, merging into current"); new_cache = gdk_display_load_pipeline_cache (display); if (new_cache) @@ -1194,6 +1195,10 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display) return FALSE; } + gdk_profiler_end_markf (begin_time, + "Save Vulkan pipeline cache", "%s size %ld", + g_file_peek_path (file), size); + g_object_unref (file); g_free (data); g_free (display->vk_pipeline_cache_etag); From ef1ff8313f5e2e2a59fea007e54cf619504f5267 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 29 Apr 2024 20:49:37 -0400 Subject: [PATCH 2/2] gsk: Improve logging Log the shader compilation with sufficient detail. --- gsk/gpu/gskvulkandevice.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/gsk/gpu/gskvulkandevice.c b/gsk/gpu/gskvulkandevice.c index 24a5ffcdbe..6962e96603 100644 --- a/gsk/gpu/gskvulkandevice.c +++ b/gsk/gpu/gskvulkandevice.c @@ -951,6 +951,8 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self, const char *version_string; char *vertex_shader_name, *fragment_shader_name; G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME; + const char *clip_name[] = { "NONE", "RECT", "ROUNDED" }; + const char *blend_name[] = { "OVER", "ADD", "CLEAR" }; cache_key = (PipelineCacheKey) { .op_class = op_class, @@ -1128,8 +1130,25 @@ gsk_vulkan_device_get_vk_pipeline (GskVulkanDevice *self, &pipeline); gdk_profiler_end_markf (begin_time, - "Create Vulkan pipeline", "frag=%s vert=%s", - fragment_shader_name, vertex_shader_name); + "Create Vulkan pipeline", "%s version=%s variation=%u clip=%s blend=%s format=%u", + op_class->shader_name, + version_string + 1, + variation, + clip_name[clip], + blend_name[blend], + format); + + GSK_DEBUG (SHADERS, + "Create Vulkan pipeline (%s %s, %u/%s/%s/%u) for layout (%lu/%lu/%lu)", + op_class->shader_name, + version_string + 1, + variation, + clip_name[clip], + blend_name[blend], + format, + layout->setup.n_buffers, + layout->setup.n_samplers, + layout->setup.n_immutable_samplers); g_free (fragment_shader_name); g_free (vertex_shader_name);