mirror of
https://github.com/g-truc/glm.git
synced 2024-11-22 08:54:35 +00:00
Fix SIMD normalize precision by default
This commit is contained in:
parent
90f2b025b1
commit
7c0d7fd6e1
@ -79,6 +79,17 @@ namespace detail
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct compute_normalize<4, float, lowp, true>
|
||||||
|
{
|
||||||
|
GLM_FUNC_QUALIFIER static vec<4, float, lowp> call(vec<4, float, lowp> const& v)
|
||||||
|
{
|
||||||
|
vec<4, float, lowp> Result;
|
||||||
|
Result.data = glm_vec4_fast_normalize(v.data);
|
||||||
|
return Result;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
template<qualifier Q>
|
template<qualifier Q>
|
||||||
struct compute_faceforward<4, float, Q, true>
|
struct compute_faceforward<4, float, Q, true>
|
||||||
{
|
{
|
||||||
|
@ -75,6 +75,15 @@ GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_cross(glm_vec4 v1, glm_vec4 v2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_normalize(glm_vec4 v)
|
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_normalize(glm_vec4 v)
|
||||||
|
{
|
||||||
|
glm_vec4 const dot0 = glm_vec4_dot(v, v);
|
||||||
|
glm_vec4 const sqr0 = _mm_sqrt_ps(dot0);
|
||||||
|
glm_vec4 const isr0 = _mm_div_ps(_mm_set1_ps(1.0f), sqr0);
|
||||||
|
glm_vec4 const mul0 = _mm_mul_ps(v, isr0);
|
||||||
|
return mul0;
|
||||||
|
}
|
||||||
|
|
||||||
|
GLM_FUNC_QUALIFIER glm_vec4 glm_vec4_fast_normalize(glm_vec4 v)
|
||||||
{
|
{
|
||||||
glm_vec4 const dot0 = glm_vec4_dot(v, v);
|
glm_vec4 const dot0 = glm_vec4_dot(v, v);
|
||||||
glm_vec4 const isr0 = _mm_rsqrt_ps(dot0);
|
glm_vec4 const isr0 = _mm_rsqrt_ps(dot0);
|
||||||
|
Loading…
Reference in New Issue
Block a user