1 | #include "gskdebugprivate.h" |
2 | #include "gdk/gdk-private.h" |
3 | |
4 | static const GdkDebugKey gsk_debug_keys[] = { |
5 | { "renderer" , GSK_DEBUG_RENDERER, "General renderer information" }, |
6 | { "cairo" , GSK_DEBUG_CAIRO, "Cairo renderer information" }, |
7 | { "opengl" , GSK_DEBUG_OPENGL, "OpenGL renderer information" }, |
8 | { "vulkan" , GSK_DEBUG_VULKAN, "Vulkan renderer information" }, |
9 | { "shaders" , GSK_DEBUG_SHADERS, "Information about shaders" }, |
10 | { "surface" , GSK_DEBUG_SURFACE, "Information about surfaces" }, |
11 | { "fallback" , GSK_DEBUG_FALLBACK, "Information about fallbacks" }, |
12 | { "glyphcache" , GSK_DEBUG_GLYPH_CACHE, "Information about glyph caching" }, |
13 | { "geometry" , GSK_DEBUG_GEOMETRY, "Show borders (when using cairo)" }, |
14 | { "full-redraw" , GSK_DEBUG_FULL_REDRAW, "Force full redraws" }, |
15 | { "sync" , GSK_DEBUG_SYNC, "Sync after each frame" }, |
16 | { "vulkan-staging-image" , GSK_DEBUG_VULKAN_STAGING_IMAGE, "Use a staging image for Vulkan texture upload" }, |
17 | { "vulkan-staging-buffer" , GSK_DEBUG_VULKAN_STAGING_BUFFER, "Use a staging buffer for Vulkan texture upload" } |
18 | }; |
19 | |
20 | static guint gsk_debug_flags; |
21 | |
22 | static void |
23 | init_debug_flags (void) |
24 | { |
25 | static gsize gsk_debug_flags__set; |
26 | |
27 | if (g_once_init_enter (&gsk_debug_flags__set)) |
28 | { |
29 | gsk_debug_flags = gdk_parse_debug_var (variable: "GSK_DEBUG" , |
30 | keys: gsk_debug_keys, |
31 | G_N_ELEMENTS (gsk_debug_keys)); |
32 | |
33 | g_once_init_leave (&gsk_debug_flags__set, TRUE); |
34 | } |
35 | } |
36 | |
37 | gboolean |
38 | gsk_check_debug_flags (GskDebugFlags flags) |
39 | { |
40 | init_debug_flags (); |
41 | return (gsk_debug_flags & flags) != 0; |
42 | } |
43 | |
44 | GskDebugFlags |
45 | gsk_get_debug_flags (void) |
46 | { |
47 | init_debug_flags (); |
48 | return gsk_debug_flags; |
49 | } |
50 | |
51 | void |
52 | gsk_set_debug_flags (GskDebugFlags flags) |
53 | { |
54 | init_debug_flags (); |
55 | gsk_debug_flags = flags; |
56 | } |
57 | |