diff options
Diffstat (limited to 'PxShared/src/foundation')
27 files changed, 53 insertions, 69 deletions
diff --git a/PxShared/src/foundation/include/PsAllocator.h b/PxShared/src/foundation/include/PsAllocator.h index cbf32d38..f988b6c5 100644 --- a/PxShared/src/foundation/include/PsAllocator.h +++ b/PxShared/src/foundation/include/PsAllocator.h @@ -108,7 +108,7 @@ #elif PX_XBOXONE #include <malloc.h> #define PxAlloca(x) alloca(x) -#elif PX_NX +#elif PX_SWITCH #include <malloc.h> #define PxAlloca(x) alloca(x) #endif diff --git a/PxShared/src/foundation/include/PsAoS.h b/PxShared/src/foundation/include/PsAoS.h index 641a40a3..5a7c82de 100644 --- a/PxShared/src/foundation/include/PsAoS.h +++ b/PxShared/src/foundation/include/PsAoS.h @@ -34,7 +34,7 @@ #if PX_WINDOWS && !PX_NEON #include "windows/PsWindowsAoS.h" -#elif(PX_UNIX_FAMILY || PX_PS4 || PX_NX) +#elif(PX_UNIX_FAMILY || PX_PS4 || PX_SWITCH) #include "unix/PsUnixAoS.h" #elif PX_XBOXONE #include "XboxOne/PsXboxOneAoS.h" diff --git a/PxShared/src/foundation/include/PsInlineAoS.h b/PxShared/src/foundation/include/PsInlineAoS.h index 6d43607f..6ae15cf3 100644 --- a/PxShared/src/foundation/include/PsInlineAoS.h +++ b/PxShared/src/foundation/include/PsInlineAoS.h @@ -35,7 +35,7 @@ #if PX_WINDOWS #include "windows/PsWindowsTrigConstants.h" #include "windows/PsWindowsInlineAoS.h" -#elif(PX_UNIX_FAMILY || PX_PS4 || PX_NX) +#elif(PX_UNIX_FAMILY || PX_PS4 || PX_SWITCH) #include "unix/PsUnixTrigConstants.h" #include "unix/PsUnixInlineAoS.h" #elif PX_XBOXONE diff --git a/PxShared/src/foundation/include/PsIntrinsics.h b/PxShared/src/foundation/include/PsIntrinsics.h index 1e1b9d1a..38b91baf 100644 --- a/PxShared/src/foundation/include/PsIntrinsics.h +++ b/PxShared/src/foundation/include/PsIntrinsics.h @@ -38,8 +38,8 @@ #include "unix/PsUnixIntrinsics.h" #elif PX_XBOXONE #include "XboxOne/PsXboxOneIntrinsics.h" -#elif PX_NX -#include "nx/PsNXIntrinsics.h" +#elif PX_SWITCH +#include "switch/PsSwitchIntrinsics.h" #else #error "Platform not supported!" #endif diff --git a/PxShared/src/foundation/include/PsMutex.h b/PxShared/src/foundation/include/PsMutex.h index 7c937965..23033d09 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 f811c373..961010b2 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 8b997312..1fd72f53 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 8ba553af..ec9f999a 100644 --- a/PxShared/src/foundation/include/PsThread.h +++ b/PxShared/src/foundation/include/PsThread.h @@ -41,7 +41,7 @@ #if PX_WINDOWS_FAMILY || PX_XBOXONE #define PxSpinLockPause() __asm pause -#elif PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_NX +#elif PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_SWITCH #define PxSpinLockPause() asm("nop") #else #error "Platform not supported!" @@ -173,7 +173,7 @@ class PX_FOUNDATION_API ThreadImpl Change the affinity mask for this thread. The mask is a platform specific value. - On Windows, Linux, PS4, XboxOne and NX platforms, each set mask bit represents + On Windows, Linux, PS4, XboxOne and Switch platforms, each set mask bit represents the index of a logical processor that the OS may schedule thread execution on. Bits outside the range of valid logical processors may be ignored or cause the function to return an error. @@ -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 32fe4ec0..cd0f200a 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/PsVecMath.h b/PxShared/src/foundation/include/PsVecMath.h index 4e891d8f..ffd2de86 100644 --- a/PxShared/src/foundation/include/PsVecMath.h +++ b/PxShared/src/foundation/include/PsVecMath.h @@ -54,7 +54,7 @@ #define COMPILE_VECTOR_INTRINSICS 1 #elif PX_IOS&& PX_NEON #define COMPILE_VECTOR_INTRINSICS 1 -#elif PX_NX +#elif PX_SWITCH #define COMPILE_VECTOR_INTRINSICS 1 #else #define COMPILE_VECTOR_INTRINSICS 0 diff --git a/PxShared/src/foundation/include/PsVecMathAoSScalar.h b/PxShared/src/foundation/include/PsVecMathAoSScalar.h index beb6cdc2..b7fe8e40 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 e54f2c8c..74002d51 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 4c6c8920..e15b3b5a 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 2a0578d1..4df3ff6c 100644 --- a/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h +++ b/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h @@ -42,7 +42,7 @@ // "exact" #define VRECIPQ recipq_newton<4> -#if PX_NX +#if PX_SWITCH // StabilizationTests.AveragePoint needs more precision to succeed. #define VRECIP recip_newton<5> #else @@ -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 03555381..cdb20fa8 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 14a311fc..5fd1b8de 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" ////////////////////////////////////////////////////////////////////// diff --git a/PxShared/src/foundation/src/PsAssert.cpp b/PxShared/src/foundation/src/PsAssert.cpp index 30703830..295a81e1 100644 --- a/PxShared/src/foundation/src/PsAssert.cpp +++ b/PxShared/src/foundation/src/PsAssert.cpp @@ -34,8 +34,8 @@ #if PX_WINDOWS_FAMILY #include <crtdbg.h> -#elif PX_NX -#include "nx/PsNXAbort.h" +#elif PX_SWITCH +#include "switch/PsSwitchAbort.h" #endif namespace @@ -63,7 +63,7 @@ class DefaultAssertHandler : public physx::PxAssertHandler __debugbreak(); #elif PX_WINDOWS_FAMILY&& PX_CHECKED __debugbreak(); -#elif PX_NX +#elif PX_SWITCH abort(buffer); #else abort(); diff --git a/PxShared/src/foundation/src/PsString.cpp b/PxShared/src/foundation/src/PsString.cpp index adb29d63..82040514 100644 --- a/PxShared/src/foundation/src/PsString.cpp +++ b/PxShared/src/foundation/src/PsString.cpp @@ -37,7 +37,7 @@ #pragma warning(disable : 4996) // unsafe string functions #endif -#if PX_PS4 || PX_APPLE_FAMILY +#if PX_PS4 || PX_APPLE_FAMILY || (PX_LINUX && PX_X86 && PX_CLANG) #pragma clang diagnostic push // error : format string is not a string literal #pragma clang diagnostic ignored "-Wformat-nonliteral" @@ -176,7 +176,7 @@ void printFormatted(const char* format, ...) } } -#if PX_PS4 || PX_APPLE_FAMILY +#if PX_PS4 || PX_APPLE_FAMILY || (PX_LINUX && PX_X86 && PX_CLANG) #pragma clang diagnostic pop #endif diff --git a/PxShared/src/foundation/src/unix/PsUnixMutex.cpp b/PxShared/src/foundation/src/unix/PsUnixMutex.cpp index 092ec1ea..23b65496 100644 --- a/PxShared/src/foundation/src/unix/PsUnixMutex.cpp +++ b/PxShared/src/foundation/src/unix/PsUnixMutex.cpp @@ -113,10 +113,9 @@ void MutexImpl::unlock() PX_UNUSED(err); } -const uint32_t gSize = sizeof(MutexUnixImpl); -const uint32_t& MutexImpl::getSize() +uint32_t MutexImpl::getSize() { - return gSize; + return sizeof(MutexUnixImpl); } class ReadWriteLockImpl diff --git a/PxShared/src/foundation/src/unix/PsUnixSList.cpp b/PxShared/src/foundation/src/unix/PsUnixSList.cpp index 5dd8ac37..c2da1bba 100644 --- a/PxShared/src/foundation/src/unix/PsUnixSList.cpp +++ b/PxShared/src/foundation/src/unix/PsUnixSList.cpp @@ -147,11 +147,9 @@ SListEntry* SListImpl::flush() return result; } -static const uint32_t gSize = sizeof(SListDetail); - -const uint32_t& SListImpl::getSize() +uint32_t SListImpl::getSize() { - return gSize; + return sizeof(SListDetail); } } // namespace shdfnd diff --git a/PxShared/src/foundation/src/unix/PsUnixSync.cpp b/PxShared/src/foundation/src/unix/PsUnixSync.cpp index aedbbe04..a488743e 100644 --- a/PxShared/src/foundation/src/unix/PsUnixSync.cpp +++ b/PxShared/src/foundation/src/unix/PsUnixSync.cpp @@ -61,10 +61,9 @@ _SyncImpl* getSync(SyncImpl* impl) } } -static const uint32_t gSize = sizeof(_SyncImpl); -const uint32_t& SyncImpl::getSize() +uint32_t SyncImpl::getSize() { - return gSize; + return sizeof(_SyncImpl); } struct PxUnixScopeLock diff --git a/PxShared/src/foundation/src/unix/PsUnixThread.cpp b/PxShared/src/foundation/src/unix/PsUnixThread.cpp index cb369e0f..749ae1d9 100644 --- a/PxShared/src/foundation/src/unix/PsUnixThread.cpp +++ b/PxShared/src/foundation/src/unix/PsUnixThread.cpp @@ -135,10 +135,9 @@ void* PxThreadStart(void* arg) } } -static const uint32_t gSize = sizeof(_ThreadImpl); -const uint32_t& ThreadImpl::getSize() +uint32_t ThreadImpl::getSize() { - return gSize; + return sizeof(_ThreadImpl); } ThreadImpl::Id ThreadImpl::getId() @@ -314,10 +313,16 @@ uint32_t ThreadImpl::setAffinityMask(uint32_t mask) return uint32_t(prevMask); } +#if PX_PS4 +int32_t setNamePS4(pthread_t, const char*); +#endif + void ThreadImpl::setName(const char* name) { -#if(defined(ANDROID) && (__ANDROID_API__ > 8)) +#if (defined(ANDROID) && (__ANDROID_API__ > 8)) pthread_setname_np(getThread(this)->thread, name); +#elif PX_PS4 + setNamePS4(getThread(this)->thread, name); #else // not implemented because most unix APIs expect setName() // to be called from the thread's context. Example see next comment: diff --git a/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp b/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp index 6174b966..e62de47c 100644 --- a/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp +++ b/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp @@ -99,11 +99,9 @@ void MutexImpl::unlock() LeaveCriticalSection(&getMutex(this)->mLock); } -static const uint32_t gSize = sizeof(MutexWinImpl); - -const uint32_t& MutexImpl::getSize() +uint32_t MutexImpl::getSize() { - return gSize; + return sizeof(MutexWinImpl); } class ReadWriteLockImpl diff --git a/PxShared/src/foundation/src/windows/PsWindowsSList.cpp b/PxShared/src/foundation/src/windows/PsWindowsSList.cpp index 146785ee..5e57b8f9 100644 --- a/PxShared/src/foundation/src/windows/PsWindowsSList.cpp +++ b/PxShared/src/foundation/src/windows/PsWindowsSList.cpp @@ -68,11 +68,9 @@ SListEntry* SListImpl::flush() return reinterpret_cast<SListEntry*>(InterlockedFlushSList(getDetail(this))); } -static const uint32_t gSize = sizeof(SLIST_HEADER); - -const uint32_t& SListImpl::getSize() +uint32_t SListImpl::getSize() { - return gSize; + return sizeof(SLIST_HEADER); } } // namespace shdfnd diff --git a/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp b/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp index bd253b9e..8654a7e4 100644 --- a/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp +++ b/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp @@ -95,8 +95,8 @@ class SocketImpl SocketImpl::SocketImpl(bool isBlocking) : mSocket(INVALID_SOCKET) , mListenSocket(INVALID_SOCKET) -, mPort(0) , mHost(NULL) +, mPort(0) , mIsConnected(false) , mIsBlocking(isBlocking) , mListenMode(false) diff --git a/PxShared/src/foundation/src/windows/PsWindowsSync.cpp b/PxShared/src/foundation/src/windows/PsWindowsSync.cpp index 5ce81229..81ae0e5f 100644 --- a/PxShared/src/foundation/src/windows/PsWindowsSync.cpp +++ b/PxShared/src/foundation/src/windows/PsWindowsSync.cpp @@ -44,10 +44,9 @@ HANDLE& getSync(SyncImpl* impl) } } -static const uint32_t gSize = sizeof(HANDLE); -const uint32_t& SyncImpl::getSize() +uint32_t SyncImpl::getSize() { - return gSize; + return sizeof(HANDLE); } SyncImpl::SyncImpl() diff --git a/PxShared/src/foundation/src/windows/PsWindowsThread.cpp b/PxShared/src/foundation/src/windows/PsWindowsThread.cpp index 18ad5ee7..9c5728af 100644 --- a/PxShared/src/foundation/src/windows/PsWindowsThread.cpp +++ b/PxShared/src/foundation/src/windows/PsWindowsThread.cpp @@ -104,10 +104,9 @@ DWORD WINAPI PxThreadStart(LPVOID arg) uint32_t gPhysicalCoreCount = 0; } -static const uint32_t gSize = sizeof(_ThreadImpl); -const uint32_t& ThreadImpl::getSize() +uint32_t ThreadImpl::getSize() { - return gSize; + return sizeof(_ThreadImpl); } ThreadImpl::Id ThreadImpl::getId() |