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; CoglMatrixOp op;
unsigned int ref_count; unsigned int ref_count;
#ifdef COGL_DEBUG_ENABLED /* Debugging, only used when defined(COGL_ENABLE_DEBUG)
/* used for performance tracing */ * Used for performance tracing */
int composite_gets; int composite_gets;
#endif
}; };
typedef struct _CoglMatrixEntryTranslate typedef struct _CoglMatrixEntryTranslate

View File

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

View File

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

View File

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

View File

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