diff --git a/cogl-debug.h b/cogl-debug.h index 79a425282..b31a36c52 100644 --- a/cogl-debug.h +++ b/cogl-debug.h @@ -36,7 +36,8 @@ typedef enum { COGL_DEBUG_OFFSCREEN = 1 << 4, COGL_DEBUG_DRAW = 1 << 5, COGL_DEBUG_PANGO = 1 << 6, - COGL_DEBUG_RECTANGLES = 1 << 7 + COGL_DEBUG_RECTANGLES = 1 << 7, + COGL_DEBUG_HANDLE = 1 << 8 } CoglDebugFlags; #ifdef COGL_ENABLE_DEBUG diff --git a/common/Makefile.am b/common/Makefile.am index 47d24199b..138893a14 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -12,7 +12,7 @@ INCLUDES = \ noinst_LTLIBRARIES = libclutter-cogl-common.la EXTRA_DIST = stb_image.c -libclutter_cogl_common_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) +libclutter_cogl_common_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(COGL_DEBUG_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) libclutter_cogl_common_la_LIBADD = -lm $(CLUTTER_LIBS) libclutter_cogl_common_la_SOURCES = \ cogl-handle.h \ diff --git a/common/cogl-debug.c b/common/cogl-debug.c index 2763314d5..85721fc22 100644 --- a/common/cogl-debug.c +++ b/common/cogl-debug.c @@ -38,7 +38,8 @@ static const GDebugKey cogl_debug_keys[] = { { "offscreen", COGL_DEBUG_OFFSCREEN }, { "draw", COGL_DEBUG_DRAW }, { "pango", COGL_DEBUG_PANGO }, - { "rectangles", COGL_DEBUG_RECTANGLES } + { "rectangles", COGL_DEBUG_RECTANGLES }, + { "handle", COGL_DEBUG_HANDLE } }; static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys); diff --git a/common/cogl-handle.h b/common/cogl-handle.h index e1f1e3c8a..7851932db 100644 --- a/common/cogl-handle.h +++ b/common/cogl-handle.h @@ -48,24 +48,25 @@ typedef struct _CoglHandleObject #ifdef COGL_HANDLE_DEBUG -#define _COGL_HANDLE_DEBUG_NEW(type_name, obj) \ - g_debug ("COGL " G_STRINGIFY (type_name) " NEW %p %i\n", \ - (obj), (obj)->ref_count) +#define _COGL_HANDLE_DEBUG_NEW(type_name, obj) \ + COGL_NOTE (HANDLE, "COGL " G_STRINGIFY (type_name) " NEW %p %i\n", \ + (obj), (obj)->ref_count) #define _COGL_HANDLE_DEBUG_REF(type_name, handle) G_STMT_START { \ CoglHandleObject *__obj = (CoglHandleObject *)handle; \ - g_debug ("COGL %s REF %p %i\n", \ - g_quark_to_string ((__obj)->klass->type), \ - (__obj), (__obj)->ref_count); } G_STMT_END + COGL_NOTE (HANDLE, "COGL %s REF %p %i\n", \ + g_quark_to_string ((__obj)->klass->type), \ + (__obj), (__obj)->ref_count); } G_STMT_END #define _COGL_HANDLE_DEBUG_UNREF(type_name, handle) G_STMT_START { \ CoglHandleObject *__obj = (CoglHandleObject *)handle; \ - g_debug ("COGL %s UNREF %p %i\n", \ - g_quark_to_string ((__obj)->klass->type), \ - (__obj), (__obj)->ref_count - 1); } G_STMT_END + COGL_NOTE (HANDLE, "COGL %s UNREF %p %i\n", \ + g_quark_to_string ((__obj)->klass->type), \ + (__obj), (__obj)->ref_count - 1); } G_STMT_END -#define COGL_HANDLE_DEBUG_FREE(obj) \ - g_debug ("COGL %s FREE %p\n", g_quark_to_string ((obj)->klass->type), (obj)) +#define COGL_HANDLE_DEBUG_FREE(obj) \ + COGL_NOTE (HANDLE, "COGL %s FREE %p\n", \ + g_quark_to_string ((obj)->klass->type), (obj)) #else /* !COGL_HANDLE_DEBUG */ diff --git a/common/cogl-internal.h b/common/cogl-internal.h index b71de0f7c..f148c35b6 100644 --- a/common/cogl-internal.h +++ b/common/cogl-internal.h @@ -24,6 +24,8 @@ #ifndef __COGL_INTERNAL_H #define __COGL_INTERNAL_H +#include "cogl-debug.h" + #ifdef HAVE_COGL_GLES2 typedef enum { COGL_BOXED_NONE, @@ -49,10 +51,7 @@ typedef struct _CoglBoxedValue } CoglBoxedValue; #endif -/* XXX - set to 1 to enable checks on every GL call */ -#define COGL_GL_DEBUG 0 - -#if COGL_GL_DEBUG +#ifdef COGL_GL_DEBUG const gchar *cogl_gl_error_to_string (GLenum error_code); diff --git a/gl/Makefile.am b/gl/Makefile.am index 26fadc42c..367f674f2 100644 --- a/gl/Makefile.am +++ b/gl/Makefile.am @@ -52,7 +52,7 @@ INCLUDES = \ noinst_LTLIBRARIES = libclutter-cogl.la -libclutter_cogl_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) +libclutter_cogl_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(COGL_DEBUG_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) libclutter_cogl_la_LIBADD = -lm $(CLUTTER_LIBS) $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la libclutter_cogl_la_DEPENDENCIES = $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la libclutter_cogl_la_SOURCES = \ diff --git a/gles/Makefile.am b/gles/Makefile.am index abebf7275..3f84b4b2f 100644 --- a/gles/Makefile.am +++ b/gles/Makefile.am @@ -29,7 +29,7 @@ INCLUDES = \ noinst_LTLIBRARIES = libclutter-cogl.la -libclutter_cogl_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) +libclutter_cogl_la_CPPFLAGS = $(CLUTTER_CFLAGS) $(COGL_DEBUG_CFLAGS) $(CLUTTER_DEBUG_CFLAGS) $(MAINTAINER_CFLAGS) libclutter_cogl_la_LIBADD = -lm $(CLUTTER_LIBS) $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la libclutter_cogl_la_DEPENDENCIES = $(top_builddir)/clutter/cogl/common/libclutter-cogl-common.la libclutter_cogl_la_SOURCES = \