From 28aba540ee8d02ab384639dc16c05d7fb008243e Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 1 Dec 2014 20:27:56 +0100 Subject: [PATCH 01/65] Fixed scalar uaddCarry build error with Cuda #276 --- glm/detail/func_integer.inl | 2 +- readme.txt | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/glm/detail/func_integer.inl b/glm/detail/func_integer.inl index f84304e5..cc1c4d33 100644 --- a/glm/detail/func_integer.inl +++ b/glm/detail/func_integer.inl @@ -203,7 +203,7 @@ namespace detail GLM_FUNC_QUALIFIER uint uaddCarry(uint const & x, uint const & y, uint & Carry) { uint64 const Value64(static_cast(x) + static_cast(y)); - uint64 const Max32(static_cast(std::numeric_limits::max())); + uint64 const Max32((static_cast(1) << static_cast(32)) - static_cast(1)); Carry = Value64 > Max32 ? 1 : 0; return static_cast(Value64 % (Max32 + static_cast(1))); } diff --git a/readme.txt b/readme.txt index b3cdcd76..cd2bb67d 100644 --- a/readme.txt +++ b/readme.txt @@ -62,6 +62,12 @@ GLM is a header only library, there is nothing to build, just include it. More informations in GLM manual: http://glm.g-truc.net/glm.pdf +================================================================================ +GLM 0.9.6.1: 2014-12-XX +-------------------------------------------------------------------------------- +Fixes: +- Fixed uaddCarry error for Cuda build #276 + ================================================================================ GLM 0.9.6.0: 2014-11-30 -------------------------------------------------------------------------------- From 09083fef056ee12e727e1262e2c649f819a4ac96 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 2 Dec 2014 20:48:26 +0100 Subject: [PATCH 02/65] Added more log2 tests --- readme.txt | 2 +- test/gtc/gtc_integer.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/readme.txt b/readme.txt index cd2bb67d..fec7dd1c 100644 --- a/readme.txt +++ b/readme.txt @@ -66,7 +66,7 @@ http://glm.g-truc.net/glm.pdf GLM 0.9.6.1: 2014-12-XX -------------------------------------------------------------------------------- Fixes: -- Fixed uaddCarry error for Cuda build #276 +- Fixed scalar uaddCarry build error with Cuda #276 ================================================================================ GLM 0.9.6.0: 2014-11-30 diff --git a/test/gtc/gtc_integer.cpp b/test/gtc/gtc_integer.cpp index b306b843..7c2099bd 100644 --- a/test/gtc/gtc_integer.cpp +++ b/test/gtc/gtc_integer.cpp @@ -67,6 +67,18 @@ namespace log2_ Error += glm::all(glm::equal(D0, D1)) ? 0 : 1; Error += glm::all(glm::equal(E0, E1)) ? 0 : 1; + glm::uint64 A2 = glm::log2(glm::uint64(10.f)); + glm::u64vec1 B2 = glm::log2(glm::u64vec1(10.f)); + glm::u64vec2 C2 = glm::log2(glm::u64vec2(10.f)); + glm::u64vec3 D2 = glm::log2(glm::u64vec3(10.f)); + glm::u64vec4 E2 = glm::log2(glm::u64vec4(10.f)); + + Error += A2 == glm::uint64(1) ? 0 : 1; + Error += glm::all(glm::equal(B2, glm::u64vec1(1))) ? 0 : 1; + Error += glm::all(glm::equal(C2, glm::u64vec2(1))) ? 0 : 1; + Error += glm::all(glm::equal(D2, glm::u64vec3(1))) ? 0 : 1; + Error += glm::all(glm::equal(E2, glm::u64vec4(1))) ? 0 : 1; + return Error; } From 6a1a673b4176752875bcc7457d9f35246d1a3272 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 3 Dec 2014 14:55:47 +0100 Subject: [PATCH 03/65] Fixed C++11 explicit conversion operators detection #282 --- glm/detail/setup.hpp | 8 ++++++++ glm/gtc/quaternion.hpp | 6 ++++-- readme.txt | 1 + 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index 0148f5f9..e2f65e88 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -506,6 +506,14 @@ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC43)) || \ __has_feature(cxx_rvalue_references)) +// N2437 +#define GLM_HAS_EXPLICIT_CONVERSION_OPERATORS ( \ + (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14))) || \ + ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \ + __has_feature(cxx_explicit_conversions) + #define GLM_HAS_STL_ARRAY ( \ (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2010))) || \ diff --git a/glm/gtc/quaternion.hpp b/glm/gtc/quaternion.hpp index 15372cd0..0230bacf 100644 --- a/glm/gtc/quaternion.hpp +++ b/glm/gtc/quaternion.hpp @@ -113,8 +113,10 @@ namespace glm # endif // explicit conversion operators - GLM_FUNC_DECL explicit operator tmat3x3(); - GLM_FUNC_DECL explicit operator tmat4x4(); +# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS + GLM_FUNC_DECL explicit operator tmat3x3(); + GLM_FUNC_DECL explicit operator tmat4x4(); +# endif /// Create a quaternion from two normalized axis /// diff --git a/readme.txt b/readme.txt index fec7dd1c..97a40c66 100644 --- a/readme.txt +++ b/readme.txt @@ -67,6 +67,7 @@ GLM 0.9.6.1: 2014-12-XX -------------------------------------------------------------------------------- Fixes: - Fixed scalar uaddCarry build error with Cuda #276 +- Fixed C++11 explicit conversion operators detection #282 ================================================================================ GLM 0.9.6.0: 2014-11-30 From 38d99978abc700e09c520ab99dca6d54c4f9306b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 3 Dec 2014 21:48:41 +0100 Subject: [PATCH 04/65] Fixed C++11 explicit conversion operators detection #282 --- glm/detail/setup.hpp | 2 +- glm/gtc/quaternion.inl | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/glm/detail/setup.hpp b/glm/detail/setup.hpp index e2f65e88..a32406d5 100644 --- a/glm/detail/setup.hpp +++ b/glm/detail/setup.hpp @@ -512,7 +512,7 @@ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2013))) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && ((GLM_COMPILER & GLM_COMPILER_INTEL) && (GLM_COMPILER >= GLM_COMPILER_INTEL14))) || \ ((GLM_LANG & GLM_LANG_CXX0X_FLAG) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC45)) || \ - __has_feature(cxx_explicit_conversions) + __has_feature(cxx_explicit_conversions)) #define GLM_HAS_STL_ARRAY ( \ (GLM_LANG & GLM_LANG_CXX11_FLAG) || \ diff --git a/glm/gtc/quaternion.inl b/glm/gtc/quaternion.inl index d9615ce1..3eb598ce 100644 --- a/glm/gtc/quaternion.inl +++ b/glm/gtc/quaternion.inl @@ -190,7 +190,8 @@ namespace detail { *this = quat_cast(m); } - + +# if GLM_HAS_EXPLICIT_CONVERSION_OPERATORS template GLM_FUNC_QUALIFIER tquat::operator tmat3x3() { @@ -202,6 +203,7 @@ namespace detail { return mat4_cast(*this); } +# endif//GLM_HAS_EXPLICIT_CONVERSION_OPERATORS template GLM_FUNC_QUALIFIER tquat conjugate(tquat const & q) From f026e722ee210b45f0c77e6def7113551efdc058 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 3 Dec 2014 23:23:24 +0100 Subject: [PATCH 05/65] Fixed missing explicit convertion when using integer log2 with *vec1 types --- glm/gtc/integer.inl | 2 +- readme.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/glm/gtc/integer.inl b/glm/gtc/integer.inl index 5a23f0b2..c7bb36d8 100644 --- a/glm/gtc/integer.inl +++ b/glm/gtc/integer.inl @@ -40,7 +40,7 @@ namespace detail { //Equivalent to return findMSB(vec); but save one function call in ASM with VC //return findMSB(vec); - return detail::compute_findMSB_vec::call(vec); + return vecType(detail::compute_findMSB_vec::call(vec)); } }; diff --git a/readme.txt b/readme.txt index 97a40c66..5027ddff 100644 --- a/readme.txt +++ b/readme.txt @@ -68,6 +68,7 @@ GLM 0.9.6.1: 2014-12-XX Fixes: - Fixed scalar uaddCarry build error with Cuda #276 - Fixed C++11 explicit conversion operators detection #282 +- Fixed missing explicit convertion when using integer log2 with *vec1 types ================================================================================ GLM 0.9.6.0: 2014-11-30 From bd2601f12a223ba310de41269fcf88b0cb41d829 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 4 Dec 2014 00:27:49 +0100 Subject: [PATCH 06/65] Removed warnings --- test/gtc/gtc_integer.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/gtc/gtc_integer.cpp b/test/gtc/gtc_integer.cpp index 7c2099bd..7c00c314 100644 --- a/test/gtc/gtc_integer.cpp +++ b/test/gtc/gtc_integer.cpp @@ -49,17 +49,17 @@ namespace log2_ { int Error = 0; - int A0(glm::log2(10.f)); + int A0 = static_cast(glm::log2(10.f)); glm::ivec1 B0(glm::log2(glm::vec1(10.f))); glm::ivec2 C0(glm::log2(glm::vec2(10.f))); glm::ivec3 D0(glm::log2(glm::vec3(10.f))); glm::ivec4 E0(glm::log2(glm::vec4(10.f))); - int A1 = glm::log2(int(10.f)); - glm::ivec1 B1 = glm::log2(glm::ivec1(10.f)); - glm::ivec2 C1 = glm::log2(glm::ivec2(10.f)); - glm::ivec3 D1 = glm::log2(glm::ivec3(10.f)); - glm::ivec4 E1 = glm::log2(glm::ivec4(10.f)); + int A1 = glm::log2(int(10)); + glm::ivec1 B1 = glm::log2(glm::ivec1(10)); + glm::ivec2 C1 = glm::log2(glm::ivec2(10)); + glm::ivec3 D1 = glm::log2(glm::ivec3(10)); + glm::ivec4 E1 = glm::log2(glm::ivec4(10)); Error += A0 == A1 ? 0 : 1; Error += glm::all(glm::equal(B0, B1)) ? 0 : 1; @@ -67,11 +67,11 @@ namespace log2_ Error += glm::all(glm::equal(D0, D1)) ? 0 : 1; Error += glm::all(glm::equal(E0, E1)) ? 0 : 1; - glm::uint64 A2 = glm::log2(glm::uint64(10.f)); - glm::u64vec1 B2 = glm::log2(glm::u64vec1(10.f)); - glm::u64vec2 C2 = glm::log2(glm::u64vec2(10.f)); - glm::u64vec3 D2 = glm::log2(glm::u64vec3(10.f)); - glm::u64vec4 E2 = glm::log2(glm::u64vec4(10.f)); + glm::uint64 A2 = glm::log2(glm::uint64(10)); + glm::u64vec1 B2 = glm::log2(glm::u64vec1(10)); + glm::u64vec2 C2 = glm::log2(glm::u64vec2(10)); + glm::u64vec3 D2 = glm::log2(glm::u64vec3(10)); + glm::u64vec4 E2 = glm::log2(glm::u64vec4(10)); Error += A2 == glm::uint64(1) ? 0 : 1; Error += glm::all(glm::equal(B2, glm::u64vec1(1))) ? 0 : 1; @@ -93,7 +93,7 @@ namespace log2_ std::clock_t Begin = clock(); - for(std::size_t i = 0; i < Count; ++i) + for(int i = 0; i < static_cast(Count); ++i) Result[i] = glm::log2(static_cast(i)); std::clock_t End = clock(); @@ -107,7 +107,7 @@ namespace log2_ std::clock_t Begin = clock(); - for(std::size_t i = 0; i < Count; ++i) + for(int i = 0; i < static_cast(Count); ++i) Result[i] = glm::log2(glm::ivec4(i)); std::clock_t End = clock(); @@ -198,7 +198,7 @@ namespace log2_ std::clock_t Begin = clock(); - for(std::size_t i = 0; i < Count; ++i) + for(int i = 0; i < static_cast(Count); ++i) Result[i] = glm::log2(glm::vec4(i)); std::clock_t End = clock(); From e1a9702097cb12c611fb5003626d4a136c67c4e3 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Thu, 4 Dec 2014 22:47:30 +0100 Subject: [PATCH 07/65] Fixed GTC_integer test --- test/gtc/gtc_integer.cpp | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/test/gtc/gtc_integer.cpp b/test/gtc/gtc_integer.cpp index 7c00c314..c63e84fd 100644 --- a/test/gtc/gtc_integer.cpp +++ b/test/gtc/gtc_integer.cpp @@ -49,17 +49,17 @@ namespace log2_ { int Error = 0; - int A0 = static_cast(glm::log2(10.f)); - glm::ivec1 B0(glm::log2(glm::vec1(10.f))); - glm::ivec2 C0(glm::log2(glm::vec2(10.f))); - glm::ivec3 D0(glm::log2(glm::vec3(10.f))); - glm::ivec4 E0(glm::log2(glm::vec4(10.f))); + int A0 = static_cast(glm::log2(16.f)); + glm::ivec1 B0(glm::log2(glm::vec1(16.f))); + glm::ivec2 C0(glm::log2(glm::vec2(16.f))); + glm::ivec3 D0(glm::log2(glm::vec3(16.f))); + glm::ivec4 E0(glm::log2(glm::vec4(16.f))); - int A1 = glm::log2(int(10)); - glm::ivec1 B1 = glm::log2(glm::ivec1(10)); - glm::ivec2 C1 = glm::log2(glm::ivec2(10)); - glm::ivec3 D1 = glm::log2(glm::ivec3(10)); - glm::ivec4 E1 = glm::log2(glm::ivec4(10)); + int A1 = glm::log2(int(16)); + glm::ivec1 B1 = glm::log2(glm::ivec1(16)); + glm::ivec2 C1 = glm::log2(glm::ivec2(16)); + glm::ivec3 D1 = glm::log2(glm::ivec3(16)); + glm::ivec4 E1 = glm::log2(glm::ivec4(16)); Error += A0 == A1 ? 0 : 1; Error += glm::all(glm::equal(B0, B1)) ? 0 : 1; @@ -67,17 +67,17 @@ namespace log2_ Error += glm::all(glm::equal(D0, D1)) ? 0 : 1; Error += glm::all(glm::equal(E0, E1)) ? 0 : 1; - glm::uint64 A2 = glm::log2(glm::uint64(10)); - glm::u64vec1 B2 = glm::log2(glm::u64vec1(10)); - glm::u64vec2 C2 = glm::log2(glm::u64vec2(10)); - glm::u64vec3 D2 = glm::log2(glm::u64vec3(10)); - glm::u64vec4 E2 = glm::log2(glm::u64vec4(10)); + glm::uint64 A2 = glm::log2(glm::uint64(16)); + glm::u64vec1 B2 = glm::log2(glm::u64vec1(16)); + glm::u64vec2 C2 = glm::log2(glm::u64vec2(16)); + glm::u64vec3 D2 = glm::log2(glm::u64vec3(16)); + glm::u64vec4 E2 = glm::log2(glm::u64vec4(16)); - Error += A2 == glm::uint64(1) ? 0 : 1; - Error += glm::all(glm::equal(B2, glm::u64vec1(1))) ? 0 : 1; - Error += glm::all(glm::equal(C2, glm::u64vec2(1))) ? 0 : 1; - Error += glm::all(glm::equal(D2, glm::u64vec3(1))) ? 0 : 1; - Error += glm::all(glm::equal(E2, glm::u64vec4(1))) ? 0 : 1; + Error += A2 == glm::uint64(4) ? 0 : 1; + Error += glm::all(glm::equal(B2, glm::u64vec1(4))) ? 0 : 1; + Error += glm::all(glm::equal(C2, glm::u64vec2(4))) ? 0 : 1; + Error += glm::all(glm::equal(D2, glm::u64vec3(4))) ? 0 : 1; + Error += glm::all(glm::equal(E2, glm::u64vec4(4))) ? 0 : 1; return Error; } From 732b40c251eafbd034abeebe7731c818e5591193 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Fri, 5 Dec 2014 18:09:48 +0100 Subject: [PATCH 08/65] Fixed 64 bits integer GTX_string_cast to_string on VC 32 bit compiler --- glm/gtx/string_cast.inl | 74 ++++++++++++++++++++++++++++------------- readme.txt | 1 + 2 files changed, 51 insertions(+), 24 deletions(-) diff --git a/glm/gtx/string_cast.inl b/glm/gtx/string_cast.inl index a898b542..24d1b3b4 100644 --- a/glm/gtx/string_cast.inl +++ b/glm/gtx/string_cast.inl @@ -59,73 +59,99 @@ namespace detail static const char* True = "true"; static const char* False = "false"; + template + struct literal + { + GLM_FUNC_QUALIFIER static char const * value() {return "%d";}; + }; + + template + struct literal + { + GLM_FUNC_QUALIFIER static char const * value() {return "%f";}; + }; + +# if GLM_MODEL == GLM_MODEL_32 && GLM_COMPILER && GLM_COMPILER_VC + template <> + struct literal + { + GLM_FUNC_QUALIFIER static char const * value() {return "%lld";}; + }; + + template <> + struct literal + { + GLM_FUNC_QUALIFIER static char const * value() {return "%lld";}; + }; +# endif//GLM_MODEL == GLM_MODEL_32 && GLM_COMPILER && GLM_COMPILER_VC + template struct prefix{}; template <> struct prefix { - static char const * value() {return "";}; + GLM_FUNC_QUALIFIER static char const * value() {return "";}; }; template <> struct prefix { - static char const * value() {return "d";}; + GLM_FUNC_QUALIFIER static char const * value() {return "d";}; }; template <> struct prefix { - static char const * value() {return "b";}; + GLM_FUNC_QUALIFIER static char const * value() {return "b";}; }; template <> struct prefix { - static char const * value() {return "u8";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u8";}; }; template <> struct prefix { - static char const * value() {return "i8";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i8";}; }; template <> struct prefix { - static char const * value() {return "u16";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u16";}; }; template <> struct prefix { - static char const * value() {return "i16";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i16";}; }; template <> struct prefix { - static char const * value() {return "u";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u";}; }; template <> struct prefix { - static char const * value() {return "i";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i";}; }; template <> struct prefix { - static char const * value() {return "u64";}; + GLM_FUNC_QUALIFIER static char const * value() {return "u64";}; }; template <> struct prefix { - static char const * value() {return "i64";}; + GLM_FUNC_QUALIFIER static char const * value() {return "i64";}; }; template