gtk/gsk/gskdebugprivate.h
Benjamin Otte 310ab7b531 Remove G_ENABLE_DEBUG around debug checks
It started out as busywork, but it does many separate things. If I could
start over, I'd take them apart into multiple commits:

1. Remove G_ENABLE_DEBUG around GDK_DEBUG_*() calls
   This is not needed at all, the calls themselves take care of it.

2. Remove G_ENABLE_DEBUG around profiling code
   This now enables profiling support in release builds.

3. Stop poking _gdk_debug_flags and use GDK_DEBUG_CHECK()
   This was old code that was never updated.

4. Make !G_ENABLE_DEBUG turn off GDK_DEBUG_CHECK()
   The code used to
     #define GDK_DEBUG_CHECK(...) false
     #define GDK_DEBUG(...)
   which would compile away all the code inside those macros. This
   means a lot of variable definitions and debug utility functions
   would suddenly no longer be used and cause compiler errors.
2023-11-05 11:16:23 +01:00

50 lines
1.8 KiB
C

#pragma once
#include <glib.h>
#include "gdk/gdkdebugprivate.h"
G_BEGIN_DECLS
typedef enum {
GSK_DEBUG_RENDERER = 1 << 0,
GSK_DEBUG_CAIRO = 1 << 1,
GSK_DEBUG_OPENGL = 1 << 2,
GSK_DEBUG_SHADERS = 1 << 3,
GSK_DEBUG_SURFACE = 1 << 4,
GSK_DEBUG_VULKAN = 1 << 5,
GSK_DEBUG_FALLBACK = 1 << 6,
GSK_DEBUG_GLYPH_CACHE = 1 << 7,
GSK_DEBUG_VERBOSE = 1 << 8,
/* flags below may affect behavior */
GSK_DEBUG_GEOMETRY = 1 << 9,
GSK_DEBUG_FULL_REDRAW = 1 << 10,
GSK_DEBUG_SYNC = 1 << 11,
GSK_DEBUG_STAGING = 1 << 12
} GskDebugFlags;
#define GSK_DEBUG_ANY ((1 << 13) - 1)
GskDebugFlags gsk_get_debug_flags (void);
void gsk_set_debug_flags (GskDebugFlags flags);
gboolean gsk_check_debug_flags (GskDebugFlags flags);
#define GSK_DEBUG_CHECK(type) G_UNLIKELY (gsk_check_debug_flags (GSK_DEBUG_ ## type))
#define GSK_RENDERER_DEBUG_CHECK(renderer,type) \
G_UNLIKELY ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ ## type) != 0)
#define GSK_RENDERER_DEBUG(renderer,type,...) \
G_STMT_START { \
if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) \
gdk_debug_message (__VA_ARGS__); \
} G_STMT_END
#define GSK_DEBUG(type,...) \
G_STMT_START { \
if (GSK_DEBUG_CHECK (type)) \
gdk_debug_message (__VA_ARGS__); \
} G_STMT_END
G_END_DECLS