From 58dc29a8602e60589fdf0609dabe1964251c56ad Mon Sep 17 00:00:00 2001 From: tszirr Date: Fri, 14 Jun 2013 16:38:58 +0200 Subject: [PATCH 1/6] 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 2/6] 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 3/6] 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 4/6] 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 5/6] 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 6/6] 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