vulkan: Add profiling to Vulkan initialization

This helps understanding where our startup time is spent.
This commit is contained in:
Matthias Clasen 2024-04-29 18:27:05 -04:00
parent 744016e768
commit 6022fbcdf8

View File

@ -29,6 +29,7 @@
#include "gdkdmabuffourccprivate.h" #include "gdkdmabuffourccprivate.h"
#include "gdkdmabuftextureprivate.h" #include "gdkdmabuftextureprivate.h"
#include "gdkdisplayprivate.h" #include "gdkdisplayprivate.h"
#include "gdkprofilerprivate.h"
#include <glib/gi18n-lib.h> #include <glib/gi18n-lib.h>
#include <math.h> #include <math.h>
@ -1345,6 +1346,7 @@ static gboolean
gdk_display_create_vulkan_device (GdkDisplay *display, gdk_display_create_vulkan_device (GdkDisplay *display,
GError **error) GError **error)
{ {
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
uint32_t i, j, k; uint32_t i, j, k;
const char *override; const char *override;
gboolean list_devices; gboolean list_devices;
@ -1553,6 +1555,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
"Hum, what? This should not happen."))); "Hum, what? This should not happen.")));
} }
gdk_profiler_end_mark (start_time, "Create Vulkan device", NULL);
return TRUE; return TRUE;
} }
} }
@ -1591,6 +1595,7 @@ static gboolean
gdk_display_create_vulkan_instance (GdkDisplay *display, gdk_display_create_vulkan_instance (GdkDisplay *display,
GError **error) GError **error)
{ {
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
uint32_t i; uint32_t i;
GPtrArray *used_extensions; GPtrArray *used_extensions;
GPtrArray *used_layers; GPtrArray *used_layers;
@ -1752,6 +1757,8 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal); display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
gdk_profiler_end_mark (start_time, "Create Vulkan instance", NULL);
return TRUE; return TRUE;
} }