diff options
author | erwin.coumans <erwin.coumans@08e121b0-ae19-0410-a57b-3be3395fd4fd> | 2013-09-10 23:09:24 +0000 |
---|---|---|
committer | erwin.coumans <erwin.coumans@08e121b0-ae19-0410-a57b-3be3395fd4fd> | 2013-09-10 23:09:24 +0000 |
commit | 7195b54d137ba8e125f0f7a962597c3a1aef4db3 (patch) | |
tree | ef5b578e2bb310a3f60dd1908a63566a69bbc08e /src/LinearMath/btVector3.cpp | |
parent | 7633dc8b1358bdeaff94b6b0629bb94083236bfc (diff) | |
download | bullet3-7195b54d137ba8e125f0f7a962597c3a1aef4db3.tar.gz |
Fix Issue 712, related to NVIDIA CUDA check in CMakeLists.txt
Enable btGImpact raycast optimization, thanks to C0DEFACE, see Issue 664
Cull triangle/AABB for concave/heightfield shapes, thanks to Danny Chapman
fix btGetCpuCapabilities, thanks to Ian Ollman! See https://code.google.com/p/bullet/issues/detail?id=738
Diffstat (limited to 'src/LinearMath/btVector3.cpp')
-rw-r--r-- | src/LinearMath/btVector3.cpp | 43 |
1 files changed, 26 insertions, 17 deletions
diff --git a/src/LinearMath/btVector3.cpp b/src/LinearMath/btVector3.cpp index 97e90f105..0af112c75 100644 --- a/src/LinearMath/btVector3.cpp +++ b/src/LinearMath/btVector3.cpp @@ -835,39 +835,48 @@ static long _mindot_large_sel( const float *vv, const float *vec, unsigned long long (*_maxdot_large)( const float *vv, const float *vec, unsigned long count, float *dotResult ) = _maxdot_large_sel; long (*_mindot_large)( const float *vv, const float *vec, unsigned long count, float *dotResult ) = _mindot_large_sel; -//Apple doesn't allow to use this internal API and rejects Apps. -//thanks Apple for rejecting your own contribution :-) -//Let's always use version 'v1' -//See https://code.google.com/p/bullet/issues/detail?id=738 -#ifdef USE_DEVICE_CAPABILITIES -extern "C" {int _get_cpu_capabilities( void );} -#endif //USE_DEVICE_CAPABILITIES + +static inline uint32_t btGetCpuCapabilities( void )
+{
+ static uint32_t capabilities = 0;
+ static bool testedCapabilities = false;
+
+ if( 0 == testedCapabilities)
+ {
+ uint32_t hasFeature = 0;
+ size_t featureSize = sizeof( hasFeature );
+ int err = sysctlbyname( "hw.optional.neon_hpfp", &hasFeature, &featureSize, NULL, 0 );
+
+ if( 0 == err && hasFeature)
+ capabilities |= 0x2000;
+
+ testedCapabilities = true;
+ }
+
+ return capabilities;
+} + + static long _maxdot_large_sel( const float *vv, const float *vec, unsigned long count, float *dotResult ) { -#ifdef USE_DEVICE_CAPABILITIES - if( _get_cpu_capabilities() & 0x2000 ) + + if( btGetCpuCapabilities() & 0x2000 ) _maxdot_large = _maxdot_large_v1; else _maxdot_large = _maxdot_large_v0; -#else - _maxdot_large = _maxdot_large_v1; -#endif return _maxdot_large(vv, vec, count, dotResult); } static long _mindot_large_sel( const float *vv, const float *vec, unsigned long count, float *dotResult ) { -#ifdef USE_DEVICE_CAPABILITIES - if( _get_cpu_capabilities() & 0x2000 ) + + if( btGetCpuCapabilities() & 0x2000 ) _mindot_large = _mindot_large_v1; else _mindot_large = _mindot_large_v0; -#else - _mindot_large = _mindot_large_v1; -#endif return _mindot_large(vv, vec, count, dotResult); } |