Add runtime debug messages for COGL
authorEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 23 Feb 2009 12:47:02 +0000 (12:47 +0000)
committerEmmanuele Bassi <ebassi@linux.intel.com>
Mon, 23 Feb 2009 13:00:52 +0000 (13:00 +0000)
commit605dfb8fd0451dd087a13cb21032a288ce5a3ea3
tree7b6a5cd760495e6ff384fc86cc741ba40ad743ea
parenta4c8e7847710a3818e3839224251cafe24c4ceb6
Add runtime debug messages for COGL

Clutter is able to show debug messages written using the CLUTTER_NOTE()
macro at runtime, either by using an environment variable:

  CLUTTER_DEBUG=...

or by using a command line switch:

  --clutter-debug=...
  --clutter-no-debug=...

Both are parsed during the initialization process by using the
GOption API.

COGL would benefit from having the same support.

In order to do this, we need a cogl_get_option_group() function in
COGL that sets up a GOptionGroup for COGL and adds a pre-parse hook
that will check the COGL_DEBUG environment variable. The OptionGroup
will also install two command line switches:

  --cogl-debug
  --cogl-no-debug

With the same semantics of the Clutter ones.

During Clutter initialization, the COGL option group will be attached
to the GOptionContext used to parse the command line options passed
to a Clutter application.

Every debug message written using:

  COGL_NOTE (SECTION, "message format", arguments);

Will then be printed only if SECTION was enabled at runtime.

This whole machinery, like the equivalent one in Clutter, depends on
a compile time switch, COGL_ENABLE_DEBUG, which is enabled at the same
time as CLUTTER_ENABLE_DEBUG. Having two different symbols allows
greater granularity.
clutter/clutter-main.c
clutter/cogl/cogl-debug.h [new file with mode: 0644]
clutter/cogl/cogl.h.in
clutter/cogl/common/Makefile.am
clutter/cogl/common/cogl-debug.c [new file with mode: 0644]
clutter/cogl/gl/Makefile.am
clutter/cogl/gles/Makefile.am
configure.ac