Merge pull request #74 from mackron/0.9.5_Compilation_Fixes

SIMD compilation fixes + clamp() ambiguity fix.
This commit is contained in:
Christophe Riccio 2013-04-23 07:37:37 -07:00
commit fb99c4d2e7
12 changed files with 42 additions and 42 deletions

View File

@ -208,7 +208,7 @@ namespace glm
genType const & minVal, genType const & minVal,
genType const & maxVal); genType const & maxVal);
template <typename genType> template <typename genType, precision P>
genType clamp( genType clamp(
genType const & x, genType const & x,
typename genType::value_type const & minVal, typename genType::value_type const & minVal,

View File

@ -339,7 +339,7 @@ namespace glm
return Result; return Result;
} }
template <typename T, precision P, typename U> template <typename T, typename U, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> project GLM_FUNC_QUALIFIER detail::tvec3<T, P> project
( (
detail::tvec3<T, P> const & obj, detail::tvec3<T, P> const & obj,
@ -360,7 +360,7 @@ namespace glm
return detail::tvec3<T, P>(tmp); return detail::tvec3<T, P>(tmp);
} }
template <typename T, precision P, typename U> template <typename T, typename U, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> unProject GLM_FUNC_QUALIFIER detail::tvec3<T, P> unProject
( (
detail::tvec3<T, P> const & win, detail::tvec3<T, P> const & win,

View File

@ -27,20 +27,20 @@ namespace glm
return f; return f;
} }
template <typename T> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fastPow( GLM_FUNC_QUALIFIER detail::tvec2<T, P> fastPow(
const detail::tvec2<T, P>& x, const detail::tvec2<T, P>& x,
const detail::tvec2<int>& y) const detail::tvec2<int, P>& y)
{ {
return detail::tvec2<T, P>( return detail::tvec2<T, P>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
fastPow(x.y, y.y)); fastPow(x.y, y.y));
} }
template <typename T> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fastPow( GLM_FUNC_QUALIFIER detail::tvec3<T, P> fastPow(
const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& x,
const detail::tvec3<int>& y) const detail::tvec3<int, P>& y)
{ {
return detail::tvec3<T, P>( return detail::tvec3<T, P>(
fastPow(x.x, y.x), fastPow(x.x, y.x),
@ -48,10 +48,10 @@ namespace glm
fastPow(x.z, y.z)); fastPow(x.z, y.z));
} }
template <typename T> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fastPow( GLM_FUNC_QUALIFIER detail::tvec4<T, P> fastPow(
const detail::tvec4<T, P>& x, const detail::tvec4<T, P>& x,
const detail::tvec4<int>& y) const detail::tvec4<int, P>& y)
{ {
return detail::tvec4<T, P>( return detail::tvec4<T, P>(
fastPow(x.x, y.x), fastPow(x.x, y.x),

View File

@ -36,7 +36,7 @@ namespace glm
i = 0x5f375a86 - (i >> 1); i = 0x5f375a86 - (i >> 1);
//x = *(float*)&i; //x = *(float*)&i;
//x = *((float*)(char*)&i); //x = *((float*)(char*)&i);
tmp = detail::uif(i).f; tmp = detail::uif32(i).f;
tmp = tmp * (1.5f - xhalf * tmp * tmp); tmp = tmp * (1.5f - xhalf * tmp * tmp);
return genType(tmp); return genType(tmp);
} }
@ -53,30 +53,30 @@ namespace glm
return abs(x); return abs(x);
} }
template <typename valType> template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastLength GLM_FUNC_QUALIFIER valType fastLength
( (
detail::tvec2<valType> const & x detail::tvec2<valType, P> const & x
) )
{ {
valType sqr = x.x * x.x + x.y * x.y; valType sqr = x.x * x.x + x.y * x.y;
return fastSqrt(sqr); return fastSqrt(sqr);
} }
template <typename valType> template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastLength GLM_FUNC_QUALIFIER valType fastLength
( (
detail::tvec3<valType> const & x detail::tvec3<valType, P> const & x
) )
{ {
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; valType sqr = x.x * x.x + x.y * x.y + x.z * x.z;
return fastSqrt(sqr); return fastSqrt(sqr);
} }
template <typename valType> template <typename valType, precision P>
GLM_FUNC_QUALIFIER valType fastLength GLM_FUNC_QUALIFIER valType fastLength
( (
detail::tvec4<valType> const & x detail::tvec4<valType, P> const & x
) )
{ {
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
@ -104,30 +104,30 @@ namespace glm
return x > genType(0) ? genType(1) : -genType(1); return x > genType(0) ? genType(1) : -genType(1);
} }
template <typename valType> template <typename valType, precision P>
GLM_FUNC_QUALIFIER detail::tvec2<valType> fastNormalize GLM_FUNC_QUALIFIER detail::tvec2<valType, P> fastNormalize
( (
detail::tvec2<valType> const & x detail::tvec2<valType, P> const & x
) )
{ {
valType sqr = x.x * x.x + x.y * x.y; valType sqr = x.x * x.x + x.y * x.y;
return x * fastInverseSqrt(sqr); return x * fastInverseSqrt(sqr);
} }
template <typename valType> template <typename valType, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<valType> fastNormalize GLM_FUNC_QUALIFIER detail::tvec3<valType, P> fastNormalize
( (
detail::tvec3<valType> const & x detail::tvec3<valType, P> const & x
) )
{ {
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z; valType sqr = x.x * x.x + x.y * x.y + x.z * x.z;
return x * fastInverseSqrt(sqr); return x * fastInverseSqrt(sqr);
} }
template <typename valType> template <typename valType, precision P>
GLM_FUNC_QUALIFIER detail::tvec4<valType> fastNormalize GLM_FUNC_QUALIFIER detail::tvec4<valType, P> fastNormalize
( (
detail::tvec4<valType> const & x detail::tvec4<valType, P> const & x
) )
{ {
valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w; valType sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;

View File

@ -53,7 +53,7 @@ namespace glm
//! Computes triangle normal from triangle points. //! Computes triangle normal from triangle points.
//! From GLM_GTX_normal extension. //! From GLM_GTX_normal extension.
template <typename T> template <typename T, precision P>
detail::tvec3<T, P> triangleNormal( detail::tvec3<T, P> triangleNormal(
detail::tvec3<T, P> const & p1, detail::tvec3<T, P> const & p1,
detail::tvec3<T, P> const & p2, detail::tvec3<T, P> const & p2,

View File

@ -9,7 +9,7 @@
namespace glm namespace glm
{ {
template <typename T> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> triangleNormal GLM_FUNC_QUALIFIER detail::tvec3<T, P> triangleNormal
( (
detail::tvec3<T, P> const & p1, detail::tvec3<T, P> const & p1,

View File

@ -53,13 +53,13 @@ namespace glm
//! Returns the orthonormalized matrix of m. //! Returns the orthonormalized matrix of m.
//! From GLM_GTX_orthonormalize extension. //! From GLM_GTX_orthonormalize extension.
template <typename T> template <typename T, precision P>
detail::tmat3x3<T, P> orthonormalize( detail::tmat3x3<T, P> orthonormalize(
const detail::tmat3x3<T, P>& m); const detail::tmat3x3<T, P>& m);
//! Orthonormalizes x according y. //! Orthonormalizes x according y.
//! From GLM_GTX_orthonormalize extension. //! From GLM_GTX_orthonormalize extension.
template <typename T> template <typename T, precision P>
detail::tvec3<T, P> orthonormalize( detail::tvec3<T, P> orthonormalize(
const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& x,
const detail::tvec3<T, P>& y); const detail::tvec3<T, P>& y);

View File

@ -9,7 +9,7 @@
namespace glm namespace glm
{ {
template <typename T> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> orthonormalize GLM_FUNC_QUALIFIER detail::tmat3x3<T, P> orthonormalize
( (
const detail::tmat3x3<T, P>& m const detail::tmat3x3<T, P>& m
@ -31,7 +31,7 @@ namespace glm
return r; return r;
} }
template <typename T> template <typename T, precision P>
GLM_FUNC_QUALIFIER detail::tvec3<T, P> orthonormalize GLM_FUNC_QUALIFIER detail::tvec3<T, P> orthonormalize
( (
const detail::tvec3<T, P>& x, const detail::tvec3<T, P>& x,

View File

@ -90,7 +90,7 @@ namespace detail
fvec4SIMD const & v2, fvec4SIMD const & v2,
fvec4SIMD const & v3); fvec4SIMD const & v3);
explicit fmat4x4SIMD( explicit fmat4x4SIMD(
tmat4x4<float> const & m); mat4x4 const & m);
explicit fmat4x4SIMD( explicit fmat4x4SIMD(
__m128 const in[4]); __m128 const in[4]);
@ -163,7 +163,7 @@ namespace detail
//! Convert a simdMat4 to a mat4. //! Convert a simdMat4 to a mat4.
//! (From GLM_GTX_simd_mat4 extension) //! (From GLM_GTX_simd_mat4 extension)
detail::tmat4x4<float> mat4_cast( mat4 mat4_cast(
detail::fmat4x4SIMD const & x); detail::fmat4x4SIMD const & x);
//! Multiply matrix x by matrix y component-wise, i.e., //! Multiply matrix x by matrix y component-wise, i.e.,

View File

@ -73,7 +73,7 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD GLM_FUNC_QUALIFIER fmat4x4SIMD::fmat4x4SIMD
( (
tmat4x4<float> const & m mat4 const & m
) )
{ {
this->Data[0] = fvec4SIMD(m[0]); this->Data[0] = fvec4SIMD(m[0]);
@ -520,12 +520,12 @@ GLM_FUNC_QUALIFIER fmat4x4SIMD const operator++
}//namespace detail }//namespace detail
GLM_FUNC_QUALIFIER detail::tmat4x4<float> mat4_cast GLM_FUNC_QUALIFIER mat4 mat4_cast
( (
detail::fmat4x4SIMD const & x detail::fmat4x4SIMD const & x
) )
{ {
GLM_ALIGN(16) detail::tmat4x4<float> Result; GLM_ALIGN(16) mat4 Result;
_mm_store_ps(&Result[0][0], x.Data[0].Data); _mm_store_ps(&Result[0][0], x.Data[0].Data);
_mm_store_ps(&Result[1][0], x.Data[1].Data); _mm_store_ps(&Result[1][0], x.Data[1].Data);
_mm_store_ps(&Result[2][0], x.Data[2].Data); _mm_store_ps(&Result[2][0], x.Data[2].Data);

View File

@ -76,7 +76,7 @@ namespace detail
static size_type value_size(); static size_type value_size();
typedef fvec4SIMD type; typedef fvec4SIMD type;
typedef tvec4<bool> bool_type; typedef tvec4<bool, highp> bool_type;
#ifdef GLM_SIMD_ENABLE_XYZW_UNION #ifdef GLM_SIMD_ENABLE_XYZW_UNION
union union
@ -108,7 +108,7 @@ namespace detail
float const & z, float const & z,
float const & w); float const & w);
explicit fvec4SIMD( explicit fvec4SIMD(
tvec4<float> const & v); vec4 const & v);
//////////////////////////////////////// ////////////////////////////////////////
//// Convertion vector constructors //// Convertion vector constructors
@ -161,7 +161,7 @@ namespace detail
//! Convert a simdVec4 to a vec4. //! Convert a simdVec4 to a vec4.
//! (From GLM_GTX_simd_vec4 extension) //! (From GLM_GTX_simd_vec4 extension)
detail::tvec4<float> vec4_cast( vec4 vec4_cast(
detail::fvec4SIMD const & x); detail::fvec4SIMD const & x);
//! Returns x if x >= 0; otherwise, it returns -x. //! Returns x if x >= 0; otherwise, it returns -x.

View File

@ -33,7 +33,7 @@ GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(fvec4SIMD const & v) :
Data(v.Data) Data(v.Data)
{} {}
GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(tvec4<float> const & v) : GLM_FUNC_QUALIFIER fvec4SIMD::fvec4SIMD(vec4 const & v) :
Data(_mm_set_ps(v.w, v.z, v.y, v.x)) Data(_mm_set_ps(v.w, v.z, v.y, v.x))
{} {}
@ -269,12 +269,12 @@ GLM_FUNC_QUALIFIER fvec4SIMD operator-- (fvec4SIMD const & v, int)
}//namespace detail }//namespace detail
GLM_FUNC_QUALIFIER detail::tvec4<float> vec4_cast GLM_FUNC_QUALIFIER vec4 vec4_cast
( (
detail::fvec4SIMD const & x detail::fvec4SIMD const & x
) )
{ {
GLM_ALIGN(16) detail::tvec4<float> Result; GLM_ALIGN(16) vec4 Result;
_mm_store_ps(&Result[0], x.Data); _mm_store_ps(&Result[0], x.Data);
return Result; return Result;
} }