4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2007,2008,2009 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
24 #ifndef __COGL_DEBUG_H__
25 #define __COGL_DEBUG_H__
27 #include "cogl-profile.h"
28 #include "cogl-flags.h"
29 #include "cogl-util.h"
40 COGL_DEBUG_RECTANGLES,
42 COGL_DEBUG_BLEND_STRINGS,
43 COGL_DEBUG_DISABLE_BATCHING,
44 COGL_DEBUG_DISABLE_VBOS,
45 COGL_DEBUG_DISABLE_PBOS,
48 COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM,
51 COGL_DEBUG_DUMP_ATLAS_IMAGE,
52 COGL_DEBUG_DISABLE_ATLAS,
53 COGL_DEBUG_DISABLE_SHARED_ATLAS,
55 COGL_DEBUG_DISABLE_TEXTURING,
56 COGL_DEBUG_DISABLE_ARBFP,
57 COGL_DEBUG_DISABLE_FIXED,
58 COGL_DEBUG_DISABLE_GLSL,
59 COGL_DEBUG_SHOW_SOURCE,
60 COGL_DEBUG_DISABLE_BLENDING,
61 COGL_DEBUG_TEXTURE_PIXMAP,
63 COGL_DEBUG_DISABLE_NPOT_TEXTURES,
65 COGL_DEBUG_DISABLE_SOFTWARE_CLIP,
66 COGL_DEBUG_DISABLE_PROGRAM_CACHES,
67 COGL_DEBUG_DISABLE_FAST_READ_PIXEL,
74 #ifdef COGL_ENABLE_DEBUG
76 #define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
78 /* _cogl_debug_flags currently needs to exported outside of the shared
79 library for cogl-pango. The special COGL_EXPORT macro is needed to
80 get this to work when building with MSVC */
81 COGL_EXPORT extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
83 extern GHashTable *_cogl_debug_instances;
85 #define COGL_DEBUG_ENABLED(flag) \
86 COGL_FLAGS_GET (_cogl_debug_flags, flag)
88 #define COGL_DEBUG_SET_FLAG(flag) \
89 COGL_FLAGS_SET (_cogl_debug_flags, flag, TRUE)
91 #define COGL_DEBUG_CLEAR_FLAG(flag) \
92 COGL_FLAGS_SET (_cogl_debug_flags, flag, FALSE)
95 #define COGL_NOTE(type,x,a...) G_STMT_START { \
96 if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
97 _cogl_profile_trace_message ("[" #type "] " G_STRLOC " & " x, ##a); \
101 #define COGL_NOTE(type,...) G_STMT_START { \
102 if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
103 char *_fmt = g_strdup_printf (__VA_ARGS__); \
104 _cogl_profile_trace_message ("[" #type "] " G_STRLOC " & %s", _fmt);\
108 #endif /* __GNUC__ */
110 #else /* !COGL_ENABLE_DEBUG */
112 #define COGL_NOTE(type,...) G_STMT_START {} G_STMT_END
114 #define COGL_DEBUG_ENABLED(flag) FALSE
116 #define COGL_DEBUG_SET_FLAG(flag) \
117 G_STMT_START { } G_STMT_END
119 #define COGL_DEBUG_CLEAR_FLAG(flag) \
120 G_STMT_START { } G_STMT_END
122 #endif /* COGL_ENABLE_DEBUG */
125 _cogl_debug_check_environment (void);
128 _cogl_parse_debug_string (const char *value,
130 gboolean ignore_help);
134 #endif /* __COGL_DEBUG_H__ */