From 563427cf88100742b96140c4aa4473b7947b8794 Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Tue, 26 Mar 2013 00:26:41 +0100 Subject: [PATCH] C++ AMP test --- glm/core/_vectorize.hpp | 18 ++-- glm/core/func_common.hpp | 72 ++++++++-------- glm/core/func_common.inl | 178 +++++++++++++++++++-------------------- glm/core/setup.hpp | 5 ++ glm/core/type_half.hpp | 56 ++++++------ glm/core/type_half.inl | 62 +++++++------- glm/core/type_vec3.hpp | 112 ++++++++++++------------ glm/core/type_vec3.inl | 178 +++++++++++++++++++-------------------- test/core/CMakeLists.txt | 1 + test/core/core_amp.cpp | 37 ++++++++ 10 files changed, 383 insertions(+), 336 deletions(-) create mode 100644 test/core/core_amp.cpp diff --git a/glm/core/_vectorize.hpp b/glm/core/_vectorize.hpp index 9984014f..0a0568eb 100644 --- a/glm/core/_vectorize.hpp +++ b/glm/core/_vectorize.hpp @@ -29,7 +29,7 @@ #define VECTORIZE2_VEC(func) \ template \ GLM_FUNC_QUALIFIER detail::tvec2 func( \ - detail::tvec2 const & v) \ + detail::tvec2 const & v) GLM_FUNC_POST \ { \ return detail::tvec2( \ func(v.x), \ @@ -39,7 +39,7 @@ #define VECTORIZE3_VEC(func) \ template \ GLM_FUNC_QUALIFIER detail::tvec3 func( \ - detail::tvec3 const & v) \ + detail::tvec3 const & v) GLM_FUNC_POST \ { \ return detail::tvec3( \ func(v.x), \ @@ -50,7 +50,7 @@ #define VECTORIZE4_VEC(func) \ template \ GLM_FUNC_QUALIFIER detail::tvec4 func( \ - detail::tvec4 const & v) \ + detail::tvec4 const & v) GLM_FUNC_POST \ { \ return detail::tvec4( \ func(v.x), \ @@ -70,7 +70,7 @@ ( \ detail::tvec2 const & x, \ typename detail::tvec2::value_type const & y \ - ) \ + ) GLM_FUNC_POST \ { \ return detail::tvec2( \ func(x.x, y), \ @@ -83,7 +83,7 @@ ( \ detail::tvec3 const & x, \ typename detail::tvec3::value_type const & y \ - ) \ + ) GLM_FUNC_POST \ { \ return detail::tvec3( \ func(x.x, y), \ @@ -97,7 +97,7 @@ ( \ detail::tvec4 const & x, \ typename detail::tvec4::value_type const & y \ - ) \ + ) GLM_FUNC_POST \ { \ return detail::tvec4( \ func(x.x, y), \ @@ -117,7 +117,7 @@ ( \ detail::tvec2 const & x, \ detail::tvec2 const & y \ - ) \ + ) GLM_FUNC_POST \ { \ return detail::tvec2( \ func(x.x, y.x), \ @@ -130,7 +130,7 @@ ( \ detail::tvec3 const & x, \ detail::tvec3 const & y \ - ) \ + ) GLM_FUNC_POST \ { \ return detail::tvec3( \ func(x.x, y.x), \ @@ -144,7 +144,7 @@ ( \ detail::tvec4 const & x, \ detail::tvec4 const & y \ - ) \ + ) GLM_FUNC_POST \ { \ return detail::tvec4( \ func(x.x, y.x), \ diff --git a/glm/core/func_common.hpp b/glm/core/func_common.hpp index f184c45e..f64d09de 100644 --- a/glm/core/func_common.hpp +++ b/glm/core/func_common.hpp @@ -50,7 +50,7 @@ namespace glm /// @see GLSL abs man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType abs(genType const & x); + genType abs(genType const & x) GLM_FUNC_POST; /// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0. /// @@ -59,7 +59,7 @@ namespace glm /// @see GLSL sign man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType sign(genType const & x); + genType sign(genType const & x) GLM_FUNC_POST; /// Returns a value equal to the nearest integer that is less then or equal to x. /// @@ -68,7 +68,7 @@ namespace glm /// @see GLSL floor man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType floor(genType const & x); + genType floor(genType const & x) GLM_FUNC_POST; /// Returns a value equal to the nearest integer to x /// whose absolute value is not larger than the absolute value of x. @@ -78,7 +78,7 @@ namespace glm /// @see GLSL trunc man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType trunc(genType const & x); + genType trunc(genType const & x) GLM_FUNC_POST; /// Returns a value equal to the nearest integer to x. /// The fraction 0.5 will round in a direction chosen by the @@ -91,7 +91,7 @@ namespace glm /// @see GLSL round man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType round(genType const & x); + genType round(genType const & x) GLM_FUNC_POST; /// Returns a value equal to the nearest integer to x. /// A fractional part of 0.5 will round toward the nearest even @@ -103,7 +103,7 @@ namespace glm /// @see GLSL 4.20.8 specification, section 8.3 Common Functions /// @see New round to even technique template - genType roundEven(genType const & x); + genType roundEven(genType const & x) GLM_FUNC_POST; /// Returns a value equal to the nearest integer /// that is greater than or equal to x. @@ -113,7 +113,7 @@ namespace glm /// @see GLSL ceil man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType ceil(genType const & x); + genType ceil(genType const & x) GLM_FUNC_POST; /// Return x - floor(x). /// @@ -122,7 +122,7 @@ namespace glm /// @see GLSL fract man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType fract(genType const & x); + genType fract(genType const & x) GLM_FUNC_POST; /// Modulus. Returns x - y * floor(x / y) /// for each component in x using the floating point value y. @@ -134,7 +134,7 @@ namespace glm template genType mod( genType const & x, - genType const & y); + genType const & y) GLM_FUNC_POST; /// Modulus. Returns x - y * floor(x / y) /// for each component in x using the floating point value y. @@ -146,7 +146,7 @@ namespace glm template genType mod( genType const & x, - typename genType::value_type const & y); + typename genType::value_type const & y) GLM_FUNC_POST; /// Returns the fractional part of x and sets i to the integer /// part (as a whole number floating point value). Both the @@ -171,12 +171,12 @@ namespace glm template genType min( genType const & x, - genType const & y); + genType const & y) GLM_FUNC_POST; template genType min( genType const & x, - typename genType::value_type const & y); + typename genType::value_type const & y) GLM_FUNC_POST; /// Returns y if x < y; otherwise, it returns x. /// @@ -187,12 +187,12 @@ namespace glm template genType max( genType const & x, - genType const & y); + genType const & y) GLM_FUNC_POST; template genType max( genType const & x, - typename genType::value_type const & y); + typename genType::value_type const & y) GLM_FUNC_POST; /// Returns min(max(x, minVal), maxVal) for each component in x /// using the floating-point values minVal and maxVal. @@ -201,17 +201,17 @@ namespace glm /// /// @see GLSL clamp man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions - template + template genType clamp( - genType const & x, - genType const & minVal, - genType const & maxVal); + genType const & x, + genType const & minVal, + genType const & maxVal) GLM_FUNC_POST; - template + template genType clamp( - genType const & x, - typename genType::value_type const & minVal, - typename genType::value_type const & maxVal); + genType const & x, + typename genType::value_type const & minVal, + typename genType::value_type const & maxVal) GLM_FUNC_POST; /// If genTypeU is a floating scalar or vector: /// Returns x * (1.0 - a) + y * a, i.e., the linear blend of @@ -256,7 +256,7 @@ namespace glm /// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter. /// @endcode template - genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a); + genTypeT mix(genTypeT const & x, genTypeT const & y, genTypeU const & a) GLM_FUNC_POST; //! Returns 0.0 if x < edge, otherwise it returns 1.0. //! @@ -265,12 +265,12 @@ namespace glm template genType step( genType const & edge, - genType const & x); + genType const & x) GLM_FUNC_POST; template genType step( typename genType::value_type const & edge, - genType const & x); + genType const & x) GLM_FUNC_POST; /// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and /// performs smooth Hermite interpolation between 0 and 1 @@ -290,13 +290,13 @@ namespace glm genType smoothstep( genType const & edge0, genType const & edge1, - genType const & x); + genType const & x) GLM_FUNC_POST; template genType smoothstep( typename genType::value_type const & edge0, typename genType::value_type const & edge1, - genType const & x); + genType const & x) GLM_FUNC_POST; /// Returns true if x holds a NaN (not a number) /// representation in the underlying implementation's set of @@ -311,7 +311,7 @@ namespace glm /// @see GLSL isnan man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - typename genType::bool_type isnan(genType const & x); + typename genType::bool_type isnan(genType const & x) GLM_FUNC_POST; /// Returns true if x holds a positive infinity or negative /// infinity representation in the underlying implementation's @@ -324,7 +324,7 @@ namespace glm /// @see GLSL isinf man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - typename genType::bool_type isinf(genType const & x); + typename genType::bool_type isinf(genType const & x) GLM_FUNC_POST; /// Returns a signed integer value representing /// the encoding of a floating-point value. The floatingpoint @@ -336,7 +336,7 @@ namespace glm /// @see GLSL floatBitsToInt man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genIType floatBitsToInt(genType const & value); + genIType floatBitsToInt(genType const & value) GLM_FUNC_POST; /// Returns a unsigned integer value representing /// the encoding of a floating-point value. The floatingpoint @@ -348,7 +348,7 @@ namespace glm /// @see GLSL floatBitsToUint man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genUType floatBitsToUint(genType const & value); + genUType floatBitsToUint(genType const & value) GLM_FUNC_POST; /// Returns a floating-point value corresponding to a signed /// integer encoding of a floating-point value. @@ -364,7 +364,7 @@ namespace glm /// /// @todo Clarify this declaration, we don't need to actually specify the return type template - genType intBitsToFloat(genIType const & value); + genType intBitsToFloat(genIType const & value) GLM_FUNC_POST; /// Returns a floating-point value corresponding to a /// unsigned integer encoding of a floating-point value. @@ -380,7 +380,7 @@ namespace glm /// /// @todo Clarify this declaration, we don't need to actually specify the return type template - genType uintBitsToFloat(genUType const & value); + genType uintBitsToFloat(genUType const & value) GLM_FUNC_POST; /// Computes and returns a * b + c. /// @@ -389,7 +389,7 @@ namespace glm /// @see GLSL fma man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType fma(genType const & a, genType const & b, genType const & c); + genType fma(genType const & a, genType const & b, genType const & c) GLM_FUNC_POST; /// Splits x into a floating-point significand in the range /// [0.5, 1.0) and an integral exponent of two, such that: @@ -406,7 +406,7 @@ namespace glm /// @see GLSL frexp man page /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType frexp(genType const & x, genIType & exp); + genType frexp(genType const & x, genIType & exp) GLM_FUNC_POST; /// Builds a floating-point number from x and the /// corresponding integral exponent of two in exp, returning: @@ -420,7 +420,7 @@ namespace glm /// @see GLSL ldexp man page; /// @see GLSL 4.20.8 specification, section 8.3 Common Functions template - genType ldexp(genType const & x, genIType const & exp); + genType ldexp(genType const & x, genIType const & exp) GLM_FUNC_POST; /// @} }//namespace glm diff --git a/glm/core/func_common.inl b/glm/core/func_common.inl index 11045da6..0ccde672 100644 --- a/glm/core/func_common.inl +++ b/glm/core/func_common.inl @@ -36,7 +36,7 @@ namespace detail template struct Abs_ { - static genFIType get(genFIType const & x) + static genFIType get(genFIType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT( detail::type::is_float || @@ -49,7 +49,7 @@ namespace detail template struct Abs_ { - static genFIType get(genFIType const & x) + static genFIType get(genFIType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT( detail::type::is_uint, "'abs' only accept floating-point and integer inputs"); @@ -63,7 +63,7 @@ namespace detail GLM_FUNC_QUALIFIER genFIType abs ( genFIType const & x - ) + ) GLM_FUNC_POST { return detail::Abs_::is_signed>::get(x); } @@ -76,7 +76,7 @@ namespace detail GLM_FUNC_QUALIFIER genFIType sign ( genFIType const & x - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT( detail::type::is_float || @@ -96,13 +96,13 @@ namespace detail // floor template <> - GLM_FUNC_QUALIFIER detail::half floor(detail::half const & x) + GLM_FUNC_QUALIFIER detail::half floor(detail::half const & x) GLM_FUNC_POST { return detail::half(::std::floor(float(x))); } template - GLM_FUNC_QUALIFIER genType floor(genType const & x) + GLM_FUNC_QUALIFIER genType floor(genType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'floor' only accept floating-point inputs"); @@ -113,7 +113,7 @@ namespace detail // trunc template - GLM_FUNC_QUALIFIER genType trunc(genType const & x) + GLM_FUNC_QUALIFIER genType trunc(genType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'trunc' only accept floating-point inputs"); return x < 0 ? -floor(-x) : floor(x); @@ -123,7 +123,7 @@ namespace detail // round template - GLM_FUNC_QUALIFIER genType round(genType const& x) + GLM_FUNC_QUALIFIER genType round(genType const& x) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'round' only accept floating-point inputs"); @@ -147,7 +147,7 @@ namespace detail // roundEven template - GLM_FUNC_QUALIFIER genType roundEven(genType const & x) + GLM_FUNC_QUALIFIER genType roundEven(genType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'roundEven' only accept floating-point inputs"); @@ -181,7 +181,7 @@ namespace detail // ceil template - GLM_FUNC_QUALIFIER genType ceil(genType const & x) + GLM_FUNC_QUALIFIER genType ceil(genType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'ceil' only accept floating-point inputs"); @@ -195,7 +195,7 @@ namespace detail GLM_FUNC_QUALIFIER genType fract ( genType const & x - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'fract' only accept floating-point inputs"); @@ -210,7 +210,7 @@ namespace detail ( genType const & x, genType const & y - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mod' only accept floating-point inputs"); @@ -226,7 +226,7 @@ namespace detail ( genType const & x, genType & i - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'modf' only accept floating-point inputs"); @@ -238,7 +238,7 @@ namespace detail ( detail::tvec2 const & x, detail::tvec2 & i - ) + ) GLM_FUNC_POST { return detail::tvec2( modf(x.x, i.x), @@ -250,7 +250,7 @@ namespace detail ( detail::tvec3 const & x, detail::tvec3 & i - ) + ) GLM_FUNC_POST { return detail::tvec3( modf(x.x, i.x), @@ -263,7 +263,7 @@ namespace detail ( detail::tvec4 const & x, detail::tvec4 & i - ) + ) GLM_FUNC_POST { return detail::tvec4( modf(x.x, i.x), @@ -286,7 +286,7 @@ namespace detail ( genType const & x, genType const & y - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT( detail::type::is_float || @@ -305,7 +305,7 @@ namespace detail ( genType const & x, genType const & y - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT( detail::type::is_float || @@ -325,7 +325,7 @@ namespace detail valType const & x, valType const & minVal, valType const & maxVal - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT( detail::type::is_float || @@ -341,7 +341,7 @@ namespace detail detail::tvec2 const & x, typename detail::tvec2::value_type const & minVal, typename detail::tvec2::value_type const & maxVal - ) + ) GLM_FUNC_POST { return detail::tvec2( clamp(x.x, minVal, maxVal), @@ -354,7 +354,7 @@ namespace detail detail::tvec3 const & x, typename detail::tvec3::value_type const & minVal, typename detail::tvec3::value_type const & maxVal - ) + ) GLM_FUNC_POST { return detail::tvec3( clamp(x.x, minVal, maxVal), @@ -368,7 +368,7 @@ namespace detail detail::tvec4 const & x, typename detail::tvec4::value_type const & minVal, typename detail::tvec4::value_type const & maxVal - ) + ) GLM_FUNC_POST { return detail::tvec4( clamp(x.x, minVal, maxVal), @@ -383,7 +383,7 @@ namespace detail detail::tvec2 const & x, detail::tvec2 const & minVal, detail::tvec2 const & maxVal - ) + ) GLM_FUNC_POST { return detail::tvec2( clamp(x.x, minVal.x, maxVal.x), @@ -396,7 +396,7 @@ namespace detail detail::tvec3 const & x, detail::tvec3 const & minVal, detail::tvec3 const & maxVal - ) + ) GLM_FUNC_POST { return detail::tvec3( clamp(x.x, minVal.x, maxVal.x), @@ -410,7 +410,7 @@ namespace detail detail::tvec4 const & x, detail::tvec4 const & minVal, detail::tvec4 const & maxVal - ) + ) GLM_FUNC_POST { return detail::tvec4( clamp(x.x, minVal.x, maxVal.x), @@ -426,7 +426,7 @@ namespace detail genType const & x, genType const & y, genType const & a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float , "'genType' is not floating-point type"); @@ -439,7 +439,7 @@ namespace detail detail::tvec2 const & x, detail::tvec2 const & y, valType const & a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float , "'genType' is not floating-point type"); @@ -452,7 +452,7 @@ namespace detail detail::tvec3 const & x, detail::tvec3 const & y, valType const & a - ) + ) GLM_FUNC_POST { return x + a * (y - x); } @@ -463,7 +463,7 @@ namespace detail detail::tvec4 const & x, detail::tvec4 const & y, valType const & a - ) + ) GLM_FUNC_POST { return x + a * (y - x); } @@ -474,7 +474,7 @@ namespace detail detail::tvec2 const & x, detail::tvec2 const & y, detail::tvec2 const & a - ) + ) GLM_FUNC_POST { return x + a * (y - x); } @@ -485,7 +485,7 @@ namespace detail detail::tvec3 const & x, detail::tvec3 const & y, detail::tvec3 const & a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float , "'genType' is not floating-point type"); @@ -498,7 +498,7 @@ namespace detail detail::tvec4 const & x, detail::tvec4 const & y, detail::tvec4 const & a - ) + ) GLM_FUNC_POST { return x + a * (y - x); } @@ -525,7 +525,7 @@ namespace detail float const & x, float const & y, bool const & a - ) + ) GLM_FUNC_POST { return a ? y : x; } @@ -536,7 +536,7 @@ namespace detail double const & x, double const & y, bool const & a - ) + ) GLM_FUNC_POST { return a ? y : x; } @@ -547,7 +547,7 @@ namespace detail detail::tvec2 const & x, detail::tvec2 const & y, bool a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); @@ -560,7 +560,7 @@ namespace detail detail::tvec3 const & x, detail::tvec3 const & y, bool a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); @@ -573,7 +573,7 @@ namespace detail detail::tvec4 const & x, detail::tvec4 const & y, bool a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); @@ -586,7 +586,7 @@ namespace detail detail::tvec2 const & x, detail::tvec2 const & y, typename detail::tvec2::bool_type a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); @@ -608,7 +608,7 @@ namespace detail detail::tvec3 const & x, detail::tvec3 const & y, typename detail::tvec3::bool_type a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); @@ -630,7 +630,7 @@ namespace detail detail::tvec4 const & x, detail::tvec4 const & y, typename detail::tvec4::bool_type a - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'mix' only accept floating-point inputs"); @@ -652,7 +652,7 @@ namespace detail ( genType const & edge, genType const & x - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'step' only accept floating-point inputs"); @@ -664,7 +664,7 @@ namespace detail ( typename detail::tvec2::value_type const & edge, detail::tvec2 const & x - ) + ) GLM_FUNC_POST { return detail::tvec2( x.x < edge ? T(0) : T(1), @@ -676,7 +676,7 @@ namespace detail ( typename detail::tvec3::value_type const & edge, detail::tvec3 const & x - ) + ) GLM_FUNC_POST { return detail::tvec3( x.x < edge ? T(0) : T(1), @@ -689,7 +689,7 @@ namespace detail ( typename detail::tvec4::value_type const & edge, detail::tvec4 const & x - ) + ) GLM_FUNC_POST { return detail::tvec4( x.x < edge ? T(0) : T(1), @@ -703,7 +703,7 @@ namespace detail ( detail::tvec2 const & edge, detail::tvec2 const & x - ) + ) GLM_FUNC_POST { return detail::tvec2( x.x < edge.x ? T(0) : T(1), @@ -715,7 +715,7 @@ namespace detail ( detail::tvec3 const & edge, detail::tvec3 const & x - ) + ) GLM_FUNC_POST { return detail::tvec3( x.x < edge.x ? T(0) : T(1), @@ -728,7 +728,7 @@ namespace detail ( detail::tvec4 const & edge, detail::tvec4 const & x - ) + ) GLM_FUNC_POST { return detail::tvec4( x.x < edge.x ? T(0) : T(1), @@ -744,7 +744,7 @@ namespace detail genType const & edge0, genType const & edge1, genType const & x - ) + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'smoothstep' only accept floating-point inputs"); @@ -758,7 +758,7 @@ namespace detail typename detail::tvec2::value_type const & edge0, typename detail::tvec2::value_type const & edge1, detail::tvec2 const & x - ) + ) GLM_FUNC_POST { return detail::tvec2( smoothstep(edge0, edge1, x.x), @@ -771,7 +771,7 @@ namespace detail typename detail::tvec3::value_type const & edge0, typename detail::tvec3::value_type const & edge1, detail::tvec3 const & x - ) + ) GLM_FUNC_POST { return detail::tvec3( smoothstep(edge0, edge1, x.x), @@ -785,7 +785,7 @@ namespace detail typename detail::tvec4::value_type const & edge0, typename detail::tvec4::value_type const & edge1, detail::tvec4 const & x - ) + ) GLM_FUNC_POST { return detail::tvec4( smoothstep(edge0, edge1, x.x), @@ -800,7 +800,7 @@ namespace detail detail::tvec2 const & edge0, detail::tvec2 const & edge1, detail::tvec2 const & x - ) + ) GLM_FUNC_POST { return detail::tvec2( smoothstep(edge0.x, edge1.x, x.x), @@ -813,7 +813,7 @@ namespace detail detail::tvec3 const & edge0, detail::tvec3 const & edge1, detail::tvec3 const & x - ) + ) GLM_FUNC_POST { return detail::tvec3( smoothstep(edge0.x, edge1.x, x.x), @@ -827,7 +827,7 @@ namespace detail detail::tvec4 const & edge0, detail::tvec4 const & edge1, detail::tvec4 const & x - ) + ) GLM_FUNC_POST { return detail::tvec4( smoothstep(edge0.x, edge1.x, x.x), @@ -838,7 +838,7 @@ namespace detail // TODO: Not working on MinGW... template - GLM_FUNC_QUALIFIER bool isnan(genType const & x) + GLM_FUNC_QUALIFIER bool isnan(genType const & x) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'isnan' only accept floating-point inputs"); @@ -861,7 +861,7 @@ namespace detail GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isnan ( detail::tvec2 const & x - ) + ) GLM_FUNC_POST { return typename detail::tvec2::bool_type( isnan(x.x), @@ -872,7 +872,7 @@ namespace detail GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isnan ( detail::tvec3 const & x - ) + ) GLM_FUNC_POST { return typename detail::tvec3::bool_type( isnan(x.x), @@ -884,7 +884,7 @@ namespace detail GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isnan ( detail::tvec4 const & x - ) + ) GLM_FUNC_POST { return typename detail::tvec4::bool_type( isnan(x.x), @@ -894,8 +894,10 @@ namespace detail } template - GLM_FUNC_QUALIFIER bool isinf( - genType const & x) + GLM_FUNC_QUALIFIER bool isinf + ( + genType const & x + ) GLM_FUNC_POST { GLM_STATIC_ASSERT(detail::type::is_float, "'isinf' only accept floating-point inputs"); @@ -919,7 +921,7 @@ namespace detail GLM_FUNC_QUALIFIER typename detail::tvec2::bool_type isinf ( detail::tvec2 const & x - ) + ) GLM_FUNC_POST { return typename detail::tvec2::bool_type( isinf(x.x), @@ -930,7 +932,7 @@ namespace detail GLM_FUNC_QUALIFIER typename detail::tvec3::bool_type isinf ( detail::tvec3 const & x - ) + ) GLM_FUNC_POST { return typename detail::tvec3::bool_type( isinf(x.x), @@ -942,7 +944,7 @@ namespace detail GLM_FUNC_QUALIFIER typename detail::tvec4::bool_type isinf ( detail::tvec4 const & x - ) + ) GLM_FUNC_POST { return typename detail::tvec4::bool_type( isinf(x.x), @@ -951,7 +953,7 @@ namespace detail isinf(x.w)); } - GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) + GLM_FUNC_QUALIFIER int floatBitsToInt(float const & value) GLM_FUNC_POST { union { @@ -966,7 +968,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToInt ( detail::tvec2 const & value - ) + ) GLM_FUNC_POST { return detail::tvec2( floatBitsToInt(value.x), @@ -976,7 +978,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToInt ( detail::tvec3 const & value - ) + ) GLM_FUNC_POST { return detail::tvec3( floatBitsToInt(value.x), @@ -987,7 +989,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToInt ( detail::tvec4 const & value - ) + ) GLM_FUNC_POST { return detail::tvec4( floatBitsToInt(value.x), @@ -996,7 +998,7 @@ namespace detail floatBitsToInt(value.w)); } - GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) + GLM_FUNC_QUALIFIER uint floatBitsToUint(float const & value) GLM_FUNC_POST { union { @@ -1011,7 +1013,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec2 floatBitsToUint ( detail::tvec2 const & value - ) + ) GLM_FUNC_POST { return detail::tvec2( floatBitsToUint(value.x), @@ -1021,7 +1023,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec3 floatBitsToUint ( detail::tvec3 const & value - ) + ) GLM_FUNC_POST { return detail::tvec3( floatBitsToUint(value.x), @@ -1032,7 +1034,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec4 floatBitsToUint ( detail::tvec4 const & value - ) + ) GLM_FUNC_POST { return detail::tvec4( floatBitsToUint(value.x), @@ -1054,10 +1056,9 @@ namespace detail } GLM_FUNC_QUALIFIER detail::tvec2 intBitsToFloat - ( detail::tvec2 const & value - ) + ) GLM_FUNC_POST { return detail::tvec2( intBitsToFloat(value.x), @@ -1067,7 +1068,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec3 intBitsToFloat ( detail::tvec3 const & value - ) + ) GLM_FUNC_POST { return detail::tvec3( intBitsToFloat(value.x), @@ -1078,7 +1079,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec4 intBitsToFloat ( detail::tvec4 const & value - ) + ) GLM_FUNC_POST { return detail::tvec4( intBitsToFloat(value.x), @@ -1087,7 +1088,7 @@ namespace detail intBitsToFloat(value.w)); } - GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) + GLM_FUNC_QUALIFIER float uintBitsToFloat(uint const & value) GLM_FUNC_POST { union { @@ -1102,7 +1103,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec2 uintBitsToFloat ( detail::tvec2 const & value - ) + ) GLM_FUNC_POST { return detail::tvec2( uintBitsToFloat(value.x), @@ -1112,7 +1113,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec3 uintBitsToFloat ( detail::tvec3 const & value - ) + ) GLM_FUNC_POST { return detail::tvec3( uintBitsToFloat(value.x), @@ -1123,7 +1124,7 @@ namespace detail GLM_FUNC_QUALIFIER detail::tvec4 uintBitsToFloat ( detail::tvec4 const & value - ) + ) GLM_FUNC_POST { return detail::tvec4( uintBitsToFloat(value.x), @@ -1138,7 +1139,7 @@ namespace detail genType const & a, genType const & b, genType const & c - ) + ) GLM_FUNC_POST { return a * b + c; } @@ -1148,7 +1149,7 @@ namespace detail ( genType const & x, int & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1158,7 +1159,7 @@ namespace detail ( detail::tvec2 const & x, detail::tvec2 & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1168,7 +1169,7 @@ namespace detail ( detail::tvec3 const & x, detail::tvec3 & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1178,7 +1179,7 @@ namespace detail ( detail::tvec4 const & x, detail::tvec4 & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1188,7 +1189,7 @@ namespace detail ( genType const & x, int const & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1198,7 +1199,7 @@ namespace detail ( detail::tvec2 const & x, detail::tvec2 const & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1208,7 +1209,7 @@ namespace detail ( detail::tvec3 const & x, detail::tvec3 const & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } @@ -1218,9 +1219,8 @@ namespace detail ( detail::tvec4 const & x, detail::tvec4 const & exp - ) + ) GLM_FUNC_POST { return std::frexp(x, exp); } - }//namespace glm diff --git a/glm/core/setup.hpp b/glm/core/setup.hpp index 0a838e55..579b6e41 100644 --- a/glm/core/setup.hpp +++ b/glm/core/setup.hpp @@ -709,6 +709,11 @@ #define GLM_FUNC_DECL GLM_CUDA_FUNC_DECL #define GLM_FUNC_QUALIFIER GLM_CUDA_FUNC_DEF GLM_INLINE +#ifdef _AMP_H +# define GLM_FUNC_POST restrict(amp, cpu) +#else +# define GLM_FUNC_POST +#endif//_AMP_H /////////////////////////////////////////////////////////////////////////////////////////////////// // Swizzle operators diff --git a/glm/core/type_half.hpp b/glm/core/type_half.hpp index 13a15961..da2a2988 100644 --- a/glm/core/type_half.hpp +++ b/glm/core/type_half.hpp @@ -37,79 +37,79 @@ namespace detail { typedef short hdata; - GLM_FUNC_DECL float toFloat32(hdata value); - GLM_FUNC_DECL hdata toFloat16(float const & value); + GLM_FUNC_DECL float toFloat32(hdata value) GLM_FUNC_POST; + GLM_FUNC_DECL hdata toFloat16(float const & value) GLM_FUNC_POST; class half { public: // Constructors - GLM_FUNC_DECL half(); - GLM_FUNC_DECL half(half const & s); + GLM_FUNC_DECL half() GLM_FUNC_POST; + GLM_FUNC_DECL half(half const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL explicit half(U const & s); + GLM_FUNC_DECL explicit half(U const & s) GLM_FUNC_POST; // Cast //template //GLM_FUNC_DECL operator U() const; - GLM_FUNC_DECL operator float() const; + GLM_FUNC_DECL operator float() const GLM_FUNC_POST; // Unary updatable operators - GLM_FUNC_DECL half& operator= (half const & s); - GLM_FUNC_DECL half& operator+=(half const & s); - GLM_FUNC_DECL half& operator-=(half const & s); - GLM_FUNC_DECL half& operator*=(half const & s); - GLM_FUNC_DECL half& operator/=(half const & s); - GLM_FUNC_DECL half& operator++(); - GLM_FUNC_DECL half& operator--(); + GLM_FUNC_DECL half& operator= (half const & s) GLM_FUNC_POST; + GLM_FUNC_DECL half& operator+=(half const & s) GLM_FUNC_POST; + GLM_FUNC_DECL half& operator-=(half const & s) GLM_FUNC_POST; + GLM_FUNC_DECL half& operator*=(half const & s) GLM_FUNC_POST; + GLM_FUNC_DECL half& operator/=(half const & s) GLM_FUNC_POST; + GLM_FUNC_DECL half& operator++() GLM_FUNC_POST; + GLM_FUNC_DECL half& operator--() GLM_FUNC_POST; - GLM_FUNC_DECL float toFloat() const{return toFloat32(data);} + GLM_FUNC_DECL float toFloat() const GLM_FUNC_POST {return toFloat32(data);} - GLM_FUNC_DECL hdata _data() const{return data;} + GLM_FUNC_DECL hdata _data() const GLM_FUNC_POST {return data;} private: hdata data; }; - GLM_FUNC_DECL half operator+ (half const & s1, half const & s2); + GLM_FUNC_DECL half operator+ (half const & s1, half const & s2) GLM_FUNC_POST; - GLM_FUNC_DECL half operator- (half const & s1, half const & s2); + GLM_FUNC_DECL half operator- (half const & s1, half const & s2) GLM_FUNC_POST; - GLM_FUNC_DECL half operator* (half const & s1, half const & s2); + GLM_FUNC_DECL half operator* (half const & s1, half const & s2) GLM_FUNC_POST; - GLM_FUNC_DECL half operator/ (half const & s1, half const & s2); + GLM_FUNC_DECL half operator/ (half const & s1, half const & s2) GLM_FUNC_POST; // Unary constant operators - GLM_FUNC_DECL half operator- (half const & s); + GLM_FUNC_DECL half operator- (half const & s) GLM_FUNC_POST; - GLM_FUNC_DECL half operator-- (half const & s, int); + GLM_FUNC_DECL half operator-- (half const & s, int) GLM_FUNC_POST; - GLM_FUNC_DECL half operator++ (half const & s, int); + GLM_FUNC_DECL half operator++ (half const & s, int) GLM_FUNC_POST; GLM_FUNC_DECL bool operator==( detail::half const & x, - detail::half const & y); + detail::half const & y) GLM_FUNC_POST; GLM_FUNC_DECL bool operator!=( detail::half const & x, - detail::half const & y); + detail::half const & y) GLM_FUNC_POST; GLM_FUNC_DECL bool operator<( detail::half const & x, - detail::half const & y); + detail::half const & y) GLM_FUNC_POST; GLM_FUNC_DECL bool operator<=( detail::half const & x, - detail::half const & y); + detail::half const & y) GLM_FUNC_POST; GLM_FUNC_DECL bool operator>( detail::half const & x, - detail::half const & y); + detail::half const & y) GLM_FUNC_POST; GLM_FUNC_DECL bool operator>=( detail::half const & x, - detail::half const & y); + detail::half const & y) GLM_FUNC_POST; }//namespace detail }//namespace glm diff --git a/glm/core/type_half.inl b/glm/core/type_half.inl index aa465b02..75bc7a31 100644 --- a/glm/core/type_half.inl +++ b/glm/core/type_half.inl @@ -33,9 +33,13 @@ namespace glm{ namespace detail { - GLM_FUNC_QUALIFIER float overflow() + GLM_FUNC_QUALIFIER float overflow() GLM_FUNC_POST { - volatile float f = 1e10; +# ifdef _AMP_H + float f = 1e10; +# else + volatile float f = 1e10; +# endif for(int i = 0; i < 10; ++i) f *= f; // this will overflow before @@ -43,7 +47,7 @@ namespace detail return f; } - GLM_FUNC_QUALIFIER float toFloat32(hdata value) + GLM_FUNC_QUALIFIER float toFloat32(hdata value) GLM_FUNC_POST { int s = (value >> 15) & 0x00000001; int e = (value >> 10) & 0x0000001f; @@ -117,7 +121,7 @@ namespace detail return Result.f; } - GLM_FUNC_QUALIFIER hdata toFloat16(float const & f) + GLM_FUNC_QUALIFIER hdata toFloat16(float const & f) GLM_FUNC_POST { uif Entry; Entry.f = f; @@ -252,16 +256,16 @@ namespace detail } } - GLM_FUNC_QUALIFIER half::half() : + GLM_FUNC_QUALIFIER half::half() GLM_FUNC_POST : data(0) {} - GLM_FUNC_QUALIFIER half::half(half const & s) : + GLM_FUNC_QUALIFIER half::half(half const & s) GLM_FUNC_POST : data(s.data) {} template - GLM_FUNC_QUALIFIER half::half(U const & s) : + GLM_FUNC_QUALIFIER half::half(U const & s) GLM_FUNC_POST : data(toFloat16(float(s))) {} /* @@ -272,50 +276,50 @@ namespace detail } */ - GLM_FUNC_QUALIFIER half::operator float() const + GLM_FUNC_QUALIFIER half::operator float() const GLM_FUNC_POST { return toFloat32(this->data); } // Unary updatable operators - GLM_FUNC_QUALIFIER half& half::operator= (half const & s) + GLM_FUNC_QUALIFIER half& half::operator= (half const & s) GLM_FUNC_POST { data = s.data; return *this; } - GLM_FUNC_QUALIFIER half& half::operator+=(half const & s) + GLM_FUNC_QUALIFIER half& half::operator+=(half const & s) GLM_FUNC_POST { data = toFloat16(toFloat32(data) + toFloat32(s.data)); return *this; } - GLM_FUNC_QUALIFIER half& half::operator-=(half const & s) + GLM_FUNC_QUALIFIER half& half::operator-=(half const & s) GLM_FUNC_POST { data = toFloat16(toFloat32(data) - toFloat32(s.data)); return *this; } - GLM_FUNC_QUALIFIER half& half::operator*=(half const & s) + GLM_FUNC_QUALIFIER half& half::operator*=(half const & s) GLM_FUNC_POST { - data = toFloat16(toFloat32(data) * toFloat32(s.data)); + data = toFloat16(toFloat32(data) * toFloat32(s.data)); return *this; } - GLM_FUNC_QUALIFIER half& half::operator/=(half const & s) + GLM_FUNC_QUALIFIER half& half::operator/=(half const & s) GLM_FUNC_POST { data = toFloat16(toFloat32(data) / toFloat32(s.data)); return *this; } - GLM_FUNC_QUALIFIER half& half::operator++() + GLM_FUNC_QUALIFIER half& half::operator++() GLM_FUNC_POST { float Casted = toFloat32(data); this->data = toFloat16(++Casted); return *this; } - GLM_FUNC_QUALIFIER half& half::operator--() + GLM_FUNC_QUALIFIER half& half::operator--() GLM_FUNC_POST { float Casted = toFloat32(data); this->data = toFloat16(--Casted); @@ -325,38 +329,38 @@ namespace detail ////////////////////////////////////// // Binary arithmetic operators - GLM_FUNC_QUALIFIER detail::half operator+ (detail::half const & s1, detail::half const & s2) + GLM_FUNC_QUALIFIER detail::half operator+ (detail::half const & s1, detail::half const & s2) GLM_FUNC_POST { return detail::half(float(s1) + float(s2)); } - GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s1, detail::half const & s2) + GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s1, detail::half const & s2) GLM_FUNC_POST { return detail::half(float(s1) - float(s2)); } - GLM_FUNC_QUALIFIER detail::half operator* (detail::half const & s1, detail::half const & s2) + GLM_FUNC_QUALIFIER detail::half operator* (detail::half const & s1, detail::half const & s2) GLM_FUNC_POST { return detail::half(float(s1) * float(s2)); } - GLM_FUNC_QUALIFIER detail::half operator/ (detail::half const & s1, detail::half const & s2) + GLM_FUNC_QUALIFIER detail::half operator/ (detail::half const & s1, detail::half const & s2) GLM_FUNC_POST { return detail::half(float(s1) / float(s2)); } // Unary constant operators - GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s) + GLM_FUNC_QUALIFIER detail::half operator- (detail::half const & s) GLM_FUNC_POST { return detail::half(-float(s)); } - GLM_FUNC_QUALIFIER detail::half operator-- (detail::half const & s, int) + GLM_FUNC_QUALIFIER detail::half operator-- (detail::half const & s, int) GLM_FUNC_POST { return detail::half(float(s) - 1.0f); } - GLM_FUNC_QUALIFIER detail::half operator++ (detail::half const & s, int) + GLM_FUNC_QUALIFIER detail::half operator++ (detail::half const & s, int) GLM_FUNC_POST { return detail::half(float(s) + 1.0f); } @@ -365,7 +369,7 @@ namespace detail ( detail::half const & x, detail::half const & y - ) + ) GLM_FUNC_POST { return x._data() == y._data(); } @@ -374,7 +378,7 @@ namespace detail ( detail::half const & x, detail::half const & y - ) + ) GLM_FUNC_POST { return x._data() != y._data(); } @@ -383,7 +387,7 @@ namespace detail ( detail::half const & x, detail::half const & y - ) + ) GLM_FUNC_POST { return float(x) < float(y); } @@ -392,7 +396,7 @@ namespace detail ( detail::half const & x, detail::half const & y - ) + ) GLM_FUNC_POST { return float(x) <= float(y); } @@ -401,7 +405,7 @@ namespace detail ( detail::half const & x, detail::half const & y - ) + ) GLM_FUNC_POST { return float(x) > float(y); } @@ -410,7 +414,7 @@ namespace detail ( detail::half const & x, detail::half const & y - ) + ) GLM_FUNC_POST { return float(x) >= float(y); } diff --git a/glm/core/type_vec3.hpp b/glm/core/type_vec3.hpp index 7cda2d28..8476d143 100644 --- a/glm/core/type_vec3.hpp +++ b/glm/core/type_vec3.hpp @@ -54,7 +54,7 @@ namespace detail typedef tvec3 type; typedef tvec3 bool_type; - GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const; + GLM_FUNC_DECL GLM_CONSTEXPR size_type length() const GLM_FUNC_POST; ////////////////////////////////////// // Data @@ -101,26 +101,26 @@ namespace detail ////////////////////////////////////// // Accesses - GLM_FUNC_DECL value_type & operator[](size_type i); - GLM_FUNC_DECL value_type const & operator[](size_type i) const; + GLM_FUNC_DECL value_type & operator[](size_type i) GLM_FUNC_POST; + GLM_FUNC_DECL value_type const & operator[](size_type i) const GLM_FUNC_POST; ////////////////////////////////////// // Implicit basic constructors - GLM_FUNC_DECL tvec3(); - GLM_FUNC_DECL tvec3(tvec3 const & v); + GLM_FUNC_DECL tvec3() GLM_FUNC_POST; + GLM_FUNC_DECL tvec3(tvec3 const & v) GLM_FUNC_POST; ////////////////////////////////////// // Explicit basic constructors GLM_FUNC_DECL explicit tvec3( - ctor); + ctor) GLM_FUNC_POST; GLM_FUNC_DECL explicit tvec3( - value_type const & s); + value_type const & s) GLM_FUNC_POST; GLM_FUNC_DECL explicit tvec3( value_type const & s1, value_type const & s2, - value_type const & s3); + value_type const & s3) GLM_FUNC_POST; ////////////////////////////////////// // Convertion scalar constructors @@ -128,55 +128,55 @@ namespace detail //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL explicit tvec3( - U const & x); + U const & x) GLM_FUNC_POST; //! Explicit converions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template GLM_FUNC_DECL explicit tvec3( U const & x, V const & y, - W const & z); + W const & z) GLM_FUNC_POST; ////////////////////////////////////// // Convertion vector constructors //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec2 const & v, B const & s); + GLM_FUNC_DECL explicit tvec3(tvec2 const & v, B const & s) GLM_FUNC_POST; //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(A const & s, tvec2 const & v); + GLM_FUNC_DECL explicit tvec3(A const & s, tvec2 const & v) GLM_FUNC_POST; //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec3 const & v); + GLM_FUNC_DECL explicit tvec3(tvec3 const & v) GLM_FUNC_POST; //! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) template - GLM_FUNC_DECL explicit tvec3(tvec4 const & v); + GLM_FUNC_DECL explicit tvec3(tvec4 const & v) GLM_FUNC_POST; ////////////////////////////////////// // Swizzle constructors - GLM_FUNC_DECL tvec3(tref3 const & r); + GLM_FUNC_DECL tvec3(tref3 const & r) GLM_FUNC_POST; template - GLM_FUNC_DECL explicit tvec3(tref2 const & v, B const & s); + GLM_FUNC_DECL explicit tvec3(tref2 const & v, B const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL explicit tvec3(A const & s, tref2 const & v); + GLM_FUNC_DECL explicit tvec3(A const & s, tref2 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3, E0, E1, E2, -1> const & that) + GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3, E0, E1, E2, -1> const & that) GLM_FUNC_POST { *this = that(); } template - GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2, E0, E1, -1, -2> const & v, T const & s) + GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2, E0, E1, -1, -2> const & v, T const & s) GLM_FUNC_POST { *this = tvec3(v(), s); } template - GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2, E0, E1, -1, -2> const & v) + GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2, E0, E1, -1, -2> const & v) GLM_FUNC_POST { *this = tvec3(s, v()); } @@ -184,79 +184,79 @@ namespace detail ////////////////////////////////////// // Unary arithmetic operators - GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator= (tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator+=(U const & s); + GLM_FUNC_DECL tvec3 & operator+=(U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator+=(tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator+=(tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator-=(U const & s); + GLM_FUNC_DECL tvec3 & operator-=(U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator-=(tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator-=(tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator*=(U const & s); + GLM_FUNC_DECL tvec3 & operator*=(U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator*=(tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator*=(tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator/=(U const & s); + GLM_FUNC_DECL tvec3 & operator/=(U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator/=(tvec3 const & v); - GLM_FUNC_DECL tvec3 & operator++(); - GLM_FUNC_DECL tvec3 & operator--(); + GLM_FUNC_DECL tvec3 & operator/=(tvec3 const & v) GLM_FUNC_POST; + GLM_FUNC_DECL tvec3 & operator++() GLM_FUNC_POST; + GLM_FUNC_DECL tvec3 & operator--() GLM_FUNC_POST; ////////////////////////////////////// // Unary bit operators template - GLM_FUNC_DECL tvec3 & operator%= (U const & s); + GLM_FUNC_DECL tvec3 & operator%= (U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator%= (tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator%= (tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator&= (U const & s); + GLM_FUNC_DECL tvec3 & operator&= (U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator&= (tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator&= (tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator|= (U const & s); + GLM_FUNC_DECL tvec3 & operator|= (U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator|= (tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator|= (tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator^= (U const & s); + GLM_FUNC_DECL tvec3 & operator^= (U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator^= (tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator^= (tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator<<=(U const & s); + GLM_FUNC_DECL tvec3 & operator<<=(U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator<<=(tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator<<=(tvec3 const & v) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator>>=(U const & s); + GLM_FUNC_DECL tvec3 & operator>>=(U const & s) GLM_FUNC_POST; template - GLM_FUNC_DECL tvec3 & operator>>=(tvec3 const & v); + GLM_FUNC_DECL tvec3 & operator>>=(tvec3 const & v) GLM_FUNC_POST; ////////////////////////////////////// // Swizzle operators - GLM_FUNC_DECL value_type swizzle(comp X) const; - GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const; - GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const; - GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const; - GLM_FUNC_DECL tref2 swizzle(comp X, comp Y); - GLM_FUNC_DECL tref3 swizzle(comp X, comp Y, comp Z); + GLM_FUNC_DECL value_type swizzle(comp X) const GLM_FUNC_POST; + GLM_FUNC_DECL tvec2 swizzle(comp X, comp Y) const GLM_FUNC_POST; + GLM_FUNC_DECL tvec3 swizzle(comp X, comp Y, comp Z) const GLM_FUNC_POST; + GLM_FUNC_DECL tvec4 swizzle(comp X, comp Y, comp Z, comp W) const GLM_FUNC_POST; + GLM_FUNC_DECL tref2 swizzle(comp X, comp Y) GLM_FUNC_POST; + GLM_FUNC_DECL tref3 swizzle(comp X, comp Y, comp Z) GLM_FUNC_POST; }; template struct tref3 { - GLM_FUNC_DECL tref3(T & x, T & y, T & z); - GLM_FUNC_DECL tref3(tref3 const & r); - GLM_FUNC_DECL explicit tref3(tvec3 const & v); + GLM_FUNC_DECL tref3(T & x, T & y, T & z) GLM_FUNC_POST; + GLM_FUNC_DECL tref3(tref3 const & r) GLM_FUNC_POST; + GLM_FUNC_DECL explicit tref3(tvec3 const & v) GLM_FUNC_POST; - GLM_FUNC_DECL tref3 & operator= (tref3 const & r); - GLM_FUNC_DECL tref3 & operator= (tvec3 const & v); + GLM_FUNC_DECL tref3 & operator= (tref3 const & r) GLM_FUNC_POST; + GLM_FUNC_DECL tref3 & operator= (tvec3 const & v) GLM_FUNC_POST; - GLM_FUNC_DECL tvec3 operator() (); + GLM_FUNC_DECL tvec3 operator() () GLM_FUNC_POST; T & x; T & y; diff --git a/glm/core/type_vec3.inl b/glm/core/type_vec3.inl index 3bcf1c8a..6e339a93 100644 --- a/glm/core/type_vec3.inl +++ b/glm/core/type_vec3.inl @@ -30,7 +30,7 @@ namespace glm{ namespace detail { template - GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3::size_type tvec3::length() const + GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3::size_type tvec3::length() const GLM_FUNC_POST { return 3; } @@ -43,7 +43,7 @@ namespace detail tvec3::operator[] ( size_type i - ) + ) GLM_FUNC_POST { assert(i < this->length()); return (&x)[i]; @@ -54,7 +54,7 @@ namespace detail tvec3::operator[] ( size_type i - ) const + ) const GLM_FUNC_POST { assert(i < this->length()); return (&x)[i]; @@ -64,7 +64,7 @@ namespace detail // Implicit basic constructors template - GLM_FUNC_QUALIFIER tvec3::tvec3() : + GLM_FUNC_QUALIFIER tvec3::tvec3() GLM_FUNC_POST : x(value_type(0)), y(value_type(0)), z(value_type(0)) @@ -74,14 +74,14 @@ namespace detail GLM_FUNC_QUALIFIER tvec3::tvec3 ( ctor - ) + ) GLM_FUNC_POST {} template GLM_FUNC_QUALIFIER tvec3::tvec3 ( tvec3 const & v - ) : + ) GLM_FUNC_POST : x(v.x), y(v.y), z(v.z) @@ -94,7 +94,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3::tvec3 ( value_type const & s - ) : + ) GLM_FUNC_POST : x(s), y(s), z(s) @@ -106,7 +106,7 @@ namespace detail value_type const & s0, value_type const & s1, value_type const & s2 - ) : + ) GLM_FUNC_POST : x(s0), y(s1), z(s2) @@ -119,7 +119,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3::tvec3 ( tref3 const & r - ) : + ) GLM_FUNC_POST : x(r.x), y(r.y), z(r.z) @@ -131,7 +131,7 @@ namespace detail ( tref2 const & v, B const & s - ) : + ) GLM_FUNC_POST : x(value_type(v.x)), y(value_type(v.y)), z(value_type(s)) @@ -143,7 +143,7 @@ namespace detail ( A const & s, tref2 const & v - ) : + ) GLM_FUNC_POST : x(value_type(s)), y(value_type(v.x)), z(value_type(v.y)) @@ -157,7 +157,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3::tvec3 ( U const & s - ) : + ) GLM_FUNC_POST : x(value_type(s)), y(value_type(s)), z(value_type(s)) @@ -170,7 +170,7 @@ namespace detail A const & x, B const & y, C const & z - ) : + ) GLM_FUNC_POST : x(value_type(x)), y(value_type(y)), z(value_type(z)) @@ -185,7 +185,7 @@ namespace detail ( tvec2 const & v, B const & s - ) : + ) GLM_FUNC_POST : x(value_type(v.x)), y(value_type(v.y)), z(value_type(s)) @@ -197,7 +197,7 @@ namespace detail ( A const & s, tvec2 const & v - ) : + ) GLM_FUNC_POST : x(value_type(s)), y(value_type(v.x)), z(value_type(v.y)) @@ -208,7 +208,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3::tvec3 ( tvec3 const & v - ) : + ) GLM_FUNC_POST : x(value_type(v.x)), y(value_type(v.y)), z(value_type(v.z)) @@ -219,7 +219,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3::tvec3 ( tvec4 const & v - ) : + ) GLM_FUNC_POST : x(value_type(v.x)), y(value_type(v.y)), z(value_type(v.z)) @@ -232,7 +232,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3& tvec3::operator= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x = v.x; this->y = v.y; @@ -245,7 +245,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3& tvec3::operator= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x = T(v.x); this->y = T(v.y); @@ -258,7 +258,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= ( U const & s - ) + ) GLM_FUNC_POST { this->x += T(s); this->y += T(s); @@ -271,7 +271,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator+= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x += T(v.x); this->y += T(v.y); @@ -284,7 +284,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= ( U const & s - ) + ) GLM_FUNC_POST { this->x -= T(s); this->y -= T(s); @@ -297,7 +297,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator-= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x -= T(v.x); this->y -= T(v.y); @@ -310,7 +310,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= ( U const & s - ) + ) GLM_FUNC_POST { this->x *= T(s); this->y *= T(s); @@ -323,7 +323,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator*= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x *= T(v.x); this->y *= T(v.y); @@ -336,7 +336,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= ( U const & s - ) + ) GLM_FUNC_POST { this->x /= T(s); this->y /= T(s); @@ -349,7 +349,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator/= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x /= T(v.x); this->y /= T(v.y); @@ -358,7 +358,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator++() + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator++() GLM_FUNC_POST { ++this->x; ++this->y; @@ -367,7 +367,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec3 & tvec3::operator--() + GLM_FUNC_QUALIFIER tvec3 & tvec3::operator--() GLM_FUNC_POST { --this->x; --this->y; @@ -383,7 +383,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return (v1.x == v2.x) && (v1.y == v2.y) && (v1.z == v2.z); } @@ -393,7 +393,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return (v1.x != v2.x) || (v1.y != v2.y) || (v1.z != v2.z); } @@ -406,7 +406,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator%= ( U const & s - ) + ) GLM_FUNC_POST { this->x %= s; this->y %= s; @@ -419,7 +419,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator%= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x %= v.x; this->y %= v.y; @@ -432,7 +432,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator&= ( U const & s - ) + ) GLM_FUNC_POST { this->x &= s; this->y &= s; @@ -445,7 +445,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator&= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x &= v.x; this->y &= v.y; @@ -458,7 +458,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator|= ( U const & s - ) + ) GLM_FUNC_POST { this->x |= s; this->y |= s; @@ -471,7 +471,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator|= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x |= v.x; this->y |= v.y; @@ -484,7 +484,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator^= ( U const & s - ) + ) GLM_FUNC_POST { this->x ^= s; this->y ^= s; @@ -497,7 +497,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator^= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x ^= v.x; this->y ^= v.y; @@ -510,7 +510,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator<<= ( U const & s - ) + ) GLM_FUNC_POST { this->x <<= s; this->y <<= s; @@ -523,7 +523,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator<<= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x <<= T(v.x); this->y <<= T(v.y); @@ -536,7 +536,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator>>= ( U const & s - ) + ) GLM_FUNC_POST { this->x >>= T(s); this->y >>= T(s); @@ -549,7 +549,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 & tvec3::operator>>= ( tvec3 const & v - ) + ) GLM_FUNC_POST { this->x >>= T(v.x); this->y >>= T(v.y); @@ -565,7 +565,7 @@ namespace detail tvec3::swizzle ( comp x - ) const + ) const GLM_FUNC_POST { return (*this)[x]; } @@ -575,7 +575,7 @@ namespace detail ( comp x, comp y - ) const + ) const GLM_FUNC_POST { return tvec2( (*this)[x], @@ -588,7 +588,7 @@ namespace detail comp x, comp y, comp z - ) const + ) const GLM_FUNC_POST { return tvec3( (*this)[x], @@ -603,7 +603,7 @@ namespace detail comp y, comp z, comp w - ) const + ) const GLM_FUNC_POST { return tvec4( (*this)[x], @@ -617,7 +617,7 @@ namespace detail ( comp x, comp y - ) + ) GLM_FUNC_POST { return tref2( (*this)[x], @@ -630,7 +630,7 @@ namespace detail comp x, comp y, comp z - ) + ) GLM_FUNC_POST { return tref3( (*this)[x], @@ -646,7 +646,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x + T(s), @@ -659,7 +659,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) + v.x, @@ -672,7 +672,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x + T(v2.x), @@ -686,7 +686,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x - T(s), @@ -699,7 +699,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) - v.x, @@ -712,7 +712,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x - T(v2.x), @@ -726,7 +726,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x * T(s), @@ -739,7 +739,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) * v.x, @@ -752,7 +752,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x * T(v2.x), @@ -766,7 +766,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x / T(s), @@ -779,7 +779,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) / v.x, @@ -792,7 +792,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x / T(v2.x), @@ -805,7 +805,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 operator- ( tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( -v.x, @@ -818,7 +818,7 @@ namespace detail ( tvec3 const & v, int - ) + ) GLM_FUNC_POST { return tvec3( v.x + T(1), @@ -831,7 +831,7 @@ namespace detail ( tvec3 const & v, int - ) + ) GLM_FUNC_POST { return tvec3( v.x - T(1), @@ -847,7 +847,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x % T(s), @@ -860,7 +860,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) % v.x, @@ -873,7 +873,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x % T(v2.x), @@ -886,7 +886,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x & T(s), @@ -899,7 +899,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) & v.x, @@ -912,7 +912,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x & T(v2.x), @@ -925,7 +925,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x | T(s), @@ -938,7 +938,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) | v.x, @@ -951,7 +951,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x | T(v2.x), @@ -964,7 +964,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x ^ T(s), @@ -977,7 +977,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) ^ v.x, @@ -990,7 +990,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x ^ T(v2.x), @@ -1003,7 +1003,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x << T(s), @@ -1016,7 +1016,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( T(s) << v.x, @@ -1029,7 +1029,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x << T(v2.x), @@ -1042,7 +1042,7 @@ namespace detail ( tvec3 const & v, T const & s - ) + ) GLM_FUNC_POST { return tvec3( v.x >> T(s), @@ -1055,7 +1055,7 @@ namespace detail ( T const & s, tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( s >> T(v.x), @@ -1068,7 +1068,7 @@ namespace detail ( tvec3 const & v1, tvec3 const & v2 - ) + ) GLM_FUNC_POST { return tvec3( v1.x >> T(v2.x), @@ -1080,7 +1080,7 @@ namespace detail GLM_FUNC_QUALIFIER tvec3 operator~ ( tvec3 const & v - ) + ) GLM_FUNC_POST { return tvec3( ~v.x, @@ -1092,7 +1092,7 @@ namespace detail // tref definition template - GLM_FUNC_QUALIFIER tref3::tref3(T & x, T & y, T & z) : + GLM_FUNC_QUALIFIER tref3::tref3(T & x, T & y, T & z) GLM_FUNC_POST : x(x), y(y), z(z) @@ -1102,7 +1102,7 @@ namespace detail GLM_FUNC_QUALIFIER tref3::tref3 ( tref3 const & r - ) : + ) GLM_FUNC_POST : x(r.x), y(r.y), z(r.z) @@ -1112,7 +1112,7 @@ namespace detail GLM_FUNC_QUALIFIER tref3::tref3 ( tvec3 const & v - ) : + ) GLM_FUNC_POST : x(v.x), y(v.y), z(v.z) @@ -1122,7 +1122,7 @@ namespace detail GLM_FUNC_QUALIFIER tref3 & tref3::operator= ( tref3 const & r - ) + ) GLM_FUNC_POST { x = r.x; y = r.y; @@ -1134,7 +1134,7 @@ namespace detail GLM_FUNC_QUALIFIER tref3 & tref3::operator= ( tvec3 const & v - ) + ) GLM_FUNC_POST { x = v.x; y = v.y; @@ -1143,7 +1143,7 @@ namespace detail } template - GLM_FUNC_QUALIFIER tvec3 tref3::operator() () + GLM_FUNC_QUALIFIER tvec3 tref3::operator() () GLM_FUNC_POST { return tvec3(this->x, this->y, this->z); } diff --git a/test/core/CMakeLists.txt b/test/core/CMakeLists.txt index 2528da85..c01e8dbd 100644 --- a/test/core/CMakeLists.txt +++ b/test/core/CMakeLists.txt @@ -1,3 +1,4 @@ +glmCreateTestGTC(core_amp) glmCreateTestGTC(core_type_float) glmCreateTestGTC(core_type_half) glmCreateTestGTC(core_type_int) diff --git a/test/core/core_amp.cpp b/test/core/core_amp.cpp new file mode 100644 index 00000000..dafff151 --- /dev/null +++ b/test/core/core_amp.cpp @@ -0,0 +1,37 @@ +/////////////////////////////////////////////////////////////////////////////////////////////////// +// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net) +/////////////////////////////////////////////////////////////////////////////////////////////////// +// Created : 2013-03-21 +// Updated : 2013-03-21 +// Licence : This source is under MIT licence +// File : test/core/core_amp.cpp +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include +#include +#include + +using namespace concurrency; + +int test(int a, int b) restrict(amp, cpu) +{ + return a + b; +} + +int main() +{ + int v[11] = {'G', 'd', 'k', 'k', 'n', 31, 'v', 'n', 'q', 'k', 'c'}; + + array_view av(11, v); + parallel_for_each(av.extent, [=](index<1> idx) restrict(amp) + { + av[idx] += 1; + av[idx] = glm::clamp(av[idx], 0, 255); + }); + + for(unsigned int i = 0; i < 11; i++) + std::cout << static_cast(av[i]); + + return 0; +} +