Fixed invalid conversion from int scalar with vec4 constructor when using SSE instruction

This commit is contained in:
Groove 2018-07-29 22:30:19 +02:00
parent 147d56d90c
commit d4daef9150
3 changed files with 14 additions and 12 deletions

View File

@ -446,19 +446,19 @@ namespace detail
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_lowp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR 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_cvtepi32_ps(_mm_set_epi32(_w, _z, _y, _x)))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_mediump>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR 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_cvtepi32_ps(_mm_set_epi32(_w, _z, _y, _x)))
{} {}
template<> template<>
template<> template<>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR vec<4, float, aligned_highp>::vec(int32 _x, int32 _y, int32 _z, int32 _w) : GLM_FUNC_QUALIFIER GLM_CONSTEXPR 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_cvtepi32_ps(_mm_set_epi32(_w, _z, _y, _x)))
{} {}
#endif// GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE #endif// GLM_USE_ALIGNED_GENTYPES == GLM_ENABLE
}//namespace glm }//namespace glm

View File

@ -74,6 +74,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
- Fixed Visual C++ 2013 warnings in vector relational code #782 - Fixed Visual C++ 2013 warnings in vector relational code #782
- Fixed ICC build errors with constexpr #704 - Fixed ICC build errors with constexpr #704
- Fixed defaulted operator= and constructors #791 - Fixed defaulted operator= and constructors #791
- Fixed invalid conversion from int scalar with vec4 constructor when using SSE instruction
### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/tag/0.9.9.0) - 2018-05-22 ### [GLM 0.9.9.0](https://github.com/g-truc/glm/releases/tag/0.9.9.0) - 2018-05-22
#### Features: #### Features:

View File

@ -127,19 +127,20 @@ static int test_ctor()
return Error; return Error;
} }
using namespace glm;
typedef mat<4, 4, float, aligned> aligned_mat4;
static int test_aligned_mat4() static int test_aligned_mat4()
{ {
int Error = 0; int Error = 0;
aligned_mat4 m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); glm::aligned_vec4 const u(1.f, 2.f, 3.f, 4.f);
aligned_mat4 t = transpose(m); Error += glm::all(glm::equal(u, glm::aligned_vec4(1.f, 2.f, 3.f, 4.f), 0.0001f)) ? 0 : 1;
aligned_mat4 const expected = mat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
for (length_t l = 0; l < expected.length(); ++l) glm::aligned_vec4 const v(1, 2, 3, 4);
Error += all(equal(t[l], expected[l], 0.0001f)) ? 0 : 1; Error += glm::all(glm::equal(v, glm::aligned_vec4(1.f, 2.f, 3.f, 4.f), 0.0001f)) ? 0 : 1;
glm::aligned_mat4 const m(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15);
glm::aligned_mat4 const t = glm::transpose(m);
glm::aligned_mat4 const expected = glm::mat4(0, 4, 8, 12, 1, 5, 9, 13, 2, 6, 10, 14, 3, 7, 11, 15);
Error += glm::all(glm::equal(t, expected, 0.0001f)) ? 0 : 1;
return Error; return Error;
} }