Fixed strict alignment warnings #235 #370

master
Christophe Riccio ago%!(EXTRA string=10 years)
parent 2f4338269d
commit c10df14b58
  1. 1
      glm/detail/precision.hpp
  2. 20
      glm/detail/type_vec4.hpp
  3. 2
      glm/detail/type_vec4.inl
  4. 53
      glm/detail/type_vec4_sse2.inl
  5. 1
      glm/gtc/matrix_transform.hpp
  6. 4
      readme.md

@ -39,6 +39,7 @@ namespace glm
highp, highp,
mediump, mediump,
lowp, lowp,
simd,
defaultp = highp defaultp = highp
}; };
}//namespace glm }//namespace glm

@ -46,8 +46,8 @@
namespace glm{ namespace glm{
namespace detail namespace detail
{ {
template <typename T> template <typename T, precision P = defaultp>
struct simd struct simd_data
{ {
typedef T type[4]; typedef T type[4];
}; };
@ -56,19 +56,19 @@ namespace detail
# if (GLM_ARCH & GLM_ARCH_SSE2) && GLM_NOT_BUGGY_VC32BITS # if (GLM_ARCH & GLM_ARCH_SSE2) && GLM_NOT_BUGGY_VC32BITS
template <> template <>
struct simd<float> struct simd_data<float, simd>
{ {
typedef __m128 type; typedef __m128 type;
}; };
template <> template <>
struct simd<int> struct simd_data<int, simd>
{ {
typedef __m128i type; typedef __m128i type;
}; };
template <> template <>
struct simd<unsigned int> struct simd_data<unsigned int, simd>
{ {
typedef __m128i type; typedef __m128i type;
}; };
@ -76,7 +76,7 @@ namespace detail
# if (GLM_ARCH & GLM_ARCH_AVX) && GLM_NOT_BUGGY_VC32BITS # if (GLM_ARCH & GLM_ARCH_AVX) && GLM_NOT_BUGGY_VC32BITS
template <> template <>
struct simd<double> struct simd_data<double, simd>
{ {
typedef __m256d type; typedef __m256d type;
}; };
@ -84,13 +84,13 @@ namespace detail
# if (GLM_ARCH & GLM_ARCH_AVX2) && GLM_NOT_BUGGY_VC32BITS # if (GLM_ARCH & GLM_ARCH_AVX2) && GLM_NOT_BUGGY_VC32BITS
template <> template <>
struct simd<int64> struct simd_data<int64, simd>
{ {
typedef __m256i type; typedef __m256i type;
}; };
template <> template <>
struct simd<uint64> struct simd_data<uint64, simd>
{ {
typedef __m256i type; typedef __m256i type;
}; };
@ -121,9 +121,7 @@ namespace detail
struct { T r, g, b, a; }; struct { T r, g, b, a; };
struct { T s, t, p, q; }; struct { T s, t, p, q; };
# ifdef GLM_SIMD typename detail::simd_data<T, P>::type data;
typename detail::simd<T>::type data;
# endif
# ifdef GLM_SWIZZLE # ifdef GLM_SWIZZLE
_GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w) _GLM_SWIZZLE4_2_MEMBERS(T, P, tvec2, x, y, z, w)

@ -1104,7 +1104,7 @@ namespace glm
} }
}//namespace glm }//namespace glm
#if GLM_HAS_ANONYMOUS_UNION && defined(GLM_SIMD) && GLM_NOT_BUGGY_VC32BITS #if GLM_HAS_ANONYMOUS_UNION && GLM_NOT_BUGGY_VC32BITS
#if GLM_ARCH & GLM_ARCH_SSE2 #if GLM_ARCH & GLM_ARCH_SSE2
# include "type_vec4_sse2.inl" # include "type_vec4_sse2.inl"
#endif #endif

@ -34,14 +34,7 @@ namespace glm{
# if !GLM_HAS_DEFAULTED_FUNCTIONS # if !GLM_HAS_DEFAULTED_FUNCTIONS
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4() GLM_FUNC_QUALIFIER tvec4<float, simd>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps())
# endif
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4()
# ifndef GLM_FORCE_NO_CTOR_INIT # ifndef GLM_FORCE_NO_CTOR_INIT
: data(_mm_setzero_ps()) : data(_mm_setzero_ps())
# endif # endif
@ -49,28 +42,18 @@ namespace glm{
# endif//!GLM_HAS_DEFAULTED_FUNCTIONS # endif//!GLM_HAS_DEFAULTED_FUNCTIONS
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(float s) : GLM_FUNC_QUALIFIER tvec4<float, simd>::tvec4(float s) :
data(_mm_set1_ps(s))
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(float s) :
data(_mm_set1_ps(s)) data(_mm_set1_ps(s))
{} {}
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp>::tvec4(float a, float b, float c, float d) : GLM_FUNC_QUALIFIER tvec4<float, simd>::tvec4(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a))
{}
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump>::tvec4(float a, float b, float c, float d) :
data(_mm_set_ps(d, c, b, a)) data(_mm_set_ps(d, c, b, a))
{} {}
template <> template <>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(U scalar) GLM_FUNC_QUALIFIER tvec4<float, simd> & tvec4<float, simd>::operator+=(U scalar)
{ {
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(scalar))); this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(scalar)));
return *this; return *this;
@ -78,7 +61,7 @@ namespace glm{
template <> template <>
template <> template <>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=<float>(float scalar) GLM_FUNC_QUALIFIER tvec4<float, simd> & tvec4<float, simd>::operator+=<float>(float scalar)
{ {
this->data = _mm_add_ps(this->data, _mm_set_ps1(scalar)); this->data = _mm_add_ps(this->data, _mm_set_ps1(scalar));
return *this; return *this;
@ -86,31 +69,7 @@ namespace glm{
template <> template <>
template <typename U> template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(U scalar) GLM_FUNC_QUALIFIER tvec4<float, simd> & tvec4<float, simd>::operator+=(tvec1<U, simd> const & v)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(scalar)));
return *this;
}
template <>
template <>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=<float>(float scalar)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(scalar));
return *this;
}
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, lowp> & tvec4<float, lowp>::operator+=(tvec1<U, lowp> const & v)
{
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(v.x)));
return *this;
}
template <>
template <typename U>
GLM_FUNC_QUALIFIER tvec4<float, mediump> & tvec4<float, mediump>::operator+=(tvec1<U, mediump> const & v)
{ {
this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(v.x))); this->data = _mm_add_ps(this->data, _mm_set_ps1(static_cast<float>(v.x)));
return *this; return *this;

@ -186,7 +186,6 @@ namespace glm
T near, T near,
T far); T far);
/// Creates a matrix for a right handed, symetric perspective-view frustum. /// Creates a matrix for a right handed, symetric perspective-view frustum.
/// ///
/// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians. /// @param fovy Specifies the field of view angle, in degrees, in the y direction. Expressed in radians.

@ -51,10 +51,8 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
## Release notes ## Release notes
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/latest) - 2015-XX-XX #### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/latest) - 2015-XX-XX
##### Features:
- Added GLM_SIMD to enable automatic SIMD code generation for generic GLM types #235 #370
##### Fixes: ##### Fixes:
- Fixed strict alignment warnings #235 #370
- Fixed link errors on compilers not supported default function #377 - Fixed link errors on compilers not supported default function #377
- Fixed compilation warnings in vec4 - Fixed compilation warnings in vec4

Loading…
Cancel
Save