1 | #ifndef __GSK_DEBUG_PRIVATE_H__ |
2 | #define __GSK_DEBUG_PRIVATE_H__ |
3 | |
4 | #include <glib.h> |
5 | |
6 | G_BEGIN_DECLS |
7 | |
8 | typedef enum { |
9 | GSK_DEBUG_RENDERER = 1 << 0, |
10 | GSK_DEBUG_CAIRO = 1 << 1, |
11 | GSK_DEBUG_OPENGL = 1 << 2, |
12 | GSK_DEBUG_SHADERS = 1 << 3, |
13 | GSK_DEBUG_SURFACE = 1 << 4, |
14 | GSK_DEBUG_VULKAN = 1 << 5, |
15 | GSK_DEBUG_FALLBACK = 1 << 6, |
16 | GSK_DEBUG_GLYPH_CACHE = 1 << 7, |
17 | /* flags below may affect behavior */ |
18 | GSK_DEBUG_GEOMETRY = 1 << 9, |
19 | GSK_DEBUG_FULL_REDRAW = 1 << 10, |
20 | GSK_DEBUG_SYNC = 1 << 11, |
21 | GSK_DEBUG_VULKAN_STAGING_IMAGE = 1 << 12, |
22 | GSK_DEBUG_VULKAN_STAGING_BUFFER = 1 << 13 |
23 | } GskDebugFlags; |
24 | |
25 | #define GSK_DEBUG_ANY ((1 << 13) - 1) |
26 | |
27 | GskDebugFlags gsk_get_debug_flags (void); |
28 | void gsk_set_debug_flags (GskDebugFlags flags); |
29 | |
30 | gboolean gsk_check_debug_flags (GskDebugFlags flags); |
31 | |
32 | #ifdef G_ENABLE_DEBUG |
33 | |
34 | #define GSK_DEBUG_CHECK(type) G_UNLIKELY (gsk_check_debug_flags (GSK_DEBUG_ ## type)) |
35 | #define GSK_RENDERER_DEBUG_CHECK(renderer,type) \ |
36 | G_UNLIKELY ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ ## type) != 0) |
37 | |
38 | #define GSK_NOTE(type,action) G_STMT_START { \ |
39 | if (GSK_DEBUG_CHECK (type)) { \ |
40 | action; \ |
41 | } } G_STMT_END |
42 | #define GSK_RENDERER_NOTE(renderer,type,action) G_STMT_START { \ |
43 | if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) { \ |
44 | action; \ |
45 | } } G_STMT_END |
46 | |
47 | #else |
48 | |
49 | #define GSK_DEBUG_CHECK(type) 0 |
50 | #define GSK_RENDERER_DEBUG_CHECK(renderer,type) 0 |
51 | #define GSK_NOTE(type,action) |
52 | #define GSK_RENDERER_NOTE(renderer,type,action) |
53 | |
54 | #endif |
55 | |
56 | G_END_DECLS |
57 | |
58 | #endif /* __GSK_DEBUG_PRIVATE_H__ */ |
59 | |