From 58dc29a8602e60589fdf0609dabe1964251c56ad Mon Sep 17 00:00:00 2001 From: tszirr Date: Fri, 14 Jun 2013 16:38:58 +0200 Subject: [PATCH 01/11] fix: subscript swizzles in cuda device code --- glm/core/_swizzle.hpp | 62 +++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index 5a522fef..c6af9a4e 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -60,8 +60,8 @@ namespace detail typedef T value_type; protected: - value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } - const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } + GLM_FUNC_QUALIFIER value_type& elem (size_t i) { return (reinterpret_cast(_buffer))[i]; } + GLM_FUNC_QUALIFIER const value_type& elem (size_t i) const { return (reinterpret_cast(_buffer))[i]; } // Use an opaque buffer to *ensure* the compiler doesn't call a constructor. // The size 1 buffer is assumed to aligned to the actual members so that the @@ -77,19 +77,19 @@ namespace detail template struct _swizzle_base1 : public _swizzle_base0 { - V operator ()() const { return V(this->elem(E0), this->elem(E1)); } + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1)); } }; template struct _swizzle_base1 : public _swizzle_base0 { - V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2)); } }; template struct _swizzle_base1 : public _swizzle_base0 { - V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } + GLM_FUNC_QUALIFIER V operator ()() const { return V(this->elem(E0), this->elem(E1), this->elem(E2), this->elem(E3)); } }; // Internal class for implementing swizzle operators @@ -110,14 +110,14 @@ namespace detail typedef VecType vec_type; typedef ValueType value_type; - _swizzle_base2& operator= (const ValueType& t) + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const ValueType& t) { for (int i = 0; i < N; ++i) (*this)[i] = t; return *this; } - _swizzle_base2& operator= (const VecType& that) + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) { struct op { void operator() (value_type& e, value_type& t) { e = t; } @@ -126,7 +126,7 @@ namespace detail return *this; } - void operator -= (const VecType& that) + GLM_FUNC_QUALIFIER void operator -= (const VecType& that) { struct op { void operator() (value_type& e, value_type& t) { e -= t; } @@ -134,7 +134,7 @@ namespace detail _apply_op(that, op()); } - void operator += (const VecType& that) + GLM_FUNC_QUALIFIER void operator += (const VecType& that) { struct op { void operator() (value_type& e, value_type& t) { e += t; } @@ -142,7 +142,7 @@ namespace detail _apply_op(that, op()); } - void operator *= (const VecType& that) + GLM_FUNC_QUALIFIER void operator *= (const VecType& that) { struct op { void operator() (value_type& e, value_type& t) { e *= t; } @@ -150,7 +150,7 @@ namespace detail _apply_op(that, op()); } - void operator /= (const VecType& that) + GLM_FUNC_QUALIFIER void operator /= (const VecType& that) { struct op { void operator() (value_type& e, value_type& t) { e /= t; } @@ -158,19 +158,19 @@ namespace detail _apply_op(that, op()); } - value_type& operator[] (size_t i) + GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) { static const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } - value_type operator[] (size_t i) const + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { static const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } protected: template - void _apply_op(const VecType& that, T op) + GLM_FUNC_QUALIFIER void _apply_op(const VecType& that, T op) { // Make a copy of the data in this == &that. // The copier should optimize out the copy in cases where the function is @@ -191,9 +191,9 @@ namespace detail typedef ValueType value_type; struct Stub {}; - _swizzle_base2& operator= (Stub const &) { return *this; } + GLM_FUNC_QUALIFIER _swizzle_base2& operator= (Stub const &) { return *this; } - value_type operator[] (size_t i) const + GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { static const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); @@ -207,7 +207,7 @@ namespace detail using base_type::operator=; - operator VecType () const { return (*this)(); } + GLM_FUNC_QUALIFIER operator VecType () const { return (*this)(); } }; // @@ -223,17 +223,17 @@ namespace detail // #define _GLM_SWIZZLE_VECTOR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ _GLM_SWIZZLE_TEMPLATE2 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ { \ return a() OPERAND b(); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const V& b) \ { \ return a() OPERAND b; \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const V& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return a OPERAND b(); \ } @@ -243,12 +243,12 @@ namespace detail // #define _GLM_SWIZZLE_SCALAR_BINARY_OPERATOR_IMPLEMENTATION(OPERAND) \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const _GLM_SWIZZLE_TYPE1& a, const T& b) \ { \ return a() OPERAND b; \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER V operator OPERAND ( const T& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return a OPERAND b(); \ } @@ -258,7 +258,7 @@ namespace detail // #define _GLM_SWIZZLE_FUNCTION_1_ARGS(RETURN_TYPE,FUNCTION) \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a) \ { \ return FUNCTION(a()); \ } @@ -268,22 +268,22 @@ namespace detail // #define _GLM_SWIZZLE_FUNCTION_2_ARGS(RETURN_TYPE,FUNCTION) \ _GLM_SWIZZLE_TEMPLATE2 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b) \ { \ return FUNCTION(a(), b()); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return FUNCTION(a(), b()); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename V& b) \ { \ return FUNCTION(a(), b); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const V& a, const _GLM_SWIZZLE_TYPE1& b) \ { \ return FUNCTION(a, b()); \ } @@ -293,22 +293,22 @@ namespace detail // #define _GLM_SWIZZLE_FUNCTION_2_ARGS_SCALAR(RETURN_TYPE,FUNCTION) \ _GLM_SWIZZLE_TEMPLATE2 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE2& b, const T& c) \ { \ return FUNCTION(a(), b(), c); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ { \ return FUNCTION(a(), b(), c); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const _GLM_SWIZZLE_TYPE1& a, const typename S0::vec_type& b, const T& c)\ { \ return FUNCTION(a(), b, c); \ } \ _GLM_SWIZZLE_TEMPLATE1 \ - typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ + GLM_FUNC_QUALIFIER typename _GLM_SWIZZLE_TYPE1::RETURN_TYPE FUNCTION(const typename V& a, const _GLM_SWIZZLE_TYPE1& b, const T& c) \ { \ return FUNCTION(a, b(), c); \ } From b016594ac3a39636ddae30035f99a25f2a8d0f4a Mon Sep 17 00:00:00 2001 From: tszirr Date: Mon, 17 Jun 2013 10:49:02 +0200 Subject: [PATCH 02/11] fix: function-local static arrays unsupported in cuda device code --- glm/core/_swizzle.hpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index c6af9a4e..8edadd70 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -160,12 +160,18 @@ namespace detail GLM_FUNC_QUALIFIER value_type& operator[] (size_t i) { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } protected: @@ -195,7 +201,10 @@ namespace detail GLM_FUNC_QUALIFIER value_type operator[] (size_t i) const { - static const int offset_dst[4] = { E0, E1, E2, E3 }; +#ifndef __CUDA_ARCH__ + static +#endif + const int offset_dst[4] = { E0, E1, E2, E3 }; return this->elem(offset_dst[i]); } }; From 5a48614f57cff4318b922efa6e6ef40863c33b39 Mon Sep 17 00:00:00 2001 From: tszirr Date: Fri, 21 Jun 2013 17:17:34 +0200 Subject: [PATCH 03/11] fix: component declaration order -> debug display order! --- glm/core/type_vec2.hpp | 8 ++++---- glm/core/type_vec3.hpp | 8 ++++---- glm/core/type_vec4.hpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 97b9fa8f..3f8083d8 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -62,6 +62,10 @@ namespace detail # if(GLM_COMPONENT == GLM_COMPONENT_CXX11) union { + struct{value_type x, y;}; + struct{value_type r, g;}; + struct{value_type s, t;}; + # if(defined(GLM_SWIZZLE)) _GLM_SWIZZLE2_2_MEMBERS(value_type, glm::detail::tvec2, x, y) _GLM_SWIZZLE2_2_MEMBERS(value_type, glm::detail::tvec2, r, g) @@ -73,10 +77,6 @@ namespace detail _GLM_SWIZZLE2_4_MEMBERS(value_type, glm::detail::tvec4, r, g) _GLM_SWIZZLE2_4_MEMBERS(value_type, glm::detail::tvec4, s, t) # endif//(defined(GLM_SWIZZLE)) - - struct{value_type r, g;}; - struct{value_type s, t;}; - struct{value_type x, y;}; }; # elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) union {value_type x, r, s;}; diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 26c9a219..7165fa5d 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -62,6 +62,10 @@ namespace detail # if(GLM_COMPONENT == GLM_COMPONENT_CXX11) union { + struct{value_type x, y, z;}; + struct{value_type r, g, b;}; + struct{value_type s, t, p;}; + # if(defined(GLM_SWIZZLE)) _GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2, x, y, z) _GLM_SWIZZLE3_2_MEMBERS(value_type, glm::detail::tvec2, r, g, b) @@ -73,10 +77,6 @@ namespace detail _GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4, r, g, b) _GLM_SWIZZLE3_4_MEMBERS(value_type, glm::detail::tvec4, s, t, p) # endif//(defined(GLM_SWIZZLE)) - - struct{value_type r, g, b;}; - struct{value_type s, t, p;}; - struct{value_type x, y, z;}; }; # elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) union {value_type x, r, s;}; diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index d7d092a2..c8860e22 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -62,6 +62,10 @@ namespace detail # if(GLM_COMPONENT == GLM_COMPONENT_CXX11) union { + struct{value_type x, y, z, w;}; + struct{value_type r, g, b, a;}; + struct{value_type s, t, p, q;}; + # if(defined(GLM_SWIZZLE)) _GLM_SWIZZLE4_2_MEMBERS(value_type, glm::detail::tvec2, x, y, z, w) _GLM_SWIZZLE4_2_MEMBERS(value_type, glm::detail::tvec2, r, g, b, a) @@ -73,10 +77,6 @@ namespace detail _GLM_SWIZZLE4_4_MEMBERS(value_type, glm::detail::tvec4, r, g, b, a) _GLM_SWIZZLE4_4_MEMBERS(value_type, glm::detail::tvec4, s, t, p, q) # endif//(defined(GLM_SWIZZLE)) - - struct{value_type r, g, b, a;}; - struct{value_type s, t, p, q;}; - struct{value_type x, y, z, w;}; }; # elif(GLM_COMPONENT == GLM_COMPONENT_CXX98) union {value_type x, r, s;}; From 2d88860244eb6a92f56d58e27b6d741c986035a1 Mon Sep 17 00:00:00 2001 From: tszirr Date: Mon, 24 Jun 2013 11:45:19 +0200 Subject: [PATCH 04/11] fix: no implicit vector copy --- glm/core/type_vec1.hpp | 4 ++++ glm/core/type_vec1.inl | 4 ++++ glm/core/type_vec2.hpp | 4 ++++ glm/core/type_vec2.inl | 4 ++++ glm/core/type_vec3.hpp | 4 ++++ glm/core/type_vec3.inl | 4 ++++ glm/core/type_vec4.hpp | 4 ++++ glm/core/type_vec4.inl | 4 ++++ 8 files changed, 32 insertions(+) diff --git a/glm/core/type_vec1.hpp b/glm/core/type_vec1.hpp index 395cc789..0bc4d878 100644 --- a/glm/core/type_vec1.hpp +++ b/glm/core/type_vec1.hpp @@ -78,7 +78,9 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec1(); +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec1(tvec1 const & v); +#endif ////////////////////////////////////// // Explicit basic constructors @@ -116,7 +118,9 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec1 & operator= (tvec1 const & v); +#endif template GLM_FUNC_DECL tvec1 & operator= (tvec1 const & v); diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl index 6b12e03d..4fff65e3 100644 --- a/glm/core/type_vec1.inl +++ b/glm/core/type_vec1.inl @@ -73,6 +73,7 @@ namespace detail ) {} +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec1::tvec1 ( @@ -80,6 +81,7 @@ namespace detail ) : x(v.x) {} +#endif ////////////////////////////////////// // Explicit basic constructors @@ -148,6 +150,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec1 & tvec1::operator= ( @@ -157,6 +160,7 @@ namespace detail this->x = v.x; return *this; } +#endif template template diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 97b9fa8f..70572d97 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -107,7 +107,9 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec2(); +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec2(tvec2 const & v); +#endif ////////////////////////////////////// // Explicit basic constructors @@ -160,7 +162,9 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec2 & operator= (tvec2 const & v); +#endif template GLM_FUNC_DECL tvec2 & operator= (tvec2 const & v); diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index fbad911b..c7d53f6e 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -76,6 +76,7 @@ namespace detail ) {} +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec2::tvec2 ( @@ -84,6 +85,7 @@ namespace detail x(v.x), y(v.y) {} +#endif ////////////////////////////////////// // Explicit basic constructors @@ -179,6 +181,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= ( @@ -189,6 +192,7 @@ namespace detail this->y = v.y; return *this; } +#endif template template diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 26c9a219..3efe71d5 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -108,7 +108,9 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec3(); +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec3(tvec3 const & v); +#endif ////////////////////////////////////// // Explicit basic constructors @@ -184,7 +186,9 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v); +#endif template GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v); diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index 3bcf1c8a..0f774b5b 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -77,6 +77,7 @@ namespace detail ) {} +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec3::tvec3 ( @@ -86,6 +87,7 @@ namespace detail y(v.y), z(v.z) {} +#endif ////////////////////////////////////// // Explicit basic constructors @@ -228,6 +230,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec3& tvec3::operator= ( @@ -239,6 +242,7 @@ namespace detail this->z = v.z; return *this; } +#endif template template diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index d7d092a2..98bd732a 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -109,7 +109,9 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec4(type const & v); +#endif ////////////////////////////////////// // Explicit basic constructors @@ -239,7 +241,9 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec4 & operator= (tvec4 const & v); +#endif template GLM_FUNC_DECL tvec4 & operator= (tvec4 const & v); diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index 744d2d0f..a636a6e8 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -78,6 +78,7 @@ namespace detail ) {} +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec4::tvec4 ( @@ -88,6 +89,7 @@ namespace detail z(v.z), w(v.w) {} +#endif ////////////////////////////////////// // Explicit basic constructors @@ -367,6 +369,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators +#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= ( @@ -379,6 +382,7 @@ namespace detail this->w = v.w; return *this; } +#endif template template From 861d6d19331a6224efc3af5e709e23eddaf4259e Mon Sep 17 00:00:00 2001 From: tszirr Date: Fri, 12 Jul 2013 15:29:48 +0200 Subject: [PATCH 05/11] fix: swizzled operations in cuda code --- glm/core/_swizzle.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/glm/core/_swizzle.hpp b/glm/core/_swizzle.hpp index 8edadd70..dc069443 100644 --- a/glm/core/_swizzle.hpp +++ b/glm/core/_swizzle.hpp @@ -120,7 +120,7 @@ namespace detail GLM_FUNC_QUALIFIER _swizzle_base2& operator= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e = t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e = t; } }; _apply_op(that, op()); return *this; @@ -129,7 +129,7 @@ namespace detail GLM_FUNC_QUALIFIER void operator -= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e -= t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e -= t; } }; _apply_op(that, op()); } @@ -137,7 +137,7 @@ namespace detail GLM_FUNC_QUALIFIER void operator += (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e += t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e += t; } }; _apply_op(that, op()); } @@ -145,7 +145,7 @@ namespace detail GLM_FUNC_QUALIFIER void operator *= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e *= t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e *= t; } }; _apply_op(that, op()); } @@ -153,7 +153,7 @@ namespace detail GLM_FUNC_QUALIFIER void operator /= (const VecType& that) { struct op { - void operator() (value_type& e, value_type& t) { e /= t; } + GLM_FUNC_QUALIFIER void operator() (value_type& e, value_type& t) { e /= t; } }; _apply_op(that, op()); } From 968c892f92199c93c60b39f5c02a718e45964dbe Mon Sep 17 00:00:00 2001 From: tszirr Date: Fri, 12 Jul 2013 15:44:02 +0200 Subject: [PATCH 06/11] Revert "fix: no implicit vector copy" Reason: Wrong branch This reverts commit 2d88860244eb6a92f56d58e27b6d741c986035a1. --- glm/core/type_vec1.hpp | 4 ---- glm/core/type_vec1.inl | 4 ---- glm/core/type_vec2.hpp | 4 ---- glm/core/type_vec2.inl | 4 ---- glm/core/type_vec3.hpp | 4 ---- glm/core/type_vec3.inl | 4 ---- glm/core/type_vec4.hpp | 4 ---- glm/core/type_vec4.inl | 4 ---- 8 files changed, 32 deletions(-) diff --git a/glm/core/type_vec1.hpp b/glm/core/type_vec1.hpp index 0bc4d878..395cc789 100644 --- a/glm/core/type_vec1.hpp +++ b/glm/core/type_vec1.hpp @@ -78,9 +78,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec1(); -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec1(tvec1 const & v); -#endif ////////////////////////////////////// // Explicit basic constructors @@ -118,9 +116,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec1 & operator= (tvec1 const & v); -#endif template GLM_FUNC_DECL tvec1 & operator= (tvec1 const & v); diff --git a/glm/core/type_vec1.inl b/glm/core/type_vec1.inl index 4fff65e3..6b12e03d 100644 --- a/glm/core/type_vec1.inl +++ b/glm/core/type_vec1.inl @@ -73,7 +73,6 @@ namespace detail ) {} -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec1::tvec1 ( @@ -81,7 +80,6 @@ namespace detail ) : x(v.x) {} -#endif ////////////////////////////////////// // Explicit basic constructors @@ -150,7 +148,6 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec1 & tvec1::operator= ( @@ -160,7 +157,6 @@ namespace detail this->x = v.x; return *this; } -#endif template template diff --git a/glm/core/type_vec2.hpp b/glm/core/type_vec2.hpp index 61d4a952..3f8083d8 100644 --- a/glm/core/type_vec2.hpp +++ b/glm/core/type_vec2.hpp @@ -107,9 +107,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec2(); -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec2(tvec2 const & v); -#endif ////////////////////////////////////// // Explicit basic constructors @@ -162,9 +160,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec2 & operator= (tvec2 const & v); -#endif template GLM_FUNC_DECL tvec2 & operator= (tvec2 const & v); diff --git a/glm/core/type_vec2.inl b/glm/core/type_vec2.inl index c7d53f6e..fbad911b 100644 --- a/glm/core/type_vec2.inl +++ b/glm/core/type_vec2.inl @@ -76,7 +76,6 @@ namespace detail ) {} -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec2::tvec2 ( @@ -85,7 +84,6 @@ namespace detail x(v.x), y(v.y) {} -#endif ////////////////////////////////////// // Explicit basic constructors @@ -181,7 +179,6 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec2 & tvec2::operator= ( @@ -192,7 +189,6 @@ namespace detail this->y = v.y; return *this; } -#endif template template diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 75640632..7165fa5d 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -108,9 +108,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec3(); -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec3(tvec3 const & v); -#endif ////////////////////////////////////// // Explicit basic constructors @@ -186,9 +184,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v); -#endif template GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v); diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index 0f774b5b..3bcf1c8a 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -77,7 +77,6 @@ namespace detail ) {} -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec3::tvec3 ( @@ -87,7 +86,6 @@ namespace detail y(v.y), z(v.z) {} -#endif ////////////////////////////////////// // Explicit basic constructors @@ -230,7 +228,6 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec3& tvec3::operator= ( @@ -242,7 +239,6 @@ namespace detail this->z = v.z; return *this; } -#endif template template diff --git a/glm/core/type_vec4.hpp b/glm/core/type_vec4.hpp index 48c08188..c8860e22 100644 --- a/glm/core/type_vec4.hpp +++ b/glm/core/type_vec4.hpp @@ -109,9 +109,7 @@ namespace detail // Implicit basic constructors GLM_FUNC_DECL tvec4(); -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec4(type const & v); -#endif ////////////////////////////////////// // Explicit basic constructors @@ -241,9 +239,7 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY GLM_FUNC_DECL tvec4 & operator= (tvec4 const & v); -#endif template GLM_FUNC_DECL tvec4 & operator= (tvec4 const & v); diff --git a/glm/core/type_vec4.inl b/glm/core/type_vec4.inl index a636a6e8..744d2d0f 100644 --- a/glm/core/type_vec4.inl +++ b/glm/core/type_vec4.inl @@ -78,7 +78,6 @@ namespace detail ) {} -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec4::tvec4 ( @@ -89,7 +88,6 @@ namespace detail z(v.z), w(v.w) {} -#endif ////////////////////////////////////// // Explicit basic constructors @@ -369,7 +367,6 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators -#ifndef GLM_NO_EXPLICIT_COPY template GLM_FUNC_QUALIFIER tvec4 & tvec4::operator= ( @@ -382,7 +379,6 @@ namespace detail this->w = v.w; return *this; } -#endif template template From 1375a99b83d6b495b184886eb1f3f78279131591 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 12 Aug 2013 22:26:23 +0200 Subject: [PATCH 07/11] Added missing non-const value_ptr fort quat #99 --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index 7c066843..14709287 100644 --- a/readme.txt +++ b/readme.txt @@ -41,6 +41,7 @@ GLM 0.9.4.5: 2013-06-XX -------------------------------------------------------------------------------- - Fixed inclusion of intrinsics in "pure" mode #92 - Fixed language detection on GCC when the C++0x mode isn't enabled #95 +- Added missing value_ptr for quaternions #99 ================================================================================ GLM 0.9.4.4: 2013-05-29 From 5b525ced24608719a10d922653d6aeb1190d23ba Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 12 Aug 2013 22:32:39 +0200 Subject: [PATCH 08/11] Back port fix for issue #99 --- glm/gtc/type_ptr.inl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/glm/gtc/type_ptr.inl b/glm/gtc/type_ptr.inl index c0d1d877..6c5a1577 100644 --- a/glm/gtc/type_ptr.inl +++ b/glm/gtc/type_ptr.inl @@ -284,6 +284,14 @@ namespace glm return &(mat[0].x); } + //! Get the address of the matrix content. + /// @see gtc_type_ptr + template + GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3 & mat) + { + return &(mat[0].x); + } + //! Return the constant address to the data of the input parameter. /// @see gtc_type_ptr template @@ -295,12 +303,15 @@ namespace glm return &(q[0]); } - //! Get the address of the matrix content. + //! Return the constant address to the data of the input parameter. /// @see gtc_type_ptr template - GLM_FUNC_QUALIFIER T * value_ptr(detail::tmat4x3 & mat) + GLM_FUNC_QUALIFIER T * value_ptr + ( + detail::tquat & q + ) { - return &(mat[0].x); + return &(q[0]); } //! Build a vector from a pointer. From b592d9ff8353e5fef30ff9c29410ba9015c2d5b0 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 12 Aug 2013 23:05:29 +0200 Subject: [PATCH 09/11] Added WINCE detection #92 --- glm/core/setup.hpp | 3 +++ readme.txt | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index eb11115e..854e2ebb 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -50,6 +50,7 @@ #define GLM_PLATFORM_CHROME_NACL 0x00200000 #define GLM_PLATFORM_UNIX 0x00400000 #define GLM_PLATFORM_QNXNTO 0x00800000 +#define GLM_PLATFORM_WINCE 0x01000000 #ifdef GLM_FORCE_PLATFORM_UNKNOWN # define GLM_PLATFORM GLM_PLATFORM_UNKNOWN @@ -57,6 +58,8 @@ # define GLM_PLATFORM GLM_PLATFORM_QNXNTO #elif defined(__APPLE__) # define GLM_PLATFORM GLM_PLATFORM_APPLE +#elif defined(WINCE) +# define GLM_PLATFORM GLM_PLATFORM_WINCE #elif defined(_WIN32) # define GLM_PLATFORM GLM_PLATFORM_WINDOWS #elif defined(__native_client__) diff --git a/readme.txt b/readme.txt index 14709287..62d31cb6 100644 --- a/readme.txt +++ b/readme.txt @@ -37,11 +37,12 @@ More informations in GLM manual: http://glm.g-truc.net/glm.pdf ================================================================================ -GLM 0.9.4.5: 2013-06-XX +GLM 0.9.4.5: 2013-08-13 -------------------------------------------------------------------------------- - Fixed inclusion of intrinsics in "pure" mode #92 - Fixed language detection on GCC when the C++0x mode isn't enabled #95 - Added missing value_ptr for quaternions #99 +- Added WINCE detection #92 ================================================================================ GLM 0.9.4.4: 2013-05-29 From 37ae8da67c8f6810fc40d85a11dc452b3ef2218f Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Mon, 12 Aug 2013 23:18:28 +0200 Subject: [PATCH 10/11] Updated readme for release --- readme.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index 62d31cb6..6fcb28aa 100644 --- a/readme.txt +++ b/readme.txt @@ -37,9 +37,10 @@ More informations in GLM manual: http://glm.g-truc.net/glm.pdf ================================================================================ -GLM 0.9.4.5: 2013-08-13 +GLM 0.9.4.5: 2013-08-12 -------------------------------------------------------------------------------- -- Fixed inclusion of intrinsics in "pure" mode #92 +- Fixed CUDA support +- Fixed inclusion of intrinsics in "pure" mode #92 - Fixed language detection on GCC when the C++0x mode isn't enabled #95 - Added missing value_ptr for quaternions #99 - Added WINCE detection #92 From 54a395abd9a55b10173f2797d496a292f7613051 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 13 Aug 2013 23:22:16 +0200 Subject: [PATCH 11/11] Added Visual C++ 2013 detection --- glm/core/setup.hpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 854e2ebb..798720a5 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -36,7 +36,7 @@ #define GLM_VERSION_MAJOR 0 #define GLM_VERSION_MINOR 9 #define GLM_VERSION_PATCH 4 -#define GLM_VERSION_REVISION 5 +#define GLM_VERSION_REVISION 6 /////////////////////////////////////////////////////////////////////////////////////////////////// // Platform @@ -77,20 +77,24 @@ // Report platform detection #if(defined(GLM_MESSAGES) && !defined(GLM_MESSAGE_PLATFORM_DISPLAYED)) # define GLM_MESSAGE_PLATFORM_DISPLAYED -# if(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) -# pragma message("GLM: Windows platform detected") +# if(GLM_PLATFORM & GLM_PLATFORM_QNXNTO) +# pragma message("GLM: QNX platform detected") //# elif(GLM_PLATFORM & GLM_PLATFORM_IOS) //# pragma message("GLM: iOS platform detected") # elif(GLM_PLATFORM & GLM_PLATFORM_APPLE) # pragma message("GLM: Apple platform detected") +# elif(GLM_PLATFORM & GLM_PLATFORM_WINCE) +# pragma message("GLM: WinCE platform detected") +# elif(GLM_PLATFORM & GLM_PLATFORM_WINDOWS) +# pragma message("GLM: Windows platform detected") +# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL) +# pragma message("GLM: Native Client detected") +# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) +# pragma message("GLM: Android platform detected") # elif(GLM_PLATFORM & GLM_PLATFORM_LINUX) # pragma message("GLM: Linux platform detected") # elif(GLM_PLATFORM & GLM_PLATFORM_UNIX) # pragma message("GLM: UNIX platform detected") -# elif(GLM_PLATFORM & GLM_PLATFORM_ANDROID) -# pragma message("GLM: Android platform detected") -# elif(GLM_PLATFORM & GLM_PLATFORM_CHROME_NACL) -# pragma message("GLM: Chrone Native Client detected") # elif(GLM_PLATFORM & GLM_PLATFORM_UNKNOWN) # pragma message("GLM: platform unknown") # else @@ -118,6 +122,7 @@ #define GLM_COMPILER_VC2008 0x01000080 #define GLM_COMPILER_VC2010 0x01000090 #define GLM_COMPILER_VC2012 0x010000A0 +#define GLM_COMPILER_VC2013 0x010000B0 // GCC defines #define GLM_COMPILER_GCC 0x02000000 @@ -267,6 +272,8 @@ # define GLM_COMPILER GLM_COMPILER_VC2010 # elif _MSC_VER == 1700 # define GLM_COMPILER GLM_COMPILER_VC2012 +# elif _MSC_VER == 1800 +# define GLM_COMPILER GLM_COMPILER_VC2013 # else//_MSC_VER # define GLM_COMPILER GLM_COMPILER_VC # endif//_MSC_VER