diff options
author | Neil Roberts <neil@linux.intel.com> | 2011-01-24 14:28:00 +0000 |
---|---|---|
committer | Neil Roberts <neil@linux.intel.com> | 2011-01-24 15:45:45 +0000 |
commit | c4a94439de2700c550da742143c46ee7e72e7f62 (patch) | |
tree | f4536965d9f9dcdbb834a59cf342a61a8f7c530d /cogl/cogl-profile.c | |
parent | 4bb08ba00b4d572b3201a833377304b88f66e3c3 (diff) |
cogl-debug: Split the flags to support more than 32
The CoglDebugFlags are now stored in an array of unsigned ints rather
than a single variable. The flags are accessed using macros instead of
directly peeking at the cogl_debug_flags variable. The index values
are stored in the enum rather than the actual mask values so that the
enum doesn't need to be more than 32 bits wide. The hope is that the
code to determine the index into the array can be optimized out by the
compiler so it should have exactly the same performance as the old
code.
Diffstat (limited to 'cogl/cogl-profile.c')
-rw-r--r-- | cogl/cogl-profile.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/cogl/cogl-profile.c b/cogl/cogl-profile.c index 8f01d2c1..92ef7073 100644 --- a/cogl/cogl-profile.c +++ b/cogl/cogl-profile.c @@ -12,7 +12,7 @@ static gboolean debug_option_getter (void *user_data) { unsigned int shift = GPOINTER_TO_UINT (user_data); - return (cogl_debug_flags & (1 << shift)) ? TRUE : FALSE; + return COGL_DEBUG_ENABLED (shift); } static void @@ -21,9 +21,9 @@ debug_option_setter (gboolean value, void *user_data) unsigned int shift = GPOINTER_TO_UINT (user_data); if (value) - cogl_debug_flags |= (1 << shift); + COGL_DEBUG_SET_FLAG (shift); else - cogl_debug_flags &= ~(1 << shift); + COGL_DEBUG_CLEAR_FLAG (shift); } static void @@ -45,9 +45,7 @@ _cogl_uprof_init (void) _cogl_uprof_context = uprof_context_new ("Cogl"); #define OPT(MASK_NAME, GROUP, NAME, NAME_FORMATTED, DESCRIPTION) \ G_STMT_START { \ - int shift; \ - for (shift = 0; (COGL_DEBUG_ ## MASK_NAME >> shift) != 1; shift++) \ - ; \ + int shift = COGL_DEBUG_ ## MASK_NAME; \ uprof_context_add_boolean_option (_cogl_uprof_context, \ GROUP, \ NAME, \ |