1
0
mirror of https://github.com/alliedmodders/hl2sdk.git synced 2025-09-20 04:26:03 +08:00

More portions of L4D2 SDK compile and link on Mac OS X (bug 4646, r=dvander).

This commit is contained in:
Scott Ehlert
2010-10-14 16:36:09 -05:00
parent 1d2bcd2337
commit f12130c3a9
33 changed files with 107 additions and 92 deletions

View File

@ -35,7 +35,7 @@ static const uint32 _sincos_inv_masks[] = { (uint32)~0x0, (uint32)0x0 };
#define _PS_CONST(Name, Val) \
static const __declspec(align(16)) float _ps_##Name[4] = { Val, Val, Val, Val }
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
#define _PS_EXTERN_CONST(Name, Val) \
const __attribute__((aligned(16))) float _ps_##Name[4] = { Val, Val, Val, Val }
@ -90,7 +90,7 @@ float _SSE_Sqrt(float x)
sqrtss xmm0, x
movss root, xmm0
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
"movss %1,%%xmm2\n"
"sqrtss %%xmm2,%%xmm1\n"
@ -143,7 +143,7 @@ float _SSE_RSqrtAccurate(float a)
movss x, xmm1;
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
"movss %1, %%xmm3 \n\t"
"movss %2, %%xmm1 \n\t"
@ -179,7 +179,7 @@ float _SSE_RSqrtFast(float x)
rsqrtss xmm0, x
movss rroot, xmm0
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
"rsqrtss %1, %%xmm0 \n\t"
"movss %%xmm0, %0 \n\t"
@ -202,7 +202,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
// sice vec only has 3 floats, we can't "movaps" directly into it.
#ifdef _WIN32
__declspec(align(16)) float result[4];
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
__attribute__((aligned(16))) float result[4];
#endif
@ -239,7 +239,7 @@ float FASTCALL _SSE_VectorNormalize (Vector& vec)
mulps xmm4, xmm1 // r4 = vx * 1/radius, vy * 1/radius, vz * 1/radius, X
movaps [edx], xmm4 // v = vx * 1/radius, vy * 1/radius, vz * 1/radius, X
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
#ifdef ALIGNED_VECTOR
"movaps %2, %%xmm4 \n\t"
@ -307,7 +307,7 @@ float _SSE_InvRSquared(const float* v)
rcpss xmm0, xmm1 // x0 = 1 / max( 1.0, x1 )
movss inv_r2, xmm0 // inv_r2 = x0
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
__asm__ __volatile__(
#ifdef ALIGNED_VECTOR
"movaps %1, %%xmm4 \n\t"
@ -421,7 +421,7 @@ void _SSE_SinCos(float x, float* s, float* c)
movss [eax], xmm0
movss [edx], xmm4
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE_sincos NOT implemented!"
#else
#error "Not Implemented"
@ -479,7 +479,7 @@ float _SSE_cos( float x )
movss x, xmm0
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE_cos NOT implemented!"
#else
#error "Not Implemented"
@ -569,7 +569,7 @@ void _SSE2_SinCos(float x, float* s, float* c) // any x
movss [eax], xmm0
movss [edx], xmm6
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE2_SinCos NOT implemented!"
#else
#error "Not Implemented"
@ -624,7 +624,7 @@ float _SSE2_cos(float x)
mulss xmm0, xmm1
movss x, xmm0
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
// #warning "_SSE2_cos NOT implemented!"
#else
#error "Not Implemented"
@ -681,7 +681,7 @@ void VectorTransformSSE(const float *in1, const matrix3x4_t& in2, float *out1)
addss xmm0, [ecx+12]
movss [edx+8], xmm0;
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
// #warning "VectorTransformSSE C implementation only"
out1[0] = DotProduct(in1, in2[0]) + in2[0][3];
out1[1] = DotProduct(in1, in2[1]) + in2[1][3];
@ -735,7 +735,7 @@ void VectorRotateSSE( const float *in1, const matrix3x4_t& in2, float *out1 )
addss xmm0, xmm2;
movss [edx+8], xmm0;
}
#elif _LINUX
#elif defined _LINUX || defined __APPLE__
// #warning "VectorRotateSSE C implementation only"
out1[0] = DotProduct( in1, in2[0] );
out1[1] = DotProduct( in1, in2[1] );