allow to compile using clang-cl on visual studio (disable SSE)
This commit is contained in:
@@ -14,7 +14,20 @@ extern "C"
|
||||
//#define b3Printf b3OutputPrintfVarArgsInternal
|
||||
//#define b3Printf(...) printf(__VA_ARGS__)
|
||||
//#define b3Printf(...)
|
||||
|
||||
#ifdef __clang__
|
||||
#define b3Warning(...) \
|
||||
do \
|
||||
{ \
|
||||
b3OutputWarningMessageVarArgsInternal("b3Warning[%s,%d]:\n", __FILE_NAME__, __LINE__); \
|
||||
b3OutputWarningMessageVarArgsInternal(__VA_ARGS__); \
|
||||
} while (0)
|
||||
#define b3Error(...) \
|
||||
do \
|
||||
{ \
|
||||
b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE_NAME__, __LINE__); \
|
||||
b3OutputErrorMessageVarArgsInternal(__VA_ARGS__); \
|
||||
} while (0)
|
||||
#else//__clang__
|
||||
#define b3Warning(...) \
|
||||
do \
|
||||
{ \
|
||||
@@ -27,7 +40,7 @@ extern "C"
|
||||
b3OutputErrorMessageVarArgsInternal("b3Error[%s,%d]:\n", __FILE__, __LINE__); \
|
||||
b3OutputErrorMessageVarArgsInternal(__VA_ARGS__); \
|
||||
} while (0)
|
||||
|
||||
#endif //__clang__
|
||||
#ifndef B3_NO_PROFILE
|
||||
|
||||
void b3EnterProfileZone(const char* name);
|
||||
|
||||
@@ -71,7 +71,17 @@ inline int b3GetVersion()
|
||||
|
||||
#if (defined(_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined(B3_USE_DOUBLE_PRECISION))
|
||||
#if (defined(_M_IX86) || defined(_M_X64))
|
||||
|
||||
|
||||
#ifdef __clang__
|
||||
//#define B3_NO_SIMD_OPERATOR_OVERLOADS
|
||||
#define B3_DISABLE_SSE
|
||||
#endif //__clang__
|
||||
|
||||
#ifndef B3_DISABLE_SSE
|
||||
#define B3_USE_SSE
|
||||
#endif //B3_DISABLE_SSE
|
||||
|
||||
#ifdef B3_USE_SSE
|
||||
//B3_USE_SSE_IN_API is disabled under Windows by default, because
|
||||
//it makes it harder to integrate Bullet into your application under Windows
|
||||
@@ -92,17 +102,7 @@ inline int b3GetVersion()
|
||||
#ifdef B3_DEBUG
|
||||
#ifdef _MSC_VER
|
||||
#include <stdio.h>
|
||||
#define b3Assert(x) \
|
||||
{ \
|
||||
if (!(x)) \
|
||||
{ \
|
||||
b3Error( \
|
||||
"Assert "__FILE__ \
|
||||
":%u (" #x ")\n", \
|
||||
__LINE__); \
|
||||
__debugbreak(); \
|
||||
} \
|
||||
}
|
||||
#define b3Assert(x) { if(!(x)){b3Error("Assert " __FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }}
|
||||
#else //_MSC_VER
|
||||
#include <assert.h>
|
||||
#define b3Assert assert
|
||||
@@ -297,7 +297,7 @@ static int b3NanMask = 0x7F800001;
|
||||
static int b3InfinityMask = 0x7F800000;
|
||||
#define B3_INFINITY_MASK (*(float *)&b3InfinityMask)
|
||||
#endif
|
||||
|
||||
#ifndef B3_NO_SIMD_OPERATOR_OVERLOADS
|
||||
inline __m128 operator+(const __m128 A, const __m128 B)
|
||||
{
|
||||
return _mm_add_ps(A, B);
|
||||
@@ -312,7 +312,7 @@ inline __m128 operator*(const __m128 A, const __m128 B)
|
||||
{
|
||||
return _mm_mul_ps(A, B);
|
||||
}
|
||||
|
||||
#endif //B3_NO_SIMD_OPERATOR_OVERLOADS
|
||||
#define b3CastfTo128i(a) (_mm_castps_si128(a))
|
||||
#define b3CastfTo128d(a) (_mm_castps_pd(a))
|
||||
#define b3CastiTo128f(a) (_mm_castsi128_ps(a))
|
||||
|
||||
@@ -110,11 +110,16 @@ inline int btIsDoublePrecision()
|
||||
#if defined (_M_ARM)
|
||||
//Do not turn SSE on for ARM (may want to turn on BT_USE_NEON however)
|
||||
#elif (defined (_WIN32) && (_MSC_VER) && _MSC_VER >= 1400) && (!defined (BT_USE_DOUBLE_PRECISION))
|
||||
|
||||
#ifdef __clang__
|
||||
#define __BT_DISABLE_SSE__
|
||||
#endif
|
||||
#ifndef __BT_DISABLE_SSE__
|
||||
#if _MSC_VER>1400
|
||||
#define BT_USE_SIMD_VECTOR3
|
||||
#endif
|
||||
|
||||
#define BT_USE_SSE
|
||||
#endif//__BT_DISABLE_SSE__
|
||||
#ifdef BT_USE_SSE
|
||||
|
||||
#if (_MSC_FULL_VER >= 170050727)//Visual Studio 2012 can compile SSE4/FMA3 (but SSE4/FMA3 is not enabled by default)
|
||||
@@ -210,6 +215,7 @@ inline int btIsDoublePrecision()
|
||||
|
||||
#if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION)))
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
#error bla
|
||||
#define BT_USE_SIMD_VECTOR3
|
||||
#define BT_USE_SSE
|
||||
//BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries
|
||||
|
||||
Reference in New Issue
Block a user