summaryrefslogtreecommitdiff
path: root/cogl/cogl-debug.h
diff options
context:
space:
mode:
authorNeil Roberts <neil@linux.intel.com>2011-04-15 15:39:14 +0100
committerNeil Roberts <neil@linux.intel.com>2011-04-20 18:20:10 +0100
commit4a7762d6d744133ee2492900ffda6843624e2b78 (patch)
tree0d7531902c131f04319f20f0ae574f41c7db0709 /cogl/cogl-debug.h
parentf6ae9decaa9367faaf74b8da22859ed5288b840d (diff)
downloadcogl-4a7762d6d744133ee2492900ffda6843624e2b78.tar.gz
cogl-context: Store winsys features in an array of unsigned ints
Previously the mask of available winsys features was stored in a CoglBitmask. That isn't the ideal type to use for this because it is intended for a growable array of bits so it can allocate extra memory if there are more than 31 flags set. For the winsys feature flags the highest used bit is known at compile time so it makes sense to allocate a fixed array instead. This is conceptually similar to the CoglDebugFlags which are stored in an array of integers with macros to test a bit in the array. This moves the macros used for CoglDebugFlags to cogl-flags.h and makes them more generic so they can be shared with CoglContext.
Diffstat (limited to 'cogl/cogl-debug.h')
-rw-r--r--cogl/cogl-debug.h23
1 files changed, 5 insertions, 18 deletions
diff --git a/cogl/cogl-debug.h b/cogl/cogl-debug.h
index 87f280db..15de706f 100644
--- a/cogl/cogl-debug.h
+++ b/cogl/cogl-debug.h
@@ -25,6 +25,7 @@
#define __COGL_DEBUG_H__
#include "cogl-profile.h"
+#include "cogl-flags.h"
#include <glib.h>
@@ -70,32 +71,18 @@ typedef enum {
#ifdef COGL_ENABLE_DEBUG
-#define COGL_DEBUG_N_INTS ((COGL_DEBUG_N_FLAGS + \
- (sizeof (unsigned int) * 8 - 1)) \
- / (sizeof (unsigned int) * 8))
+#define COGL_DEBUG_N_INTS COGL_FLAGS_N_INTS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
-/* It would probably make sense to use unsigned long here instead
- because then on 64-bit systems where it can handle 64-bits just as
- easily and it can test more bits. However GDebugKey uses a guint
- for the mask and we need to fit the masks into this */
extern unsigned int _cogl_debug_flags[COGL_DEBUG_N_INTS];
-#define COGL_DEBUG_GET_FLAG_INDEX(flag) \
- ((flag) / (sizeof (unsigned int) * 8))
-#define COGL_DEBUG_GET_FLAG_MASK(flag) \
- (1U << ((unsigned int) (flag) & (sizeof (unsigned int) * 8 - 1)))
-
#define COGL_DEBUG_ENABLED(flag) \
- (!!(_cogl_debug_flags[COGL_DEBUG_GET_FLAG_INDEX (flag)] & \
- COGL_DEBUG_GET_FLAG_MASK (flag)))
+ COGL_FLAGS_GET (_cogl_debug_flags, flag)
#define COGL_DEBUG_SET_FLAG(flag) \
- (_cogl_debug_flags[COGL_DEBUG_GET_FLAG_INDEX (flag)] |= \
- COGL_DEBUG_GET_FLAG_MASK (flag))
+ COGL_FLAGS_SET (_cogl_debug_flags, flag, TRUE)
#define COGL_DEBUG_CLEAR_FLAG(flag) \
- (_cogl_debug_flags[COGL_DEBUG_GET_FLAG_INDEX (flag)] &= \
- ~COGL_DEBUG_GET_FLAG_MASK (flag))
+ COGL_FLAGS_SET (_cogl_debug_flags, flag, FALSE)
#ifdef __GNUC__
#define COGL_NOTE(type,x,a...) G_STMT_START { \