Skip to content

Commit

Permalink
Fixed SIMD build
Browse files Browse the repository at this point in the history
  • Loading branch information
Groovounet committed Aug 16, 2017
1 parent 211881a commit 8bcf9b5
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 90 deletions.
108 changes: 54 additions & 54 deletions glm/detail/func_common_simd.inl
Expand Up @@ -11,11 +11,11 @@ namespace glm{
namespace detail
{
template<qualifier Q>
struct compute_abs_vector<4, float, P, true>
struct compute_abs_vector<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = glm_vec4_abs(v.data);
return result;
}
Expand All @@ -33,168 +33,168 @@ namespace detail
};

template<qualifier Q>
struct compute_floor<4, float, P, true>
struct compute_floor<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = glm_vec4_floor(v.data);
return result;
}
};

template<qualifier Q>
struct compute_ceil<4, float, P, true>
struct compute_ceil<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = glm_vec4_ceil(v.data);
return result;
}
};

template<qualifier Q>
struct compute_fract<4, float, P, true>
struct compute_fract<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = glm_vec4_fract(v.data);
return result;
}
};

template<qualifier Q>
struct compute_round<4, float, P, true>
struct compute_round<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = glm_vec4_round(v.data);
return result;
}
};

template<qualifier Q>
struct compute_mod<4, float, P, true>
struct compute_mod<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = glm_vec4_mod(x.data, y.data);
return result;
}
};

template<qualifier Q>
struct compute_min_vector<4, float, P, true>
struct compute_min_vector<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = _mm_min_ps(v1.data, v2.data);
return result;
}
};

template<qualifier Q>
struct compute_min_vector<4, int32, P, true>
struct compute_min_vector<4, int32, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2)
GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2)
{
vec<4, int32, P> result;
vec<4, int32, Q> result;
result.data = _mm_min_epi32(v1.data, v2.data);
return result;
}
};

template<qualifier Q>
struct compute_min_vector<4, uint32, P, true>
struct compute_min_vector<4, uint32, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2)
GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2)
{
vec<4, uint32, P> result;
vec<4, uint32, Q> result;
result.data = _mm_min_epu32(v1.data, v2.data);
return result;
}
};

template<qualifier Q>
struct compute_max_vector<4, float, P, true>
struct compute_max_vector<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v1, vec<4, float, Q> const& v2)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = _mm_max_ps(v1.data, v2.data);
return result;
}
};

template<qualifier Q>
struct compute_max_vector<4, int32, P, true>
struct compute_max_vector<4, int32, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2)
GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& v1, vec<4, int32, Q> const& v2)
{
vec<4, int32, P> result;
vec<4, int32, Q> result;
result.data = _mm_max_epi32(v1.data, v2.data);
return result;
}
};

template<qualifier Q>
struct compute_max_vector<4, uint32, P, true>
struct compute_max_vector<4, uint32, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2)
GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v1, vec<4, uint32, Q> const& v2)
{
vec<4, uint32, P> result;
vec<4, uint32, Q> result;
result.data = _mm_max_epu32(v1.data, v2.data);
return result;
}
};

template<qualifier Q>
struct compute_clamp_vector<4, float, P, true>
struct compute_clamp_vector<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& x, vec<4, float, Q> const& minVal, vec<4, float, Q> const& maxVal)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& x, vec<4, float, Q> const& minVal, vec<4, float, Q> const& maxVal)
{
vec<4, float, P> result;
vec<4, float, Q> result;
result.data = _mm_min_ps(_mm_max_ps(x.data, minVal.data), maxVal.data);
return result;
}
};

template<qualifier Q>
struct compute_clamp_vector<4, int32, P, true>
struct compute_clamp_vector<4, int32, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, int32, P> call(vec<4, int32, Q> const& x, vec<4, int32, Q> const& minVal, vec<4, int32, Q> const& maxVal)
GLM_FUNC_QUALIFIER static vec<4, int32, Q> call(vec<4, int32, Q> const& x, vec<4, int32, Q> const& minVal, vec<4, int32, Q> const& maxVal)
{
vec<4, int32, P> result;
vec<4, int32, Q> result;
result.data = _mm_min_epi32(_mm_max_epi32(x.data, minVal.data), maxVal.data);
return result;
}
};

template<qualifier Q>
struct compute_clamp_vector<4, uint32, P, true>
struct compute_clamp_vector<4, uint32, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& x, vec<4, uint32, Q> const& minVal, vec<4, uint32, Q> const& maxVal)
GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& x, vec<4, uint32, Q> const& minVal, vec<4, uint32, Q> const& maxVal)
{
vec<4, uint32, P> result;
vec<4, uint32, Q> result;
result.data = _mm_min_epu32(_mm_max_epu32(x.data, minVal.data), maxVal.data);
return result;
}
};

template<qualifier Q>
struct compute_mix_vector<4, float, bool, P, true>
struct compute_mix_vector<4, float, bool, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y, vec<4, bool, Q> const& a)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& x, vec<4, float, Q> const& y, vec<4, bool, Q> const& a)
{
__m128i const Load = _mm_set_epi32(-static_cast<int>(a.w), -static_cast<int>(a.z), -static_cast<int>(a.y), -static_cast<int>(a.x));
__m128 const Mask = _mm_castsi128_ps(Load);

vec<4, float, P> Result;
vec<4, float, Q> Result;
# if 0 && GLM_ARCH & GLM_ARCH_AVX
Result.data = _mm_blendv_ps(x.data, y.data, Mask);
# else
Expand All @@ -205,22 +205,22 @@ namespace detail
};
/* FIXME
template<qualifier Q>
struct compute_step_vector<float, P, tvec4>
struct compute_step_vector<float, Q, tvec4>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& edge, vec<4, float, Q> const& x)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& edge, vec<4, float, Q> const& x)
{
vec<4, float, P> Result;
vec<4, float, Q> Result;
result.data = glm_vec4_step(edge.data, x.data);
return result;
}
};
*/
template<qualifier Q>
struct compute_smoothstep_vector<4, float, P, true>
struct compute_smoothstep_vector<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& edge0, vec<4, float, Q> const& edge1, vec<4, float, Q> const& x)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& edge0, vec<4, float, Q> const& edge1, vec<4, float, Q> const& x)
{
vec<4, float, P> Result;
vec<4, float, Q> Result;
Result.data = glm_vec4_smoothstep(edge0.data, edge1.data, x.data);
return Result;
}
Expand Down
4 changes: 2 additions & 2 deletions glm/detail/func_exponential_simd.inl
Expand Up @@ -9,9 +9,9 @@ namespace glm{
namespace detail
{
template<qualifier Q>
struct compute_sqrt<4, float, P, true>
struct compute_sqrt<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> Result;
Result.data = _mm_sqrt_ps(v.data);
Expand Down
36 changes: 18 additions & 18 deletions glm/detail/func_geometric_simd.inl
Expand Up @@ -9,7 +9,7 @@ namespace glm{
namespace detail
{
template<qualifier Q>
struct compute_length<4, float, P, true>
struct compute_length<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& v)
{
Expand All @@ -18,7 +18,7 @@ namespace detail
};

template<qualifier Q>
struct compute_distance<4, float, P, true>
struct compute_distance<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& p0, vec<4, float, Q> const& p1)
{
Expand All @@ -27,7 +27,7 @@ namespace detail
};

template<qualifier Q>
struct compute_dot<vec<4, float, P>, float, true>
struct compute_dot<vec<4, float, Q>, float, true>
{
GLM_FUNC_QUALIFIER static float call(vec<4, float, Q> const& x, vec<4, float, Q> const& y)
{
Expand All @@ -36,59 +36,59 @@ namespace detail
};

template<qualifier Q>
struct compute_cross<float, P, true>
struct compute_cross<float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<3, float, P> call(vec<3, float, Q> const& a, vec<3, float, Q> const& b)
GLM_FUNC_QUALIFIER static vec<3, float, Q> call(vec<3, float, Q> const& a, vec<3, float, Q> const& b)
{
__m128 const set0 = _mm_set_ps(0.0f, a.z, a.y, a.x);
__m128 const set1 = _mm_set_ps(0.0f, b.z, b.y, b.x);
__m128 const xpd0 = glm_vec4_cross(set0, set1);

vec<4, float, P> Result;
vec<4, float, Q> Result;
Result.data = xpd0;
return vec<3, float, Q>(Result);
}
};

template<qualifier Q>
struct compute_normalize<4, float, P, true>
struct compute_normalize<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& v)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& v)
{
vec<4, float, P> Result;
vec<4, float, Q> Result;
Result.data = glm_vec4_normalize(v.data);
return Result;
}
};

template<qualifier Q>
struct compute_faceforward<4, float, P, true>
struct compute_faceforward<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& N, vec<4, float, Q> const& I, vec<4, float, Q> const& Nref)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& N, vec<4, float, Q> const& I, vec<4, float, Q> const& Nref)
{
vec<4, float, P> Result;
vec<4, float, Q> Result;
Result.data = glm_vec4_faceforward(N.data, I.data, Nref.data);
return Result;
}
};

template<qualifier Q>
struct compute_reflect<4, float, P, true>
struct compute_reflect<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N)
{
vec<4, float, P> Result;
vec<4, float, Q> Result;
Result.data = glm_vec4_reflect(I.data, N.data);
return Result;
}
};

template<qualifier Q>
struct compute_refract<4, float, P, true>
struct compute_refract<4, float, Q, true>
{
GLM_FUNC_QUALIFIER static vec<4, float, P> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N, float eta)
GLM_FUNC_QUALIFIER static vec<4, float, Q> call(vec<4, float, Q> const& I, vec<4, float, Q> const& N, float eta)
{
vec<4, float, P> Result;
vec<4, float, Q> Result;
Result.data = glm_vec4_refract(I.data, N.data, _mm_set1_ps(eta));
return Result;
}
Expand Down
12 changes: 6 additions & 6 deletions glm/detail/func_integer_simd.inl
Expand Up @@ -8,10 +8,10 @@
namespace glm{
namespace detail
{
template<glm::qualifier P>
struct compute_bitfieldReverseStep<4, uint32, P, true, true>
template<qualifier Q>
struct compute_bitfieldReverseStep<4, uint32, Q, true, true>
{
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift)
GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift)
{
__m128i const set0 = v.data;

Expand All @@ -29,10 +29,10 @@ namespace detail
}
};

template<glm::qualifier P>
struct compute_bitfieldBitCountStep<4, uint32, P, true, true>
template<qualifier Q>
struct compute_bitfieldBitCountStep<4, uint32, Q, true, true>
{
GLM_FUNC_QUALIFIER static vec<4, uint32, P> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift)
GLM_FUNC_QUALIFIER static vec<4, uint32, Q> call(vec<4, uint32, Q> const& v, uint32 Mask, uint32 Shift)
{
__m128i const set0 = v.data;

Expand Down

0 comments on commit 8bcf9b5

Please sign in to comment.