C++ AMP test

This commit is contained in:
Christophe Riccio 2013-03-26 00:26:41 +01:00
parent 7739e9c3e3
commit 563427cf88
10 changed files with 383 additions and 336 deletions

View File

@ -29,7 +29,7 @@
#define VECTORIZE2_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec2<T> func( \
detail::tvec2<T> const & v) \
detail::tvec2<T> const & v) GLM_FUNC_POST \
{ \
return detail::tvec2<T>( \
func(v.x), \
@ -39,7 +39,7 @@
#define VECTORIZE3_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec3<T> func( \
detail::tvec3<T> const & v) \
detail::tvec3<T> const & v) GLM_FUNC_POST \
{ \
return detail::tvec3<T>( \
func(v.x), \
@ -50,7 +50,7 @@
#define VECTORIZE4_VEC(func) \
template <typename T> \
GLM_FUNC_QUALIFIER detail::tvec4<T> func( \
detail::tvec4<T> const & v) \
detail::tvec4<T> const & v) GLM_FUNC_POST \
{ \
return detail::tvec4<T>( \
func(v.x), \
@ -70,7 +70,7 @@
( \
detail::tvec2<T> const & x, \
typename detail::tvec2<T>::value_type const & y \
) \
) GLM_FUNC_POST \
{ \
return detail::tvec2<T>( \
func(x.x, y), \
@ -83,7 +83,7 @@
( \
detail::tvec3<T> const & x, \
typename detail::tvec3<T>::value_type const & y \
) \
) GLM_FUNC_POST \
{ \
return detail::tvec3<T>( \
func(x.x, y), \
@ -97,7 +97,7 @@
( \
detail::tvec4<T> const & x, \
typename detail::tvec4<T>::value_type const & y \
) \
) GLM_FUNC_POST \
{ \
return detail::tvec4<T>( \
func(x.x, y), \
@ -117,7 +117,7 @@
( \
detail::tvec2<T> const & x, \
detail::tvec2<T> const & y \
) \
) GLM_FUNC_POST \
{ \
return detail::tvec2<T>( \
func(x.x, y.x), \
@ -130,7 +130,7 @@
( \
detail::tvec3<T> const & x, \
detail::tvec3<T> const & y \
) \
) GLM_FUNC_POST \
{ \
return detail::tvec3<T>( \
func(x.x, y.x), \
@ -144,7 +144,7 @@
( \
detail::tvec4<T> const & x, \
detail::tvec4<T> const & y \
) \
) GLM_FUNC_POST \
{ \
return detail::tvec4<T>( \
func(x.x, y.x), \

View File

@ -50,7 +50,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
genType ceil(genType const & x);
genType ceil(genType const & x) GLM_FUNC_POST;
/// Return x - floor(x).
///
@ -122,7 +122,7 @@ namespace glm
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <typename genType>
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 <typename genType>
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 <typename genType>
genType min(
genType const & x,
genType const & y);
genType const & y) GLM_FUNC_POST;
template <typename genType>
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 <typename genType>
genType max(
genType const & x,
genType const & y);
genType const & y) GLM_FUNC_POST;
template <typename genType>
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.
@ -205,13 +205,13 @@ namespace glm
genType clamp(
genType const & x,
genType const & minVal,
genType const & maxVal);
genType const & maxVal) GLM_FUNC_POST;
template <typename genType>
genType clamp(
genType const & x,
typename genType::value_type const & minVal,
typename genType::value_type const & maxVal);
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 <typename genTypeT, typename genTypeU>
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 <typename genType>
genType step(
genType const & edge,
genType const & x);
genType const & x) GLM_FUNC_POST;
template <typename genType>
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 <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToInt.xml">GLSL floatBitsToInt man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floatBitsToUint.xml">GLSL floatBitsToUint man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genUType>
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 <typename genType, typename genIType>
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 <typename genType, typename genUType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fma.xml">GLSL fma man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/frexp.xml">GLSL frexp man page</a>
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
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 <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ldexp.xml">GLSL ldexp man page</a>;
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
template <typename genType, typename genIType>
genType ldexp(genType const & x, genIType const & exp);
genType ldexp(genType const & x, genIType const & exp) GLM_FUNC_POST;
/// @}
}//namespace glm

View File

@ -36,7 +36,7 @@ namespace detail
template <typename genFIType>
struct Abs_<genFIType, true>
{
static genFIType get(genFIType const & x)
static genFIType get(genFIType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(
detail::type<genFIType>::is_float ||
@ -49,7 +49,7 @@ namespace detail
template <typename genFIType>
struct Abs_<genFIType, false>
{
static genFIType get(genFIType const & x)
static genFIType get(genFIType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(
detail::type<genFIType>::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_<genFIType, std::numeric_limits<genFIType>::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<genFIType>::is_float ||
@ -96,13 +96,13 @@ namespace detail
// floor
template <>
GLM_FUNC_QUALIFIER detail::half floor<detail::half>(detail::half const & x)
GLM_FUNC_QUALIFIER detail::half floor<detail::half>(detail::half const & x) GLM_FUNC_POST
{
return detail::half(::std::floor(float(x)));
}
template <typename genType>
GLM_FUNC_QUALIFIER genType floor(genType const & x)
GLM_FUNC_QUALIFIER genType floor(genType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'floor' only accept floating-point inputs");
@ -113,7 +113,7 @@ namespace detail
// trunc
template <typename genType>
GLM_FUNC_QUALIFIER genType trunc(genType const & x)
GLM_FUNC_QUALIFIER genType trunc(genType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'trunc' only accept floating-point inputs");
return x < 0 ? -floor(-x) : floor(x);
@ -123,7 +123,7 @@ namespace detail
// round
template <typename genType>
GLM_FUNC_QUALIFIER genType round(genType const& x)
GLM_FUNC_QUALIFIER genType round(genType const& x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'round' only accept floating-point inputs");
@ -147,7 +147,7 @@ namespace detail
// roundEven
template <typename genType>
GLM_FUNC_QUALIFIER genType roundEven(genType const & x)
GLM_FUNC_QUALIFIER genType roundEven(genType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'roundEven' only accept floating-point inputs");
@ -181,7 +181,7 @@ namespace detail
// ceil
template <typename genType>
GLM_FUNC_QUALIFIER genType ceil(genType const & x)
GLM_FUNC_QUALIFIER genType ceil(genType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::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<genType>::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<genType>::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<genType>::is_float, "'modf' only accept floating-point inputs");
@ -238,7 +238,7 @@ namespace detail
(
detail::tvec2<valType> const & x,
detail::tvec2<valType> & i
)
) GLM_FUNC_POST
{
return detail::tvec2<valType>(
modf(x.x, i.x),
@ -250,7 +250,7 @@ namespace detail
(
detail::tvec3<valType> const & x,
detail::tvec3<valType> & i
)
) GLM_FUNC_POST
{
return detail::tvec3<valType>(
modf(x.x, i.x),
@ -263,7 +263,7 @@ namespace detail
(
detail::tvec4<valType> const & x,
detail::tvec4<valType> & i
)
) GLM_FUNC_POST
{
return detail::tvec4<valType>(
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<genType>::is_float ||
@ -305,7 +305,7 @@ namespace detail
(
genType const & x,
genType const & y
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(
detail::type<genType>::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<valType>::is_float ||
@ -341,7 +341,7 @@ namespace detail
detail::tvec2<T> const & x,
typename detail::tvec2<T>::value_type const & minVal,
typename detail::tvec2<T>::value_type const & maxVal
)
) GLM_FUNC_POST
{
return detail::tvec2<T>(
clamp(x.x, minVal, maxVal),
@ -354,7 +354,7 @@ namespace detail
detail::tvec3<T> const & x,
typename detail::tvec3<T>::value_type const & minVal,
typename detail::tvec3<T>::value_type const & maxVal
)
) GLM_FUNC_POST
{
return detail::tvec3<T>(
clamp(x.x, minVal, maxVal),
@ -368,7 +368,7 @@ namespace detail
detail::tvec4<T> const & x,
typename detail::tvec4<T>::value_type const & minVal,
typename detail::tvec4<T>::value_type const & maxVal
)
) GLM_FUNC_POST
{
return detail::tvec4<T>(
clamp(x.x, minVal, maxVal),
@ -383,7 +383,7 @@ namespace detail
detail::tvec2<T> const & x,
detail::tvec2<T> const & minVal,
detail::tvec2<T> const & maxVal
)
) GLM_FUNC_POST
{
return detail::tvec2<T>(
clamp(x.x, minVal.x, maxVal.x),
@ -396,7 +396,7 @@ namespace detail
detail::tvec3<T> const & x,
detail::tvec3<T> const & minVal,
detail::tvec3<T> const & maxVal
)
) GLM_FUNC_POST
{
return detail::tvec3<T>(
clamp(x.x, minVal.x, maxVal.x),
@ -410,7 +410,7 @@ namespace detail
detail::tvec4<T> const & x,
detail::tvec4<T> const & minVal,
detail::tvec4<T> const & maxVal
)
) GLM_FUNC_POST
{
return detail::tvec4<T>(
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<genType>::is_float , "'genType' is not floating-point type");
@ -439,7 +439,7 @@ namespace detail
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y,
valType const & a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<valType>::is_float , "'genType' is not floating-point type");
@ -452,7 +452,7 @@ namespace detail
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y,
valType const & a
)
) GLM_FUNC_POST
{
return x + a * (y - x);
}
@ -463,7 +463,7 @@ namespace detail
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y,
valType const & a
)
) GLM_FUNC_POST
{
return x + a * (y - x);
}
@ -474,7 +474,7 @@ namespace detail
detail::tvec2<valType> const & x,
detail::tvec2<valType> const & y,
detail::tvec2<valType> const & a
)
) GLM_FUNC_POST
{
return x + a * (y - x);
}
@ -485,7 +485,7 @@ namespace detail
detail::tvec3<valType> const & x,
detail::tvec3<valType> const & y,
detail::tvec3<valType> const & a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<valType>::is_float , "'genType' is not floating-point type");
@ -498,7 +498,7 @@ namespace detail
detail::tvec4<valType> const & x,
detail::tvec4<valType> const & y,
detail::tvec4<valType> 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<T> const & x,
detail::tvec2<T> const & y,
bool a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
@ -560,7 +560,7 @@ namespace detail
detail::tvec3<T> const & x,
detail::tvec3<T> const & y,
bool a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
@ -573,7 +573,7 @@ namespace detail
detail::tvec4<T> const & x,
detail::tvec4<T> const & y,
bool a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
@ -586,7 +586,7 @@ namespace detail
detail::tvec2<T> const & x,
detail::tvec2<T> const & y,
typename detail::tvec2<T>::bool_type a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
@ -608,7 +608,7 @@ namespace detail
detail::tvec3<T> const & x,
detail::tvec3<T> const & y,
typename detail::tvec3<T>::bool_type a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<T>::is_float, "'mix' only accept floating-point inputs");
@ -630,7 +630,7 @@ namespace detail
detail::tvec4<T> const & x,
detail::tvec4<T> const & y,
typename detail::tvec4<T>::bool_type a
)
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<T>::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<genType>::is_float, "'step' only accept floating-point inputs");
@ -664,7 +664,7 @@ namespace detail
(
typename detail::tvec2<T>::value_type const & edge,
detail::tvec2<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec2<T>(
x.x < edge ? T(0) : T(1),
@ -676,7 +676,7 @@ namespace detail
(
typename detail::tvec3<T>::value_type const & edge,
detail::tvec3<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec3<T>(
x.x < edge ? T(0) : T(1),
@ -689,7 +689,7 @@ namespace detail
(
typename detail::tvec4<T>::value_type const & edge,
detail::tvec4<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec4<T>(
x.x < edge ? T(0) : T(1),
@ -703,7 +703,7 @@ namespace detail
(
detail::tvec2<T> const & edge,
detail::tvec2<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec2<T>(
x.x < edge.x ? T(0) : T(1),
@ -715,7 +715,7 @@ namespace detail
(
detail::tvec3<T> const & edge,
detail::tvec3<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec3<T>(
x.x < edge.x ? T(0) : T(1),
@ -728,7 +728,7 @@ namespace detail
(
detail::tvec4<T> const & edge,
detail::tvec4<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec4<T>(
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<genType>::is_float, "'smoothstep' only accept floating-point inputs");
@ -758,7 +758,7 @@ namespace detail
typename detail::tvec2<T>::value_type const & edge0,
typename detail::tvec2<T>::value_type const & edge1,
detail::tvec2<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec2<T>(
smoothstep(edge0, edge1, x.x),
@ -771,7 +771,7 @@ namespace detail
typename detail::tvec3<T>::value_type const & edge0,
typename detail::tvec3<T>::value_type const & edge1,
detail::tvec3<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec3<T>(
smoothstep(edge0, edge1, x.x),
@ -785,7 +785,7 @@ namespace detail
typename detail::tvec4<T>::value_type const & edge0,
typename detail::tvec4<T>::value_type const & edge1,
detail::tvec4<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec4<T>(
smoothstep(edge0, edge1, x.x),
@ -800,7 +800,7 @@ namespace detail
detail::tvec2<T> const & edge0,
detail::tvec2<T> const & edge1,
detail::tvec2<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec2<T>(
smoothstep(edge0.x, edge1.x, x.x),
@ -813,7 +813,7 @@ namespace detail
detail::tvec3<T> const & edge0,
detail::tvec3<T> const & edge1,
detail::tvec3<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec3<T>(
smoothstep(edge0.x, edge1.x, x.x),
@ -827,7 +827,7 @@ namespace detail
detail::tvec4<T> const & edge0,
detail::tvec4<T> const & edge1,
detail::tvec4<T> const & x
)
) GLM_FUNC_POST
{
return detail::tvec4<T>(
smoothstep(edge0.x, edge1.x, x.x),
@ -838,7 +838,7 @@ namespace detail
// TODO: Not working on MinGW...
template <typename genType>
GLM_FUNC_QUALIFIER bool isnan(genType const & x)
GLM_FUNC_QUALIFIER bool isnan(genType const & x) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs");
@ -861,7 +861,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename detail::tvec2<T>::bool_type isnan
(
detail::tvec2<T> const & x
)
) GLM_FUNC_POST
{
return typename detail::tvec2<T>::bool_type(
isnan(x.x),
@ -872,7 +872,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename detail::tvec3<T>::bool_type isnan
(
detail::tvec3<T> const & x
)
) GLM_FUNC_POST
{
return typename detail::tvec3<T>::bool_type(
isnan(x.x),
@ -884,7 +884,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename detail::tvec4<T>::bool_type isnan
(
detail::tvec4<T> const & x
)
) GLM_FUNC_POST
{
return typename detail::tvec4<T>::bool_type(
isnan(x.x),
@ -894,8 +894,10 @@ namespace detail
}
template <typename genType>
GLM_FUNC_QUALIFIER bool isinf(
genType const & x)
GLM_FUNC_QUALIFIER bool isinf
(
genType const & x
) GLM_FUNC_POST
{
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isinf' only accept floating-point inputs");
@ -919,7 +921,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename detail::tvec2<T>::bool_type isinf
(
detail::tvec2<T> const & x
)
) GLM_FUNC_POST
{
return typename detail::tvec2<T>::bool_type(
isinf(x.x),
@ -930,7 +932,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename detail::tvec3<T>::bool_type isinf
(
detail::tvec3<T> const & x
)
) GLM_FUNC_POST
{
return typename detail::tvec3<T>::bool_type(
isinf(x.x),
@ -942,7 +944,7 @@ namespace detail
GLM_FUNC_QUALIFIER typename detail::tvec4<T>::bool_type isinf
(
detail::tvec4<T> const & x
)
) GLM_FUNC_POST
{
return typename detail::tvec4<T>::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<int> floatBitsToInt
(
detail::tvec2<float> const & value
)
) GLM_FUNC_POST
{
return detail::tvec2<int>(
floatBitsToInt(value.x),
@ -976,7 +978,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec3<int> floatBitsToInt
(
detail::tvec3<float> const & value
)
) GLM_FUNC_POST
{
return detail::tvec3<int>(
floatBitsToInt(value.x),
@ -987,7 +989,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec4<int> floatBitsToInt
(
detail::tvec4<float> const & value
)
) GLM_FUNC_POST
{
return detail::tvec4<int>(
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<uint> floatBitsToUint
(
detail::tvec2<float> const & value
)
) GLM_FUNC_POST
{
return detail::tvec2<uint>(
floatBitsToUint(value.x),
@ -1021,7 +1023,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec3<uint> floatBitsToUint
(
detail::tvec3<float> const & value
)
) GLM_FUNC_POST
{
return detail::tvec3<uint>(
floatBitsToUint(value.x),
@ -1032,7 +1034,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec4<uint> floatBitsToUint
(
detail::tvec4<float> const & value
)
) GLM_FUNC_POST
{
return detail::tvec4<uint>(
floatBitsToUint(value.x),
@ -1054,10 +1056,9 @@ namespace detail
}
GLM_FUNC_QUALIFIER detail::tvec2<float> intBitsToFloat
(
detail::tvec2<int> const & value
)
) GLM_FUNC_POST
{
return detail::tvec2<float>(
intBitsToFloat(value.x),
@ -1067,7 +1068,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec3<float> intBitsToFloat
(
detail::tvec3<int> const & value
)
) GLM_FUNC_POST
{
return detail::tvec3<float>(
intBitsToFloat(value.x),
@ -1078,7 +1079,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec4<float> intBitsToFloat
(
detail::tvec4<int> const & value
)
) GLM_FUNC_POST
{
return detail::tvec4<float>(
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<float> uintBitsToFloat
(
detail::tvec2<uint> const & value
)
) GLM_FUNC_POST
{
return detail::tvec2<float>(
uintBitsToFloat(value.x),
@ -1112,7 +1113,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec3<float> uintBitsToFloat
(
detail::tvec3<uint> const & value
)
) GLM_FUNC_POST
{
return detail::tvec3<float>(
uintBitsToFloat(value.x),
@ -1123,7 +1124,7 @@ namespace detail
GLM_FUNC_QUALIFIER detail::tvec4<float> uintBitsToFloat
(
detail::tvec4<uint> const & value
)
) GLM_FUNC_POST
{
return detail::tvec4<float>(
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<T> const & x,
detail::tvec2<int> & exp
)
) GLM_FUNC_POST
{
return std::frexp(x, exp);
}
@ -1168,7 +1169,7 @@ namespace detail
(
detail::tvec3<T> const & x,
detail::tvec3<int> & exp
)
) GLM_FUNC_POST
{
return std::frexp(x, exp);
}
@ -1178,7 +1179,7 @@ namespace detail
(
detail::tvec4<T> const & x,
detail::tvec4<int> & 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<T> const & x,
detail::tvec2<int> const & exp
)
) GLM_FUNC_POST
{
return std::frexp(x, exp);
}
@ -1208,7 +1209,7 @@ namespace detail
(
detail::tvec3<T> const & x,
detail::tvec3<int> const & exp
)
) GLM_FUNC_POST
{
return std::frexp(x, exp);
}
@ -1218,9 +1219,8 @@ namespace detail
(
detail::tvec4<T> const & x,
detail::tvec4<int> const & exp
)
) GLM_FUNC_POST
{
return std::frexp(x, exp);
}
}//namespace glm

View File

@ -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

View File

@ -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 <typename U>
GLM_FUNC_DECL explicit half(U const & s);
GLM_FUNC_DECL explicit half(U const & s) GLM_FUNC_POST;
// Cast
//template <typename U>
//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

View File

@ -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 <typename U>
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));
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);
}

View File

@ -54,7 +54,7 @@ namespace detail
typedef tvec3<T> type;
typedef tvec3<bool> 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<T> const & v);
GLM_FUNC_DECL tvec3() GLM_FUNC_POST;
GLM_FUNC_DECL tvec3(tvec3<T> 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 <typename U>
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 <typename U, typename V, typename W>
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 <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(tvec2<A> const & v, B const & s);
GLM_FUNC_DECL explicit tvec3(tvec2<A> 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 <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B> const & v);
GLM_FUNC_DECL explicit tvec3(A const & s, tvec2<B> const & v) GLM_FUNC_POST;
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec3(tvec3<U> const & v);
GLM_FUNC_DECL explicit tvec3(tvec3<U> const & v) GLM_FUNC_POST;
//! Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template <typename U>
GLM_FUNC_DECL explicit tvec3(tvec4<U> const & v);
GLM_FUNC_DECL explicit tvec3(tvec4<U> const & v) GLM_FUNC_POST;
//////////////////////////////////////
// Swizzle constructors
GLM_FUNC_DECL tvec3(tref3<T> const & r);
GLM_FUNC_DECL tvec3(tref3<T> const & r) GLM_FUNC_POST;
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(tref2<A> const & v, B const & s);
GLM_FUNC_DECL explicit tvec3(tref2<A> const & v, B const & s) GLM_FUNC_POST;
template <typename A, typename B>
GLM_FUNC_DECL explicit tvec3(A const & s, tref2<B> const & v);
GLM_FUNC_DECL explicit tvec3(A const & s, tref2<B> const & v) GLM_FUNC_POST;
template <int E0, int E1, int E2>
GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & that)
GLM_FUNC_DECL tvec3(glm::detail::swizzle<3, T, tvec3<T>, E0, E1, E2, -1> const & that) GLM_FUNC_POST
{
*this = that();
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & s)
GLM_FUNC_DECL tvec3(glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v, T const & s) GLM_FUNC_POST
{
*this = tvec3<T>(v(), s);
}
template <int E0, int E1>
GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v)
GLM_FUNC_DECL tvec3(T const & s, glm::detail::swizzle<2, T, tvec2<T>, E0, E1, -1, -2> const & v) GLM_FUNC_POST
{
*this = tvec3<T>(s, v());
}
@ -184,79 +184,79 @@ namespace detail
//////////////////////////////////////
// Unary arithmetic operators
GLM_FUNC_DECL tvec3<T> & operator= (tvec3<T> const & v);
GLM_FUNC_DECL tvec3<T> & operator= (tvec3<T> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator= (tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator= (tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator+=(U const & s);
GLM_FUNC_DECL tvec3<T> & operator+=(U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator+=(tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator+=(tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator-=(U const & s);
GLM_FUNC_DECL tvec3<T> & operator-=(U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator-=(tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator-=(tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator*=(U const & s);
GLM_FUNC_DECL tvec3<T> & operator*=(U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator*=(tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator*=(tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator/=(U const & s);
GLM_FUNC_DECL tvec3<T> & operator/=(U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator/=(tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator++();
GLM_FUNC_DECL tvec3<T> & operator--();
GLM_FUNC_DECL tvec3<T> & operator/=(tvec3<U> const & v) GLM_FUNC_POST;
GLM_FUNC_DECL tvec3<T> & operator++() GLM_FUNC_POST;
GLM_FUNC_DECL tvec3<T> & operator--() GLM_FUNC_POST;
//////////////////////////////////////
// Unary bit operators
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator%= (U const & s);
GLM_FUNC_DECL tvec3<T> & operator%= (U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator%= (tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator%= (tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator&= (U const & s);
GLM_FUNC_DECL tvec3<T> & operator&= (U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator&= (tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator&= (tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator|= (U const & s);
GLM_FUNC_DECL tvec3<T> & operator|= (U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator|= (tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator|= (tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator^= (U const & s);
GLM_FUNC_DECL tvec3<T> & operator^= (U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator^= (tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator^= (tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator<<=(U const & s);
GLM_FUNC_DECL tvec3<T> & operator<<=(U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator<<=(tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator<<=(tvec3<U> const & v) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator>>=(U const & s);
GLM_FUNC_DECL tvec3<T> & operator>>=(U const & s) GLM_FUNC_POST;
template <typename U>
GLM_FUNC_DECL tvec3<T> & operator>>=(tvec3<U> const & v);
GLM_FUNC_DECL tvec3<T> & operator>>=(tvec3<U> const & v) GLM_FUNC_POST;
//////////////////////////////////////
// Swizzle operators
GLM_FUNC_DECL value_type swizzle(comp X) const;
GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const;
GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const;
GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const;
GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y);
GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z);
GLM_FUNC_DECL value_type swizzle(comp X) const GLM_FUNC_POST;
GLM_FUNC_DECL tvec2<T> swizzle(comp X, comp Y) const GLM_FUNC_POST;
GLM_FUNC_DECL tvec3<T> swizzle(comp X, comp Y, comp Z) const GLM_FUNC_POST;
GLM_FUNC_DECL tvec4<T> swizzle(comp X, comp Y, comp Z, comp W) const GLM_FUNC_POST;
GLM_FUNC_DECL tref2<T> swizzle(comp X, comp Y) GLM_FUNC_POST;
GLM_FUNC_DECL tref3<T> swizzle(comp X, comp Y, comp Z) GLM_FUNC_POST;
};
template <typename T>
struct tref3
{
GLM_FUNC_DECL tref3(T & x, T & y, T & z);
GLM_FUNC_DECL tref3(tref3<T> const & r);
GLM_FUNC_DECL explicit tref3(tvec3<T> const & v);
GLM_FUNC_DECL tref3(T & x, T & y, T & z) GLM_FUNC_POST;
GLM_FUNC_DECL tref3(tref3<T> const & r) GLM_FUNC_POST;
GLM_FUNC_DECL explicit tref3(tvec3<T> const & v) GLM_FUNC_POST;
GLM_FUNC_DECL tref3<T> & operator= (tref3<T> const & r);
GLM_FUNC_DECL tref3<T> & operator= (tvec3<T> const & v);
GLM_FUNC_DECL tref3<T> & operator= (tref3<T> const & r) GLM_FUNC_POST;
GLM_FUNC_DECL tref3<T> & operator= (tvec3<T> const & v) GLM_FUNC_POST;
GLM_FUNC_DECL tvec3<T> operator() ();
GLM_FUNC_DECL tvec3<T> operator() () GLM_FUNC_POST;
T & x;
T & y;

View File

@ -30,7 +30,7 @@ namespace glm{
namespace detail
{
template <typename T>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T>::size_type tvec3<T>::length() const
GLM_FUNC_QUALIFIER GLM_CONSTEXPR typename tvec3<T>::size_type tvec3<T>::length() const GLM_FUNC_POST
{
return 3;
}
@ -43,7 +43,7 @@ namespace detail
tvec3<T>::operator[]
(
size_type i
)
) GLM_FUNC_POST
{
assert(i < this->length());
return (&x)[i];
@ -54,7 +54,7 @@ namespace detail
tvec3<T>::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 <typename T>
GLM_FUNC_QUALIFIER tvec3<T>::tvec3() :
GLM_FUNC_QUALIFIER tvec3<T>::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<T>::tvec3
(
ctor
)
) GLM_FUNC_POST
{}
template <typename T>
GLM_FUNC_QUALIFIER tvec3<T>::tvec3
(
tvec3<T> const & v
) :
) GLM_FUNC_POST :
x(v.x),
y(v.y),
z(v.z)
@ -94,7 +94,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T>::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<T>::tvec3
(
tref3<T> const & r
) :
) GLM_FUNC_POST :
x(r.x),
y(r.y),
z(r.z)
@ -131,7 +131,7 @@ namespace detail
(
tref2<A> 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<B> 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<T>::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<A> 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<B> 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<T>::tvec3
(
tvec3<U> 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<T>::tvec3
(
tvec4<U> 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<T>& tvec3<T>::operator=
(
tvec3<T> const & v
)
) GLM_FUNC_POST
{
this->x = v.x;
this->y = v.y;
@ -245,7 +245,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T>& tvec3<T>::operator=
(
tvec3<U> 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<T> & tvec3<T>::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<T> & tvec3<T>::operator+=
(
tvec3<U> 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<T> & tvec3<T>::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<T> & tvec3<T>::operator-=
(
tvec3<U> 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<T> & tvec3<T>::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<T> & tvec3<T>::operator*=
(
tvec3<U> 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<T> & tvec3<T>::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<T> & tvec3<T>::operator/=
(
tvec3<U> const & v
)
) GLM_FUNC_POST
{
this->x /= T(v.x);
this->y /= T(v.y);
@ -358,7 +358,7 @@ namespace detail
}
template <typename T>
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator++()
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator++() GLM_FUNC_POST
{
++this->x;
++this->y;
@ -367,7 +367,7 @@ namespace detail
}
template <typename T>
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator--()
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator--() GLM_FUNC_POST
{
--this->x;
--this->y;
@ -383,7 +383,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> 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<T> const & v1,
tvec3<T> 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<T> & tvec3<T>::operator%=
(
U const & s
)
) GLM_FUNC_POST
{
this->x %= s;
this->y %= s;
@ -419,7 +419,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator%=
(
tvec3<U> const & v
)
) GLM_FUNC_POST
{
this->x %= v.x;
this->y %= v.y;
@ -432,7 +432,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator&=
(
U const & s
)
) GLM_FUNC_POST
{
this->x &= s;
this->y &= s;
@ -445,7 +445,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator&=
(
tvec3<U> const & v
)
) GLM_FUNC_POST
{
this->x &= v.x;
this->y &= v.y;
@ -458,7 +458,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator|=
(
U const & s
)
) GLM_FUNC_POST
{
this->x |= s;
this->y |= s;
@ -471,7 +471,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator|=
(
tvec3<U> const & v
)
) GLM_FUNC_POST
{
this->x |= v.x;
this->y |= v.y;
@ -484,7 +484,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator^=
(
U const & s
)
) GLM_FUNC_POST
{
this->x ^= s;
this->y ^= s;
@ -497,7 +497,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator^=
(
tvec3<U> const & v
)
) GLM_FUNC_POST
{
this->x ^= v.x;
this->y ^= v.y;
@ -510,7 +510,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator<<=
(
U const & s
)
) GLM_FUNC_POST
{
this->x <<= s;
this->y <<= s;
@ -523,7 +523,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> & tvec3<T>::operator<<=
(
tvec3<U> 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<T> & tvec3<T>::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<T> & tvec3<T>::operator>>=
(
tvec3<U> const & v
)
) GLM_FUNC_POST
{
this->x >>= T(v.x);
this->y >>= T(v.y);
@ -565,7 +565,7 @@ namespace detail
tvec3<T>::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<T>(
(*this)[x],
@ -588,7 +588,7 @@ namespace detail
comp x,
comp y,
comp z
) const
) const GLM_FUNC_POST
{
return tvec3<T>(
(*this)[x],
@ -603,7 +603,7 @@ namespace detail
comp y,
comp z,
comp w
) const
) const GLM_FUNC_POST
{
return tvec4<T>(
(*this)[x],
@ -617,7 +617,7 @@ namespace detail
(
comp x,
comp y
)
) GLM_FUNC_POST
{
return tref2<T>(
(*this)[x],
@ -630,7 +630,7 @@ namespace detail
comp x,
comp y,
comp z
)
) GLM_FUNC_POST
{
return tref3<T>(
(*this)[x],
@ -646,7 +646,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x + T(s),
@ -659,7 +659,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) + v.x,
@ -672,7 +672,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x + T(v2.x),
@ -686,7 +686,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x - T(s),
@ -699,7 +699,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) - v.x,
@ -712,7 +712,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x - T(v2.x),
@ -726,7 +726,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x * T(s),
@ -739,7 +739,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) * v.x,
@ -752,7 +752,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x * T(v2.x),
@ -766,7 +766,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x / T(s),
@ -779,7 +779,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) / v.x,
@ -792,7 +792,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x / T(v2.x),
@ -805,7 +805,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> operator-
(
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
-v.x,
@ -818,7 +818,7 @@ namespace detail
(
tvec3<T> const & v,
int
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x + T(1),
@ -831,7 +831,7 @@ namespace detail
(
tvec3<T> const & v,
int
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x - T(1),
@ -847,7 +847,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x % T(s),
@ -860,7 +860,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) % v.x,
@ -873,7 +873,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x % T(v2.x),
@ -886,7 +886,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x & T(s),
@ -899,7 +899,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) & v.x,
@ -912,7 +912,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x & T(v2.x),
@ -925,7 +925,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x | T(s),
@ -938,7 +938,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) | v.x,
@ -951,7 +951,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x | T(v2.x),
@ -964,7 +964,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x ^ T(s),
@ -977,7 +977,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) ^ v.x,
@ -990,7 +990,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x ^ T(v2.x),
@ -1003,7 +1003,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x << T(s),
@ -1016,7 +1016,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
T(s) << v.x,
@ -1029,7 +1029,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x << T(v2.x),
@ -1042,7 +1042,7 @@ namespace detail
(
tvec3<T> const & v,
T const & s
)
) GLM_FUNC_POST
{
return tvec3<T>(
v.x >> T(s),
@ -1055,7 +1055,7 @@ namespace detail
(
T const & s,
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
s >> T(v.x),
@ -1068,7 +1068,7 @@ namespace detail
(
tvec3<T> const & v1,
tvec3<T> const & v2
)
) GLM_FUNC_POST
{
return tvec3<T>(
v1.x >> T(v2.x),
@ -1080,7 +1080,7 @@ namespace detail
GLM_FUNC_QUALIFIER tvec3<T> operator~
(
tvec3<T> const & v
)
) GLM_FUNC_POST
{
return tvec3<T>(
~v.x,
@ -1092,7 +1092,7 @@ namespace detail
// tref definition
template <typename T>
GLM_FUNC_QUALIFIER tref3<T>::tref3(T & x, T & y, T & z) :
GLM_FUNC_QUALIFIER tref3<T>::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<T>::tref3
(
tref3<T> const & r
) :
) GLM_FUNC_POST :
x(r.x),
y(r.y),
z(r.z)
@ -1112,7 +1112,7 @@ namespace detail
GLM_FUNC_QUALIFIER tref3<T>::tref3
(
tvec3<T> const & v
) :
) GLM_FUNC_POST :
x(v.x),
y(v.y),
z(v.z)
@ -1122,7 +1122,7 @@ namespace detail
GLM_FUNC_QUALIFIER tref3<T> & tref3<T>::operator=
(
tref3<T> const & r
)
) GLM_FUNC_POST
{
x = r.x;
y = r.y;
@ -1134,7 +1134,7 @@ namespace detail
GLM_FUNC_QUALIFIER tref3<T> & tref3<T>::operator=
(
tvec3<T> const & v
)
) GLM_FUNC_POST
{
x = v.x;
y = v.y;
@ -1143,7 +1143,7 @@ namespace detail
}
template <typename T>
GLM_FUNC_QUALIFIER tvec3<T> tref3<T>::operator() ()
GLM_FUNC_QUALIFIER tvec3<T> tref3<T>::operator() () GLM_FUNC_POST
{
return tvec3<T>(this->x, this->y, this->z);
}

View File

@ -1,3 +1,4 @@
glmCreateTestGTC(core_amp)
glmCreateTestGTC(core_type_float)
glmCreateTestGTC(core_type_half)
glmCreateTestGTC(core_type_int)

37
test/core/core_amp.cpp Normal file
View File

@ -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 <iostream>
#include <amp.h>
#include <glm/glm.hpp>
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<int> 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<char>(av[i]);
return 0;
}