aboutsummaryrefslogtreecommitdiff
path: root/PxShared/src/foundation/include
diff options
context:
space:
mode:
authorMarijn Tamis <[email protected]>2017-10-20 14:30:56 +0200
committerMarijn Tamis <[email protected]>2017-10-20 14:36:12 +0200
commitfabb251458f4a2d6d4f87dd36038fac2774b378c (patch)
tree68a4a0ecd940dc949e0477d521d8c159968cfcd5 /PxShared/src/foundation/include
parentNvCloth 1.1.2 Release. (22576033) (diff)
downloadnvcloth-1.1.3.tar.xz
nvcloth-1.1.3.zip
NvCloth 1.1.3 Release. (23014067)v1.1.3
Diffstat (limited to 'PxShared/src/foundation/include')
-rw-r--r--PxShared/src/foundation/include/PsArray.h129
-rw-r--r--PxShared/src/foundation/include/PsMathUtils.h3
-rw-r--r--PxShared/src/foundation/include/PsMutex.h2
-rw-r--r--PxShared/src/foundation/include/PsSList.h2
-rw-r--r--PxShared/src/foundation/include/PsSync.h6
-rw-r--r--PxShared/src/foundation/include/PsThread.h6
-rw-r--r--PxShared/src/foundation/include/PsUtilities.h8
-rw-r--r--PxShared/src/foundation/include/PsVecMathAoSScalar.h3
-rw-r--r--PxShared/src/foundation/include/unix/PsUnixInlineAoS.h3
-rw-r--r--PxShared/src/foundation/include/unix/PsUnixIntrinsics.h2
-rw-r--r--PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h3
-rw-r--r--PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h3
-rw-r--r--PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h3
13 files changed, 37 insertions, 136 deletions
diff --git a/PxShared/src/foundation/include/PsArray.h b/PxShared/src/foundation/include/PsArray.h
index 8433fbe..2121c30 100644
--- a/PxShared/src/foundation/include/PsArray.h
+++ b/PxShared/src/foundation/include/PsArray.h
@@ -35,17 +35,6 @@
#include "PsAllocator.h"
#include "PsBasicTemplates.h"
-#if PX_LIBCPP
-#include <type_traits>
-#else
-#include <tr1/type_traits>
-#endif
-
-#if PX_VC == 9 || PX_VC == 10
-#pragma warning(push)
-#pragma warning(disable : 4347) // behavior change: 'function template' is called instead of 'function'
-#endif
-
namespace physx
{
namespace shdfnd
@@ -158,15 +147,6 @@ class Array : protected Alloc
return operator=<Alloc>(t);
}
- PX_FORCE_INLINE static bool isArrayOfPOD()
- {
-#if PX_LIBCPP
- return std::is_trivially_copyable<T>::value;
-#else
- return std::tr1::is_pod<T>::value;
-#endif
- }
-
/*!
Array indexing operator.
\param i
@@ -338,14 +318,7 @@ class Array : protected Alloc
PX_ASSERT(mSize);
T t = mData[mSize - 1];
- if(!isArrayOfPOD())
- {
- mData[--mSize].~T();
- }
- else
- {
- --mSize;
- }
+ mData[--mSize].~T();
return t;
}
@@ -379,10 +352,7 @@ class Array : protected Alloc
PX_ASSERT(i < mSize);
mData[i] = mData[--mSize];
- if(!isArrayOfPOD())
- {
- mData[mSize].~T();
- }
+ mData[mSize].~T();
}
PX_INLINE void replaceWithLast(Iterator i)
@@ -424,24 +394,14 @@ class Array : protected Alloc
{
PX_ASSERT(i < mSize);
- if(isArrayOfPOD())
- {
- if(i + 1 != mSize)
- {
- physx::intrinsics::memMove(mData + i, mData + i + 1, (mSize - i - 1) * sizeof(T));
- }
- }
- else
- {
- T* it = mData + i;
+ T* it = mData + i;
+ it->~T();
+ while (++i < mSize)
+ {
+ new (it) T(mData[i]);
+ ++it;
it->~T();
- while (++i < mSize)
- {
- new (it) T(mData[i]);
- ++it;
- it->~T();
- }
- }
+ }
--mSize;
}
@@ -460,31 +420,19 @@ class Array : protected Alloc
PX_ASSERT(begin < mSize);
PX_ASSERT((begin + count) <= mSize);
- if(!isArrayOfPOD())
- {
- for(uint32_t i = 0; i < count; i++)
- {
- mData[begin + i].~T(); // call the destructor on the ones being removed first.
- }
- }
+ for(uint32_t i = 0; i < count; i++)
+ mData[begin + i].~T(); // call the destructor on the ones being removed first.
T* dest = &mData[begin]; // location we are copying the tail end objects to
T* src = &mData[begin + count]; // start of tail objects
uint32_t move_count = mSize - (begin + count); // compute remainder that needs to be copied down
- if(isArrayOfPOD())
- {
- physx::intrinsics::memMove(dest, src, move_count * sizeof(T));
- }
- else
+ for(uint32_t i = 0; i < move_count; i++)
{
- for(uint32_t i = 0; i < move_count; i++)
- {
- new (dest) T(*src); // copy the old one to the new location
- src->~T(); // call the destructor on the old location
- dest++;
- src++;
- }
+ new (dest) T(*src); // copy the old one to the new location
+ src->~T(); // call the destructor on the old location
+ dest++;
+ src++;
}
mSize -= count;
}
@@ -624,29 +572,10 @@ definition for serialized classes is complete in checked builds.
Alloc::deallocate(mem);
}
- static PX_INLINE bool isZeroInit(const T& object)
- {
- if (!isArrayOfPOD())
- return false;
- char ZeroBuffOnStack[sizeof(object)] = {};
- // bgaldrikian - casting to void* to avoid compiler error:
- // error : first operand of this 'memcmp' call is a pointer to dynamic class [...]; vtable pointer will be compared [-Werror,-Wdynamic-class-memaccess]
- // even though POD check prevents memcmp from being used on a dynamic class
- return memcmp(reinterpret_cast<const void*>(&object), ZeroBuffOnStack, sizeof(object)) == 0;
- }
-
static PX_INLINE void create(T* first, T* last, const T& a)
{
- if(isZeroInit(a))
- {
- if(last > first)
- physx::intrinsics::memZero(first, uint32_t((last - first) * sizeof(T)));
- }
- else
- {
- for(; first < last; ++first)
- ::new (first) T(a);
- }
+ for(; first < last; ++first)
+ ::new (first) T(a);
}
static PX_INLINE void copy(T* first, T* last, const T* src)
@@ -654,24 +583,14 @@ definition for serialized classes is complete in checked builds.
if(last <= first)
return;
- if(isArrayOfPOD())
- {
- physx::intrinsics::memCopy(first, src, uint32_t((last - first) * sizeof(T)));
- }
- else
- {
- for(; first < last; ++first, ++src)
- ::new (first) T(*src);
- }
+ for(; first < last; ++first, ++src)
+ ::new (first) T(*src);
}
static PX_INLINE void destroy(T* first, T* last)
{
- if(!isArrayOfPOD())
- {
- for(; first < last; ++first)
- first->~T();
- }
+ for(; first < last; ++first)
+ first->~T();
}
/*!
@@ -799,8 +718,4 @@ PX_INLINE void swap(Array<T, Alloc>& x, Array<T, Alloc>& y)
} // namespace shdfnd
} // namespace physx
-#if PX_VC == 9 || PX_VC == 10
-#pragma warning(pop)
-#endif
-
#endif // #ifndef PSFOUNDATION_PSARRAY_H
diff --git a/PxShared/src/foundation/include/PsMathUtils.h b/PxShared/src/foundation/include/PsMathUtils.h
index 794419b..789cf3f 100644
--- a/PxShared/src/foundation/include/PsMathUtils.h
+++ b/PxShared/src/foundation/include/PsMathUtils.h
@@ -493,9 +493,6 @@ PX_FORCE_INLINE void normalToTangents(const PxVec3& normal, PxVec3& tangent0, Px
tangent1 = normal.cross(tangent0);
}
-// todo: what is this function doing?
-PX_FOUNDATION_API PxQuat computeQuatFromNormal(const PxVec3& n);
-
/**
\brief computes a oriented bounding box around the scaled basis.
\param basis Input = skewed basis, Output = (normalized) orthogonal basis.
diff --git a/PxShared/src/foundation/include/PsMutex.h b/PxShared/src/foundation/include/PsMutex.h
index 7c93796..23033d0 100644
--- a/PxShared/src/foundation/include/PsMutex.h
+++ b/PxShared/src/foundation/include/PsMutex.h
@@ -82,7 +82,7 @@ class PX_FOUNDATION_API MutexImpl
/**
Size of this class.
*/
- static const uint32_t& getSize();
+ static uint32_t getSize();
};
template <typename Alloc = ReflectionAllocator<MutexImpl> >
diff --git a/PxShared/src/foundation/include/PsSList.h b/PxShared/src/foundation/include/PsSList.h
index f811c37..961010b 100644
--- a/PxShared/src/foundation/include/PsSList.h
+++ b/PxShared/src/foundation/include/PsSList.h
@@ -91,7 +91,7 @@ struct PX_FOUNDATION_API SListImpl
void push(SListEntry* entry);
SListEntry* pop();
SListEntry* flush();
- static const uint32_t& getSize();
+ static uint32_t getSize();
};
template <typename Alloc = ReflectionAllocator<SListImpl> >
diff --git a/PxShared/src/foundation/include/PsSync.h b/PxShared/src/foundation/include/PsSync.h
index 8b99731..1fd72f5 100644
--- a/PxShared/src/foundation/include/PsSync.h
+++ b/PxShared/src/foundation/include/PsSync.h
@@ -70,9 +70,9 @@ class PX_FOUNDATION_API SyncImpl
void reset();
/**
- Size of this class.
- */
- static const uint32_t& getSize();
+ Size of this class.
+ */
+ static uint32_t getSize();
};
/*!
diff --git a/PxShared/src/foundation/include/PsThread.h b/PxShared/src/foundation/include/PsThread.h
index 4e7c104..ec9f999 100644
--- a/PxShared/src/foundation/include/PsThread.h
+++ b/PxShared/src/foundation/include/PsThread.h
@@ -206,9 +206,9 @@ class PX_FOUNDATION_API ThreadImpl
static uint32_t getNbPhysicalCores();
/**
- Size of this class.
- */
- static const uint32_t& getSize();
+ Size of this class.
+ */
+ static uint32_t getSize();
};
/**
diff --git a/PxShared/src/foundation/include/PsUtilities.h b/PxShared/src/foundation/include/PsUtilities.h
index 32fe4ec..cd0f200 100644
--- a/PxShared/src/foundation/include/PsUtilities.h
+++ b/PxShared/src/foundation/include/PsUtilities.h
@@ -122,7 +122,7 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE void order(T& x, T& y, E1& xe1, E1& ye1)
}
}
-#if PX_GCC_FAMILY && !PX_EMSCRIPTEN
+#if PX_GCC_FAMILY && !PX_EMSCRIPTEN && !PX_LINUX
__attribute__((noreturn))
#endif
PX_INLINE void debugBreak()
@@ -132,7 +132,11 @@ __attribute__((noreturn))
#elif PX_ANDROID
raise(SIGTRAP); // works better than __builtin_trap. Proper call stack and can be continued.
#elif PX_LINUX
- asm("int $3");
+ #if (PX_X64 || PX_X64)
+ asm("int $3");
+ #else
+ raise(SIGTRAP);
+ #endif
#elif PX_GCC_FAMILY
__builtin_trap();
#else
diff --git a/PxShared/src/foundation/include/PsVecMathAoSScalar.h b/PxShared/src/foundation/include/PsVecMathAoSScalar.h
index beb6cdc..b7fe8e4 100644
--- a/PxShared/src/foundation/include/PsVecMathAoSScalar.h
+++ b/PxShared/src/foundation/include/PsVecMathAoSScalar.h
@@ -34,9 +34,6 @@
#error Scalar version should not be included when using vector intrinsics.
#endif
-// Remove this define when all platforms use simd solver.
-#define PX_SUPPORT_SIMD
-
struct VecI16V;
struct VecU16V;
struct VecI32V;
diff --git a/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h b/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h
index e54f2c8..74002d5 100644
--- a/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h
+++ b/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h
@@ -34,9 +34,6 @@
#error Vector intrinsics should not be included when using scalar implementation.
#endif
-// Remove this define when all platforms use simd solver.
-#define PX_SUPPORT_SIMD
-
#if PX_INTEL_FAMILY
#include "sse2/PsUnixSse2InlineAoS.h"
#elif PX_NEON
diff --git a/PxShared/src/foundation/include/unix/PsUnixIntrinsics.h b/PxShared/src/foundation/include/unix/PsUnixIntrinsics.h
index 4c6c892..e15b3b5 100644
--- a/PxShared/src/foundation/include/unix/PsUnixIntrinsics.h
+++ b/PxShared/src/foundation/include/unix/PsUnixIntrinsics.h
@@ -34,7 +34,7 @@
#include "foundation/PxAssert.h"
#include <math.h>
-#if PX_ANDROID
+#if PX_ANDROID || (PX_LINUX && !(PX_X64 || PX_X64)) // x86[_64] Linux uses inline assembly for debug break
#include <signal.h> // for Ns::debugBreak() { raise(SIGTRAP); }
#endif
diff --git a/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h b/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h
index a97f821..4df3ff6 100644
--- a/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h
+++ b/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h
@@ -53,9 +53,6 @@
#define VECMATH_AOS_EPSILON (1e-3f)
-// Remove this define when all platforms use simd solver.
-#define PX_SUPPORT_SIMD
-
//////////////////////////////////////////////////////////////////////
//Test that Vec3V and FloatV are legal
//////////////////////////////////
diff --git a/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h b/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h
index 0355538..cdb20fa 100644
--- a/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h
+++ b/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h
@@ -34,9 +34,6 @@
#error Vector intrinsics should not be included when using scalar implementation.
#endif
-// Remove this define when all platforms use simd solver.
-#define PX_SUPPORT_SIMD
-
#ifdef __SSE4_2__
#include "smmintrin.h"
#endif
diff --git a/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h b/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h
index 14a311f..5fd1b8d 100644
--- a/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h
+++ b/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h
@@ -34,9 +34,6 @@
#error Vector intrinsics should not be included when using scalar implementation.
#endif
-// Remove this define when all platforms use simd solver.
-#define PX_SUPPORT_SIMD
-
#include "../PsVecMathSSE.h"
//////////////////////////////////////////////////////////////////////