mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-02-21 11:21:52 +00:00
GL3: Update HandMadeMath.h to include my non-SSE patch
from https://github.com/StrangeZak/Handmade-Math/pull/60 Hopefully fixes #204 (broken build on ARM)
This commit is contained in:
parent
8fa861d8e9
commit
36c880e105
2 changed files with 30 additions and 11 deletions
|
@ -29,9 +29,6 @@
|
|||
#include "../../header/ref.h"
|
||||
#include "header/local.h"
|
||||
|
||||
#ifndef __SSE__
|
||||
#define HANDMADE_MATH_NO_SSE
|
||||
#endif
|
||||
#define HANDMADE_MATH_IMPLEMENTATION
|
||||
#include "header/HandmadeMath.h"
|
||||
|
||||
|
|
|
@ -173,6 +173,8 @@
|
|||
(*) Resolved compiler warnings on gcc and g++
|
||||
1.1.2
|
||||
(*) Fixed invalid HMMDEF's in the function definitions
|
||||
1.1.3
|
||||
(*) Fixed compile error in C mode
|
||||
|
||||
LICENSE
|
||||
|
||||
|
@ -198,7 +200,27 @@
|
|||
Insofaras (@insofaras)
|
||||
*/
|
||||
|
||||
#ifndef HANDMADE_NO_SSE
|
||||
|
||||
// let's figure out if SSE is really available (unless disabled anyway)
|
||||
// (it isn't on non-x86/x86_64 platforms or even x86 without explicit SSE support)
|
||||
// => only use "#ifdef HANDMADE_MATH__USE_SSE" to check for SSE support below this block!
|
||||
#ifndef HANDMADE_MATH_NO_SSE
|
||||
|
||||
# ifdef _MSC_VER
|
||||
// MSVC supports SSE in amd64 mode or _M_IX86_FP >= 1 (2 means SSE2)
|
||||
# if defined(_M_AMD64) || ( defined(_M_IX86_FP) && _M_IX86_FP >= 1 )
|
||||
# define HANDMADE_MATH__USE_SSE 1
|
||||
# endif
|
||||
# else // not MSVC, probably GCC, clang, icc or something that doesn't support SSE anyway
|
||||
# ifdef __SSE__ // they #define __SSE__ if it's supported
|
||||
# define HANDMADE_MATH__USE_SSE 1
|
||||
# endif // __SSE__
|
||||
# endif // not _MSC_VER
|
||||
|
||||
#endif // #ifndef HANDMADE_MATH_NO_SSE
|
||||
|
||||
|
||||
#ifdef HANDMADE_MATH__USE_SSE
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
|
@ -755,12 +777,12 @@ HMM_SquareRootF(float Value)
|
|||
{
|
||||
float Result = 0.0f;
|
||||
|
||||
#ifdef HANDMADE_MATH_NO_SSE
|
||||
Result = sqrtf(Value);
|
||||
#else
|
||||
#ifdef HANDMADE_MATH__USE_SSE
|
||||
__m128 In = _mm_set_ss(Value);
|
||||
__m128 Out = _mm_sqrt_ss(In);
|
||||
Result = _mm_cvtss_f32(Out);
|
||||
#else
|
||||
Result = sqrtf(Value);
|
||||
#endif
|
||||
|
||||
return(Result);
|
||||
|
@ -771,12 +793,12 @@ HMM_RSquareRootF(float Value)
|
|||
{
|
||||
float Result = 0.0f;
|
||||
|
||||
#ifdef HANDMADE_MATH_NO_SSE
|
||||
Result = 1.0f/HMM_SquareRootF(Value);
|
||||
#else
|
||||
#ifdef HANDMADE_MATH__USE_SSE
|
||||
__m128 In = _mm_set_ss(Value);
|
||||
__m128 Out = _mm_rsqrt_ss(In);
|
||||
Result = _mm_cvtss_f32(Out);
|
||||
#else
|
||||
Result = 1.0f/HMM_SquareRootF(Value);
|
||||
#endif
|
||||
|
||||
return(Result);
|
||||
|
@ -1692,7 +1714,7 @@ HMM_NLerp(hmm_quaternion Left, float Time, hmm_quaternion Right)
|
|||
Result.Z = HMM_Lerp(Left.Z, Time, Right.Z);
|
||||
Result.W = HMM_Lerp(Left.W, Time, Right.W);
|
||||
|
||||
HMM_NormalizeQuaternion(Result);
|
||||
Result = HMM_NormalizeQuaternion(Result);
|
||||
|
||||
return(Result);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue