/* Don't put textures in the atlas if the user has explicitly
requested to disable it */
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_ATLAS))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ATLAS)))
return COGL_INVALID_HANDLE;
/* We can't put the texture in the atlas if there are any special
cogl_push_source (wire_pipeline);
/* temporarily disable the wireframe to avoid recursion! */
- cogl_debug_flags &= ~COGL_DEBUG_WIREFRAME;
+ COGL_DEBUG_CLEAR_FLAG (COGL_DEBUG_WIREFRAME);
_cogl_draw_attributes_array (COGL_VERTICES_MODE_LINES,
0,
n_line_vertices,
COGL_DRAW_SKIP_FRAMEBUFFER_FLUSH |
COGL_DRAW_SKIP_LEGACY_STATE);
- cogl_debug_flags |= COGL_DEBUG_WIREFRAME;
+ COGL_DEBUG_SET_FLAG (COGL_DEBUG_WIREFRAME);
cogl_pop_source ();
disable_gl_state (attributes, source);
#ifdef COGL_ENABLE_DEBUG
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_WIREFRAME))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
draw_wireframe (mode, first_vertex, n_vertices, attributes, NULL);
#endif
}
disable_gl_state (attributes, source);
#ifdef COGL_ENABLE_DEBUG
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_WIREFRAME))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_WIREFRAME)))
draw_wireframe (mode, first_vertex, n_vertices, attributes, indices);
#endif
}
"Invalid texture combine string: %s",
error_string);
- if (cogl_debug_flags & COGL_DEBUG_BLEND_STRINGS)
+ if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
g_debug ("Invalid texture combine string: %s",
error_string);
"blend" : "texture combine",
error_string);
- if (cogl_debug_flags & COGL_DEBUG_BLEND_STRINGS)
+ if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
g_debug ("Invalid %s string: %s",
context == COGL_BLEND_STRING_CONTEXT_BLENDING ?
offset,
error_string);
- if (cogl_debug_flags & COGL_DEBUG_BLEND_STRINGS)
+ if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
g_debug ("Syntax error for argument %d at offset %d: %s",
current_arg, offset, error_string);
int remaining_argc = 0;
#if 0
- cogl_debug_flags |= COGL_DEBUG_BLEND_STRINGS;
+ COGL_DEBUG_SET_FLAG (COGL_DEBUG_BLEND_STRINGS);
#endif
- if (cogl_debug_flags & COGL_DEBUG_BLEND_STRINGS)
+ if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
COGL_NOTE (BLEND_STRINGS, "Compiling %s string:\n%s\n",
context == COGL_BLEND_STRING_CONTEXT_BLENDING ?
finished:
- if (cogl_debug_flags & COGL_DEBUG_BLEND_STRINGS)
+ if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
if (current_statement > 0)
print_statement (0, &statements[0]);
offset,
error_string);
- if (cogl_debug_flags & COGL_DEBUG_BLEND_STRINGS)
+ if (COGL_DEBUG_ENABLED (COGL_DEBUG_BLEND_STRINGS))
{
g_debug ("Syntax error at offset %d: %s",
offset, error_string);
static void
_cogl_init_feature_overrides (CoglContext *ctx)
{
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_VBOS))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_VBOS)))
ctx->feature_flags &= ~COGL_FEATURE_VBOS;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_PBOS))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PBOS)))
ctx->feature_flags &= ~COGL_FEATURE_PBOS;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_ARBFP))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_ARBFP)))
ctx->feature_flags &= ~COGL_FEATURE_SHADERS_ARBFP;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_GLSL))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_GLSL)))
ctx->feature_flags &= ~COGL_FEATURE_SHADERS_GLSL;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_NPOT_TEXTURES))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_NPOT_TEXTURES)))
ctx->feature_flags &= ~(COGL_FEATURE_TEXTURE_NPOT |
COGL_FEATURE_TEXTURE_NPOT_BASIC |
COGL_FEATURE_TEXTURE_NPOT_MIPMAP |
#endif /* COGL_ENABLE_DEBUG */
-unsigned int cogl_debug_flags = 0;
+unsigned int _cogl_debug_flags[COGL_DEBUG_N_INTS];
#ifdef COGL_ENABLE_DEBUG
-static unsigned int
+
+static void
+_cogl_parse_debug_string_for_keys (const char *value,
+ gboolean enable,
+ const GDebugKey *keys,
+ unsigned int nkeys)
+{
+ int int_num, key_num;
+
+ /* g_parse_debug_string expects the value field in GDebugKey to be a
+ mask in a guint but we may have multiple guints so we need to
+ build a separate array for each possible guint */
+
+ for (int_num = 0; int_num < COGL_DEBUG_N_INTS; int_num++)
+ {
+ GDebugKey keys_for_int[sizeof (unsigned int) * 8];
+ unsigned int mask_for_int;
+ int nkeys_for_int = 0;
+
+ for (key_num = 0; key_num < nkeys; key_num++)
+ if (COGL_DEBUG_GET_FLAG_INDEX (keys[key_num].value) == int_num)
+ {
+ keys_for_int[nkeys_for_int] = keys[key_num];
+ keys_for_int[nkeys_for_int].value =
+ COGL_DEBUG_GET_FLAG_MASK (keys[key_num].value);
+ nkeys_for_int++;
+ }
+
+ if (nkeys_for_int > 0)
+ {
+ mask_for_int = g_parse_debug_string (value,
+ keys_for_int,
+ nkeys_for_int);
+ if (enable)
+ _cogl_debug_flags[int_num] |= mask_for_int;
+ else
+ _cogl_debug_flags[int_num] &= ~mask_for_int;
+ }
+ }
+}
+
+static void
_cogl_parse_debug_string (const char *value,
+ gboolean enable,
gboolean ignore_help)
{
- unsigned int flags = 0;
-
if (ignore_help && strcmp (value, "help") == 0)
- return 0;
+ return;
/* We don't want to let g_parse_debug_string handle "all" because
* literally enabling all the debug options wouldn't be useful to
{
int i;
for (i = 0; i < n_cogl_log_debug_keys; i++)
- flags |= cogl_log_debug_keys[i].value;
+ if (enable)
+ COGL_DEBUG_SET_FLAG (cogl_log_debug_keys[i].value);
+ else
+ COGL_DEBUG_CLEAR_FLAG (cogl_log_debug_keys[i].value);
}
else if (strcmp (value, "help") == 0)
{
}
else
{
- flags |=
- g_parse_debug_string (value,
- cogl_log_debug_keys,
- n_cogl_log_debug_keys);
- flags |=
- g_parse_debug_string (value,
- cogl_behavioural_debug_keys,
- n_cogl_behavioural_debug_keys);
+ _cogl_parse_debug_string_for_keys (value,
+ enable,
+ cogl_log_debug_keys,
+ n_cogl_log_debug_keys);
+ _cogl_parse_debug_string_for_keys (value,
+ enable,
+ cogl_behavioural_debug_keys,
+ n_cogl_behavioural_debug_keys);
}
-
- return flags;
}
static gboolean
const char *value,
gpointer user_data)
{
- cogl_debug_flags |= _cogl_parse_debug_string (value, FALSE);
+ _cogl_parse_debug_string (value,
+ TRUE /* enable the flags */,
+ FALSE /* don't ignore help */);
return TRUE;
}
const char *value,
gpointer user_data)
{
- cogl_debug_flags &= ~_cogl_parse_debug_string (value, TRUE);
+ _cogl_parse_debug_string (value,
+ FALSE, /* disable the flags */
+ TRUE /* ignore help */);
return TRUE;
}
#endif /* COGL_ENABLE_DEBUG */
env_string = g_getenv ("COGL_DEBUG");
if (env_string != NULL)
{
- cogl_debug_flags |= _cogl_parse_debug_string (env_string, FALSE);
+ _cogl_parse_debug_string (env_string,
+ TRUE /* enable the flags */,
+ FALSE /* don't ignore help */);
env_string = NULL;
}
#endif /* COGL_ENABLE_DEBUG */
G_BEGIN_DECLS
typedef enum {
- COGL_DEBUG_SLICING = 1 << 0,
- COGL_DEBUG_OFFSCREEN = 1 << 1,
- COGL_DEBUG_DRAW = 1 << 2,
- COGL_DEBUG_PANGO = 1 << 3,
- COGL_DEBUG_RECTANGLES = 1 << 4,
- COGL_DEBUG_HANDLE = 1 << 5,
- COGL_DEBUG_BLEND_STRINGS = 1 << 6,
- COGL_DEBUG_DISABLE_BATCHING = 1 << 7,
- COGL_DEBUG_DISABLE_VBOS = 1 << 8,
- COGL_DEBUG_DISABLE_PBOS = 1 << 9,
- COGL_DEBUG_JOURNAL = 1 << 10,
- COGL_DEBUG_BATCHING = 1 << 11,
- COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM = 1 << 12,
- COGL_DEBUG_MATRICES = 1 << 13,
- COGL_DEBUG_ATLAS = 1 << 14,
- COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 15,
- COGL_DEBUG_DISABLE_ATLAS = 1 << 16,
- COGL_DEBUG_OPENGL = 1 << 17,
- COGL_DEBUG_DISABLE_TEXTURING = 1 << 18,
- COGL_DEBUG_DISABLE_ARBFP = 1 << 19,
- COGL_DEBUG_DISABLE_FIXED = 1 << 20,
- COGL_DEBUG_DISABLE_GLSL = 1 << 21,
- COGL_DEBUG_SHOW_SOURCE = 1 << 22,
- COGL_DEBUG_DISABLE_BLENDING = 1 << 23,
- COGL_DEBUG_TEXTURE_PIXMAP = 1 << 24,
- COGL_DEBUG_BITMAP = 1 << 25,
- COGL_DEBUG_DISABLE_NPOT_TEXTURES = 1 << 26,
- COGL_DEBUG_WIREFRAME = 1 << 27,
- COGL_DEBUG_DISABLE_SOFTWARE_CLIP = 1 << 28,
- COGL_DEBUG_DISABLE_PROGRAM_CACHES = 1 << 29,
- COGL_DEBUG_DISABLE_FAST_READ_PIXEL = 1 << 30
+ COGL_DEBUG_SLICING,
+ COGL_DEBUG_OFFSCREEN,
+ COGL_DEBUG_DRAW,
+ COGL_DEBUG_PANGO,
+ COGL_DEBUG_RECTANGLES,
+ COGL_DEBUG_HANDLE,
+ COGL_DEBUG_BLEND_STRINGS,
+ COGL_DEBUG_DISABLE_BATCHING,
+ COGL_DEBUG_DISABLE_VBOS,
+ COGL_DEBUG_DISABLE_PBOS,
+ COGL_DEBUG_JOURNAL,
+ COGL_DEBUG_BATCHING,
+ COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM,
+ COGL_DEBUG_MATRICES,
+ COGL_DEBUG_ATLAS,
+ COGL_DEBUG_DUMP_ATLAS_IMAGE,
+ COGL_DEBUG_DISABLE_ATLAS,
+ COGL_DEBUG_OPENGL,
+ COGL_DEBUG_DISABLE_TEXTURING,
+ COGL_DEBUG_DISABLE_ARBFP,
+ COGL_DEBUG_DISABLE_FIXED,
+ COGL_DEBUG_DISABLE_GLSL,
+ COGL_DEBUG_SHOW_SOURCE,
+ COGL_DEBUG_DISABLE_BLENDING,
+ COGL_DEBUG_TEXTURE_PIXMAP,
+ COGL_DEBUG_BITMAP,
+ COGL_DEBUG_DISABLE_NPOT_TEXTURES,
+ COGL_DEBUG_WIREFRAME,
+ COGL_DEBUG_DISABLE_SOFTWARE_CLIP,
+ COGL_DEBUG_DISABLE_PROGRAM_CACHES,
+ COGL_DEBUG_DISABLE_FAST_READ_PIXEL,
+
+ COGL_DEBUG_N_FLAGS
} CoglDebugFlags;
#ifdef COGL_ENABLE_DEBUG
+#define COGL_DEBUG_N_INTS ((COGL_DEBUG_N_FLAGS + \
+ (sizeof (unsigned int) * 8 - 1)) \
+ / (sizeof (unsigned int) * 8))
+
+/* It would probably make sense to use unsigned long here instead
+ because then on 64-bit systems where it can handle 64-bits just as
+ easily and it can test more bits. However GDebugKey uses a guint
+ for the mask and we need to fit the masks into this */
+extern unsigned int _cogl_debug_flags[COGL_DEBUG_N_INTS];
+
+#define COGL_DEBUG_GET_FLAG_INDEX(flag) \
+ ((flag) / (sizeof (unsigned int) * 8))
+#define COGL_DEBUG_GET_FLAG_MASK(flag) \
+ (1U << ((unsigned int) (flag) & (sizeof (unsigned int) * 8 - 1)))
+
+#define COGL_DEBUG_ENABLED(flag) \
+ (!!(_cogl_debug_flags[COGL_DEBUG_GET_FLAG_INDEX (flag)] & \
+ COGL_DEBUG_GET_FLAG_MASK (flag)))
+
+#define COGL_DEBUG_SET_FLAG(flag) \
+ (_cogl_debug_flags[COGL_DEBUG_GET_FLAG_INDEX (flag)] |= \
+ COGL_DEBUG_GET_FLAG_MASK (flag))
+
+#define COGL_DEBUG_CLEAR_FLAG(flag) \
+ (_cogl_debug_flags[COGL_DEBUG_GET_FLAG_INDEX (flag)] &= \
+ ~COGL_DEBUG_GET_FLAG_MASK (flag))
+
#ifdef __GNUC__
#define COGL_NOTE(type,x,a...) G_STMT_START { \
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type))) { \
_cogl_profile_trace_message ("[" #type "] " G_STRLOC " & " x, ##a); \
} } G_STMT_END
#else
#define COGL_NOTE(type,...) G_STMT_START { \
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_##type)) { \
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_##type)) { \
char *_fmt = g_strdup_printf (__VA_ARGS__); \
_cogl_profile_trace_message ("[" #type "] " G_STRLOC " & %s", _fmt);\
g_free (_fmt); \
#define COGL_NOTE(type,...) G_STMT_START {} G_STMT_END
-#endif /* COGL_ENABLE_DEBUG */
+#define COGL_DEBUG_ENABLED(flag) FALSE
+
+#define COGL_DEBUG_SET_FLAG(flag) \
+ G_STMT_START { } G_STMT_END
-extern unsigned int cogl_debug_flags;
+#define COGL_DEBUG_CLEAR_FLAG(flag) \
+ G_STMT_START { } G_STMT_END
+
+#endif /* COGL_ENABLE_DEBUG */
G_END_DECLS
* batches from the journal. It is reset here to increase the
* chances of getting the same colours for each frame during an
* animation */
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_RECTANGLES) &&
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)) &&
buffers & COGL_BUFFER_BIT_COLOR)
{
_COGL_GET_CONTEXT (ctxt, NO_RETVAL);
{
gboolean found_intersection;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_FAST_READ_PIXEL))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FAST_READ_PIXEL)))
return FALSE;
if (source != COGL_READ_PIXELS_COLOR_BUFFER)
*
* So for a given number of layers this gets the stride in 32bit words:
*/
-#define SW_TRANSFORM (!(cogl_debug_flags & \
- COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
+#define SW_TRANSFORM (!(COGL_DEBUG_ENABLED \
+ (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
#define POS_STRIDE (SW_TRANSFORM ? 3 : 2) /* number of 32bit words */
#define N_POS_COMPONENTS POS_STRIDE
#define COLOR_STRIDE 1 /* number of 32bit words */
guint8 *c = data + (POS_STRIDE * 4) + (i * stride * 4);
int j;
- if (G_UNLIKELY (cogl_debug_flags &
- COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED
+ (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
g_print ("v%d: x = %f, y = %f, rgba=0x%02X%02X%02X%02X",
i, v[0], v[1], c[0], c[1], c[2], c[3]);
else
COGL_TIMER_START (_cogl_uprof_context, time_flush_modelview_and_entries);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
g_print ("BATCHING: modelview batch len = %d\n", batch_len);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
{
_cogl_matrix_stack_set (state->modelview_stack,
&batch_start->model_view);
* issues, visually seeing what is batched and debugging blending
* issues, plus it looks quite cool.
*/
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_RECTANGLES))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_RECTANGLES)))
{
static CoglPipeline *outline = NULL;
guint8 color_intensity;
COGL_TIMER_START (_cogl_uprof_context, time_flush_pipeline_entries);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
g_print ("BATCHING: pipeline batch len = %d\n", batch_len);
state->source = batch_start->pipeline;
/* If we haven't transformed the quads in software then we need to also break
* up batches according to changes in the modelview matrix... */
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
{
batch_and_call (batch_start,
batch_len,
COGL_TIMER_START (_cogl_uprof_context,
time_flush_vbo_texcoord_pipeline_entries);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
g_print ("BATCHING: vbo offset batch len = %d\n", batch_len);
/* XXX NB:
*/
state->current_vertex = 0;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
{
guint8 *verts;
/* progress forward through the VBO containing all our vertices */
state->array_offset += (stride * 4 * batch_len);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
g_print ("new vbo offset = %lu\n", (unsigned long)state->array_offset);
COGL_TIMER_STOP (_cogl_uprof_context,
COGL_TIMER_START (_cogl_uprof_context,
time_flush_clip_stack_pipeline_entries);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
g_print ("BATCHING: clip stack batch len = %d\n", batch_len);
_cogl_clip_stack_flush (batch_start->clip_stack);
* no further model transform is applied by loading the identity
* matrix here. We need to do this after flushing the clip stack
* because the clip stack flushing code can modify the matrix */
- if (G_LIKELY (!(cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
+ if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))))
{
_cogl_matrix_stack_load_identity (state->modelview_stack);
_cogl_matrix_stack_flush_to_gl (state->modelview_stack,
memcpy (vout + vb_stride * i + POS_STRIDE, vin, 4);
vin++;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM)))
{
vout[vb_stride * 0] = vin[0];
vout[vb_stride * 0 + 1] = vin[1];
cogl_push_framebuffer (framebuffer);
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_BATCHING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_BATCHING)))
g_print ("BATCHING: journal len = %d\n", journal->entries->len);
/* NB: the journal deals with flushing the modelview stack and clip
state.modelview_stack = modelview_stack;
state.projection_stack = _cogl_framebuffer_get_projection_stack (framebuffer);
- if (G_UNLIKELY ((cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_CLIP) == 0))
+ if (G_UNLIKELY ((COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_SOFTWARE_CLIP)) == 0))
{
/* We do an initial walk of the journal to analyse the clip stack
batches to see if we can do software clipping. We do this as a
memcpy (t + stride, tex_coords + i * 4 + 2, sizeof (float) * 2);
}
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_JOURNAL))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_JOURNAL)))
{
g_print ("Logged new quad:\n");
v = &g_array_index (journal->vertices, float, next_vert);
* think a journal->framebuffer reference would seem nicer here but
* the reason we don't have that currently is that it would
* introduce a circular reference. */
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_BATCHING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BATCHING)))
_cogl_framebuffer_flush_journal (_cogl_get_framebuffer ());
COGL_TIMER_STOP (_cogl_uprof_context, log_timer);
G_BEGIN_DECLS
#define _COGL_MATRIX_DEBUG_PRINT(MATRIX) \
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_MATRICES)) \
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_MATRICES))) \
{ \
g_print ("%s:\n", G_STRFUNC); \
_cogl_matrix_print (MATRIX); \
/* If we haven't yet found an existing program then before we resort to
* generating a new arbfp program we see if we can find a suitable
* program in the arbfp_cache. */
- if (G_LIKELY (!(cogl_debug_flags & COGL_DEBUG_DISABLE_PROGRAM_CACHES)))
+ if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
{
arbfp_program_state = g_hash_table_lookup (ctx->arbfp_cache, authority);
if (arbfp_program_state)
"MOV result.color,output;\n");
g_string_append (arbfp_program_state->source, "END\n");
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
g_message ("pipeline program:\n%s", arbfp_program_state->source->str);
GE (glGenPrograms (1, &arbfp_program_state->gl_program));
arbfp_program_state->source = NULL;
- if (G_LIKELY (!(cogl_debug_flags & COGL_DEBUG_DISABLE_PROGRAM_CACHES)))
+ if (G_LIKELY (!(COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_PROGRAM_CACHES))))
{
CoglPipeline *key;
{
CoglHandle user_program;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_FIXED))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
return FALSE;
/* If there is a user program with a fragment shader then the
GE (glDisable (unit->enabled_gl_target));
/* Enable the new target */
- if (!G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_TEXTURING))
+ if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)))
{
GE (glEnable (gl_target));
unit->enabled_gl_target = gl_target;
* texture unit has been disabled for some time so we need to assert that
* it's enabled now.
*/
- if (!G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_TEXTURING) &&
+ if (!G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_TEXTURING)) &&
!unit->enabled_gl_target == 0)
{
_cogl_set_active_texture_unit (unit_index);
{
CoglProgram *user_program;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_FIXED))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_FIXED)))
return FALSE;
/* If there is a user program with a vertex shader then the
CoglPipelineBlendEnable enabled;
unsigned long other_state;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_BLENDING))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DISABLE_BLENDING)))
return FALSE;
enable_authority =
debug_option_getter (void *user_data)
{
unsigned int shift = GPOINTER_TO_UINT (user_data);
- return (cogl_debug_flags & (1 << shift)) ? TRUE : FALSE;
+ return COGL_DEBUG_ENABLED (shift);
}
static void
unsigned int shift = GPOINTER_TO_UINT (user_data);
if (value)
- cogl_debug_flags |= (1 << shift);
+ COGL_DEBUG_SET_FLAG (shift);
else
- cogl_debug_flags &= ~(1 << shift);
+ COGL_DEBUG_CLEAR_FLAG (shift);
}
static void
_cogl_uprof_context = uprof_context_new ("Cogl");
#define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \
G_STMT_START { \
- int shift; \
- for (shift = 0; (COGL_DEBUG_ ## MASK_NAME >> shift) != 1; shift++) \
- ; \
+ int shift = COGL_DEBUG_ ## MASK_NAME; \
uprof_context_add_boolean_option (_cogl_uprof_context, \
GROUP, \
NAME, \
map->space_remaining -= rectangle_size;
#ifdef COGL_ENABLE_DEBUG
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DUMP_ATLAS_IMAGE))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
{
_cogl_rectangle_map_dump_image (map);
/* Dumping the rectangle map is really slow so we might as well
}
#ifdef COGL_ENABLE_DEBUG
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DUMP_ATLAS_IMAGE))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_DUMP_ATLAS_IMAGE)))
{
_cogl_rectangle_map_dump_image (map);
/* Dumping the rectangle map is really slow so we might as well
}
count += count_in;
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
{
GString *buf = g_string_new (NULL);
int i;
GE (glBindProgram (GL_FRAGMENT_PROGRAM_ARB, shader->gl_handle));
- if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_SHOW_SOURCE))
+ if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
g_message ("user ARBfp program:\n%s", shader->source);
#ifdef COGL_GL_DEBUG