1
0
Fork 0

cogl: Use COGL_ENABLE_DEBUG instead of COGL_DEBUG_ENABLED

COGL_DEBUG_ENABLED is a macro to check if a debug flag is set.
COGL_ENABLE_DEBUG is set by the build system if it's a debug build. The
check `#ifdef COGL_DEBUG_ENABLED` always evaluates to true. Use the
appropriate macro to guard some debugging code.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3446>
This commit is contained in:
Sebastian Wick 2024-01-04 16:32:12 +01:00 committed by Marge Bot
parent 6749151ac9
commit db492fe335
5 changed files with 16 additions and 19 deletions

View file

@ -56,10 +56,9 @@ struct _CoglMatrixEntry
CoglMatrixOp op;
unsigned int ref_count;
#ifdef COGL_DEBUG_ENABLED
/* used for performance tracing */
/* Debugging, only used when defined(COGL_ENABLE_DEBUG)
* Used for performance tracing */
int composite_gets;
#endif
};
typedef struct _CoglMatrixEntryTranslate

View file

@ -56,7 +56,7 @@ _cogl_matrix_entry_new (CoglMatrixOp operation)
entry->ref_count = 1;
entry->op = operation;
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
entry->composite_gets = 0;
#endif
@ -154,7 +154,7 @@ _cogl_matrix_entry_identity_init (CoglMatrixEntry *entry)
entry->ref_count = 1;
entry->op = COGL_MATRIX_OP_LOAD_IDENTITY;
entry->parent = NULL;
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
entry->composite_gets = 0;
#endif
}

View file

@ -163,7 +163,7 @@ dump_pipeline_cb (CoglNode *node, void *user_data)
pipeline_id,
pipeline,
G_OBJECT (pipeline)->ref_count,
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
pipeline->has_static_breadcrumb ?
pipeline->static_breadcrumb : "NULL"
#else

View file

@ -308,13 +308,6 @@ struct _CoglPipeline
* be allocated dynamically when required... */
CoglPipelineBigState *big_state;
#ifdef COGL_DEBUG_ENABLED
/* For debugging purposes it's possible to associate a static const
* string with a pipeline which can be an aid when trying to trace
* where the pipeline originates from */
const char *static_breadcrumb;
#endif
/* Cached state... */
/* A cached, complete list of the layers this pipeline depends
@ -360,12 +353,17 @@ struct _CoglPipeline
unsigned int layers_cache_dirty:1;
#ifdef COGL_DEBUG_ENABLED
/* Debugging, only used when defined(COGL_ENABLE_DEBUG) */
/* For debugging purposes it's possible to associate a static const
* string with a pipeline which can be an aid when trying to trace
* where the pipeline originates from */
unsigned int has_static_breadcrumb:1;
#endif
/* For debugging purposes it's possible to associate a static const
* string with a pipeline which can be an aid when trying to trace
* where the pipeline originates from */
const char *static_breadcrumb;
};
struct _CoglPipelineClass
@ -728,7 +726,7 @@ void
_cogl_pipeline_apply_overrides (CoglPipeline *pipeline,
CoglPipelineFlushOptions *options);
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
void
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
const char *breadcrumb);

View file

@ -373,7 +373,7 @@ cogl_pipeline_new (CoglContext *context)
{
CoglPipeline *new = cogl_pipeline_copy (context->default_pipeline);
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
_cogl_pipeline_set_static_breadcrumb (new, "new");
#endif
return new;
@ -1159,7 +1159,7 @@ _cogl_pipeline_pre_change_notify (CoglPipeline *pipeline,
new_authority =
cogl_pipeline_copy (_cogl_pipeline_get_parent (pipeline));
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
_cogl_pipeline_set_static_breadcrumb (new_authority,
"pre_change_notify:copy-on-write");
#endif
@ -2302,7 +2302,7 @@ _cogl_pipeline_journal_unref (CoglPipeline *pipeline)
g_object_unref (pipeline);
}
#ifdef COGL_DEBUG_ENABLED
#ifdef COGL_ENABLE_DEBUG
void
_cogl_pipeline_set_static_breadcrumb (CoglPipeline *pipeline,
const char *breadcrumb)