Updated simd implementation

This commit is contained in:
Christophe Riccio 2010-12-16 23:33:04 +00:00
parent 4634ff3647
commit b149eb626c
3 changed files with 48 additions and 1 deletions

View File

@ -125,6 +125,18 @@ namespace glm
{
typedef detail::fmat4x4SIMD simd_mat4;
//! Returns the transposed matrix of x
//! (From GLM_GTX_simd_mat4 extension).
detail::fmat4x4SIMD simd_transpose(detail::fmat4x4SIMD const & m);
//! Return the determinant of a mat4 matrix.
//! (From GLM_GTX_simd_mat4 extension).
float simd_determinant(detail::fmat4x4SIMD const & m);
//! Return the inverse of a mat4 matrix.
//! (From GLM_GTX_simd_mat4 extension).
detail::fmat4x4SIMD simd_inverse(detail::fmat4x4SIMD const & m);
}//namespace simd_mat4
}//namespace gtx
}//namespace glm

View File

@ -218,4 +218,38 @@ namespace detail
}
}//namespace detail
namespace gtx{
namespace simd_mat4
{
inline detail::fmat4x4SIMD matrixCompMult
(
detail::fmat4x4SIMD const & x,
detail::fmat4x4SIMD const & y
)
{
GLM_STATIC_ASSERT(0, "TODO");
}
inline detail::fmat4x4SIMD simd_transpose(detail::fmat4x4SIMD const & m)
{
detail::fmat4x4SIMD result;
_mm_transpose_ps(&m[0].Data, &result[0].Data);
return result;
}
inline float simd_determinant(detail::fmat4x4SIMD const & m)
{
GLM_STATIC_ASSERT(0, "TODO");
}
inline detail::fmat4x4SIMD simd_inverse(detail::fmat4x4SIMD const & m)
{
detail::fmat4x4SIMD result;
_mm_inverse_ps(&m[0].Data, &result[0].Data);
return result;
}
}//namespace simd_mat4
}//namespace gtx
}//namespace glm

View File

@ -163,7 +163,8 @@ namespace glm
template <comp a, comp b, comp c, comp d>
inline fvec4SIMD& fvec4SIMD::swizzle()
{
this->Data = _mm_shuffle_ps(this->Data, this->Data, (((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0))));
enum{mask = (((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0)))};
this->Data = _mm_shuffle_ps(this->Data, this->Data, mask);
return *this;
}