Added tests to main repository

This commit is contained in:
Christophe Riccio
2010-12-17 01:33:17 +00:00
parent 9b01c2d57c
commit d7f768718c
31 changed files with 769 additions and 241 deletions

View File

@@ -1,59 +0,0 @@
__author__="eloraiby"
__date__ ="$5-Sep-2010 9:35:29 PM$"
atomic_types = ["unsigned char", "unsigned short", "unsigned int",
"signed char", "signed short", "signed int",
"float", "double"]
glsl_vector_types = ["tvec2", "tvec3", "tvec4"]
glsl_matrix_types = ["tmat2x2", "tmat2x3", "tmat2x4",
"tmat3x2", "tmat3x3", "tmat3x4",
"tmat4x2", "tmat4x3", "tmat4x4"]
glsl_operators = []
def gen_vectors():
for v in glsl_vector_types:
print
print "//"
print "// " + v + " type explicit instantiation"
print "//"
for a in atomic_types:
print "template struct " + v + "<" + a + ">;"
print
def gen_matrices():
for m in glsl_matrix_types:
print
print "//"
print "// " + m + " type explicit instantiation"
print "//"
for a in atomic_types:
print "template struct " + m + "<" + a + ">;"
print
if __name__ == "__main__":
print "//"
print "// GLM External templates generator script version 0.1 for GLM core"
print "//"
print "// atomic types:", atomic_types
print "// GLSL vector types:", glsl_vector_types;
print "// GLSL matrix types:", glsl_matrix_types;
print "//"
print
print "#include \"glm.hpp\""
print
print "namespace glm {"
print "namespace detail {"
gen_vectors()
gen_matrices()
print "} // namespace detail"
print "} // namespace glm"

View File

@@ -1,170 +0,0 @@
//
// GLM External templates generator script version 0.1 for GLM core
//
// atomic types: ['unsigned char', 'unsigned short', 'unsigned int', 'signed char', 'signed short', 'signed int', 'float', 'double']
// GLSL vector types: ['tvec2', 'tvec3', 'tvec4']
// GLSL matrix types: ['tmat2x2', 'tmat2x3', 'tmat2x4', 'tmat3x2', 'tmat3x3', 'tmat3x4', 'tmat4x2', 'tmat4x3', 'tmat4x4']
//
#include "glm.hpp"
namespace glm {
namespace detail {
//
// tvec2 type explicit instantiation
//
template struct tvec2<unsigned char>;
template struct tvec2<unsigned short>;
template struct tvec2<unsigned int>;
template struct tvec2<signed char>;
template struct tvec2<signed short>;
template struct tvec2<signed int>;
template struct tvec2<float>;
template struct tvec2<double>;
//
// tvec3 type explicit instantiation
//
template struct tvec3<unsigned char>;
template struct tvec3<unsigned short>;
template struct tvec3<unsigned int>;
template struct tvec3<signed char>;
template struct tvec3<signed short>;
template struct tvec3<signed int>;
template struct tvec3<float>;
template struct tvec3<double>;
//
// tvec4 type explicit instantiation
//
template struct tvec4<unsigned char>;
template struct tvec4<unsigned short>;
template struct tvec4<unsigned int>;
template struct tvec4<signed char>;
template struct tvec4<signed short>;
template struct tvec4<signed int>;
template struct tvec4<float>;
template struct tvec4<double>;
//
// tmat2x2 type explicit instantiation
//
template struct tmat2x2<unsigned char>;
template struct tmat2x2<unsigned short>;
template struct tmat2x2<unsigned int>;
template struct tmat2x2<signed char>;
template struct tmat2x2<signed short>;
template struct tmat2x2<signed int>;
template struct tmat2x2<float>;
template struct tmat2x2<double>;
//
// tmat2x3 type explicit instantiation
//
template struct tmat2x3<unsigned char>;
template struct tmat2x3<unsigned short>;
template struct tmat2x3<unsigned int>;
template struct tmat2x3<signed char>;
template struct tmat2x3<signed short>;
template struct tmat2x3<signed int>;
template struct tmat2x3<float>;
template struct tmat2x3<double>;
//
// tmat2x4 type explicit instantiation
//
template struct tmat2x4<unsigned char>;
template struct tmat2x4<unsigned short>;
template struct tmat2x4<unsigned int>;
template struct tmat2x4<signed char>;
template struct tmat2x4<signed short>;
template struct tmat2x4<signed int>;
template struct tmat2x4<float>;
template struct tmat2x4<double>;
//
// tmat3x2 type explicit instantiation
//
template struct tmat3x2<unsigned char>;
template struct tmat3x2<unsigned short>;
template struct tmat3x2<unsigned int>;
template struct tmat3x2<signed char>;
template struct tmat3x2<signed short>;
template struct tmat3x2<signed int>;
template struct tmat3x2<float>;
template struct tmat3x2<double>;
//
// tmat3x3 type explicit instantiation
//
template struct tmat3x3<unsigned char>;
template struct tmat3x3<unsigned short>;
template struct tmat3x3<unsigned int>;
template struct tmat3x3<signed char>;
template struct tmat3x3<signed short>;
template struct tmat3x3<signed int>;
template struct tmat3x3<float>;
template struct tmat3x3<double>;
//
// tmat3x4 type explicit instantiation
//
template struct tmat3x4<unsigned char>;
template struct tmat3x4<unsigned short>;
template struct tmat3x4<unsigned int>;
template struct tmat3x4<signed char>;
template struct tmat3x4<signed short>;
template struct tmat3x4<signed int>;
template struct tmat3x4<float>;
template struct tmat3x4<double>;
//
// tmat4x2 type explicit instantiation
//
template struct tmat4x2<unsigned char>;
template struct tmat4x2<unsigned short>;
template struct tmat4x2<unsigned int>;
template struct tmat4x2<signed char>;
template struct tmat4x2<signed short>;
template struct tmat4x2<signed int>;
template struct tmat4x2<float>;
template struct tmat4x2<double>;
//
// tmat4x3 type explicit instantiation
//
template struct tmat4x3<unsigned char>;
template struct tmat4x3<unsigned short>;
template struct tmat4x3<unsigned int>;
template struct tmat4x3<signed char>;
template struct tmat4x3<signed short>;
template struct tmat4x3<signed int>;
template struct tmat4x3<float>;
template struct tmat4x3<double>;
//
// tmat4x4 type explicit instantiation
//
template struct tmat4x4<unsigned char>;
template struct tmat4x4<unsigned short>;
template struct tmat4x4<unsigned int>;
template struct tmat4x4<signed char>;
template struct tmat4x4<signed short>;
template struct tmat4x4<signed int>;
template struct tmat4x4<float>;
template struct tmat4x4<double>;
} // namespace detail
} // namespace glm

View File

@@ -90,15 +90,15 @@ namespace glm
//////////////////////////////////////
// Swizzle operators
template <comp A, comp B, comp C, comp D>
template <comp X, comp Y, comp Z, comp W>
fvec4SIMD& swizzle();
template <comp A, comp B, comp C, comp D>
template <comp X, comp Y, comp Z, comp W>
fvec4SIMD swizzle() const;
template <comp A, comp B, comp C>
template <comp X, comp Y, comp Z>
fvec4SIMD swizzle() const;
template <comp A, comp B>
template <comp X, comp Y>
fvec4SIMD swizzle() const;
template <comp A>
template <comp X>
fvec4SIMD swizzle() const;
};

View File

@@ -11,6 +11,12 @@ namespace glm
{
namespace detail
{
template <int Value>
struct mask
{
enum{value = Value};
};
//////////////////////////////////////
// Implicit basic constructors
@@ -146,25 +152,24 @@ namespace glm
inline fvec4SIMD& fvec4SIMD::operator--()
{
this->Data = _mm_sub_ps(this->Data , glm::detail::one);
this->Data = _mm_sub_ps(this->Data, glm::detail::one);
return *this;
}
//////////////////////////////////////
// Swizzle operators
template <comp a, comp b, comp c, comp d>
template <comp X, comp Y, comp Z, comp W>
inline fvec4SIMD fvec4SIMD::swizzle() const
{
__m128 Data = _mm_shuffle_ps(this->Data, this->Data, ((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0)));
__m128 Data = _mm_shuffle_ps(this->Data, this->Data, mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
return fvec4SIMD(Data);
}
template <comp a, comp b, comp c, comp d>
template <comp X, comp Y, comp Z, comp W>
inline fvec4SIMD& fvec4SIMD::swizzle()
{
enum{mask = (((int(d) << 6) | (int(c) << 4) | (int(b) << 2) | (int(a) << 0)))};
this->Data = _mm_shuffle_ps(this->Data, this->Data, mask);
this->Data = _mm_shuffle_ps(this->Data, this->Data, mask<(W << 6) | (Z << 4) | (Y << 2) | (X << 0)>::value);
return *this;
}

View File

@@ -241,7 +241,7 @@
#if(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_GCC))
# define GLM_INSTRUCTION_SET
#elif(defined(GLM_COMPILER) && (GLM_COMPILER & GLM_COMPILER_VC))
# ifdef(_M_CEE_PURE)
# ifdef _M_CEE_PURE
# define GLM_INSTRUCTION_SET GLM_INSTRUCTION_SET_PURE
# else
# define GLM_INSTRUCTION_SET