[cogl] Move debugging to a configure-time switch
Currently, COGL depends on defining debug symbols by manually modifying the source code. When it's done, it will forcefully print stuff to the console. Since COGL has also a pretty, runtime selectable debugging API we might as well switch everything to it. In order for this to happen, configure needs a new: --enable-cogl-debug command line switch; this will enable COGL debugging, the CoglHandle debugging and will also turn on the error checking for each GL operation. The default setting for the COGL debug defines is off, since it slows down the GL operations; enabling it for a particular debug build is trivial, though.
This commit is contained in:
parent
cf4a49061a
commit
2fdc7e6a1b
@ -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
|
||||
|
@ -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 \
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 = \
|
||||
|
@ -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 = \
|
||||
|
Loading…
Reference in New Issue
Block a user