[cogl/msvc-support: 21/21] Merge branch 'master' into msvc-support



commit fc99756416f3231b3443871382ec972672d17375
Merge: f5413e4 3e56883
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Nov 18 12:23:25 2011 +0800

    Merge branch 'master' into msvc-support
    
    Conflicts:
    	cogl/cogl-debug.h
    	cogl/cogl-util.h

 cogl-pango/Makefile.am                             |    1 +
 cogl/Makefile.am                                   |    2 +
 cogl/cogl-attribute.c                              |    6 +-
 cogl/cogl-bitmask.c                                |  164 +++++---
 cogl/cogl-bitmask.h                                |  120 +++++-
 cogl/cogl-boxed-value.c                            |  336 +++++++++++++++
 cogl/cogl-boxed-value.h                            |  111 +++++
 cogl/cogl-context-private.h                        |   18 +-
 cogl/cogl-context.c                                |    9 +
 cogl/cogl-debug.c                                  |   70 ++--
 cogl/cogl-debug.h                                  |    4 +-
 cogl/cogl-fixed.c                                  |  147 +++++++
 cogl/cogl-flags.h                                  |   65 +++-
 cogl/cogl-internal.h                               |   23 -
 cogl/cogl-matrix.c                                 |   17 +-
 cogl/cogl-matrix.h                                 |   12 +
 cogl/cogl-pipeline-private.h                       |   25 +-
 cogl/cogl-pipeline-progend-glsl.c                  |  180 ++++++++
 cogl/cogl-pipeline-state-private.h                 |   13 +
 cogl/cogl-pipeline-state.c                         |  328 +++++++++++++++-
 cogl/cogl-pipeline-state.h                         |  160 ++++++++
 cogl/cogl-pipeline.c                               |   96 +++++-
 cogl/cogl-pipeline.h                               |   27 ++
 cogl/cogl-program.c                                |  235 +++--------
 cogl/cogl-util.c                                   |  203 ++--------
 cogl/cogl-util.h                                   |   43 ++
 cogl/winsys/cogl-winsys-glx.c                      |   21 +-
 .../cogl-2.0-experimental-sections.txt             |    8 +
 doc/reference/cogl/cogl-sections.txt               |    1 +
 po/es.po                                           |   24 +-
 po/tr.po                                           |  314 ++++++++++++++-
 tests/conform/Makefile.am                          |   12 +-
 tests/conform/test-bitmask.c                       |  185 +++++++++
 tests/conform/test-conform-main.c                  |    3 +
 tests/conform/test-pipeline-uniforms.c             |  428 ++++++++++++++++++++
 35 files changed, 2891 insertions(+), 520 deletions(-)
---
diff --cc cogl/cogl-debug.h
index 4fe20cd,901850f..a6edbb3
--- a/cogl/cogl-debug.h
+++ b/cogl/cogl-debug.h
@@@ -82,10 -72,10 +82,10 @@@ typedef enum 
  
  #ifdef COGL_ENABLE_DEBUG
  
- #define COGL_DEBUG_N_INTS COGL_FLAGS_N_INTS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
+ #define COGL_DEBUG_N_LONGS COGL_FLAGS_N_LONGS_FOR_SIZE (COGL_DEBUG_N_FLAGS)
  
- COGL_EXP extern unsigned int _cogl_debug_flags[COGL_DEBUG_N_INTS];
 -extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
 -extern GHashTable *_cogl_debug_instances;
++COGL_EXP extern unsigned long _cogl_debug_flags[COGL_DEBUG_N_LONGS];
 +COGL_EXP extern GHashTable *_cogl_debug_instances;
  
  #define COGL_DEBUG_ENABLED(flag) \
    COGL_FLAGS_GET (_cogl_debug_flags, flag)
diff --cc cogl/cogl-util.h
index 68fd915,256ecae..33b36d0
--- a/cogl/cogl-util.h
+++ b/cogl/cogl-util.h
@@@ -108,26 -114,43 +114,63 @@@ in
  _cogl_util_ffs (int num);
  #endif
  
 +/* MSVC appears to have a bug in its implementation of modff for i386 
 + * architecture so we instead use the double version there. There 
 + * is a comment about this bug here:
 + *
 + * http://connect.microsoft.com/VisualStudio/feedback/details/ \
 + *       432366/modff-corrupts-stack
 + */
 +#if (defined(_MSC_VER) && defined(_M_IX86))
 +static inline float
 +cogl_modff (float value, float *int_part)
 +{
 +  double frac_part_double, int_part_double;
 +  frac_part_double = modf (value, &int_part_double);
 +  *int_part = int_part_double;
 +  return frac_part_double;
 +}
 +#else /* _MSC_VER && _M_IX86 */
 +#define cogl_modff modff
 +#endif /* _MSC_VER && _M_IX86 */
 +
+ /* The 'ffsl' function is non-standard but GCC has a builtin for it
+    since 3.4 which we can use */
+ #ifdef COGL_UTIL_HAVE_BUILTIN_FFSL
+ #define _cogl_util_ffsl __builtin_ffsl
+ #else
+ /* If ints and longs are the same size we can just use ffs. Hopefully
+    the compiler will optimise away this conditional */
+ #define _cogl_util_ffsl(x)                                              \
+   (sizeof (long int) == sizeof (int) ? _cogl_util_ffs ((int) x) :       \
+    _cogl_util_ffsl_wrapper (x))
+ int
+ _cogl_util_ffsl_wrapper (long int num);
+ #endif /* COGL_UTIL_HAVE_BUILTIN_FFSL */
+ 
+ #ifdef COGL_UTIL_HAVE_BUILTIN_POPCOUNTL
+ #define _cogl_util_popcountl __builtin_popcountl
+ #else
+ extern const unsigned char _cogl_util_popcount_table[256];
+ 
+ /* There are many ways of doing popcount but doing a table lookup
+    seems to be the most robust against different sizes for long. Some
+    pages seem to claim it's the fastest method anyway. */
+ static inline int
+ _cogl_util_popcountl (unsigned long num)
+ {
+   int i;
+   int sum = 0;
+ 
+   /* Let's hope GCC will unroll this loop.. */
+   for (i = 0; i < sizeof (num); i++)
+     sum += _cogl_util_popcount_table[(num >> (i * 8)) & 0xff];
+ 
+   return sum;
+ }
+ 
+ #endif /* COGL_UTIL_HAVE_BUILTIN_POPCOUNTL */
+ 
  #ifdef COGL_HAS_GLIB_SUPPORT
  #define _COGL_RETURN_IF_FAIL(EXPR) g_return_if_fail(EXPR)
  #define _COGL_RETURN_VAL_IF_FAIL(EXPR, VAL) g_return_val_if_fail(EXPR, VAL)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]