Fixed vec4 SIMD constexpr #653

This commit is contained in:
Christophe Riccio 2017-07-26 02:06:33 +02:00
parent aa026cc0da
commit 950d226154
11 changed files with 64 additions and 73 deletions

View File

@ -698,7 +698,7 @@
#if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL #if GLM_HAS_CONSTEXPR || GLM_HAS_CONSTEXPR_PARTIAL
# define GLM_CONSTEXPR constexpr # define GLM_CONSTEXPR constexpr
# if GLM_COMPILER & GLM_COMPILER_VC // Visual C++ has a bug #594 https://github.com/g-truc/glm/issues/594 # if ((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC14)) // Visual C++ has a bug #594 https://github.com/g-truc/glm/issues/594
# define GLM_CONSTEXPR_CTOR # define GLM_CONSTEXPR_CTOR
# else # else
# define GLM_CONSTEXPR_CTOR constexpr # define GLM_CONSTEXPR_CTOR constexpr
@ -714,12 +714,6 @@
# define GLM_RELAXED_CONSTEXPR const # define GLM_RELAXED_CONSTEXPR const
#endif #endif
#if GLM_ARCH == GLM_ARCH_PURE
# define GLM_CONSTEXPR_SIMD GLM_CONSTEXPR_CTOR
#else
# define GLM_CONSTEXPR_SIMD
#endif
#ifdef GLM_FORCE_EXPLICIT_CTOR #ifdef GLM_FORCE_EXPLICIT_CTOR
# define GLM_EXPLICIT explicit # define GLM_EXPLICIT explicit
#else #else

View File

@ -38,7 +38,7 @@ namespace glm
} }
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER mat<2, 2, T, P>::mat GLM_FUNC_QUALIFIER mat<2, 2, T, P>::mat
( (
T const & x0, T const & y0, T const & x0, T const & y0,
T const & x1, T const & y1 T const & x1, T const & y1

View File

@ -89,21 +89,21 @@ namespace glm
// -- Implicit basic constructors -- // -- Implicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec() GLM_DEFAULT;
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, P> const& v) GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<4, T, P> const& v) GLM_DEFAULT;
template<precision Q> template<precision Q>
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(vec<4, T, Q> const& v); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<4, T, Q> const& v);
// -- Explicit basic constructors -- // -- Explicit basic constructors --
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD explicit vec(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit vec(T scalar);
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(T x, T y, T z, T w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(T x, T y, T z, T w);
// -- Conversion scalar constructors -- // -- Conversion scalar constructors --
/// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification) /// Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
template<typename X, typename Y, typename Z, typename W> template<typename X, typename Y, typename Z, typename W>
GLM_FUNC_DECL GLM_CONSTEXPR_SIMD vec(X _x, Y _y, Z _z, W _w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(X _x, Y _y, Z _z, W _w);
template<typename X, typename Y, typename Z, typename W> template<typename X, typename Y, typename Z, typename W>
GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, X, P> const& _x, vec<1, Y, P> const& _Y, vec<1, Z, P> const& _z, vec<1, W, P> const& _w); GLM_FUNC_DECL GLM_CONSTEXPR_CTOR vec(vec<1, X, P> const& _x, vec<1, Y, P> const& _Y, vec<1, Z, P> const& _z, vec<1, W, P> const& _w);

View File

@ -156,32 +156,32 @@ namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec() GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, P>::vec()
{} {}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS # endif//!GLM_HAS_DEFAULTED_FUNCTIONS
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec(vec<4, T, P> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, P>::vec(vec<4, T, P> const & v)
: x(v.x), y(v.y), z(v.z), w(v.w) : x(v.x), y(v.y), z(v.z), w(v.w)
{} {}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS # endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template<typename T, precision P> template<typename T, precision P>
template<precision Q> template<precision Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec(vec<4, T, Q> const & v) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, P>::vec(vec<4, T, Q> const & v)
: x(v.x), y(v.y), z(v.z), w(v.w) : x(v.x), y(v.y), z(v.z), w(v.w)
{} {}
// -- Explicit basic constructors -- // -- Explicit basic constructors --
template<typename T, precision P> template<typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec(T scalar) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, P>::vec(T scalar)
: x(scalar), y(scalar), z(scalar), w(scalar) : x(scalar), y(scalar), z(scalar), w(scalar)
{} {}
template <typename T, precision P> template <typename T, precision P>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec(T _x, T _y, T _z, T _w) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, P>::vec(T _x, T _y, T _z, T _w)
: x(_x), y(_y), z(_z), w(_w) : x(_x), y(_y), z(_z), w(_w)
{} {}
@ -189,7 +189,7 @@ namespace detail
template<typename T, precision P> template<typename T, precision P>
template<typename X, typename Y, typename Z, typename W> template<typename X, typename Y, typename Z, typename W>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, T, P>::vec(X _x, Y _y, Z _z, W _w) GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, T, P>::vec(X _x, Y _y, Z _z, W _w)
: x(static_cast<T>(_x)) : x(static_cast<T>(_x))
, y(static_cast<T>(_y)) , y(static_cast<T>(_y))
, z(static_cast<T>(_z)) , z(static_cast<T>(_z))

View File

@ -339,132 +339,118 @@ namespace detail
}; };
}//namespace detail }//namespace detail
# if !GLM_HAS_DEFAULTED_FUNCTIONS
template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_lowp>::vec()
{}
template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_mediump>::vec()
{}
template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_highp>::vec()
{}
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_lowp>::vec(float _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_lowp>::vec(float _s)
data(_mm_set1_ps(_s)) : data(_mm_set1_ps(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_mediump>::vec(float _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_mediump>::vec(float _s)
data(_mm_set1_ps(_s)) : data(_mm_set1_ps(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_highp>::vec(float _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_highp>::vec(float _s)
data(_mm_set1_ps(_s)) : data(_mm_set1_ps(_s))
{} {}
# if GLM_ARCH & GLM_ARCH_AVX_BIT # if GLM_ARCH & GLM_ARCH_AVX_BIT
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, double, aligned_lowp>::vec(double _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, double, aligned_lowp>::vec(double _s) :
data(_mm256_set1_pd(_s)) data(_mm256_set1_pd(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, double, aligned_mediump>::vec(double _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, double, aligned_mediump>::vec(double _s) :
data(_mm256_set1_pd(_s)) data(_mm256_set1_pd(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, double, aligned_highp>::vec(double _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, double, aligned_highp>::vec(double _s) :
data(_mm256_set1_pd(_s)) data(_mm256_set1_pd(_s))
{} {}
# endif # endif
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int32, aligned_lowp>::vec(int32 _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int32, aligned_lowp>::vec(int32 _s) :
data(_mm_set1_epi32(_s)) data(_mm_set1_epi32(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int32, aligned_mediump>::vec(int32 _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int32, aligned_mediump>::vec(int32 _s) :
data(_mm_set1_epi32(_s)) data(_mm_set1_epi32(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int32, aligned_highp>::vec(int32 _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int32, aligned_highp>::vec(int32 _s) :
data(_mm_set1_epi32(_s)) data(_mm_set1_epi32(_s))
{} {}
# if GLM_ARCH & GLM_ARCH_AVX2_BIT # if GLM_ARCH & GLM_ARCH_AVX2_BIT
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int64, aligned_lowp>::vec(int64 _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int64, aligned_lowp>::vec(int64 _s) :
data(_mm256_set1_epi64x(_s)) data(_mm256_set1_epi64x(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int64, aligned_mediump>::vec(int64 _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int64, aligned_mediump>::vec(int64 _s) :
data(_mm256_set1_epi64x(_s)) data(_mm256_set1_epi64x(_s))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int64, aligned_highp>::vec(int64 _s) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int64, aligned_highp>::vec(int64 _s) :
data(_mm256_set1_epi64x(_s)) data(_mm256_set1_epi64x(_s))
{} {}
# endif # endif
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_lowp>::vec(float _x, float _y, float _z, float _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_lowp>::vec(float _x, float _y, float _z, float _w) :
data(_mm_set_ps(_w, _z, _y, _x)) data(_mm_set_ps(_w, _z, _y, _x))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_mediump>::vec(float _x, float _y, float _z, float _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_mediump>::vec(float _x, float _y, float _z, float _w) :
data(_mm_set_ps(_w, _z, _y, _x)) data(_mm_set_ps(_w, _z, _y, _x))
{} {}
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_highp>::vec(float _x, float _y, float _z, float _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_highp>::vec(float _x, float _y, float _z, float _w) :
data(_mm_set_ps(_w, _z, _y, _x)) data(_mm_set_ps(_w, _z, _y, _x))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int32, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int32, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) :
data(_mm_set_epi32(_w, _z, _y, _x)) data(_mm_set_epi32(_w, _z, _y, _x))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int32, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int32, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) :
data(_mm_set_epi32(_w, _z, _y, _x)) data(_mm_set_epi32(_w, _z, _y, _x))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, int32, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, int32, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) :
data(_mm_set_epi32(_w, _z, _y, _x)) data(_mm_set_epi32(_w, _z, _y, _x))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) :
data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x))) data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x)))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) :
data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x))) data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x)))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR_SIMD vec<4, float, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR_CTOR vec<4, float, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) :
data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x))) data(_mm_castsi128_ps(_mm_set_epi32(_w, _z, _y, _x)))
{} {}
}//namespace glm }//namespace glm

View File

@ -91,6 +91,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
- Fixed integer pow from GTX_integer with null exponent #658 - Fixed integer pow from GTX_integer with null exponent #658
- Fixed quat normalize build error #656 - Fixed quat normalize build error #656
- Fixed Visual C++ 2017.2 warning regarding __has_feature definision #655 - Fixed Visual C++ 2017.2 warning regarding __has_feature definision #655
- Fixed vec4 SIMD constexpr #653
#### Deprecation: #### Deprecation:
- Requires Visual Studio 2013, GCC 4.7, Clang 3.4, Cuda 7, ICC 2013 or a C++11 compiler - Requires Visual Studio 2013, GCC 4.7, Clang 3.4, Cuda 7, ICC 2013 or a C++11 compiler

View File

@ -61,7 +61,7 @@ int test_ctr()
#if GLM_HAS_INITIALIZER_LISTS #if GLM_HAS_INITIALIZER_LISTS
glm::mat2x2 m0( glm::mat2x2 m0(
glm::vec2(0, 1), glm::vec2(0, 1),
glm::vec2(2, 3)); glm::vec2(2, 3));
glm::mat2x2 m1{0, 1, 2, 3}; glm::mat2x2 m1{0, 1, 2, 3};

View File

@ -38,6 +38,10 @@ int test_vec1_ctor()
{ {
int Error = 0; int Error = 0;
# if GLM_HAS_CONSTEXPR
constexpr glm::vec1 v(0);
# endif
# if GLM_HAS_TRIVIAL_QUERIES # if GLM_HAS_TRIVIAL_QUERIES
// Error += std::is_trivially_default_constructible<glm::vec1>::value ? 0 : 1; // Error += std::is_trivially_default_constructible<glm::vec1>::value ? 0 : 1;
// Error += std::is_trivially_copy_assignable<glm::vec1>::value ? 0 : 1; // Error += std::is_trivially_copy_assignable<glm::vec1>::value ? 0 : 1;

View File

@ -199,6 +199,10 @@ int test_vec2_ctor()
{ {
int Error = 0; int Error = 0;
# if GLM_HAS_CONSTEXPR
constexpr glm::vec2 v(0);
# endif
{ {
glm::vec2 A(1); glm::vec2 A(1);
glm::vec2 B(A); glm::vec2 B(A);

View File

@ -15,6 +15,10 @@ int test_vec3_ctor()
{ {
int Error = 0; int Error = 0;
# if GLM_HAS_CONSTEXPR
constexpr glm::vec3 v(0);
# endif
# if GLM_HAS_TRIVIAL_QUERIES # if GLM_HAS_TRIVIAL_QUERIES
// Error += std::is_trivially_default_constructible<glm::vec3>::value ? 0 : 1; // Error += std::is_trivially_default_constructible<glm::vec3>::value ? 0 : 1;
// Error += std::is_trivially_copy_assignable<glm::vec3>::value ? 0 : 1; // Error += std::is_trivially_copy_assignable<glm::vec3>::value ? 0 : 1;
@ -259,7 +263,7 @@ int test_vec3_swizzle3_2()
int Error = 0; int Error = 0;
glm::vec3 v(1, 2, 3); glm::vec3 v(1, 2, 3);
glm::vec2 u; glm::vec2 u(0);
# if(GLM_LANG & GLM_LANG_CXXMS_FLAG) # if(GLM_LANG & GLM_LANG_CXXMS_FLAG)
// Can not assign a vec3 swizzle to a vec2 // Can not assign a vec3 swizzle to a vec2
@ -322,7 +326,7 @@ int test_vec3_swizzle3_3()
int Error = 0; int Error = 0;
glm::vec3 v(1, 2, 3); glm::vec3 v(1, 2, 3);
glm::vec3 u; glm::vec3 u(0);
# if(GLM_LANG & GLM_LANG_CXXMS_FLAG) # if(GLM_LANG & GLM_LANG_CXXMS_FLAG)
u = v; Error += (u.x == 1.0f && u.y == 2.0f && u.z == 3.0f) ? 0 : 1; u = v; Error += (u.x == 1.0f && u.y == 2.0f && u.z == 3.0f) ? 0 : 1;
@ -348,7 +352,7 @@ int test_vec3_swizzle_operators()
{ {
int Error = 0; int Error = 0;
glm::vec3 q, u, v; glm::vec3 q(0), u, v;
u = glm::vec3(1, 2, 3); u = glm::vec3(1, 2, 3);
v = glm::vec3(10, 20, 30); v = glm::vec3(10, 20, 30);
@ -405,9 +409,9 @@ int test_vec3_swizzle_functions()
r = glm::dot(glm::vec2(a.xy()), glm::vec2(b.yy())); Error += (int(r) == 60) ? 0 : 1; r = glm::dot(glm::vec2(a.xy()), glm::vec2(b.yy())); Error += (int(r) == 60) ? 0 : 1;
// vec3 // vec3
glm::vec3 q, u, v; glm::vec3 q(0);
u = glm::vec3(1, 2, 3); glm::vec3 u = glm::vec3(1, 2, 3);
v = glm::vec3(10, 20, 30); glm::vec3 v = glm::vec3(10, 20, 30);
r = glm::dot(u, v); Error += (int(r) == 140) ? 0 : 1; r = glm::dot(u, v); Error += (int(r) == 140) ? 0 : 1;
r = glm::dot(u.xyz(), v.zyz()); Error += (int(r) == 160) ? 0 : 1; r = glm::dot(u.xyz(), v.zyz()); Error += (int(r) == 160) ? 0 : 1;
r = glm::dot(u, v.zyx()); Error += (int(r) == 100) ? 0 : 1; r = glm::dot(u, v.zyx()); Error += (int(r) == 100) ? 0 : 1;
@ -415,9 +419,8 @@ int test_vec3_swizzle_functions()
r = glm::dot(u.xy(), v.xy()); Error += (int(r) == 50) ? 0 : 1; r = glm::dot(u.xy(), v.xy()); Error += (int(r) == 50) ? 0 : 1;
// vec4 // vec4
glm::vec4 s, t; glm::vec4 s = glm::vec4(1, 2, 3, 4);
s = glm::vec4(1, 2, 3, 4); glm::vec4 t = glm::vec4(10, 20, 30, 40);
t = glm::vec4(10, 20, 30, 40);
r = glm::dot(s, t); Error += (int(r) == 300) ? 0 : 1; r = glm::dot(s, t); Error += (int(r) == 300) ? 0 : 1;
r = glm::dot(s.xyzw(), t.xyzw()); Error += (int(r) == 300) ? 0 : 1; r = glm::dot(s.xyzw(), t.xyzw()); Error += (int(r) == 300) ? 0 : 1;
r = glm::dot(s.xyz(), t.xyz()); Error += (int(r) == 140) ? 0 : 1; r = glm::dot(s.xyz(), t.xyz()); Error += (int(r) == 140) ? 0 : 1;
@ -483,9 +486,6 @@ int main()
{ {
int Error = 0; int Error = 0;
glm::vec3 v;
assert(v.length() == 3);
Error += test_vec3_ctor(); Error += test_vec3_ctor();
Error += test_vec3_operators(); Error += test_vec3_operators();
Error += test_vec3_size(); Error += test_vec3_size();

View File

@ -37,6 +37,10 @@ int test_vec4_ctor()
{ {
int Error = 0; int Error = 0;
# if GLM_HAS_CONSTEXPR
constexpr glm::vec4 v(0.0f);
# endif
{ {
glm::ivec4 A(1, 2, 3, 4); glm::ivec4 A(1, 2, 3, 4);
glm::ivec4 B(A); glm::ivec4 B(A);
@ -546,8 +550,6 @@ int main()
printf("GNI\n"); printf("GNI\n");
} }
*/ */
glm::vec4 v;
assert(v.length() == 4);
# ifdef NDEBUG # ifdef NDEBUG
std::size_t const Size(1000000); std::size_t const Size(1000000);