2016-03-17 13:48:19 +00:00
|
|
|
#include "gskdebugprivate.h"
|
|
|
|
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
static const GDebugKey gsk_debug_keys[] = {
|
|
|
|
{ "renderer", GSK_DEBUG_RENDERER },
|
|
|
|
{ "cairo", GSK_DEBUG_CAIRO },
|
|
|
|
{ "opengl", GSK_DEBUG_OPENGL },
|
2016-07-08 15:22:33 +00:00
|
|
|
{ "shaders", GSK_DEBUG_SHADERS },
|
2016-11-30 01:07:57 +00:00
|
|
|
{ "surface", GSK_DEBUG_SURFACE },
|
2016-12-23 23:52:07 +00:00
|
|
|
{ "vulkan", GSK_DEBUG_VULKAN },
|
2017-09-20 03:59:44 +00:00
|
|
|
{ "fallback", GSK_DEBUG_FALLBACK },
|
2018-01-14 20:11:33 +00:00
|
|
|
{ "glyphcache", GSK_DEBUG_GLYPH_CACHE },
|
|
|
|
{ "geometry", GSK_DEBUG_GEOMETRY },
|
|
|
|
{ "full-redraw", GSK_DEBUG_FULL_REDRAW},
|
|
|
|
{ "sync", GSK_DEBUG_SYNC },
|
|
|
|
{ "vulkan-staging-image", GSK_DEBUG_VULKAN_STAGING_IMAGE },
|
|
|
|
{ "vulkan-staging-buffer", GSK_DEBUG_VULKAN_STAGING_BUFFER }
|
2016-03-17 13:48:19 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2018-01-14 14:52:52 +00:00
|
|
|
static guint gsk_debug_flags;
|
|
|
|
|
|
|
|
static void
|
|
|
|
init_debug_flags (void)
|
2016-03-17 13:48:19 +00:00
|
|
|
{
|
|
|
|
#ifdef G_ENABLE_DEBUG
|
|
|
|
static volatile gsize gsk_debug_flags__set;
|
|
|
|
|
|
|
|
if (g_once_init_enter (&gsk_debug_flags__set))
|
|
|
|
{
|
|
|
|
const char *env = g_getenv ("GSK_DEBUG");
|
|
|
|
|
|
|
|
gsk_debug_flags = g_parse_debug_string (env,
|
|
|
|
(GDebugKey *) gsk_debug_keys,
|
|
|
|
G_N_ELEMENTS (gsk_debug_keys));
|
|
|
|
|
|
|
|
g_once_init_leave (&gsk_debug_flags__set, TRUE);
|
|
|
|
}
|
2018-01-14 14:52:52 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gsk_check_debug_flags (GskDebugFlags flags)
|
|
|
|
{
|
|
|
|
init_debug_flags ();
|
2016-03-17 13:48:19 +00:00
|
|
|
return (gsk_debug_flags & flags) != 0;
|
2018-01-14 14:52:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GskDebugFlags
|
|
|
|
gsk_get_debug_flags (void)
|
|
|
|
{
|
|
|
|
init_debug_flags ();
|
|
|
|
return gsk_debug_flags;
|
2016-03-17 13:48:19 +00:00
|
|
|
}
|
2018-01-14 21:06:25 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
gsk_set_debug_flags (GskDebugFlags flags)
|
|
|
|
{
|
|
|
|
init_debug_flags ();
|
|
|
|
gsk_debug_flags = flags;
|
|
|
|
}
|