Only enable SSE4 for Visual Studio 2012 or later (_MSC_FULL_VER >= 170050727), it breaks the build for Visual Studio 2010

Add additional constructor for btMultiBodyJointMotor
This commit is contained in:
erwincoumans
2014-05-01 22:23:37 -07:00
parent 0e1b90d708
commit 0b6d1af1d4
5 changed files with 39 additions and 13 deletions

View File

@@ -6,10 +6,8 @@
#include <string.h>//memset
#ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 160040219)
#include <intrin.h>
#endif
#endif
#if defined BT_USE_NEON
#define ARM_NEON_GCC_COMPATIBILITY 1
@@ -30,7 +28,7 @@ public:
CPU_FEATURE_NEON_HPFP=4
};
static int getCpuFeatures(btCpuFeature inFeature)
static int getCpuFeatures()
{
static int capabilities = 0;
@@ -50,31 +48,29 @@ public:
}
#endif //BT_USE_NEON
#ifdef BT_USE_SSE
#if (_MSC_FULL_VER >= 160040219)
#ifdef BT_ALLOW_SSE4
{
int cpuInfo[4];
memset(cpuInfo, 0, sizeof(cpuInfo));
unsigned long long sseExt;
__cpuid(mCpuInfo, 1);
mExt = _xgetbv(0);
__cpuid(cpuInfo, 1);
sseExt = _xgetbv(0);
const int OSXSAVEFlag = (1UL << 27);
const int AVXFlag = ((1UL << 28) | OSXSAVEFlag);
const int FMAFlag = ((1UL << 12) | AVXFlag | OSXSAVEFlag);
if ((mCpuInfo[2] & FMAFlag) == FMAFlag && (mExt & 6) == 6)
if ((cpuInfo[2] & FMAFlag) == FMAFlag && (sseExt & 6) == 6)
{
capabilities |= btCpuFeatureUtility::CPU_FEATURE_FMA3;
}
const int SSE41Flag = (1 << 19);
if (mCpuInfo[2] & SSE41Flag)
if (cpuInfo[2] & SSE41Flag)
{
capabilities |= btCpuFeatureUtility::CPU_FEATURE_SSE4_1;
}
}
#endif//(_MSC_FULL_VER >= 160040219)
#endif//BT_USE_SSE
#endif//BT_ALLOW_SSE4
testedCapabilities = true;
return capabilities;

View File

@@ -74,6 +74,11 @@ inline int btGetVersion()
#define BT_USE_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)
#define BT_ALLOW_SSE4
#endif //(_MSC_FULL_VER >= 160040219)
//BT_USE_SSE_IN_API is disabled under Windows by default, because
//it makes it harder to integrate Bullet into your application under Windows
//(structured embedding Bullet structs/classes need to be 16-byte aligned)