mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
[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
df1a9b7a74
commit
1f1d19f634
@ -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 = \
|
||||
|
21
configure.ac
21
configure.ac
@ -585,6 +585,24 @@ fi
|
||||
|
||||
AC_SUBST(CLUTTER_DEBUG_CFLAGS)
|
||||
|
||||
m4_define([cogl_debug_default], [no])
|
||||
AC_ARG_ENABLE([cogl-debug],
|
||||
[AC_HELP_STRING([--enable-cogl-debug=@<:@no/yes@:>@],
|
||||
[Turn on COGL debugging])],
|
||||
[],
|
||||
[enable_debug=debug_default])
|
||||
|
||||
AS_CASE([$enable_debug],
|
||||
|
||||
[yes], [COGL_DEBUG_CFLAGS="-DCOGL_GL_DEBUG -DCOGL_HANDLE_DEBUG -DCOGL_ENABLE_DEBUG"],
|
||||
|
||||
[no], [COGL_DEBUG_CFLAGS=""],
|
||||
|
||||
[*], [AC_MSG_ERROR([Invalid value for --enable-cogl-debug])]
|
||||
)
|
||||
|
||||
AC_SUBST(COGL_DEBUG_CFLAGS)
|
||||
|
||||
dnl = Enable strict compiler flags =========================================
|
||||
|
||||
# use strict compiler flags only on development releases
|
||||
@ -726,7 +744,8 @@ fi
|
||||
echo " GL Headers: ${CLUTTER_GL_HEADER}"
|
||||
echo " Image backend: ${imagebackend}"
|
||||
echo " Target library: ${clutterbackendlib}"
|
||||
echo " Debug level: ${enable_debug}"
|
||||
echo " Clutter Debug level: ${enable_debug}"
|
||||
echo " Enable COGL debug flags: ${enable_cogl_debug}"
|
||||
echo " Compiler flags: ${CPPFLAGS} ${MAINTAINER_CFLAGS}"
|
||||
echo " Build API Documentation: ${enable_gtk_doc}"
|
||||
echo " Build Manual Documentation: ${enable_manual}"
|
||||
|
Loading…
Reference in New Issue
Block a user