aboutsummaryrefslogtreecommitdiff
path: root/PxShared/include/foundation
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/include/foundation
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/include/foundation')
-rw-r--r--PxShared/include/foundation/PxFoundation.h11
-rw-r--r--PxShared/include/foundation/PxMemory.h2
-rw-r--r--PxShared/include/foundation/PxPreprocessor.h7
-rw-r--r--PxShared/include/foundation/PxSimpleTypes.h2
-rw-r--r--PxShared/include/foundation/unix/PxUnixIntrinsics.h18
-rw-r--r--PxShared/include/foundation/windows/PxWindowsIntrinsics.h2
6 files changed, 30 insertions, 12 deletions
diff --git a/PxShared/include/foundation/PxFoundation.h b/PxShared/include/foundation/PxFoundation.h
index 8642c16..aae84a9 100644
--- a/PxShared/include/foundation/PxFoundation.h
+++ b/PxShared/include/foundation/PxFoundation.h
@@ -126,7 +126,18 @@ PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator,
@see PxCreateFoundation()
*/
+#if PX_CLANG
+#if PX_LINUX
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
+#endif // PX_LINUX
+#endif // PX_CLANG
PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation& PX_CALL_CONV PxGetFoundation();
+#if PX_CLANG
+#if PX_LINUX
+ #pragma clang diagnostic pop
+#endif // PX_LINUX
+#endif // PX_CLANG
namespace physx
{
diff --git a/PxShared/include/foundation/PxMemory.h b/PxShared/include/foundation/PxMemory.h
index b0191e3..6a8a6ed 100644
--- a/PxShared/include/foundation/PxMemory.h
+++ b/PxShared/include/foundation/PxMemory.h
@@ -81,7 +81,7 @@ PX_FORCE_INLINE void* PxMemSet(void* dest, PxI32 c, PxU32 count)
\return Pointer to destination memory block
*/
-PX_FORCE_INLINE void* PxMemCopy(void* PX_RESTRICT dest, const void* PX_RESTRICT src, PxU32 count)
+PX_FORCE_INLINE void* PxMemCopy(void* dest, const void* src, PxU32 count)
{
return physx::intrinsics::memCopy(dest, src, count);
}
diff --git a/PxShared/include/foundation/PxPreprocessor.h b/PxShared/include/foundation/PxPreprocessor.h
index 9b6e0f4..ddbf258 100644
--- a/PxShared/include/foundation/PxPreprocessor.h
+++ b/PxShared/include/foundation/PxPreprocessor.h
@@ -47,7 +47,9 @@ All definitions have a value of 1 or 0, use '#if' instead of '#ifdef'.
Compiler defines, see http://sourceforge.net/p/predef/wiki/Compilers/
*/
#if defined(_MSC_VER)
-#if _MSC_VER >= 1900
+#if _MSC_VER >= 1910
+#define PX_VC 15
+#elif _MSC_VER >= 1900
#define PX_VC 14
#elif _MSC_VER >= 1800
#define PX_VC 12
@@ -488,7 +490,8 @@ struct PxPackValidation
long long a;
};
#endif
-#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN
+// clang (as of version 3.9) cannot align doubles on 8 byte boundary when compiling for Intel 32 bit target
+#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN && !(PX_CLANG && PX_X86)
PX_COMPILE_TIME_ASSERT(PX_OFFSET_OF(PxPackValidation, a) == 8);
#endif
diff --git a/PxShared/include/foundation/PxSimpleTypes.h b/PxShared/include/foundation/PxSimpleTypes.h
index 6ecba13..655fbb3 100644
--- a/PxShared/include/foundation/PxSimpleTypes.h
+++ b/PxShared/include/foundation/PxSimpleTypes.h
@@ -56,7 +56,7 @@
#if PX_VC // we could use inttypes.h starting with VC12
#define PX_PRIu64 "I64u"
#else
-#if !PX_PS4 && !PX_APPLE_FAMILY
+#if !PX_PS4 && !PX_APPLE_FAMILY && !PX_SWITCH
#define __STDC_FORMAT_MACROS
#endif
#include <inttypes.h>
diff --git a/PxShared/include/foundation/unix/PxUnixIntrinsics.h b/PxShared/include/foundation/unix/PxUnixIntrinsics.h
index 351c83c..5f492bc 100644
--- a/PxShared/include/foundation/unix/PxUnixIntrinsics.h
+++ b/PxShared/include/foundation/unix/PxUnixIntrinsics.h
@@ -37,11 +37,12 @@
#error "This file should only be included by Unix builds!!"
#endif
-#if PX_LINUX && !defined(__CUDACC__)
- // Linux and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable
- #ifndef isfinite
- #define isfinite std::isfinite
- #endif
+#if (PX_LINUX || PX_ANDROID) && !defined(__CUDACC__) && !PX_EMSCRIPTEN
+ // Linux/android and CUDA compilation does not work with std::isfnite, as it is not marked as CUDA callable
+ #include <cmath>
+ #ifndef isfinite
+ using std::isfinite;
+ #endif
#endif
#include <math.h>
@@ -125,7 +126,10 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE float selectMax(float a, float b)
//! \brief platform-specific finiteness check (not INF or NAN)
PX_CUDA_CALLABLE PX_FORCE_INLINE bool isFinite(float a)
{
- return !!isfinite(a);
+ //std::isfinite not recommended as of Feb 2017, since it doesn't work with g++/clang's floating point optimization.
+ union localU { PxU32 i; float f; } floatUnion;
+ floatUnion.f = a;
+ return !((floatUnion.i & 0x7fffffff) >= 0x7f800000);
}
//! \brief platform-specific finiteness check (not INF or NAN)
@@ -153,7 +157,7 @@ PX_FORCE_INLINE void* memSet(void* dest, int32_t c, uint32_t count)
/*!
Copies \c count bytes from \c src to \c dst. User memMove if regions overlap.
*/
-PX_FORCE_INLINE void* memCopy(void* PX_RESTRICT dest, const void* PX_RESTRICT src, uint32_t count)
+PX_FORCE_INLINE void* memCopy(void* dest, const void* src, uint32_t count)
{
return memcpy(dest, src, count);
}
diff --git a/PxShared/include/foundation/windows/PxWindowsIntrinsics.h b/PxShared/include/foundation/windows/PxWindowsIntrinsics.h
index 766558e..3cc63b5 100644
--- a/PxShared/include/foundation/windows/PxWindowsIntrinsics.h
+++ b/PxShared/include/foundation/windows/PxWindowsIntrinsics.h
@@ -158,7 +158,7 @@ PX_FORCE_INLINE void* memSet(void* dest, int32_t c, uint32_t count)
/*!
Copies \c count bytes from \c src to \c dst. User memMove if regions overlap.
*/
-PX_FORCE_INLINE void* memCopy(void* PX_RESTRICT dest, const void* PX_RESTRICT src, uint32_t count)
+PX_FORCE_INLINE void* memCopy(void* dest, const void* src, uint32_t count)
{
return memcpy(dest, src, count);
}