diff options
| author | Marijn Tamis <[email protected]> | 2017-10-20 14:30:56 +0200 |
|---|---|---|
| committer | Marijn Tamis <[email protected]> | 2017-10-20 14:36:12 +0200 |
| commit | fabb251458f4a2d6d4f87dd36038fac2774b378c (patch) | |
| tree | 68a4a0ecd940dc949e0477d521d8c159968cfcd5 /PxShared | |
| parent | NvCloth 1.1.2 Release. (22576033) (diff) | |
| download | nvcloth-1.1.3.tar.xz nvcloth-1.1.3.zip | |
NvCloth 1.1.3 Release. (23014067)v1.1.3
Diffstat (limited to 'PxShared')
38 files changed, 124 insertions, 307 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); } diff --git a/PxShared/src/compiler/cmake/Android/CMakeLists.txt b/PxShared/src/compiler/cmake/Android/CMakeLists.txt index 9aa00f9..08757c1 100644 --- a/PxShared/src/compiler/cmake/Android/CMakeLists.txt +++ b/PxShared/src/compiler/cmake/Android/CMakeLists.txt @@ -31,7 +31,7 @@ SET(CMAKE_CXX_FLAGS_CHECKED "-O3") SET(CMAKE_CXX_FLAGS_PROFILE "-O3") SET(CMAKE_CXX_FLAGS_RELEASE "-O3") -SET(PXSHARED_ANDROID_COMPILE_DEFS _LIB;__STDC_LIMIT_MACROS;) +SET(PXSHARED_ANDROID_COMPILE_DEFS ANDROID;_LIB;__STDC_LIMIT_MACROS;) SET(PXSHARED_ANDROID_DEBUG_COMPILE_DEFS _DEBUG;PX_DEBUG=1;PX_CHECKED=1) SET(PXSHARED_ANDROID_CHECKED_COMPILE_DEFS NDEBUG;PX_CHECKED=1) SET(PXSHARED_ANDROID_PROFILE_COMPILE_DEFS NDEBUG;PX_PROFILE=1) diff --git a/PxShared/src/compiler/cmake/Android/PsFastXml.cmake b/PxShared/src/compiler/cmake/Android/PsFastXml.cmake index 81d356e..f5dce60 100644 --- a/PxShared/src/compiler/cmake/Android/PsFastXml.cmake +++ b/PxShared/src/compiler/cmake/Android/PsFastXml.cmake @@ -10,28 +10,12 @@ SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) SET(PSFASTXML_COMPILE_DEFS # Common to all configurations ${PXSHARED_ANDROID_COMPILE_DEFS};PX_FOUNDATION_DLL=0;PxShared_STATIC_LIB; -) - -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS} - ) -else(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - MESSAGE(FATAL_ERROR "Unknown configuration ${CMAKE_BUILD_TYPE}") -endif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") + $<$<CONFIG:debug>:${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS};> + $<$<CONFIG:checked>:${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS};> + $<$<CONFIG:profile>:${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS};> + $<$<CONFIG:release>:${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS};> +) # include PsFastXml common INCLUDE(../common/PsFastXml.cmake) diff --git a/PxShared/src/compiler/cmake/Android/PxFoundation.cmake b/PxShared/src/compiler/cmake/Android/PxFoundation.cmake index c23a327..d069e41 100644 --- a/PxShared/src/compiler/cmake/Android/PxFoundation.cmake +++ b/PxShared/src/compiler/cmake/Android/PxFoundation.cmake @@ -30,28 +30,12 @@ SET(PXFOUNDATION_PLATFORM_INCLUDES SET(PXFOUNDATION_COMPILE_DEFS # Common to all configurations ${PXSHARED_ANDROID_COMPILE_DEFS};PxShared_STATIC_LIB; -) - -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS} - ) -else(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - MESSAGE(FATAL_ERROR "Unknown configuration ${CMAKE_BUILD_TYPE}") -endif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") + $<$<CONFIG:debug>:${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS};> + $<$<CONFIG:checked>:${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS};> + $<$<CONFIG:profile>:${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS};> + $<$<CONFIG:release>:${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS};> +) # include PxFoundation common INCLUDE(../common/PxFoundation.cmake) diff --git a/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake index f517efc..ea39cdb 100644 --- a/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake +++ b/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake @@ -12,27 +12,12 @@ SET(PXPVDSDK_LIBTYPE STATIC) SET(PXPVDSDK_COMPILE_DEFS # Common to all configurations ${PXSHARED_ANDROID_COMPILE_DEFS};PxShared_STATIC_LIB; -) -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS} - ) -else(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - MESSAGE(FATAL_ERROR "Unknown configuration ${CMAKE_BUILD_TYPE}") -endif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") + $<$<CONFIG:debug>:${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS};> + $<$<CONFIG:checked>:${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS};> + $<$<CONFIG:profile>:${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS};> + $<$<CONFIG:release>:${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS};> +) # include PxPvdSDK common INCLUDE(../common/PxPvdSDK.cmake) diff --git a/PxShared/src/compiler/cmake/Android/PxTask.cmake b/PxShared/src/compiler/cmake/Android/PxTask.cmake index e02aefd..eabe075 100644 --- a/PxShared/src/compiler/cmake/Android/PxTask.cmake +++ b/PxShared/src/compiler/cmake/Android/PxTask.cmake @@ -8,27 +8,12 @@ SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/task) SET(PXTASK_COMPILE_DEFS ${PXSHARED_ANDROID_COMPILE_DEFS};PxShared_STATIC_LIB; -) -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS} - ) -else(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - MESSAGE(FATAL_ERROR "Unknown configuration ${CMAKE_BUILD_TYPE}") -endif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") + $<$<CONFIG:debug>:${PXSHARED_ANDROID_DEBUG_COMPILE_DEFS};> + $<$<CONFIG:checked>:${PXSHARED_ANDROID_CHECKED_COMPILE_DEFS};> + $<$<CONFIG:profile>:${PXSHARED_ANDROID_PROFILE_COMPILE_DEFS};> + $<$<CONFIG:release>:${PXSHARED_ANDROID_RELEASE_COMPILE_DEFS};> +) SET(PXTASK_LIBTYPE OBJECT) diff --git a/PxShared/src/compiler/cmake/IOS/CMakeLists.txt b/PxShared/src/compiler/cmake/IOS/CMakeLists.txt index 4e2f814..7b05731 100644 --- a/PxShared/src/compiler/cmake/IOS/CMakeLists.txt +++ b/PxShared/src/compiler/cmake/IOS/CMakeLists.txt @@ -13,7 +13,7 @@ IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) ENDIF() -SET(CMAKE_CXX_FLAGS "-std=c++11 -fno-rtti -fno-exceptions -ffast-math -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-reinterpret-cast -Wno-invalid-offsetof -gdwarf-2") +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-reinterpret-cast -Wno-invalid-offsetof -gdwarf-2") SET(CMAKE_SHARED_LINKER_FLAGS "") @@ -22,43 +22,6 @@ SET(CMAKE_CXX_FLAGS_CHECKED "-O3 -g") SET(CMAKE_CXX_FLAGS_PROFILE "-O3 -g") SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g") -SET(CMAKE_OSX_DEPLOYMENT_TARGET "") - -SET(CMAKE_OSX_ARCHITECTURES "armv7 armv7s arm64") - -SET(IOS_PLATFORM_LOCATION "iPhoneOS.platform") - -# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT -EXEC_PROGRAM(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR) -SET(XCODE_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer") -IF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) - IF(EXISTS ${XCODE_ROOT}) - SET(CMAKE_IOS_DEVELOPER_ROOT ${XCODE_ROOT}) - ENDIF(EXISTS ${XCODE_ROOT}) -ENDIF(NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) -SET(CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") - -# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT -IF(NOT DEFINED CMAKE_IOS_SDK_ROOT) - FILE(GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*") - IF(_CMAKE_IOS_SDKS) - LIST(SORT _CMAKE_IOS_SDKS) - LIST(REVERSE _CMAKE_IOS_SDKS) - LIST(GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT) - ELSE(_CMAKE_IOS_SDKS) - MESSAGE(FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") - ENDIF(_CMAKE_IOS_SDKS) - MESSAGE(STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}") -ENDIF(NOT DEFINED CMAKE_IOS_SDK_ROOT) -SET(CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") - -# Set the sysroot default to the most recent SDK -SET(CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") - -SET(CMAKE_XCODE_ATTRIBUTE_SUPPORTED_PLATFORMS "iphoneos") -SET(CMAKE_XCODE_ATTRIBUTE_SDKROOT ${CMAKE_IOS_SDK_ROOT}) -SET(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "7.0") - SET(PXSHARED_IOS_COMPILE_DEFS _LIB;DISABLE_CUDA_PHYSX;DISABLE_COMPUTE_PHYSX) SET(PXSHARED_IOS_DEBUG_COMPILE_DEFS _DEBUG;PX_DEBUG=1;PX_CHECKED=1) SET(PXSHARED_IOS_CHECKED_COMPILE_DEFS NDEBUG;PX_CHECKED=1) diff --git a/PxShared/src/compiler/cmake/Linux/CMakeLists.txt b/PxShared/src/compiler/cmake/Linux/CMakeLists.txt index ea25a8b..543a7b1 100644 --- a/PxShared/src/compiler/cmake/Linux/CMakeLists.txt +++ b/PxShared/src/compiler/cmake/Linux/CMakeLists.txt @@ -17,16 +17,18 @@ ENDIF() IF (${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-unknown-linux-gnu" OR ${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-linux-gnu") IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") # using Clang - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffast-math -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-func-template -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-undefined-reinterpret-cast -Wno-disabled-macro-expansion") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-func-template -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-undefined-reinterpret-cast -Wno-disabled-macro-expansion -Wno-return-type-c-linkage") ELSEIF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # using GCC SET(LIBPATH_SUFFIX "x64") - SET(CMAKE_CXX_FLAGS "-Werror -m64 -fPIC -msse2 -mfpmath=sse -ffast-math -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-strict-aliasing -fdiagnostics-show-option -Wno-invalid-offsetof -Wno-uninitialized -Wno-missing-field-initializers") + SET(CMAKE_CXX_FLAGS "-Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -Wall -Wextra -fno-strict-aliasing -fdiagnostics-show-option -Wno-invalid-offsetof -Wno-uninitialized -Wno-missing-field-initializers") ENDIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") ELSEIF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "arm-unknown-linux-gnueabihf") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -mfpu=neon -fno-rtti -fno-exceptions -ffast-math -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-old-style-cast -Wno-return-type-c-linkage -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-disabled-macro-expansion") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -mfpu=neon -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-old-style-cast -Wno-return-type-c-linkage -Wno-format-nonliteral -Wno-implicit-fallthrough -Wno-disabled-macro-expansion -Wno-return-type-c-linkage") ELSEIF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "aarch64-unknown-linux-gnueabi") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffast-math -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-old-style-cast -Wno-return-type-c-linkage -Wno-format-nonliteral -Wno-unused-local-typedef -Wno-implicit-fallthrough -Wno-disabled-macro-expansion") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-old-style-cast -Wno-return-type-c-linkage -Wno-format-nonliteral -Wno-unused-local-typedef -Wno-implicit-fallthrough -Wno-disabled-macro-expansion -Wno-return-type-c-linkage") +ELSEIF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "i686-unknown-linux-gnu") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Xclang -malign-double -fpack-struct=16 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -Weverything -Wno-documentation-deprecated-sync -Wno-documentation-unknown-command -Wno-float-equal -Wno-padded -Wno-weak-vtables -Wno-cast-align -Wno-conversion -Wno-missing-noreturn -Wno-missing-variable-declarations -Wno-shift-sign-overflow -Wno-covered-switch-default -Wno-exit-time-destructors -Wno-global-constructors -Wno-missing-prototypes -Wno-unreachable-code -Wno-unused-macros -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-weak-template-vtables -Wno-deprecated -Wno-non-virtual-dtor -Wno-invalid-noreturn -Wno-return-type-c-linkage -Wno-reserved-id-macro -Wno-c++98-compat-pedantic -Wno-unused-local-typedef -Wno-old-style-cast -Wno-newline-eof -Wno-unused-private-field -Wno-undefined-reinterpret-cast -Wno-undefined-func-template -Wno-double-promotion -Wno-return-type-c-linkage") ELSE(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-unknown-linux-gnu" OR ${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-linux-gnu") MESSAGE(FATAL_ERROR "Unknown CMAKE_LIBRARY_ARCHITECTURE ${CMAKE_LIBRARY_ARCHITECTURE}") ENDIF(${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-unknown-linux-gnu" OR ${CMAKE_LIBRARY_ARCHITECTURE} STREQUAL "x86_64-linux-gnu") 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" ////////////////////////////////////////////////////////////////////// diff --git a/PxShared/src/foundation/src/PsString.cpp b/PxShared/src/foundation/src/PsString.cpp index adb29d6..8204051 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 092ec1e..23b6549 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 5dd8ac3..c2da1bb 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 aedbbe0..a488743 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 cb369e0..749ae1d 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 6174b96..e62de47 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 146785e..5e57b8f 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 bd253b9..8654a7e 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 5ce8122..81ae0e5 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 18ad5ee..9c5728a 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() diff --git a/PxShared/src/pvd/src/PxProfileEvents.h b/PxShared/src/pvd/src/PxProfileEvents.h index 25f09d7..c8a9989 100644 --- a/PxShared/src/pvd/src/PxProfileEvents.h +++ b/PxShared/src/pvd/src/PxProfileEvents.h @@ -103,7 +103,7 @@ namespace physx { namespace profile { }; }; -#if (PX_PS4) || (PX_APPLE_FAMILY) +#if (PX_PS4) || (PX_APPLE_FAMILY) || (PX_LINUX && PX_X86 && PX_CLANG) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wimplicit-fallthrough" #endif @@ -162,7 +162,7 @@ namespace physx { namespace profile { return EventStreamCompressionFlags::U32; } -#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/task/src/TaskManager.cpp b/PxShared/src/task/src/TaskManager.cpp index c6210bd..1551216 100644 --- a/PxShared/src/task/src/TaskManager.cpp +++ b/PxShared/src/task/src/TaskManager.cpp @@ -694,7 +694,7 @@ bool PxTaskMgr::dispatchTask( PxTaskID taskID, bool gpuGroupStart ) break; } - tt.mType = PxTaskType::TT_COMPLETED; + mTaskTable[taskID].mType = PxTaskType::TT_COMPLETED; return gpuGroupStart; } |