From e09a1f497e5dc762a51dbd2aee1765a0c575fb3d Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 21 Feb 2011 14:16:06 +0000 Subject: [PATCH 1/8] Resoved ticket #50, removed some warnings --- CMakeLists.txt | 3 +- glm/core/_detail.hpp | 2 +- glm/gtc/swizzle.hpp | 362 +++++++++++++++++++++---------------------- 3 files changed, 184 insertions(+), 183 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f481ce80..a502bd38 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,9 +5,10 @@ project(glm) enable_testing() add_definitions(-D_CRT_SECURE_NO_WARNINGS) +add_definitions(-pedantic) #add_definitions(-S) #add_definitions(-s) -#add_definitions(-msse2) +add_definitions(-msse2) #add_definitions(-m32) #add_definitions(-mfpmath=387) #add_definitions(-ffast-math) diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index 16124b41..d11d7052 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -259,7 +259,7 @@ namespace detail _YES = 1, \ _NO = 0 \ }; \ - }; + } ////////////////// // matrix diff --git a/glm/gtc/swizzle.hpp b/glm/gtc/swizzle.hpp index 5134a460..7ebd630c 100644 --- a/glm/gtc/swizzle.hpp +++ b/glm/gtc/swizzle.hpp @@ -148,113 +148,113 @@ namespace glm inline detail::tvec4 swizzle(detail::tvec##SIZE const & v) \ {return detail::tvec4(v[x], v[y], v[z], v[w]);} */ - static_swizzle2_const(glm::f16vec2); - static_swizzle2_const(glm::f16vec3); - static_swizzle2_const(glm::f16vec4); - static_swizzle2_const(glm::f32vec2); - static_swizzle2_const(glm::f32vec3); - static_swizzle2_const(glm::f32vec4); - static_swizzle2_const(glm::f64vec2); - static_swizzle2_const(glm::f64vec3); - static_swizzle2_const(glm::f64vec4); - - static_swizzle2_const(glm::i8vec2); - static_swizzle2_const(glm::i8vec3); - static_swizzle2_const(glm::i8vec4); - static_swizzle2_const(glm::i16vec2); - static_swizzle2_const(glm::i16vec3); - static_swizzle2_const(glm::i16vec4); - static_swizzle2_const(glm::i32vec2); - static_swizzle2_const(glm::i32vec3); - static_swizzle2_const(glm::i32vec4); - static_swizzle2_const(glm::i64vec2); - static_swizzle2_const(glm::i64vec3); - static_swizzle2_const(glm::i64vec4); - - static_swizzle2_const(glm::u8vec2); - static_swizzle2_const(glm::u8vec3); - static_swizzle2_const(glm::u8vec4); - static_swizzle2_const(glm::u16vec2); - static_swizzle2_const(glm::u16vec3); - static_swizzle2_const(glm::u16vec4); - static_swizzle2_const(glm::u32vec2); - static_swizzle2_const(glm::u32vec3); - static_swizzle2_const(glm::u32vec4); - static_swizzle2_const(glm::u64vec2); - static_swizzle2_const(glm::u64vec3); - static_swizzle2_const(glm::u64vec4); - - static_swizzle3_const(glm::f16vec2); - static_swizzle3_const(glm::f16vec3); - static_swizzle3_const(glm::f16vec4); - static_swizzle3_const(glm::f32vec2); - static_swizzle3_const(glm::f32vec3); - static_swizzle3_const(glm::f32vec4); - static_swizzle3_const(glm::f64vec2); - static_swizzle3_const(glm::f64vec3); - static_swizzle3_const(glm::f64vec4); - - static_swizzle3_const(glm::i8vec2); - static_swizzle3_const(glm::i8vec3); - static_swizzle3_const(glm::i8vec4); - static_swizzle3_const(glm::i16vec2); - static_swizzle3_const(glm::i16vec3); - static_swizzle3_const(glm::i16vec4); - static_swizzle3_const(glm::i32vec2); - static_swizzle3_const(glm::i32vec3); - static_swizzle3_const(glm::i32vec4); - static_swizzle3_const(glm::i64vec2); - static_swizzle3_const(glm::i64vec3); - static_swizzle3_const(glm::i64vec4); - - static_swizzle3_const(glm::u8vec2); - static_swizzle3_const(glm::u8vec3); - static_swizzle3_const(glm::u8vec4); - static_swizzle3_const(glm::u16vec2); - static_swizzle3_const(glm::u16vec3); - static_swizzle3_const(glm::u16vec4); - static_swizzle3_const(glm::u32vec2); - static_swizzle3_const(glm::u32vec3); - static_swizzle3_const(glm::u32vec4); - static_swizzle3_const(glm::u64vec2); - static_swizzle3_const(glm::u64vec3); - static_swizzle3_const(glm::u64vec4); - - static_swizzle4_const(glm::f16vec2); - static_swizzle4_const(glm::f16vec3); - static_swizzle4_const(glm::f16vec4); - static_swizzle4_const(glm::f32vec2); - static_swizzle4_const(glm::f32vec3); - static_swizzle4_const(glm::f32vec4); - static_swizzle4_const(glm::f64vec2); - static_swizzle4_const(glm::f64vec3); - static_swizzle4_const(glm::f64vec4); - - static_swizzle4_const(glm::i8vec2); - static_swizzle4_const(glm::i8vec3); - static_swizzle4_const(glm::i8vec4); - static_swizzle4_const(glm::i16vec2); - static_swizzle4_const(glm::i16vec3); - static_swizzle4_const(glm::i16vec4); - static_swizzle4_const(glm::i32vec2); - static_swizzle4_const(glm::i32vec3); - static_swizzle4_const(glm::i32vec4); - static_swizzle4_const(glm::i64vec2); - static_swizzle4_const(glm::i64vec3); - static_swizzle4_const(glm::i64vec4); - - static_swizzle4_const(glm::u8vec2); - static_swizzle4_const(glm::u8vec3); - static_swizzle4_const(glm::u8vec4); - static_swizzle4_const(glm::u16vec2); - static_swizzle4_const(glm::u16vec3); - static_swizzle4_const(glm::u16vec4); - static_swizzle4_const(glm::u32vec2); - static_swizzle4_const(glm::u32vec3); - static_swizzle4_const(glm::u32vec4); - static_swizzle4_const(glm::u64vec2); - static_swizzle4_const(glm::u64vec3); - static_swizzle4_const(glm::u64vec4); + static_swizzle2_const(glm::f16vec2) + static_swizzle2_const(glm::f16vec3) + static_swizzle2_const(glm::f16vec4) + static_swizzle2_const(glm::f32vec2) + static_swizzle2_const(glm::f32vec3) + static_swizzle2_const(glm::f32vec4) + static_swizzle2_const(glm::f64vec2) + static_swizzle2_const(glm::f64vec3) + static_swizzle2_const(glm::f64vec4) + + static_swizzle2_const(glm::i8vec2) + static_swizzle2_const(glm::i8vec3) + static_swizzle2_const(glm::i8vec4) + static_swizzle2_const(glm::i16vec2) + static_swizzle2_const(glm::i16vec3) + static_swizzle2_const(glm::i16vec4) + static_swizzle2_const(glm::i32vec2) + static_swizzle2_const(glm::i32vec3) + static_swizzle2_const(glm::i32vec4) + static_swizzle2_const(glm::i64vec2) + static_swizzle2_const(glm::i64vec3) + static_swizzle2_const(glm::i64vec4) + + static_swizzle2_const(glm::u8vec2) + static_swizzle2_const(glm::u8vec3) + static_swizzle2_const(glm::u8vec4) + static_swizzle2_const(glm::u16vec2) + static_swizzle2_const(glm::u16vec3) + static_swizzle2_const(glm::u16vec4) + static_swizzle2_const(glm::u32vec2) + static_swizzle2_const(glm::u32vec3) + static_swizzle2_const(glm::u32vec4) + static_swizzle2_const(glm::u64vec2) + static_swizzle2_const(glm::u64vec3) + static_swizzle2_const(glm::u64vec4) + + static_swizzle3_const(glm::f16vec2) + static_swizzle3_const(glm::f16vec3) + static_swizzle3_const(glm::f16vec4) + static_swizzle3_const(glm::f32vec2) + static_swizzle3_const(glm::f32vec3) + static_swizzle3_const(glm::f32vec4) + static_swizzle3_const(glm::f64vec2) + static_swizzle3_const(glm::f64vec3) + static_swizzle3_const(glm::f64vec4) + + static_swizzle3_const(glm::i8vec2) + static_swizzle3_const(glm::i8vec3) + static_swizzle3_const(glm::i8vec4) + static_swizzle3_const(glm::i16vec2) + static_swizzle3_const(glm::i16vec3) + static_swizzle3_const(glm::i16vec4) + static_swizzle3_const(glm::i32vec2) + static_swizzle3_const(glm::i32vec3) + static_swizzle3_const(glm::i32vec4) + static_swizzle3_const(glm::i64vec2) + static_swizzle3_const(glm::i64vec3) + static_swizzle3_const(glm::i64vec4) + + static_swizzle3_const(glm::u8vec2) + static_swizzle3_const(glm::u8vec3) + static_swizzle3_const(glm::u8vec4) + static_swizzle3_const(glm::u16vec2) + static_swizzle3_const(glm::u16vec3) + static_swizzle3_const(glm::u16vec4) + static_swizzle3_const(glm::u32vec2) + static_swizzle3_const(glm::u32vec3) + static_swizzle3_const(glm::u32vec4) + static_swizzle3_const(glm::u64vec2) + static_swizzle3_const(glm::u64vec3) + static_swizzle3_const(glm::u64vec4) + + static_swizzle4_const(glm::f16vec2) + static_swizzle4_const(glm::f16vec3) + static_swizzle4_const(glm::f16vec4) + static_swizzle4_const(glm::f32vec2) + static_swizzle4_const(glm::f32vec3) + static_swizzle4_const(glm::f32vec4) + static_swizzle4_const(glm::f64vec2) + static_swizzle4_const(glm::f64vec3) + static_swizzle4_const(glm::f64vec4) + + static_swizzle4_const(glm::i8vec2) + static_swizzle4_const(glm::i8vec3) + static_swizzle4_const(glm::i8vec4) + static_swizzle4_const(glm::i16vec2) + static_swizzle4_const(glm::i16vec3) + static_swizzle4_const(glm::i16vec4) + static_swizzle4_const(glm::i32vec2) + static_swizzle4_const(glm::i32vec3) + static_swizzle4_const(glm::i32vec4) + static_swizzle4_const(glm::i64vec2) + static_swizzle4_const(glm::i64vec3) + static_swizzle4_const(glm::i64vec4) + + static_swizzle4_const(glm::u8vec2) + static_swizzle4_const(glm::u8vec3) + static_swizzle4_const(glm::u8vec4) + static_swizzle4_const(glm::u16vec2) + static_swizzle4_const(glm::u16vec3) + static_swizzle4_const(glm::u16vec4) + static_swizzle4_const(glm::u32vec2) + static_swizzle4_const(glm::u32vec3) + static_swizzle4_const(glm::u32vec4) + static_swizzle4_const(glm::u64vec2) + static_swizzle4_const(glm::u64vec3) + static_swizzle4_const(glm::u64vec4) # define static_swizzle2_ref(TYPE) \ template \ @@ -271,80 +271,80 @@ namespace glm inline glm::detail::tref4 swizzle(TYPE & v) \ {return glm::detail::tref4(v[x], v[y], v[z], v[w]);} - static_swizzle2_ref(glm::f16vec2); - static_swizzle2_ref(glm::f16vec3); - static_swizzle2_ref(glm::f16vec4); - static_swizzle2_ref(glm::f32vec2); - static_swizzle2_ref(glm::f32vec3); - static_swizzle2_ref(glm::f32vec4); - static_swizzle2_ref(glm::f64vec2); - static_swizzle2_ref(glm::f64vec3); - static_swizzle2_ref(glm::f64vec4); - - static_swizzle2_ref(glm::i8vec2); - static_swizzle2_ref(glm::i8vec3); - static_swizzle2_ref(glm::i8vec4); - static_swizzle2_ref(glm::i16vec2); - static_swizzle2_ref(glm::i16vec3); - static_swizzle2_ref(glm::i16vec4); - static_swizzle2_ref(glm::i32vec2); - static_swizzle2_ref(glm::i32vec3); - static_swizzle2_ref(glm::i32vec4); - static_swizzle2_ref(glm::i64vec2); - static_swizzle2_ref(glm::i64vec3); - static_swizzle2_ref(glm::i64vec4); - - static_swizzle2_ref(glm::u8vec2); - static_swizzle2_ref(glm::u8vec3); - static_swizzle2_ref(glm::u8vec4); - static_swizzle2_ref(glm::u16vec2); - static_swizzle2_ref(glm::u16vec3); - static_swizzle2_ref(glm::u16vec4); - static_swizzle2_ref(glm::u32vec2); - static_swizzle2_ref(glm::u32vec3); - static_swizzle2_ref(glm::u32vec4); - static_swizzle2_ref(glm::u64vec2); - static_swizzle2_ref(glm::u64vec3); - static_swizzle2_ref(glm::u64vec4); - - static_swizzle3_ref(glm::f16vec3); - static_swizzle3_ref(glm::f16vec4); - static_swizzle3_ref(glm::f32vec3); - static_swizzle3_ref(glm::f32vec4); - static_swizzle3_ref(glm::f64vec3); - static_swizzle3_ref(glm::f64vec4); - - static_swizzle3_ref(glm::i8vec3); - static_swizzle3_ref(glm::i8vec4); - static_swizzle3_ref(glm::i16vec3); - static_swizzle3_ref(glm::i16vec4); - static_swizzle3_ref(glm::i32vec3); - static_swizzle3_ref(glm::i32vec4); - static_swizzle3_ref(glm::i64vec3); - static_swizzle3_ref(glm::i64vec4); - - static_swizzle3_ref(glm::u8vec3); - static_swizzle3_ref(glm::u8vec4); - static_swizzle3_ref(glm::u16vec3); - static_swizzle3_ref(glm::u16vec4); - static_swizzle3_ref(glm::u32vec3); - static_swizzle3_ref(glm::u32vec4); - static_swizzle3_ref(glm::u64vec3); - static_swizzle3_ref(glm::u64vec4); - - static_swizzle4_ref(glm::f16vec4); - static_swizzle4_ref(glm::f32vec4); - static_swizzle4_ref(glm::f64vec4); - - static_swizzle4_ref(glm::i8vec4); - static_swizzle4_ref(glm::i16vec4); - static_swizzle4_ref(glm::i32vec4); - static_swizzle4_ref(glm::i64vec4); - - static_swizzle4_ref(glm::u8vec4); - static_swizzle4_ref(glm::u16vec4); - static_swizzle4_ref(glm::u32vec4); - static_swizzle4_ref(glm::u64vec4); + static_swizzle2_ref(glm::f16vec2) + static_swizzle2_ref(glm::f16vec3) + static_swizzle2_ref(glm::f16vec4) + static_swizzle2_ref(glm::f32vec2) + static_swizzle2_ref(glm::f32vec3) + static_swizzle2_ref(glm::f32vec4) + static_swizzle2_ref(glm::f64vec2) + static_swizzle2_ref(glm::f64vec3) + static_swizzle2_ref(glm::f64vec4) + + static_swizzle2_ref(glm::i8vec2) + static_swizzle2_ref(glm::i8vec3) + static_swizzle2_ref(glm::i8vec4) + static_swizzle2_ref(glm::i16vec2) + static_swizzle2_ref(glm::i16vec3) + static_swizzle2_ref(glm::i16vec4) + static_swizzle2_ref(glm::i32vec2) + static_swizzle2_ref(glm::i32vec3) + static_swizzle2_ref(glm::i32vec4) + static_swizzle2_ref(glm::i64vec2) + static_swizzle2_ref(glm::i64vec3) + static_swizzle2_ref(glm::i64vec4) + + static_swizzle2_ref(glm::u8vec2) + static_swizzle2_ref(glm::u8vec3) + static_swizzle2_ref(glm::u8vec4) + static_swizzle2_ref(glm::u16vec2) + static_swizzle2_ref(glm::u16vec3) + static_swizzle2_ref(glm::u16vec4) + static_swizzle2_ref(glm::u32vec2) + static_swizzle2_ref(glm::u32vec3) + static_swizzle2_ref(glm::u32vec4) + static_swizzle2_ref(glm::u64vec2) + static_swizzle2_ref(glm::u64vec3) + static_swizzle2_ref(glm::u64vec4) + + static_swizzle3_ref(glm::f16vec3) + static_swizzle3_ref(glm::f16vec4) + static_swizzle3_ref(glm::f32vec3) + static_swizzle3_ref(glm::f32vec4) + static_swizzle3_ref(glm::f64vec3) + static_swizzle3_ref(glm::f64vec4) + + static_swizzle3_ref(glm::i8vec3) + static_swizzle3_ref(glm::i8vec4) + static_swizzle3_ref(glm::i16vec3) + static_swizzle3_ref(glm::i16vec4) + static_swizzle3_ref(glm::i32vec3) + static_swizzle3_ref(glm::i32vec4) + static_swizzle3_ref(glm::i64vec3) + static_swizzle3_ref(glm::i64vec4) + + static_swizzle3_ref(glm::u8vec3) + static_swizzle3_ref(glm::u8vec4) + static_swizzle3_ref(glm::u16vec3) + static_swizzle3_ref(glm::u16vec4) + static_swizzle3_ref(glm::u32vec3) + static_swizzle3_ref(glm::u32vec4) + static_swizzle3_ref(glm::u64vec3) + static_swizzle3_ref(glm::u64vec4) + + static_swizzle4_ref(glm::f16vec4) + static_swizzle4_ref(glm::f32vec4) + static_swizzle4_ref(glm::f64vec4) + + static_swizzle4_ref(glm::i8vec4) + static_swizzle4_ref(glm::i16vec4) + static_swizzle4_ref(glm::i32vec4) + static_swizzle4_ref(glm::i64vec4) + + static_swizzle4_ref(glm::u8vec4) + static_swizzle4_ref(glm::u16vec4) + static_swizzle4_ref(glm::u32vec4) + static_swizzle4_ref(glm::u64vec4) }//namespace swizzle }//namespace gtc From 441f8a657569cd8a61ae78681dba62bb1c5ea2a2 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 21 Feb 2011 14:43:47 +0000 Subject: [PATCH 2/8] Factorised code, reduces number of warnings --- glm/core/_detail.hpp | 10 ++++++++++ glm/core/type_int.hpp | 35 +++++++---------------------------- glm/glm.hpp | 28 +++++++++++++++------------- glm/setup.hpp | 1 + 4 files changed, 33 insertions(+), 41 deletions(-) diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index d11d7052..ed18de40 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -24,6 +24,16 @@ namespace detail #elif(GLM_COMPILER & GLM_COMPILER_GCC) __extension__ typedef signed long long sint64; __extension__ typedef unsigned long long uint64; +//# if GLM_MODEL == GLM_MODEL_64 +// typedef signed long highp_int_t; +// typedef unsigned long highp_uint_t; +//# elif GLM_MODEL == GLM_MODEL_32 +// __extension__ typedef signed long long highp_int_t; +// __extension__ typedef unsigned long long highp_uint_t; +//# endif//GLM_MODEL +#elif(GLM_COMPILER & GLM_COMPILER_BC) + typedef Int64 sint64; + typedef Uint64 uint64; #else//unknown compiler typedef signed long sint64; typedef unsigned long uint64; diff --git a/glm/core/type_int.hpp b/glm/core/type_int.hpp index e788d333..3f7aa0ab 100644 --- a/glm/core/type_int.hpp +++ b/glm/core/type_int.hpp @@ -17,26 +17,13 @@ namespace glm { namespace detail { -#if defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC) - typedef signed __int64 highp_int_t; - typedef unsigned __int64 highp_uint_t; -#elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC)) - __extension__ typedef signed long long highp_int_t; - __extension__ typedef unsigned long long highp_uint_t; -//# if GLM_MODEL == GLM_MODEL_64 -// typedef signed long highp_int_t; -// typedef unsigned long highp_uint_t; -//# elif GLM_MODEL == GLM_MODEL_32 -// __extension__ typedef signed long long highp_int_t; -// __extension__ typedef unsigned long long highp_uint_t; -//# endif//GLM_MODEL -#elif(defined(GLM_COMPILER_BC)) - typedef Int64 highp_int_t; - typedef Uint64 highp_uint_t; -#else - typedef signed long long highp_int_t; - typedef unsigned long long highp_uint_t; -#endif//GLM_COMPILER + typedef signed short lowp_int_t; + typedef signed int mediump_int_t; + typedef sint64 highp_int_t; + + typedef unsigned short lowp_uint_t; + typedef unsigned int mediump_uint_t; + typedef uint64 highp_uint_t; GLM_DETAIL_IS_INT(signed char); GLM_DETAIL_IS_INT(signed short); @@ -49,14 +36,6 @@ namespace glm GLM_DETAIL_IS_UINT(unsigned int); GLM_DETAIL_IS_UINT(unsigned long); GLM_DETAIL_IS_UINT(highp_uint_t); - - typedef signed short lowp_int_t; - typedef signed int mediump_int_t; - typedef detail::highp_int_t highp_int_t; - - typedef unsigned short lowp_uint_t; - typedef unsigned int mediump_uint_t; - typedef detail::highp_uint_t highp_uint_t; } //namespace detail diff --git a/glm/glm.hpp b/glm/glm.hpp index a587e78c..67b20753 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -95,18 +95,20 @@ namespace glm //////////////////// // check type sizes -GLM_STATIC_ASSERT(sizeof(glm::detail::int8) == 1, "int8 size isn't 1 byte on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::int16) == 2, "int16 size isn't 2 bytes on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::int32) == 4, "int32 size isn't 4 bytes on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::int64) == 8, "int64 size isn't 8 bytes on this platform"); - -GLM_STATIC_ASSERT(sizeof(glm::detail::uint8) == 1, "uint8 size isn't 1 byte on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); - -GLM_STATIC_ASSERT(sizeof(glm::detail::float16) == 2, "float16 size isn't 2 bytes on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::float32) == 4, "float32 size isn't 4 bytes on this platform"); -GLM_STATIC_ASSERT(sizeof(glm::detail::float64) == 8, "float64 size isn't 8 bytes on this platform"); +#ifndef GLM_STATIC_ASSERT_NULL + GLM_STATIC_ASSERT(sizeof(glm::detail::int8) == 1, "int8 size isn't 1 byte on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::int16) == 2, "int16 size isn't 2 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::int32) == 4, "int32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::int64) == 8, "int64 size isn't 8 bytes on this platform"); + + GLM_STATIC_ASSERT(sizeof(glm::detail::uint8) == 1, "uint8 size isn't 1 byte on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::uint16) == 2, "uint16 size isn't 2 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::uint32) == 4, "uint32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::uint64) == 8, "uint64 size isn't 8 bytes on this platform"); + + GLM_STATIC_ASSERT(sizeof(glm::detail::float16) == 2, "float16 size isn't 2 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::float32) == 4, "float32 size isn't 4 bytes on this platform"); + GLM_STATIC_ASSERT(sizeof(glm::detail::float64) == 8, "float64 size isn't 8 bytes on this platform"); +#endif//GLM_STATIC_ASSERT_NULL #endif //glm_glm diff --git a/glm/setup.hpp b/glm/setup.hpp index 65c4c071..29c9a2f8 100644 --- a/glm/setup.hpp +++ b/glm/setup.hpp @@ -365,6 +365,7 @@ # define GLM_STATIC_ASSERT(x, message) typedef char __CASSERT__##__LINE__[(x) ? 1 : -1] #else # define GLM_STATIC_ASSERT(x, message) +# define GLM_STATIC_ASSERT_NULL #endif//GLM_LANG /////////////////////////////////////////////////////////////////////////////////////////////////// From ce78b77f860a5cc7b7f46cd5d588fa6c575c07d7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 21 Feb 2011 15:03:01 +0000 Subject: [PATCH 3/8] Improved alignment --- glm/core/_detail.hpp | 5 ++++- glm/gtx/simd_mat4.hpp | 2 +- glm/gtx/simd_vec4.hpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index ed18de40..55e4fc02 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -333,11 +333,13 @@ namespace detail #if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005)) # define GLM_DEPRECATED __declspec(deprecated) # define GLM_ALIGN(x) __declspec(align(x)) +# define GLM_ALIGNED_STRUCT(x) __declspec(align(x)) struct # define GLM_RESTRICT __declspec(restrict) # define GLM_RESTRICT_VAR __restrict #elif((GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC31)) # define GLM_DEPRECATED __attribute__((__deprecated__)) # define GLM_ALIGN(x) __attribute__((aligned(x))) +# define GLM_ALIGNED_STRUCT(x) struct __attribute__((aligned(x))) # if(GLM_COMPILER >= GLM_COMPILER_GCC33) # define GLM_RESTRICT __restrict__ # define GLM_RESTRICT_VAR __restrict__ @@ -349,7 +351,8 @@ namespace detail # define GLM_RESTRICT_VAR __restrict__ #else # define GLM_DEPRECATED -# define GLM_ALIGN(x) +# define GLM_ALIGN +# define GLM_ALIGNED_STRUCT(x) # define GLM_RESTRICT # define GLM_RESTRICT_VAR #endif//GLM_COMPILER diff --git a/glm/gtx/simd_mat4.hpp b/glm/gtx/simd_mat4.hpp index 9c85fd66..07ef9cf5 100644 --- a/glm/gtx/simd_mat4.hpp +++ b/glm/gtx/simd_mat4.hpp @@ -34,7 +34,7 @@ namespace glm { /// 4x4 Matrix implemented using SIMD SEE intrinsics. /// \ingroup gtx_simd_mat4 - GLM_ALIGN(16) struct fmat4x4SIMD + GLM_ALIGNED_STRUCT(16) fmat4x4SIMD { enum ctor{null}; diff --git a/glm/gtx/simd_vec4.hpp b/glm/gtx/simd_vec4.hpp index bfd1d5fa..83bba03b 100644 --- a/glm/gtx/simd_vec4.hpp +++ b/glm/gtx/simd_vec4.hpp @@ -34,7 +34,7 @@ namespace glm { /// 4-dimensional vector implemented using SIMD SEE intrinsics. /// \ingroup gtx_simd_vec4 - GLM_ALIGN(4) struct fvec4SIMD + GLM_ALIGNED_STRUCT(4) fvec4SIMD { enum ctor{null}; typedef __m128 value_type; From ad84fb61f5889d97c3ec4a43809bd5eef1f1e4f7 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 21 Feb 2011 15:23:10 +0000 Subject: [PATCH 4/8] Fixed ticket #44 with name collision --- glm/core/_fixes.hpp | 18 ++++++++++++++++++ glm/core/func_common.hpp | 2 ++ glm/glm.hpp | 14 +++----------- 3 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 glm/core/_fixes.hpp diff --git a/glm/core/_fixes.hpp b/glm/core/_fixes.hpp new file mode 100644 index 00000000..ba708003 --- /dev/null +++ b/glm/core/_fixes.hpp @@ -0,0 +1,18 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2011-02-21 +// Updated : 2011-02-21 +// Licence : This source is under MIT License +// File : glm/core/_fixes.hpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +//! Workaround for compatibility with other libraries +#ifdef max +#undef max +#endif + +//! Workaround for compatibility with other libraries +#ifdef min +#undef min +#endif diff --git a/glm/core/func_common.hpp b/glm/core/func_common.hpp index df3ac062..c9cdc8ba 100644 --- a/glm/core/func_common.hpp +++ b/glm/core/func_common.hpp @@ -10,6 +10,8 @@ #ifndef glm_core_func_common #define glm_core_func_common +#include "_fixes.hpp" + namespace glm { namespace test{ diff --git a/glm/glm.hpp b/glm/glm.hpp index 67b20753..26a182ba 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -7,19 +7,11 @@ // File : glm/glm.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// +#include "core/_fixes.hpp" + #ifndef glm_glm #define glm_glm -//! Workaround for compatibility with other libraries -#ifdef max -#undef max -#endif - -//! Workaround for compatibility with other libraries -#ifdef min -#undef min -#endif - //! TODO: to delete #define GLMvalType typename genType::value_type //#define GLMcolType typename genType::col_type @@ -29,7 +21,7 @@ #include #include #include -#include "./setup.hpp" +#include "setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED)) # define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED From ecdbdf753cc150e7a7afca83b5e3db0e94b7c554 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 21 Feb 2011 15:24:01 +0000 Subject: [PATCH 5/8] Fixed ticket #52, namespace collision --- glm/gtc/matrix_inverse.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glm/gtc/matrix_inverse.inl b/glm/gtc/matrix_inverse.inl index e27eb301..9cd81fa1 100644 --- a/glm/gtc/matrix_inverse.inl +++ b/glm/gtc/matrix_inverse.inl @@ -8,7 +8,7 @@ /////////////////////////////////////////////////////////////////////////////////////////////////// namespace glm{ -namespace gtx{ +namespace gtc{ namespace matrix_inverse { template @@ -135,5 +135,5 @@ namespace matrix_inverse } }//namespace matrix_inverse -}//namespace gtx +}//namespace gtc }//namespace glm From 418088a947c204daa4af49366c4bdb856f81f70f Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 22 Feb 2011 01:22:38 +0000 Subject: [PATCH 6/8] Moved setup.hpp --- glm/core/_detail.hpp | 2 +- glm/core/intrinsic_common.hpp | 2 +- glm/core/intrinsic_geometric.hpp | 2 +- glm/{ => core}/setup.hpp | 0 glm/core/type_float.hpp | 2 +- glm/core/type_int.hpp | 2 +- glm/glm.hpp | 2 +- 7 files changed, 6 insertions(+), 6 deletions(-) rename glm/{ => core}/setup.hpp (100%) diff --git a/glm/core/_detail.hpp b/glm/core/_detail.hpp index 55e4fc02..9b36a921 100644 --- a/glm/core/_detail.hpp +++ b/glm/core/_detail.hpp @@ -10,7 +10,7 @@ #ifndef glm_core_detail #define glm_core_detail -#include "../setup.hpp" +#include "setup.hpp" #include namespace glm{ diff --git a/glm/core/intrinsic_common.hpp b/glm/core/intrinsic_common.hpp index 9028b4e7..ec2516e5 100644 --- a/glm/core/intrinsic_common.hpp +++ b/glm/core/intrinsic_common.hpp @@ -10,7 +10,7 @@ #ifndef glm_detail_intrinsic_common #define glm_detail_intrinsic_common -#include "../setup.hpp" +#include "setup.hpp" #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) # error "SSE2 instructions not supported or enabled" diff --git a/glm/core/intrinsic_geometric.hpp b/glm/core/intrinsic_geometric.hpp index 3791e6df..d640774b 100644 --- a/glm/core/intrinsic_geometric.hpp +++ b/glm/core/intrinsic_geometric.hpp @@ -10,7 +10,7 @@ #ifndef glm_core_intrinsic_geometric #define glm_core_intrinsic_geometric -#include "../setup.hpp" +#include "setup.hpp" #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) # error "SSE2 instructions not supported or enabled" diff --git a/glm/setup.hpp b/glm/core/setup.hpp similarity index 100% rename from glm/setup.hpp rename to glm/core/setup.hpp diff --git a/glm/core/type_float.hpp b/glm/core/type_float.hpp index 43aabb41..b62c7755 100644 --- a/glm/core/type_float.hpp +++ b/glm/core/type_float.hpp @@ -11,7 +11,7 @@ #define glm_core_type_float #include "type_half.hpp" -#include "../setup.hpp" +#include "setup.hpp" namespace glm { diff --git a/glm/core/type_int.hpp b/glm/core/type_int.hpp index 3f7aa0ab..6903c2b0 100644 --- a/glm/core/type_int.hpp +++ b/glm/core/type_int.hpp @@ -10,7 +10,7 @@ #ifndef glm_core_type_int #define glm_core_type_int -#include "../setup.hpp" +#include "setup.hpp" #include "_detail.hpp" namespace glm diff --git a/glm/glm.hpp b/glm/glm.hpp index 26a182ba..ac418334 100644 --- a/glm/glm.hpp +++ b/glm/glm.hpp @@ -21,7 +21,7 @@ #include #include #include -#include "setup.hpp" +#include "core/setup.hpp" #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_CORE_INCLUDED_DISPLAYED)) # define GLM_MESSAGE_CORE_INCLUDED_DISPLAYED From a0b07465a7b3711613196675060db1576aa3697f Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 22 Feb 2011 10:13:20 +0000 Subject: [PATCH 7/8] Fixed setup moved --- glm/core/intrinsic_exponential.hpp | 2 +- glm/core/intrinsic_matrix.hpp | 2 +- glm/core/intrinsic_trigonometric.hpp | 2 +- glm/core/intrinsic_vector_relational.hpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/core/intrinsic_exponential.hpp b/glm/core/intrinsic_exponential.hpp index 385e1fe0..317395c5 100644 --- a/glm/core/intrinsic_exponential.hpp +++ b/glm/core/intrinsic_exponential.hpp @@ -10,7 +10,7 @@ #ifndef glm_detail_intrinsic_exponential #define glm_detail_intrinsic_exponential -#include "../setup.hpp" +#include "setup.hpp" #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) # error "SSE2 instructions not supported or enabled" diff --git a/glm/core/intrinsic_matrix.hpp b/glm/core/intrinsic_matrix.hpp index 36414e29..7bb4bd17 100644 --- a/glm/core/intrinsic_matrix.hpp +++ b/glm/core/intrinsic_matrix.hpp @@ -10,7 +10,7 @@ #ifndef glm_detail_intrinsic_matrix #define glm_detail_intrinsic_matrix -#include "../setup.hpp" +#include "setup.hpp" #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) # error "SSE2 instructions not supported or enabled" diff --git a/glm/core/intrinsic_trigonometric.hpp b/glm/core/intrinsic_trigonometric.hpp index 6e4d532c..cdd82c46 100644 --- a/glm/core/intrinsic_trigonometric.hpp +++ b/glm/core/intrinsic_trigonometric.hpp @@ -10,7 +10,7 @@ #ifndef glm_detail_intrinsic_trigonometric #define glm_detail_intrinsic_trigonometric -#include "../setup.hpp" +#include "setup.hpp" #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) # error "SSE2 instructions not supported or enabled" diff --git a/glm/core/intrinsic_vector_relational.hpp b/glm/core/intrinsic_vector_relational.hpp index 5d6c1a7a..e53817a4 100644 --- a/glm/core/intrinsic_vector_relational.hpp +++ b/glm/core/intrinsic_vector_relational.hpp @@ -10,7 +10,7 @@ #ifndef glm_detail_intrinsic_vector_relational #define glm_detail_intrinsic_vector_relational -#include "../setup.hpp" +#include "setup.hpp" #if((GLM_ARCH & GLM_ARCH_SSE2) != GLM_ARCH_SSE2) # error "SSE2 instructions not supported or enabled" From 71a1df278047067b0865044757c44290d946d018 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 22 Feb 2011 10:30:54 +0000 Subject: [PATCH 8/8] Fixed ticket #45 missing iline --- glm/gtx/simd_vec4.inl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glm/gtx/simd_vec4.inl b/glm/gtx/simd_vec4.inl index ae5a250f..e8261fcb 100644 --- a/glm/gtx/simd_vec4.inl +++ b/glm/gtx/simd_vec4.inl @@ -285,7 +285,7 @@ namespace glm //{ // return max(-a, a); //} - detail::fvec4SIMD abs + inline detail::fvec4SIMD abs ( detail::fvec4SIMD const & x )