mirror of
https://github.com/g-truc/glm.git
synced 2025-04-08 06:43:10 +00:00
Fixed cases of unspecialized simd
This commit is contained in:
parent
8a1bf4410b
commit
327c7917fb
2 changed files with 30 additions and 13 deletions
|
@ -70,7 +70,7 @@ namespace glm
|
|||
w(0)
|
||||
{}
|
||||
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4() :
|
||||
data(_mm_setzero_ps())
|
||||
|
@ -90,7 +90,7 @@ namespace glm
|
|||
w(v.w)
|
||||
{}
|
||||
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(tvec4<float, lowp> const & v) :
|
||||
data(v.data)
|
||||
|
@ -126,7 +126,7 @@ namespace glm
|
|||
w(s)
|
||||
{}
|
||||
|
||||
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2))
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(float const & s) :
|
||||
data(_mm_set1_ps(s))
|
||||
|
@ -146,7 +146,7 @@ namespace glm
|
|||
w(d)
|
||||
{}
|
||||
|
||||
#if((GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2))
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(float const & a, float const & b, float const & c, float const & d) :
|
||||
data(_mm_set_ps(d, c, b, a))
|
||||
|
@ -303,7 +303,7 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator= (tvec4<float, lowp> const & v)
|
||||
{
|
||||
|
@ -341,7 +341,7 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(U s)
|
||||
|
@ -350,6 +350,14 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=<float>(float s)
|
||||
{
|
||||
this->data = _mm_add_ps(this->data, _mm_set_ps1(s));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(U s)
|
||||
|
@ -357,6 +365,14 @@ namespace glm
|
|||
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <>
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=<float>(float s)
|
||||
{
|
||||
this->data = _mm_add_ps(this->data, _mm_set_ps1(s));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename T, precision P>
|
||||
|
@ -370,10 +386,10 @@ namespace glm
|
|||
return *this;
|
||||
}
|
||||
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
#if (GLM_HAS_UNRESTRICTED_UNIONS || GLM_HAS_ANONYMOUS_UNION) && (GLM_ARCH & GLM_ARCH_SSE2)
|
||||
template <>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(tvec1<U, P> const & s)
|
||||
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(tvec1<U, lowp> const & s)
|
||||
{
|
||||
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
|
||||
return *this;
|
||||
|
@ -381,7 +397,7 @@ namespace glm
|
|||
|
||||
template <>
|
||||
template <typename U>
|
||||
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(tvec1<U, P> const & s)
|
||||
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(tvec1<U, mediump> const & s)
|
||||
{
|
||||
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(s)));
|
||||
return *this;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
// File : test/core/type_vec4.cpp
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//#define GLM_FORCE_AVX2
|
||||
#define GLM_SWIZZLE
|
||||
#include <glm/vector_relational.hpp>
|
||||
#include <glm/vec2.hpp>
|
||||
|
@ -42,7 +43,7 @@ int test_vec4_ctor()
|
|||
{
|
||||
int Error = 0;
|
||||
|
||||
#if(GLM_HAS_INITIALIZER_LISTS)
|
||||
#if GLM_HAS_INITIALIZER_LISTS
|
||||
{
|
||||
glm::vec4 a{ 0, 1, 2, 3 };
|
||||
std::vector<glm::vec4> v = {
|
||||
|
@ -60,7 +61,7 @@ int test_vec4_ctor()
|
|||
}
|
||||
#endif
|
||||
|
||||
#if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
#if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
{
|
||||
glm::vec4 A = glm::vec4(1.0f, 2.0f, 3.0f, 4.0f);
|
||||
glm::vec4 B = A.xyzw;
|
||||
|
@ -89,7 +90,7 @@ int test_vec4_ctor()
|
|||
Error += glm::all(glm::equal(A, L)) ? 0 : 1;
|
||||
Error += glm::all(glm::equal(A, M)) ? 0 : 1;
|
||||
}
|
||||
#endif//(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE))
|
||||
#endif// GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE)
|
||||
|
||||
{
|
||||
glm::vec4 A(1);
|
||||
|
@ -276,7 +277,7 @@ int test_vec4_swizzle_partial()
|
|||
|
||||
glm::vec4 A(1, 2, 3, 4);
|
||||
|
||||
# if(GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE_RELAX))
|
||||
# if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SWIZZLE_RELAX)
|
||||
{
|
||||
glm::vec4 B(A.xy, A.zw);
|
||||
Error += A == B ? 0 : 1;
|
||||
|
|
Loading…
Add table
Reference in a new issue