diff options
482 files changed, 1297 insertions, 62625 deletions
diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 16e2563..0000000 --- a/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -*.txt text eol=crlf -*.bat text eol=crlf diff --git a/NvCloth/BuildProjectsIOS.sh b/NvCloth/BuildProjectsIOS.sh index aa6bca2..5a686c0 100644 --- a/NvCloth/BuildProjectsIOS.sh +++ b/NvCloth/BuildProjectsIOS.sh @@ -2,11 +2,7 @@ # Make sure the various variables that we need are set -export GW_DEPS_ROOT="$PWD""/../../../../../" - -if [ -e $PWD"/../../Externals/CMakeModules" ]; then - export GW_DEPS_ROOT="$PWD""/../../" -fi +export GW_DEPS_ROOT="$PWD""/../" [ -z "$GW_DEPS_ROOT" ] && echo "GW_DEPS_ROOT not defined." && exit 1; diff --git a/NvCloth/BuildProjectsOsx.sh b/NvCloth/BuildProjectsOsx.sh index d0c6223..e25cffc 100644 --- a/NvCloth/BuildProjectsOsx.sh +++ b/NvCloth/BuildProjectsOsx.sh @@ -2,11 +2,7 @@ # Make sure the various variables that we need are set -export GW_DEPS_ROOT="$PWD""/../../../../../../" - -if [ -e $PWD"/../../Externals/CMakeModules" ]; then - export GW_DEPS_ROOT="$PWD""/../../" -fi +export GW_DEPS_ROOT="$PWD""/../" [ -z "$GW_DEPS_ROOT" ] && echo "GW_DEPS_ROOT not defined." && exit 1; @@ -21,10 +17,6 @@ export CMAKE="$PM_cmake_PATH/bin/cmake" # Build projects here -cd compiler/osx32-cmake/ -$CMAKE --build . --target ALL_BUILD --clean-first --config release -- -parallelizeTargets -jobs 5 || exit 1 -cd ../../ - cd compiler/osx64-cmake/ $CMAKE --build . --target ALL_BUILD --clean-first --config release -- -parallelizeTargets -jobs 5 || exit 1 cd ../../ diff --git a/NvCloth/CmakeGenerateAndroid.bat b/NvCloth/CmakeGenerateAndroid.bat index 38d255e..fc0a40d 100644 --- a/NvCloth/CmakeGenerateAndroid.bat +++ b/NvCloth/CmakeGenerateAndroid.bat @@ -2,18 +2,13 @@ set EXIT_CODE=0 REM Make sure the various variables that we need are set -CD /D %~dp0 -REM echo "Note: You need to run this with admin rights for the first time to set GW_DEPS_ROOT globally." -call "./scripts/locate_gw_root.bat" GW_DEPS_ROOT_F -@echo on -set GW_DEPS_ROOT=%GW_DEPS_ROOT_F% +echo "Note: You need to run this with admin rights for the first time to set GW_DEPS_ROOT globally." +REM single " is not a mistake +setx GW_DEPS_ROOT "%GW_DEPS_ROOT% +REM this one is for local use +set GW_DEPS_ROOT=%GW_DEPS_ROOT% echo GW_DEPS_ROOT = %GW_DEPS_ROOT% -@echo off -IF EXIST %~dp0..\Externals\CMakeModules ( - set GW_DEPS_ROOT=%~dp0..\ -) - IF NOT DEFINED GW_DEPS_ROOT GOTO GW_DEPS_ROOT_UNDEFINED set PX_OUTPUT_ROOT=%~dp0 @@ -86,7 +81,7 @@ REM Toolchain dependent cmd line params REM set CMAKE_TOOLCHAIN_PARAMS=-DCMAKE_TOOLCHAIN_FILE=C:\Users\lpanov\projects\nvidia\NvCloth\Externals\CMakeModules\Android\android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=android-%ANDROID_API% -DANDROID_ABI=%ANDROID_ABI% -DANDROID_STL="gnustl_static" -DTARGET_BUILD_PLATFORM=android set CMAKE_TOOLCHAIN_PARAMS=-DCMAKE_SYSTEM_NAME=Android -DCMAKE_ANDROID_API_MIN=%ANDROID_API% -DCMAKE_ANDROID_API=%ANDROID_API% -cmake ..\cmake\android %CMAKE_COMPILER_PARAMS% %CMAKE_TOOLCHAIN_PARAMS% %CMAKE_COMMON_PARAMS% +%CMAKE% ..\cmake\android %CMAKE_COMPILER_PARAMS% %CMAKE_TOOLCHAIN_PARAMS% %CMAKE_COMMON_PARAMS% IF %ERRORLEVEL% NEQ 0 ( set EXIT_CODE=%ERRORLEVEL% GOTO :End diff --git a/NvCloth/CmakeGenerateProjects.bat b/NvCloth/CmakeGenerateProjects.bat index 6e0f7dc..5896f9a 100644 --- a/NvCloth/CmakeGenerateProjects.bat +++ b/NvCloth/CmakeGenerateProjects.bat @@ -4,22 +4,19 @@ set EXIT_CODE=0 REM Make sure the various variables that we need are set CD /D %~dp0 -echo "Note: You need to run this with admin rights for the first time to set GW_DEPS_ROOT globally." -call "./scripts/locate_gw_root.bat" GW_DEPS_ROOT_F -REM single " is not a mistake -setx GW_DEPS_ROOT "%GW_DEPS_ROOT_F% -REM this one is for local use -set GW_DEPS_ROOT=%GW_DEPS_ROOT_F% -echo GW_DEPS_ROOT = %GW_DEPS_ROOT% REM Make sure the various variables that we need are set call "./scripts/locate_cuda.bat" CUDA_PATH_ echo CUDA_PATH_ = %CUDA_PATH_% -IF EXIST %~dp0..\Externals\CMakeModules ( - set GW_DEPS_ROOT=%~dp0..\ -) +set GW_DEPS_ROOT=%~dp0..\ +echo "Note: You need to run this with admin rights for the first time to set GW_DEPS_ROOT globally." +REM single " is not a mistake +setx GW_DEPS_ROOT "%GW_DEPS_ROOT% +REM this one is for local use +set GW_DEPS_ROOT=%GW_DEPS_ROOT% +echo GW_DEPS_ROOT = %GW_DEPS_ROOT% IF NOT DEFINED GW_DEPS_ROOT goto GW_DEPS_ROOT_UNDEFINED @@ -70,12 +67,6 @@ pushd compiler\vc12win64-cmake\ %CMAKE% ..\cmake\windows -G "Visual Studio 12 2013" -Ax64 %CMAKE_COMMON_PARAMS% -DPX_OUTPUT_DLL_DIR=%PX_OUTPUT_ROOT%\bin\vc12win64-cmake -DPX_OUTPUT_LIB_DIR=%PX_OUTPUT_ROOT%\lib\vc12win64-cmake -DPX_OUTPUT_EXE_DIR=%PX_OUTPUT_ROOT%\bin\vc12win64-cmake popd -rmdir /s /q compiler\vc14win32-cmake\ -mkdir compiler\vc14win32-cmake\ -pushd compiler\vc14win32-cmake\ -%CMAKE% ..\cmake\windows -G "Visual Studio 14 2015" -AWin32 %CMAKE_COMMON_PARAMS% -DPX_OUTPUT_DLL_DIR=%PX_OUTPUT_ROOT%\bin\vc14win32-cmake -DPX_OUTPUT_LIB_DIR=%PX_OUTPUT_ROOT%\lib\vc14win32-cmake -DPX_OUTPUT_EXE_DIR=%PX_OUTPUT_ROOT%\bin\vc14win32-cmake -popd - rmdir /s /q compiler\vc14win64-cmake\ mkdir compiler\vc14win64-cmake\ pushd compiler\vc14win64-cmake\ diff --git a/Externals/CMakeModules/FindGoogleTest.cmake b/NvCloth/Externals/CMakeModules/FindGoogleTest.cmake index c15e201..df03868 100644 --- a/Externals/CMakeModules/FindGoogleTest.cmake +++ b/NvCloth/Externals/CMakeModules/FindGoogleTest.cmake @@ -7,6 +7,7 @@ FIND_PATH( GOOGLETEST_INCLUDE_DIR gtest/gtest.h HINTS ${GW_DEPS_ROOT}/GoogleTest + ${GW_DEPS_ROOT}/NvCloth/test/external/gtest-1.4.0 ${GW_DEPS_ROOT}/sw/physx/externals/GoogleTest/gtest-1.4.0 PATH_SUFFIXES include NO_DEFAULT_PATH @@ -15,6 +16,7 @@ FIND_PATH( GOOGLETEST_INCLUDE_DIR gtest/gtest.h FIND_PATH( GOOGLETEST_SRC_DIR gtest.cpp HINTS ${GW_DEPS_ROOT}/GoogleTest + ${GW_DEPS_ROOT}/NvCloth/test/external/gtest-1.4.0 ${GW_DEPS_ROOT}/sw/physx/externals/GoogleTest/gtest-1.4.0 PATH_SUFFIXES src NO_DEFAULT_PATH diff --git a/Externals/CMakeModules/FindNvSimd.cmake b/NvCloth/Externals/CMakeModules/FindNvSimd.cmake index 02d152c..02d152c 100644 --- a/Externals/CMakeModules/FindNvSimd.cmake +++ b/NvCloth/Externals/CMakeModules/FindNvSimd.cmake diff --git a/Externals/CMakeModules/FindPhysX.cmake b/NvCloth/Externals/CMakeModules/FindPhysX.cmake index 5b07c14..5b07c14 100644 --- a/Externals/CMakeModules/FindPhysX.cmake +++ b/NvCloth/Externals/CMakeModules/FindPhysX.cmake diff --git a/Externals/CMakeModules/FindPxShared.cmake b/NvCloth/Externals/CMakeModules/FindPxShared.cmake index 3297996..3297996 100644 --- a/Externals/CMakeModules/FindPxShared.cmake +++ b/NvCloth/Externals/CMakeModules/FindPxShared.cmake diff --git a/Externals/CMakeModules/FindPxToolkit.cmake b/NvCloth/Externals/CMakeModules/FindPxToolkit.cmake index 583899b..583899b 100644 --- a/Externals/CMakeModules/FindPxToolkit.cmake +++ b/NvCloth/Externals/CMakeModules/FindPxToolkit.cmake diff --git a/Externals/CMakeModules/FindTarga.cmake b/NvCloth/Externals/CMakeModules/FindTarga.cmake index b042c96..b042c96 100644 --- a/Externals/CMakeModules/FindTarga.cmake +++ b/NvCloth/Externals/CMakeModules/FindTarga.cmake diff --git a/Externals/CMakeModules/FindnvToolsExt.cmake b/NvCloth/Externals/CMakeModules/FindnvToolsExt.cmake index 26c00dc..26c00dc 100644 --- a/Externals/CMakeModules/FindnvToolsExt.cmake +++ b/NvCloth/Externals/CMakeModules/FindnvToolsExt.cmake diff --git a/Externals/CMakeModules/NvidiaBuildOptions.cmake b/NvCloth/Externals/CMakeModules/NvidiaBuildOptions.cmake index e5d89af..e5d89af 100644 --- a/Externals/CMakeModules/NvidiaBuildOptions.cmake +++ b/NvCloth/Externals/CMakeModules/NvidiaBuildOptions.cmake diff --git a/Externals/CMakeModules/SetOutputPaths.cmake b/NvCloth/Externals/CMakeModules/SetOutputPaths.cmake index db0be34..db0be34 100644 --- a/Externals/CMakeModules/SetOutputPaths.cmake +++ b/NvCloth/Externals/CMakeModules/SetOutputPaths.cmake diff --git a/Externals/CMakeModules/Android/AndroidCMake.tps b/NvCloth/Externals/CMakeModules/android/AndroidCMake.tps index 6ca944a..6ca944a 100644 --- a/Externals/CMakeModules/Android/AndroidCMake.tps +++ b/NvCloth/Externals/CMakeModules/android/AndroidCMake.tps diff --git a/Externals/CMakeModules/Android/AndroidNdkGdb.cmake b/NvCloth/Externals/CMakeModules/android/AndroidNdkGdb.cmake index 0677dcd..0677dcd 100644 --- a/Externals/CMakeModules/Android/AndroidNdkGdb.cmake +++ b/NvCloth/Externals/CMakeModules/android/AndroidNdkGdb.cmake diff --git a/Externals/CMakeModules/Android/AndroidNdkModules.cmake b/NvCloth/Externals/CMakeModules/android/AndroidNdkModules.cmake index 64f37fd..64f37fd 100644 --- a/Externals/CMakeModules/Android/AndroidNdkModules.cmake +++ b/NvCloth/Externals/CMakeModules/android/AndroidNdkModules.cmake diff --git a/Externals/CMakeModules/Android/README.md b/NvCloth/Externals/CMakeModules/android/README.md index ee63021..ee63021 100644 --- a/Externals/CMakeModules/Android/README.md +++ b/NvCloth/Externals/CMakeModules/android/README.md diff --git a/Externals/CMakeModules/Android/android.toolchain.cmake b/NvCloth/Externals/CMakeModules/android/android.toolchain.cmake index 7fc54f2..7fc54f2 100644 --- a/Externals/CMakeModules/Android/android.toolchain.cmake +++ b/NvCloth/Externals/CMakeModules/android/android.toolchain.cmake diff --git a/Externals/CMakeModules/Android/ndk_links.md b/NvCloth/Externals/CMakeModules/android/ndk_links.md index 6d93d61..6d93d61 100644 --- a/Externals/CMakeModules/Android/ndk_links.md +++ b/NvCloth/Externals/CMakeModules/android/ndk_links.md diff --git a/Externals/CMakeModules/ios/ios.toolchain.cmake b/NvCloth/Externals/CMakeModules/ios/ios.toolchain.cmake index 1f6ed45..1f6ed45 100644 --- a/Externals/CMakeModules/ios/ios.toolchain.cmake +++ b/NvCloth/Externals/CMakeModules/ios/ios.toolchain.cmake diff --git a/Externals/CMakeModules/Linux/LinuxCrossToolchain.arm-unknown-linux-gnueabihf.cmake b/NvCloth/Externals/CMakeModules/linux/LinuxCrossToolchain.arm-unknown-linux-gnueabihf.cmake index cfe2d64..cfe2d64 100644 --- a/Externals/CMakeModules/Linux/LinuxCrossToolchain.arm-unknown-linux-gnueabihf.cmake +++ b/NvCloth/Externals/CMakeModules/linux/LinuxCrossToolchain.arm-unknown-linux-gnueabihf.cmake diff --git a/Externals/CMakeModules/Linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake b/NvCloth/Externals/CMakeModules/linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake index a82d145..a82d145 100644 --- a/Externals/CMakeModules/Linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake +++ b/NvCloth/Externals/CMakeModules/linux/LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake diff --git a/NvCloth/FindNvCloth.cmake b/NvCloth/FindNvCloth.cmake index e9966a3..6ffb0a9 100644 --- a/NvCloth/FindNvCloth.cmake +++ b/NvCloth/FindNvCloth.cmake @@ -7,7 +7,7 @@ FIND_PATH( NVCLOTH_ROOT_DIR include/NvCloth/Fabric.h HINTS ${GW_DEPS_ROOT}/NvCloth - ${GW_DEPS_ROOT}/sw/devrel/libdev/NvCloth/trunk + ${GW_DEPS_ROOT}/sw/devrel/libdev/NvCloth/trunk/NvCloth NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) diff --git a/NvCloth/GenerateProjectsIOS.sh b/NvCloth/GenerateProjectsIOS.sh index aebcb18..d4acdbe 100644 --- a/NvCloth/GenerateProjectsIOS.sh +++ b/NvCloth/GenerateProjectsIOS.sh @@ -2,12 +2,8 @@ # Make sure the various variables that we need are set -export GW_DEPS_ROOT="$PWD""/../../../../../" - -if [ -e $PWD"/../Externals/CMakeModules" ]; then - export GW_DEPS_ROOT="$PWD""/../../" -fi - +export GW_DEPS_ROOT="$PWD""/../" + [ -z "$GW_DEPS_ROOT" ] && echo "GW_DEPS_ROOT not defined." && exit 1; @@ -30,7 +26,7 @@ export USE_CUDA=0 rm -r -f compiler/ios-cmake/ mkdir compiler/ios-cmake/ cd compiler/ios-cmake/ -$CMAKE ../cmake/ios -G Xcode -DCMAKE_TOOLCHAIN_FILE=$GW_DEPS_ROOT/sw/physx/tools/CMakeModules/ios/ios.toolchain.cmake -DTARGET_BUILD_PLATFORM=ios -DCMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET="8.0" -DNV_CLOTH_ENABLE_CUDA=$USE_CUDA -DUSE_CUDA=$USE_CUDA -DPX_GENERATE_GPU_PROJECTS=0 -DPX_OUTPUT_DLL_DIR=$PX_OUTPUT_ROOT/bin/ios-cmake -DPX_OUTPUT_LIB_DIR=$PX_OUTPUT_ROOT/lib/ios-cmake -DPX_OUTPUT_EXE_DIR=$PX_OUTPUT_ROOT/bin/ios-cmake || exit 1 +$CMAKE ../cmake/ios -G Xcode -DCMAKE_TOOLCHAIN_FILE=$GW_DEPS_ROOT/NvCloth/Externals/CMakeModules/ios/ios.toolchain.cmake -DTARGET_BUILD_PLATFORM=ios -DCMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET="8.0" -DNV_CLOTH_ENABLE_CUDA=$USE_CUDA -DUSE_CUDA=$USE_CUDA -DPX_GENERATE_GPU_PROJECTS=0 -DPX_OUTPUT_DLL_DIR=$PX_OUTPUT_ROOT/bin/ios-cmake -DPX_OUTPUT_LIB_DIR=$PX_OUTPUT_ROOT/lib/ios-cmake -DPX_OUTPUT_EXE_DIR=$PX_OUTPUT_ROOT/bin/ios-cmake || exit 1 cd ../../ diff --git a/NvCloth/GenerateProjectsLinux.sh b/NvCloth/GenerateProjectsLinux.sh index 72bbdda..3be88ac 100644 --- a/NvCloth/GenerateProjectsLinux.sh +++ b/NvCloth/GenerateProjectsLinux.sh @@ -2,11 +2,7 @@ # Make sure the various variables that we need are set -export GW_DEPS_ROOT="$PWD""/../../../../../" - -if [ -e $PWD"/../Externals/CMakeModules" ]; then - export GW_DEPS_ROOT="$PWD""/../" -fi +export GW_DEPS_ROOT="$PWD""/../" [ -z "$GW_DEPS_ROOT" ] && echo "GW_DEPS_ROOT not defined." && exit 1; diff --git a/NvCloth/GenerateProjectsOsx.sh b/NvCloth/GenerateProjectsOsx.sh index c52e781..7dc9b40 100644 --- a/NvCloth/GenerateProjectsOsx.sh +++ b/NvCloth/GenerateProjectsOsx.sh @@ -2,11 +2,7 @@ # Make sure the various variables that we need are set -export GW_DEPS_ROOT="$PWD""/../../../../../" - -if [ -e $PWD"/../Externals/CMakeModules" ]; then - export GW_DEPS_ROOT="$PWD""/../../" -fi +export GW_DEPS_ROOT="$PWD""/../" [ -z "$GW_DEPS_ROOT" ] && echo "GW_DEPS_ROOT not defined." && exit 1; @@ -27,12 +23,6 @@ export USE_CUDA=0 # Generate projects here -rm -r -f compiler/osx32-cmake/ -mkdir compiler/osx32-cmake/ -cd compiler/osx32-cmake/ -$CMAKE ../cmake/mac -G Xcode -DTARGET_BUILD_PLATFORM=mac -DCMAKE_OSX_ARCHITECTURES=i386 -DPX_32BIT=1 -DNV_CLOTH_ENABLE_CUDA=$USE_CUDA -DUSE_CUDA=$USE_CUDA -DPX_GENERATE_GPU_PROJECTS=0 -DPX_OUTPUT_DLL_DIR=$PX_OUTPUT_ROOT/bin/osx32-cmake -DPX_OUTPUT_LIB_DIR=$PX_OUTPUT_ROOT/lib/osx32-cmake -DPX_OUTPUT_EXE_DIR=$PX_OUTPUT_ROOT/bin/osx32-cmake || exit 1 -cd ../../ - rm -r -f compiler/osx64-cmake/ mkdir compiler/osx64-cmake/ cd compiler/osx64-cmake/ diff --git a/NvCloth/ReleaseNotes.txt b/NvCloth/ReleaseNotes.txt index 8cc2163..4ee4d78 100644 --- a/NvCloth/ReleaseNotes.txt +++ b/NvCloth/ReleaseNotes.txt @@ -4,33 +4,45 @@ NvCloth Release notes. Release Notes *************************** -1.1.5 +1.1.6 =========================================================================================== -Supported platforms: +Compatible platforms: * Windows (CPU, CUDA, DX11) * Mac (tested on Sierra) -* iOS (tested on iOS 11) * Linux (tested on Ubuntu 16.04.1 LTS x64) -* PlayStation 4 with PS4 SDK 4.5 -* Xbox one (CPU, DX11, beta) +* PlayStation 4 with PS4 SDK 6.5 +* Xbox one (CPU, DX11) * Android (arm64-v8a, API >= 21), tested on Shield TV -* Switch (SDK 3.5.0) +* Switch (SDK 8.0.0) -Supported compilers (via cmake 3.7) +Compatible compilers (via cmake 3.7) * Windows: Visual Studio 12, 14 (2013, 2015) * Linux: gcc 5.4 (only x64) -* Mac: xcode -* iOS: tested with XCode 9 (Apple LLVM) +* Mac: XCode 10.1 +* iOS: tested with XCode 10.1 (Apple LLVM) * PlayStation 4: Visual studio 14 (2015) * Xbox one: Visual studio 14 (2015) -* Android: NDK r12b and above +* Android: NDK r15c * Switch: Visual studio 14 (2015) Fixed: +- Now compatible with the same PxShared version as PhysX 4.0 + +New: +- New setPlanes and setSpheres API. + +Known issues: +- None + +1.1.5 +=========================================================================================== + +Fixed: + - Wind simulation code could affect particle masses (especially when high drag/lift coefficients were used) - Fixed PS4 mising override error. - Fix setCapsules bug. diff --git a/NvCloth/Tools/AuthoringLibrary/CMakeLists.txt b/NvCloth/Tools/AuthoringLibrary/CMakeLists.txt index e9702e3..dcb583a 100644 --- a/NvCloth/Tools/AuthoringLibrary/CMakeLists.txt +++ b/NvCloth/Tools/AuthoringLibrary/CMakeLists.txt @@ -4,6 +4,14 @@ project(NvClothAuthoringLibrary CXX) CMAKE_POLICY(SET CMP0057 NEW) # Enable IN_LIST +SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) + +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) + + +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/../..") +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeModules") + IF(NOT DEFINED AUTHORINGLIBRARY_ROOT_DIR) STRING(REPLACE "\\" "/" BRD_TEMP $ENV{AUTHORINGLIBRARY_ROOT_DIR}) @@ -17,8 +25,6 @@ IF(NOT EXISTS ${AUTHORINGLIBRARY_ROOT_DIR}) MESSAGE(FATAL_ERROR "AUTHORINGLIBRARY_ROOT_DIR environment variable wasn't set or was invalid.") ENDIF() -SET(GW_DEPS_ROOT "${AUTHORINGLIBRARY_ROOT_DIR}/external") - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${GW_DEPS_ROOT}/CMakeModules") MESSAGE("AUTHORINGLIBRARY_ROOT_DIR:" ${AUTHORINGLIBRARY_ROOT_DIR}) diff --git a/NvCloth/Tools/AuthoringLibrary/CmakeGenerateProjects.bat b/NvCloth/Tools/AuthoringLibrary/CmakeGenerateProjects.bat index e3a297c..7b51db9 100644 --- a/NvCloth/Tools/AuthoringLibrary/CmakeGenerateProjects.bat +++ b/NvCloth/Tools/AuthoringLibrary/CmakeGenerateProjects.bat @@ -1,8 +1,10 @@ CD /D %~dp0 +set GW_DEPS_ROOT=%~dp0..\..\..\ echo "Note: You need to run this with admin rights for the first time to set GW_DEPS_ROOT globally." -call "../../scripts/locate_gw_root.bat" GW_DEPS_ROOT_F -@echo on -setx GW_DEPS_ROOT "%GW_DEPS_ROOT_F% +REM single " is not a mistake +setx GW_DEPS_ROOT "%GW_DEPS_ROOT% +REM this one is for local use +set GW_DEPS_ROOT=%GW_DEPS_ROOT% echo GW_DEPS_ROOT = %GW_DEPS_ROOT% REM Install cmake using packman @@ -27,11 +29,4 @@ pushd compiler\vc14win64-cmake\ popd -rmdir /s /q compiler\vc14win32-cmake\ -mkdir compiler\vc14win32-cmake\ -pushd compiler\vc14win32-cmake\ -%CMAKE% ..\.. -G "Visual Studio 14 2015" -AWin32 -DTARGET_BUILD_PLATFORM=windows -DSTATIC_WINCRT=0 -DBL_DLL_OUTPUT_DIR=%OUTPUT_ROOT%\bin\vc14win32-cmake -DBL_LIB_OUTPUT_DIR=%OUTPUT_ROOT%\lib\vc14win32-cmake -DBL_EXE_OUTPUT_DIR=%OUTPUT_ROOT%\bin\vc14win32-cmake - -popd - pause diff --git a/NvCloth/Tools/AuthoringLibrary/compiler/cmake/AuthoringLibrary.cmake b/NvCloth/Tools/AuthoringLibrary/compiler/cmake/AuthoringLibrary.cmake index e649116..6caab92 100644 --- a/NvCloth/Tools/AuthoringLibrary/compiler/cmake/AuthoringLibrary.cmake +++ b/NvCloth/Tools/AuthoringLibrary/compiler/cmake/AuthoringLibrary.cmake @@ -65,7 +65,6 @@ SET_TARGET_PROPERTIES(NvClothAuthoringLibrary PROPERTIES TARGET_COMPILE_OPTIONS(NvClothAuthoringLibrary PRIVATE /wd4005 /wd4244) -TARGET_LINK_LIBRARIES(NvClothAuthoringLibrary PUBLIC PxFoundation) TARGET_LINK_LIBRARIES(NvClothAuthoringLibrary PUBLIC NvCloth) SET_TARGET_PROPERTIES(NvClothAuthoringLibrary PROPERTIES LINK_FLAGS ${AUTHORINGLIBRARY_LINK_FLAGS}) diff --git a/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/AuthoringLibrary.cmake b/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/AuthoringLibrary.cmake index 88a3dd5..5b4c180 100644 --- a/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/AuthoringLibrary.cmake +++ b/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/AuthoringLibrary.cmake @@ -29,7 +29,7 @@ if (CMAKE_CL_64) SET(D3DCOMPILER_DLL "\"$(VC_ExecutablePath_x64_x64)/d3dcompiler_47.dll\"") - SET(ASSIMP_DLLS ${ASSIMP_DLL_PATH}/Release/assimp-vc140-mt.dll) +# SET(ASSIMP_DLLS ${ASSIMP_DLL_PATH}/Release/assimp-vc140-mt.dll) else() SET(SHADOW_LIB ${NVCLOTH_ROOT_DIR}/samples/external/shadow_lib/GFSDK_ShadowLib_DX11.win32.lib) SET(SHADOW_DLLS ${NVCLOTH_ROOT_DIR}/samples/external/shadow_lib/GFSDK_ShadowLib_DX11.win32.dll) @@ -39,6 +39,6 @@ else() SET(D3DCOMPILER_DLL "\"$(VC_ExecutablePath_x86_x86)/d3dcompiler_47.dll\"") - SET(ASSIMP_DLLS ${ASSIMP_DLL_PATH}/Release/assimp-vc140-mt.dll) +# SET(ASSIMP_DLLS ${ASSIMP_DLL_PATH}/Release/assimp-vc140-mt.dll) endif() diff --git a/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/CMakeLists.txt b/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/CMakeLists.txt index fd9d4bd..7670847 100644 --- a/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/CMakeLists.txt +++ b/NvCloth/Tools/AuthoringLibrary/compiler/cmake/windows/CMakeLists.txt @@ -1,20 +1,5 @@ #Platform specific compile flags and project includes -SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) - -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; $ENV{GW_DEPS_ROOT}/sw/physx/tools/CMakeModules) - -IF(EXISTS $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) -ENDIF() - - -IF(EXISTS $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) -ENDIF() - -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/../..") -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeModules") MESSAGE("CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH}) #NOTE: Warnings lowered on the sample projects as it's got a lot of warnings. Defines below hide more. @@ -67,11 +52,6 @@ SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) FIND_PACKAGE(NvCloth REQUIRED) -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -#ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/windows "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") #MESSAGE("NVCLOTH_ROOT_DIR = ${NVCLOTH_ROOT_DIR}") ADD_SUBDIRECTORY(${NVCLOTH_ROOT_DIR}/compiler/cmake/windows "${CMAKE_CURRENT_BINARY_DIR}/NvCloth_bin") diff --git a/NvCloth/Tools/AuthoringLibrary/external/CMakeModules/FindPxShared.cmake b/NvCloth/Tools/AuthoringLibrary/external/CMakeModules/FindPxShared.cmake deleted file mode 100644 index c094676..0000000 --- a/NvCloth/Tools/AuthoringLibrary/external/CMakeModules/FindPxShared.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# - Try to find PxShared -# Once done this will define -# PXSHARED_FOUND - System has PxShared -# PXSHARED_ROOT_DIR - The root of PxShared - -# NOTE: We're including a version in this, but the first hint is without one - we should use that! -FIND_PATH( PXSHARED_ROOT_DIR include/cudamanager/PxGpuCopyDesc.h - HINTS - ${GW_DEPS_ROOT}/PxShared/${PxShared_FIND_VERSION} - ${GW_DEPS_ROOT}/sw/physx/PxShared/1.0/trunk - - ) - - - - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PxShared DEFAULT_MSG PXSHARED_ROOT_DIR) - -mark_as_advanced(PXSHARED_ROOT_DIR) diff --git a/NvCloth/compiler/cmake/android/CMakeLists.txt b/NvCloth/compiler/cmake/android/CMakeLists.txt index 61a6892..7ef0673 100644 --- a/NvCloth/compiler/cmake/android/CMakeLists.txt +++ b/NvCloth/compiler/cmake/android/CMakeLists.txt @@ -44,19 +44,7 @@ SET(NVCLOTH_ANDROID_RELEASE_COMPILE_DEFS NDEBUG) SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) -################################################################################ -# TODO -################################################################################ -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -#ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/android "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") -################################################################################ - # Include all of the projects INCLUDE(NvCloth.cmake) -TARGET_LINK_LIBRARIES(NvCloth PUBLIC PxFoundation) - MESSAGE("[NvCloth]cmake/android/CMakeList.txt END")
\ No newline at end of file diff --git a/NvCloth/compiler/cmake/android/NvCloth.cmake b/NvCloth/compiler/cmake/android/NvCloth.cmake index 544a3b5..8463368 100644 --- a/NvCloth/compiler/cmake/android/NvCloth.cmake +++ b/NvCloth/compiler/cmake/android/NvCloth.cmake @@ -7,6 +7,11 @@ SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) SET(NVCLOTH_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../) SET(NVCLOTH_PLATFORM_SOURCE_FILES + ${PROJECT_ROOT_DIR}/src/ps/unix/PsUnixAtomic.cpp + ${PROJECT_ROOT_DIR}/src/ps/unix/PsUnixFPU.h + ${PROJECT_ROOT_DIR}/src/ps/android/cpu-features.c + ${PROJECT_ROOT_DIR}/src/ps/android/cpu-features.h + ${PROJECT_ROOT_DIR}/src/neon/NeonCollision.cpp ${PROJECT_ROOT_DIR}/src/neon/NeonSelfCollision.cpp ${PROJECT_ROOT_DIR}/src/neon/NeonSolverKernel.cpp diff --git a/NvCloth/compiler/cmake/common/CMakeLists.txt b/NvCloth/compiler/cmake/common/CMakeLists.txt index eddb1d9..bbebc3f 100644 --- a/NvCloth/compiler/cmake/common/CMakeLists.txt +++ b/NvCloth/compiler/cmake/common/CMakeLists.txt @@ -8,18 +8,10 @@ CMAKE_POLICY(SET CMP0057 NEW) # Enable IN_LIST SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) -SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}/sw/physx/tools/CMakeModules) - -IF(EXISTS $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) -ENDIF() +SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}/NvCloth/Externals/CMakeModules) MESSAGE( "[NvCloth]cmake/common CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") -IF(EXISTS $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) -ENDIF() - # Add find modules to the path IF(NOT EXISTS ${CMAKE_MODULE_PATH}) MESSAGE(FATAL_ERROR "Could not find CMakeModules at ${CMAKE_MODULE_PATH}") diff --git a/NvCloth/compiler/cmake/common/NvCloth.cmake b/NvCloth/compiler/cmake/common/NvCloth.cmake index 94b7e79..8d59261 100644 --- a/NvCloth/compiler/cmake/common/NvCloth.cmake +++ b/NvCloth/compiler/cmake/common/NvCloth.cmake @@ -20,6 +20,21 @@ SET( NV_CLOTH_SOURCE_LIST ${PROJECT_ROOT_DIR}/include/NvCloth/Range.h ${PROJECT_ROOT_DIR}/include/NvCloth/Solver.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/Ps.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsAtomic.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsAlignedMalloc.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsAllocator.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsAllocator.cpp + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsArray.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsBasicTemplates.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsBitUtils.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsHash.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsHashInternals.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsHashMap.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsIntrinsics.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsUserAllocated.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/PsMathUtils.h + ${PROJECT_ROOT_DIR}/src/Allocator.cpp ${PROJECT_ROOT_DIR}/src/BoundingBox.h ${PROJECT_ROOT_DIR}/src/Callbacks.cpp @@ -119,6 +134,13 @@ SET( NV_CLOTH_SOURCE_LIST ${PROJECT_ROOT_DIR}/src/sse2/SwCollisionHelpers.h ${PROJECT_ROOT_DIR}/src/sse2/SwSolveConstraints.h + ${PROJECT_ROOT_DIR}/src/ps/PsAlloca.h + ${PROJECT_ROOT_DIR}/src/ps/PsFPU.h + ${PROJECT_ROOT_DIR}/src/ps/PsSort.h + ${PROJECT_ROOT_DIR}/src/ps/PsSortInternals.h + ${PROJECT_ROOT_DIR}/src/ps/PsUtilities.h + ${PROJECT_ROOT_DIR}/src/ps/PxIntrinsics.h + ${PROJECT_ROOT_DIR}/extensions/include/NvClothExt/ClothFabricCooker.h ${PROJECT_ROOT_DIR}/extensions/include/NvClothExt/ClothMeshDesc.h ${PROJECT_ROOT_DIR}/extensions/include/NvClothExt/ClothMeshQuadifier.h @@ -178,4 +200,4 @@ IF(NOT ${NVCLOTH_LIBTYPE} STREQUAL "OBJECT") COMPILE_PDB_NAME_RELEASE "NvCloth${CMAKE_RELEASE_POSTFIX}" ) ENDIF() -MESSAGE("[NvCloth]cmake/common/NvCloth.cmake END")
\ No newline at end of file +MESSAGE("[NvCloth]cmake/common/NvCloth.cmake END") diff --git a/NvCloth/compiler/cmake/ios/CMakeLists.txt b/NvCloth/compiler/cmake/ios/CMakeLists.txt index c0c890e..bf36e95 100644 --- a/NvCloth/compiler/cmake/ios/CMakeLists.txt +++ b/NvCloth/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 -Wno-unused-value -Wno-format-nonliteral -Wno-undef -Wno-double-promotion") +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 -Wno-unused-value -Wno-format-nonliteral -Wno-undef -Wno-double-promotion -Wno-zero-as-null-pointer-constant") SET(CMAKE_SHARED_LINKER_FLAGS "") # Build debug info for all configurations @@ -37,12 +37,6 @@ SET(PHYSX_IOS_RELEASE_COMPILE_DEFS NDEBUG;PX_SUPPORT_PVD=0) SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/ios "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") - # Include all of the projects INCLUDE(NvCloth.cmake) diff --git a/NvCloth/compiler/cmake/ios/NvCloth.cmake b/NvCloth/compiler/cmake/ios/NvCloth.cmake index e837e4a..2da5516 100644 --- a/NvCloth/compiler/cmake/ios/NvCloth.cmake +++ b/NvCloth/compiler/cmake/ios/NvCloth.cmake @@ -42,11 +42,6 @@ SET(NVCLOTH_LIBTYPE STATIC) INCLUDE(../common/NvCloth.cmake) -# Add linked libraries -# TARGET_LINK_LIBRARIES(NvCloth PUBLIC ${NVTOOLSEXT_LIBRARIES} LowLevel LowLevelAABB LowLevelCloth LowLevelDynamics LowLevelParticles PhysXCommon PhysXGpu PxFoundation PxPvdSDK PxTask SceneQuery SimulationController) - -TARGET_LINK_LIBRARIES(NvCloth PUBLIC PxFoundation) - SET_TARGET_PROPERTIES(NvCloth PROPERTIES LINK_FLAGS_DEBUG "" LINK_FLAGS_CHECKED "" diff --git a/NvCloth/compiler/cmake/linux/CMakeLists.txt b/NvCloth/compiler/cmake/linux/CMakeLists.txt index 5bd8323..f8ba400 100644 --- a/NvCloth/compiler/cmake/linux/CMakeLists.txt +++ b/NvCloth/compiler/cmake/linux/CMakeLists.txt @@ -43,12 +43,6 @@ SET(PHYSX_LINUX_RELEASE_COMPILE_DEFS NDEBUG;PX_SUPPORT_PVD=0) SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/linux "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") - # Include all of the projects INCLUDE(NvCloth.cmake) diff --git a/NvCloth/compiler/cmake/linux/NvCloth.cmake b/NvCloth/compiler/cmake/linux/NvCloth.cmake index 1d53df6..64188f0 100644 --- a/NvCloth/compiler/cmake/linux/NvCloth.cmake +++ b/NvCloth/compiler/cmake/linux/NvCloth.cmake @@ -30,6 +30,8 @@ SET(NVCLOTH_PLATFORM_INCLUDES ) SET(NVCLOTH_PLATFORM_SOURCE_FILES + ${PROJECT_ROOT_DIR}/src/ps/unix/PsUnixAtomic.cpp + ${PROJECT_ROOT_DIR}/src/ps/unix/PsUnixFPU.h #${PROJECT_ROOT_DIR}/src/neon/NeonCollision.cpp #${PROJECT_ROOT_DIR}/src/neon/NeonSelfCollision.cpp #${PROJECT_ROOT_DIR}/src/neon/NeonSolverKernel.cpp @@ -128,11 +130,6 @@ ENDIF() # include common NvCloth settings INCLUDE(../common/NvCloth.cmake) - -# Add linked libraries -# TARGET_LINK_LIBRARIES(NvCloth PUBLIC ${NVTOOLSEXT_LIBRARIES} LowLevel LowLevelAABB LowLevelCloth LowLevelDynamics LowLevelParticles PhysXCommon PhysXGpu PxFoundation PxPvdSDK PxTask SceneQuery SimulationController) - -TARGET_LINK_LIBRARIES(NvCloth PUBLIC PxFoundation) TARGET_LINK_LIBRARIES(NvCloth PUBLIC ${CUDA_CUDA_LIBRARY}) SET_TARGET_PROPERTIES(NvCloth PROPERTIES @@ -144,4 +141,4 @@ SET_TARGET_PROPERTIES(NvCloth PROPERTIES # enable -fPIC so we can link static libs with the editor SET_TARGET_PROPERTIES(NvCloth PROPERTIES POSITION_INDEPENDENT_CODE TRUE) -MESSAGE("[NvCloth]cmake/linux/NvCloth.cmake END")
\ No newline at end of file +MESSAGE("[NvCloth]cmake/linux/NvCloth.cmake END") diff --git a/NvCloth/compiler/cmake/mac/CMakeLists.txt b/NvCloth/compiler/cmake/mac/CMakeLists.txt index 83ca14d..903e545 100644 --- a/NvCloth/compiler/cmake/mac/CMakeLists.txt +++ b/NvCloth/compiler/cmake/mac/CMakeLists.txt @@ -45,12 +45,6 @@ SET(PHYSX_MAC_RELEASE_COMPILE_DEFS NDEBUG;PX_SUPPORT_PVD=0) SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/mac "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") - # Include all of the projects INCLUDE(NvCloth.cmake) diff --git a/NvCloth/compiler/cmake/mac/NvCloth.cmake b/NvCloth/compiler/cmake/mac/NvCloth.cmake index faea6fd..086b508 100644 --- a/NvCloth/compiler/cmake/mac/NvCloth.cmake +++ b/NvCloth/compiler/cmake/mac/NvCloth.cmake @@ -15,6 +15,8 @@ SET(NVCLOTH_PLATFORM_INCLUDES ) SET(NVCLOTH_PLATFORM_SOURCE_FILES + ${PROJECT_ROOT_DIR}/src/ps/unix/PsUnixAtomic.cpp + ${PROJECT_ROOT_DIR}/src/ps/unix/PsUnixFPU.h #${PROJECT_ROOT_DIR}/src/neon/NeonCollision.cpp #${PROJECT_ROOT_DIR}/src/neon/NeonSelfCollision.cpp #${PROJECT_ROOT_DIR}/src/neon/NeonSolverKernel.cpp @@ -42,11 +44,6 @@ SET(NVCLOTH_LIBTYPE SHARED) INCLUDE(../common/NvCloth.cmake) -# Add linked libraries -# TARGET_LINK_LIBRARIES(NvCloth PUBLIC ${NVTOOLSEXT_LIBRARIES} LowLevel LowLevelAABB LowLevelCloth LowLevelDynamics LowLevelParticles PhysXCommon PhysXGpu PxFoundation PxPvdSDK PxTask SceneQuery SimulationController) - -TARGET_LINK_LIBRARIES(NvCloth PUBLIC PxFoundation) - SET_TARGET_PROPERTIES(NvCloth PROPERTIES LINK_FLAGS_DEBUG "" LINK_FLAGS_CHECKED "" diff --git a/NvCloth/compiler/cmake/windows/CMakeLists.txt b/NvCloth/compiler/cmake/windows/CMakeLists.txt index 9e8f66b..30f2a65 100644 --- a/NvCloth/compiler/cmake/windows/CMakeLists.txt +++ b/NvCloth/compiler/cmake/windows/CMakeLists.txt @@ -69,12 +69,6 @@ SET(CMAKE_RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}_${LIBPATH_SUFFIX}") SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/windows "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") - # Include all of the projects INCLUDE(NvCloth.cmake) IF(DEFINED PX_GENERATE_GPU_PROJECTS) diff --git a/NvCloth/compiler/cmake/windows/NvCloth.cmake b/NvCloth/compiler/cmake/windows/NvCloth.cmake index cc8ca0f..065ea18 100644 --- a/NvCloth/compiler/cmake/windows/NvCloth.cmake +++ b/NvCloth/compiler/cmake/windows/NvCloth.cmake @@ -23,7 +23,11 @@ ENDIF() SET(NVCLOTH_PLATFORM_INCLUDES PRIVATE ${CUDA_INCLUDE_DIRS}) -SET(NVCLOTH_PLATFORM_SOURCE_FILES "" ) +SET(NVCLOTH_PLATFORM_SOURCE_FILES + ${PROJECT_ROOT_DIR}/src/ps/windows/PsWindowsAtomic.cpp + ${PROJECT_ROOT_DIR}/src/ps/windows/PsWindowsFPU.h + ${PROJECT_ROOT_DIR}/src/ps/windows/PsWindowsInclude.h +) IF(${NV_CLOTH_ENABLE_CUDA}) LIST(APPEND NVCLOTH_PLATFORM_SOURCE_FILES ${PROJECT_ROOT_DIR}/src/cuda/CuCheckSuccess.h @@ -48,6 +52,7 @@ LIST(APPEND NVCLOTH_PLATFORM_SOURCE_FILES ${PROJECT_ROOT_DIR}/src/cuda/CuSolver.h ${PROJECT_ROOT_DIR}/src/cuda/CuSolverKernel.h ${PROJECT_ROOT_DIR}/src/cuda/CuSolverKernelBlob.h + ${PROJECT_ROOT_DIR}/include/NvCloth/ps/windows/PsWindowsIntrinsics.h ) ENDIF() @@ -164,13 +169,12 @@ INCLUDE(../common/NvCloth.cmake) # Add linked libraries -TARGET_LINK_LIBRARIES(NvCloth PUBLIC PxFoundation) TARGET_LINK_LIBRARIES(NvCloth PUBLIC ${CUDA_CUDA_LIBRARY}) SET_TARGET_PROPERTIES(NvCloth PROPERTIES - LINK_FLAGS_DEBUG "/DELAYLOAD:nvcuda.dll /MAP /DELAYLOAD:PxFoundationDEBUG_${LIBPATH_SUFFIX}.dll /DEBUG" - LINK_FLAGS_CHECKED "/DELAYLOAD:nvcuda.dll /MAP /DELAYLOAD:PxFoundationCHECKED_${LIBPATH_SUFFIX}.dll" - LINK_FLAGS_PROFILE "/DELAYLOAD:nvcuda.dll /MAP /DELAYLOAD:PxFoundationPROFILE_${LIBPATH_SUFFIX}.dll /INCREMENTAL:NO /DEBUG" - LINK_FLAGS_RELEASE "/DELAYLOAD:nvcuda.dll /MAP /DELAYLOAD:PxFoundation_${LIBPATH_SUFFIX}.dll /INCREMENTAL:NO" + LINK_FLAGS_DEBUG "/DELAYLOAD:nvcuda.dll /MAP /DEBUG" + LINK_FLAGS_CHECKED "/DELAYLOAD:nvcuda.dll /MAP " + LINK_FLAGS_PROFILE "/DELAYLOAD:nvcuda.dll /MAP /INCREMENTAL:NO /DEBUG" + LINK_FLAGS_RELEASE "/DELAYLOAD:nvcuda.dll /MAP /INCREMENTAL:NO" ) MESSAGE("[NvCloth]cmake/windows/NvCloth.cmake END")
\ No newline at end of file diff --git a/NvCloth/docs/documentation/CollisionDetection/Index.html b/NvCloth/docs/documentation/CollisionDetection/Index.html index b6b9501..ff23dc0 100644 --- a/NvCloth/docs/documentation/CollisionDetection/Index.html +++ b/NvCloth/docs/documentation/CollisionDetection/Index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Internal collision detection documentation — NvCloth 1.1.3 documentation</title> + <title>Internal collision detection documentation — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="Sphere Capsule collision detection" href="SphereCapsuleCollision.html" /> <link rel="prev" title="Internal solver function/algorithm documentation" href="../Solver/Index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -252,7 +252,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -261,7 +261,7 @@ <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/CollisionDetection/InterCollision.html b/NvCloth/docs/documentation/CollisionDetection/InterCollision.html index fb561dd..9928cbe 100644 --- a/NvCloth/docs/documentation/CollisionDetection/InterCollision.html +++ b/NvCloth/docs/documentation/CollisionDetection/InterCollision.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Inter Collision — NvCloth 1.1.3 documentation</title> + <title>Inter Collision — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="up" title="Internal collision detection documentation" href="Index.html" /> <link rel="next" title="Internal cooking documentation" href="../Cooking/Index.html" /> <link rel="prev" title="Self Collision" href="SelfCollision.html" /> @@ -58,7 +58,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" accesskey="U">Internal collision detection documentation</a></li> </ul> </div> @@ -281,7 +281,7 @@ Now the narrow phase only has to deal with the particles in those lists.</p> <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" >Internal collision detection documentation</a></li> </ul> </div> @@ -291,7 +291,7 @@ Now the narrow phase only has to deal with the particles in those lists.</p> <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html b/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html index 9427251..37416c6 100644 --- a/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html +++ b/NvCloth/docs/documentation/CollisionDetection/SelfCollision.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Self Collision — NvCloth 1.1.3 documentation</title> + <title>Self Collision — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="up" title="Internal collision detection documentation" href="Index.html" /> <link rel="next" title="Inter Collision" href="InterCollision.html" /> <link rel="prev" title="Sphere Capsule collision detection" href="SphereCapsuleCollision.html" /> @@ -58,7 +58,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" accesskey="U">Internal collision detection documentation</a></li> </ul> </div> @@ -309,7 +309,7 @@ p1 -= delta * w1</pre> <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" >Internal collision detection documentation</a></li> </ul> </div> @@ -319,7 +319,7 @@ p1 -= delta * w1</pre> <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/CollisionDetection/SphereCapsuleCollision.html b/NvCloth/docs/documentation/CollisionDetection/SphereCapsuleCollision.html index 8caa955..78d5841 100644 --- a/NvCloth/docs/documentation/CollisionDetection/SphereCapsuleCollision.html +++ b/NvCloth/docs/documentation/CollisionDetection/SphereCapsuleCollision.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Sphere Capsule collision detection — NvCloth 1.1.3 documentation</title> + <title>Sphere Capsule collision detection — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="up" title="Internal collision detection documentation" href="Index.html" /> <link rel="next" title="Self Collision" href="SelfCollision.html" /> <link rel="prev" title="Internal collision detection documentation" href="Index.html" /> @@ -58,7 +58,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" accesskey="U">Internal collision detection documentation</a></li> </ul> </div> @@ -555,7 +555,7 @@ The friction impulse magnitude is proportional to the friction coefficient and t <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" >Internal collision detection documentation</a></li> </ul> </div> @@ -565,7 +565,7 @@ The friction impulse magnitude is proportional to the friction coefficient and t <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/Compiling/index.html b/NvCloth/docs/documentation/Compiling/index.html index 1900835..ecef8e7 100644 --- a/NvCloth/docs/documentation/Compiling/index.html +++ b/NvCloth/docs/documentation/Compiling/index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Compiling — NvCloth 1.1.3 documentation</title> + <title>Compiling — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="Modules" href="../Modules/Index.html" /> <link rel="prev" title="Release Notes" href="../ReleaseNotes/index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -320,7 +320,7 @@ Specifically, you need to create a symlink/copy/rename:</p> <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -329,7 +329,7 @@ Specifically, you need to create a symlink/copy/rename:</p> <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/Cooking/Index.html b/NvCloth/docs/documentation/Cooking/Index.html index 03e56ca..40f9596 100644 --- a/NvCloth/docs/documentation/Cooking/Index.html +++ b/NvCloth/docs/documentation/Cooking/Index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Internal cooking documentation — NvCloth 1.1.3 documentation</title> + <title>Internal cooking documentation — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="TripletScheduler" href="TripletScheduler.html" /> <link rel="prev" title="Inter Collision" href="../CollisionDetection/InterCollision.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -242,7 +242,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -251,7 +251,7 @@ <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/Cooking/TripletScheduler.html b/NvCloth/docs/documentation/Cooking/TripletScheduler.html index fef2bfb..0954f40 100644 --- a/NvCloth/docs/documentation/Cooking/TripletScheduler.html +++ b/NvCloth/docs/documentation/Cooking/TripletScheduler.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>TripletScheduler — NvCloth 1.1.3 documentation</title> + <title>TripletScheduler — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="up" title="Internal cooking documentation" href="Index.html" /> <link rel="prev" title="Internal cooking documentation" href="Index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" accesskey="U">Internal cooking documentation</a></li> </ul> </div> @@ -267,7 +267,7 @@ It also optimizes the sets to have the least amount of bank conflicts possible.< <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> <li><a href="Index.html" >Internal cooking documentation</a></li> </ul> </div> @@ -277,7 +277,7 @@ It also optimizes the sets to have the least amount of bank conflicts possible.< <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/CopyRight/Index.html b/NvCloth/docs/documentation/CopyRight/Index.html index becc894..9122110 100644 --- a/NvCloth/docs/documentation/CopyRight/Index.html +++ b/NvCloth/docs/documentation/CopyRight/Index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>NVIDIA Copyright Notice — NvCloth 1.1.3 documentation</title> + <title>NVIDIA Copyright Notice — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="Internal solver function/algorithm documentation" href="../Solver/Index.html" /> <link rel="prev" title="User Guide" href="../UserGuide/Index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -240,7 +240,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.</p> <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -249,7 +249,7 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.</p> <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/Modules/Index.html b/NvCloth/docs/documentation/Modules/Index.html index bc2271c..b6c6a23 100644 --- a/NvCloth/docs/documentation/Modules/Index.html +++ b/NvCloth/docs/documentation/Modules/Index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Modules — NvCloth 1.1.3 documentation</title> + <title>Modules — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="User Guide" href="../UserGuide/Index.html" /> <link rel="prev" title="Compiling" href="../Compiling/index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -242,7 +242,7 @@ Users that want to use their own cooking or offline cooking can bypass these fun <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -251,7 +251,7 @@ Users that want to use their own cooking or offline cooking can bypass these fun <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/ReleaseNotes/index.html b/NvCloth/docs/documentation/ReleaseNotes/index.html index fb5bfc5..ba5ac7b 100644 --- a/NvCloth/docs/documentation/ReleaseNotes/index.html +++ b/NvCloth/docs/documentation/ReleaseNotes/index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Release Notes — NvCloth 1.1.3 documentation</title> + <title>Release Notes — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="Compiling" href="../Compiling/index.html" /> <link rel="prev" title="NvCloth" href="../index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -369,7 +369,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -378,7 +378,7 @@ <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/Solver/Index.html b/NvCloth/docs/documentation/Solver/Index.html index db5e227..8277796 100644 --- a/NvCloth/docs/documentation/Solver/Index.html +++ b/NvCloth/docs/documentation/Solver/Index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Internal solver function/algorithm documentation — NvCloth 1.1.3 documentation</title> + <title>Internal solver function/algorithm documentation — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="Internal collision detection documentation" href="../CollisionDetection/Index.html" /> <link rel="prev" title="NVIDIA Copyright Notice" href="../CopyRight/Index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -507,7 +507,7 @@ The first rest value of set s is mRestvalues[mSets[s]] and the last is mRestvalu <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -516,7 +516,7 @@ The first rest value of set s is mRestvalues[mSets[s]] and the last is mRestvalu <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/UserGuide/Index.html b/NvCloth/docs/documentation/UserGuide/Index.html index 3a465d6..5f6dd0d 100644 --- a/NvCloth/docs/documentation/UserGuide/Index.html +++ b/NvCloth/docs/documentation/UserGuide/Index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>User Guide — NvCloth 1.1.3 documentation</title> + <title>User Guide — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="../_static/default.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="../_static/bootstrap.js"></script> <script type="text/javascript" src="../_static/jquery.cookie.js"></script> <script type="text/javascript" src="../_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="../index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="../index.html" /> <link rel="next" title="NVIDIA Copyright Notice" href="../CopyRight/Index.html" /> <link rel="prev" title="Modules" href="../Modules/Index.html" /> </head> @@ -57,7 +57,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -687,7 +687,7 @@ This helps for both decreasing collision shape penetration and improving cloth s <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="../index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="../index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -696,7 +696,7 @@ This helps for both decreasing collision shape penetration and improving cloth s <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/genindex.html b/NvCloth/docs/documentation/genindex.html index b2db867..2fd9659 100644 --- a/NvCloth/docs/documentation/genindex.html +++ b/NvCloth/docs/documentation/genindex.html @@ -8,7 +8,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Index — NvCloth 1.1.3 documentation</title> + <title>Index — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> @@ -19,7 +19,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -32,7 +32,7 @@ <script type="text/javascript" src="_static/bootstrap.js"></script> <script type="text/javascript" src="_static/jquery.cookie.js"></script> <script type="text/javascript" src="_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="index.html" /> </head> <body> <nav class="navbar navbar-inverse navbar-default"> @@ -56,7 +56,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -231,7 +231,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -240,7 +240,7 @@ <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/index.html b/NvCloth/docs/documentation/index.html index aa85e92..c6495b9 100644 --- a/NvCloth/docs/documentation/index.html +++ b/NvCloth/docs/documentation/index.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>NvCloth — NvCloth 1.1.3 documentation</title> + <title>NvCloth — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -31,7 +31,7 @@ <script type="text/javascript" src="_static/bootstrap.js"></script> <script type="text/javascript" src="_static/jquery.cookie.js"></script> <script type="text/javascript" src="_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="#" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="#" /> <link rel="next" title="Release Notes" href="ReleaseNotes/index.html" /> </head> <body> @@ -56,7 +56,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="#">NvCloth 1.1.3 documentation</a></li> + <li><a href="#">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -227,7 +227,7 @@ <div class="section" id="learn-more-about-productname"> <h2>Learn more about NvCloth<a class="headerlink" href="#learn-more-about-productname" title="Permalink to this headline">¶</a></h2> <ul class="simple"> -<li>Visit the <a class="reference external" href="https://github.com/NVIDIAGameWorks/NvCloth">product home page</a> on <a class="reference external" href="http://developer.nvidia.com">NVIDIA Developer</a></li> +<li>Visit the <a class="reference external" href="https://github.com/NVIDIAGameWorks/NvCloth">NvCloth git repo</a>, note that you need to sign the <a class="reference external" href="https://developer.nvidia.com/gameworks-source-github">EULA</a> to access this page.</li> <li>View Documentation <a class="reference internal" href="search.html"><em>Search Page</em></a></li> </ul> <p><strong>Browse Documentation</strong></p> @@ -255,7 +255,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="#">NvCloth 1.1.3 documentation</a></li> + <li><a href="#">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -264,7 +264,7 @@ <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/objects.inv b/NvCloth/docs/documentation/objects.inv Binary files differindex 6f36075..7443e96 100644 --- a/NvCloth/docs/documentation/objects.inv +++ b/NvCloth/docs/documentation/objects.inv diff --git a/NvCloth/docs/documentation/search.html b/NvCloth/docs/documentation/search.html index 3f23fd5..acd0163 100644 --- a/NvCloth/docs/documentation/search.html +++ b/NvCloth/docs/documentation/search.html @@ -7,7 +7,7 @@ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="x-ua-compatible" content="IE=Edge"/> - <title>Search — NvCloth 1.1.3 documentation</title> + <title>Search — NvCloth 1.1.5 documentation</title> <link rel="stylesheet" href="_static/default.css" type="text/css" /> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> @@ -18,7 +18,7 @@ <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: './', - VERSION: '1.1.3', + VERSION: '1.1.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true @@ -32,7 +32,7 @@ <script type="text/javascript" src="_static/bootstrap.js"></script> <script type="text/javascript" src="_static/jquery.cookie.js"></script> <script type="text/javascript" src="_static/jquery.storageapi.js"></script> - <link rel="top" title="NvCloth 1.1.3 documentation" href="index.html" /> + <link rel="top" title="NvCloth 1.1.5 documentation" href="index.html" /> <script type="text/javascript"> jQuery(function() { Search.loadIndex("searchindex.js"); }); </script> @@ -52,7 +52,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -225,7 +225,7 @@ <div class="masthead"> <div class="row"> <ul class="breadcrumb"> - <li><a href="index.html">NvCloth 1.1.3 documentation</a></li> + <li><a href="index.html">NvCloth 1.1.5 documentation</a></li> </ul> </div> </div> @@ -234,7 +234,7 @@ <div class="footer-boilerplate"> <div class="row"> <div class="boilerplate"> - Copyright © 2014, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> + Copyright © 2019, NVIDIA Corporation | <a href="http://www.nvidia.com/object/about-nvidia.html" onclick="s_objectID="http://www.nvidia.com/object/about-nvidia.html_1";return this.s_oc?this.s_oc(e):true">About NVIDIA </a> | <a href="http://www.nvidia.com/object/legal_info.html" onclick="s_objectID="http://www.nvidia.com/object/legal_info.html_1";return this.s_oc?this.s_oc(e):true">Legal Information </a> | <a href="http://www.nvidia.com/object/privacy_policy.html" onclick="s_objectID="http://www.nvidia.com/object/privacy_policy.html_1";return this.s_oc?this.s_oc(e):true">Privacy Policy </a> </div> </div> </div> diff --git a/NvCloth/docs/documentation/searchindex.js b/NvCloth/docs/documentation/searchindex.js index ca646a5..0a5c06b 100644 --- a/NvCloth/docs/documentation/searchindex.js +++ b/NvCloth/docs/documentation/searchindex.js @@ -1 +1 @@ -Search.setIndex({envversion:42,terms:{represent:2,all:[1,2,9,4,5,6,8,10,3],code:[5,6,7,2,11,12],edg:1,orthogon:12,skip:[2,6],lack:5,yellow:1,minusa:2,signific:1,sleep:12,per:[1,12,6],capsul:11,skin:[2,6],follow:[12,9,4,6,2,3],calculatepotentialcollid:4,mupper:4,minusk:2,content:[7,11],depend:[9,1,12,6],sensit:6,adjacencycount:3,negativescal:2,setselfcollisiondist:1,program:9,gsimd4fon:2,those:[2,4],q_0:2,text:[2,9,12],vcxxwinxx:9,sens:2,leav:2,introduc:5,everyth:[9,6],certain:9,generateprojectsio:9,sourc:12,everi:[2,1,4],lrg:12,reproduct:8,far:2,than:[2,1,3,6],incompat:5,offlin:10,vertex:[2,6],assimp:9,volum:[2,4,12,6],friction:[2,5,6],setplan:6,fall:2,veri:[2,4,6],affect:[12,5],ajust:12,brows:0,tri:[1,4],pbw:12,info:2,dampen:6,doesn:[2,5,6],stiff:1,did:5,list:[3,4,12,6,10],prefix:3,iter:[2,4,12,6],readabl:2,"try":6,tunnel:6,race:3,swcollis:[2,1],d_o:2,sqdeltalegnth:2,small:[2,12],setdragcoeffici:6,playstat:5,freed:6,dir:12,setmotionconstraintstiff:6,upper:1,smaller:[1,12,6],p_j:12,unnorm:12,mdeltaxyz:2,natur:6,compens:12,direct:[2,12,6],transform:[4,12,6],batch:[3,5],past:2,particle_invmass:12,second:[2,12],cost:2,design:0,pass:6,download:9,massscal:12,p_t:12,setstiffnessfrequ:12,currentparticlekei:1,index:[3,1,9,12,6],lastkei:1,r15c:9,neg:[2,6],section:[3,12,6,2],prevradiu:2,abl:9,sln:9,access:[0,1,4],delet:6,version:9,run:[2,9,6],linux64:9,intersect:[2,1,4,6],"new":[3,12,5,6],impuls:[2,12,6],method:[2,5,6],movement:[2,12,6],cull:[2,1,4],mlower:4,intellectu:8,hash:1,mergeacceler:2,locate_cuda:9,cellcount:1,curradiu:2,getsimulationchunkcount:6,never:2,dotcurcur:2,onli:[1,4,5,6,2,3],here:[2,12,6,10],shape:[5,6],tangent:2,sortedindic:4,trunk:9,path:9,along:[2,1,6],vertic:[12,6],p_2:12,sinc:6,valu:[3,1,12,6,2],p_1:[2,12],box:4,x86_64:9,convert:[2,1],shift:6,anymor:5,larger:1,bot:2,later:[9,3,6],precis:6,bitmask:2,r12b:[9,5],setposit:6,pick:[1,12,6],clearmotionconstraint:6,chang:[2,9,5,6],narrow:4,magnitud:2,overrid:5,eshear:6,via:5,sskeletonwidth:2,triplet:3,extra:[3,12],appli:[2,12,6],approxim:2,sphereradiu:[2,6],linearli:[2,5],c_1:[2,12],c_0:[2,12],c_2:[2,12],clothfabriccook:6,sr_0:2,integrateparticl:12,instabl:[12,6],instal:9,decrement:3,total:3,unit:[2,5],from:[1,2,3,4,5,6,8,9,10,12],describ:[1,12,6,7,2,11,3],would:[2,5],memori:[4,6],fill:[2,3,6],give:[12,4,6,2,10,3],regist:2,two:[2,1,6],madjac:3,next:[3,1,9,12,2],live:5,solvefabr:12,call:6,shortest:1,taken:[1,6],suppos:1,type:[12,6],tell:6,reorder:3,"const":6,sort:4,flat:[2,5],desir:6,settetherconstraintstiff:[12,6],c_i:2,c_j:12,p_0p_1:2,finit:2,warn:5,pxprofilercallback:6,visual:[9,5],mparticleindic:4,c_t:12,"4ac":2,known:[1,5],ebend:6,hold:6,oldradiu:6,logarithm:12,madjacencyindeci:3,none:5,graphic:6,left:[2,12],stretchlimit:12,local:[4,12],prepar:10,work:[5,6,7,2,11,12],uniqu:3,swcloth:3,remain:[1,12,6],pxquat:6,vertexcount:6,can:[1,12,4,6,2,9,10,3],particledelta:2,collidespher:2,d3d11:6,root:9,veloc:[2,12,6],tripletschedul:7,control:[9,6],nearest:12,overlapbound:4,process:[9,1,3],lock:6,share:[3,6],calcul:[1,12,4,5,6,2,3],gsimd4fepsilon:2,high:[12,5],sphere:11,minimum:[2,1,4],proprietari:8,bend:12,want:[1,12,6,10],setvirtualparticl:3,setconvex:6,simul:5,occur:2,getparticl:4,alwai:6,differenti:[12,6],multipl:[3,4,12,5,6],parralel:3,divid:[3,1,12,6,2],divis:12,how:[3,1,12,6],enforc:12,low:0,env:9,instead:[1,12,4,6,2,3],q_0q_1:2,config:[12,6],sin:[2,12],updat:[12,6],product:[2,0],collisionshap:6,frac:[2,12],clothdata:1,referenc:3,teleport:[5,6],tetherconstraintstiff:12,max:12,after:[12,9,4,6,2,3],tool:5,surfac:[2,12],usabl:2,constraint:1,diagram:[2,1],befor:[2,9,6],mesh:[1,6,10],generatecon:2,buildacceler:2,mai:[12,6],end:[2,9,12,6],data:[2,10],parallel:[9,3],averag:2,stabil:6,alloc:[3,5,6],setwindveloc:6,interpol:[2,12],"6th":2,createcloth:6,favorit:9,correspond:[2,6],processor:9,issu:[5,6],inform:[12,6],"switch":[5,6],combin:[3,1,12,6,2],allow:[5,6],nvidia:9,exclus:3,attachmentvertic:6,"253x253":1,order:[3,1,12,6,2],wind:5,vc14win64:9,oper:1,p_0c_0:2,help:[9,12,6],v_r:2,routin:2,gradual:6,over:[2,4,6],move:[2,12,5,6],becaus:[2,1,12],meter:6,cross:2,sphere_radiu:12,nv_cloth_delet:6,paper:12,through:[2,3,6],sqrt:[2,12],evert:6,v_l:2,still:[3,12,6],pointer:1,directx:5,paramet:[12,5,6],snippet:6,typedef:5,outer:2,render:6,apex:5,fix:[9,12,5,6],constrainsepar:12,better:[5,6],platform:[9,12,5,6],pend:6,mrestvalu:12,requir:[1,9,6],bypass:10,clothimpl:[12,5],featurelevel:6,might:[9,12,6],arrai:[3,1,4,12,6],recip:2,non:[2,1,6],good:[2,6],crash:5,thei:[2,1,6],handl:[2,6,10],"2q_0":2,deiniti:6,sooner:12,number:[5,6],"break":6,mappedrang:6,asr_0:2,intercollis:4,now:[1,4,5,6,2,3],discuss:2,bigger:2,makefil:9,somewher:6,name:12,anyth:6,edit:9,simpl:6,solver:[2,9,5],separ:3,easili:6,mode:5,ratio:1,each:[1,12,4,6,2,3],debug:[9,5],ndk:[9,5],penetr:[2,6],complet:5,out:[3,6],mtriplet:3,mean:[12,6],clamp:[2,6],prohibit:8,devrel:9,cudacontext:6,weight:12,replac:[12,6],individu:[1,4,3,6],continu:[2,1,3,6],realli:2,path_to_android_ndk:9,dx11:[9,5,6],"static":[5,6],connect:[9,12,6],someth:6,fluctuat:12,happen:[2,12],thing:6,firstkei:1,variabl:[2,1,9],getnumcloth:5,won:2,space:[2,4,12],goe:12,open:9,develop:[0,9],profil:6,rewrit:[2,12],adjust:[12,6],suitabl:0,rel:[2,1,6],internet:9,hardwar:5,formula:2,gridbia:1,correct:[3,2,12,5,6],red:2,mphase:12,log2:12,linear:[2,6],insid:[2,9,3,5,6],advanc:6,midpoint:2,inclus:3,selfcollideparticl:12,reason:[1,12],base:[9,1,4,12,6],discrimin:2,removecloth:6,releas:9,org:9,"byte":[1,6],compressionlimitc:12,refer:[2,12,6],bash:9,care:[4,6],setliftcoeffici:6,reusabl:6,r_0r_1:2,thread:6,buildprojectsio:9,angl:12,frequenc:[12,6],could:[3,5,6],omit:2,put:9,keep:[1,12,4,6,2,3],recov:[12,6],stride:6,length:[2,1,12,6],plane:[11,3,12,6,2],place:[9,3],outsid:12,nvcloth:[1,2,9,4,7,8,11,3],retain:8,onto:2,licens:8,first:[1,12,4,6,2,9],origin:[12,6],softwar:8,obviou:4,curesult:6,cuda_success:6,mise:5,independ:12,scene:[5,6],sometim:6,pop:12,alreadi:[5,6],done:[1,12,4,2,9,3],least:[1,3,6],robust:0,setcapsul:[5,6],thick:2,miss:6,primari:2,mpaddedtriplet:3,helper:[3,5,6],given:[3,1,12,2],optim:[1,3,5],script:9,exp2:2,interact:0,flag:5,system:6,construct:[2,1,6],toi:2,too:[1,12,6],circl:2,sear:12,gpu:[3,5,6],dt1:12,dt0:12,store:[1,12,4,6,2,3],includ:[9,12,6,10],dampexpon:12,getnumtriangl:6,option:[9,6],especi:[5,6],namespac:5,aabb:[1,5],copi:[9,3],lower:[1,4,6],specifi:[1,12,6],clothmeshdesc:6,part:[2,12,10],enclos:4,mostli:12,quad:[6,10],exactli:[2,12],t4f:[2,1],ehorizont:6,f_d:12,prune:2,provid:[0,1,6,10],remov:[5,6],onc:1,rate:[2,12,6],horizont:[12,6],project:[2,9],matter:6,reus:[2,1,12],were:[2,5],posit:[2,1,12,6],amount:[1,3],dxcontextmanagercallback:6,expf:12,lowest:2,vector:[12,6],comput:2,behavior:[12,5,6],nicer:1,explicit:12,c_0c_1:2,getclothlist:5,ani:[8,4,6],nvclothcookfabricfrommesh:6,dash:2,necessari:6,thereto:8,constrainteth:12,have:[3,12,6,2],reserv:[8,1,3],need:[1,12,4,6,2,9,3],seen:12,mset:12,border:2,cmakegenerateal:9,polynomi:2,caus:[12,5,6],rmin:2,strength:6,engin:6,squar:3,lib:[9,10],min:[2,1,12],r_p:2,destroi:6,self:11,endsimul:6,mid:2,accuraci:6,note:[2,1,9],also:[3,1,12,6,2],discret:2,take:4,indic:[2,1,4,12,6],environ:9,graviti:6,singl:12,clearinertia:6,compat:6,begin:[3,1,12,6,2],sure:9,android_ndk_root:9,packman:9,though:[2,1,12],multipli:[2,12,6],dxdevic:6,previou:[2,1,12,6],compress:6,what:2,react:[5,6],most:[12,6],beta:5,regular:[2,1],cucontext:6,rho:12,thi:[1,2,3,4,6,7,8,9,10,11,12],pair:[2,1,4,12,6],alpha:2,cap:2,"8x8x8":2,getmotionconstraint:6,worldspac:4,don:[2,1,3],r_0:2,r_1:2,clear:6,r_3:2,cover:1,collisionmask:2,doe:[2,1,4,12,6],settetherconstraintscal:6,zero:[12,6],runtim:[10,5,6],determin:[2,4,3],occasion:12,constrain:[12,6],impulseaccumul:2,blend:6,sum:[2,3],dot:2,slope:2,settodefault:6,radix:1,getcurrentparticl:6,show:6,opposit:12,xcode:[9,5],beginsimul:6,stiffnessexpon:12,radiu:[2,12,6],brief:10,directli:[2,1,4,6,10],concurr:6,dxdevicecontext:6,unchang:6,threshold:12,unfinish:12,find:3,setintercollisiondist:4,impact:2,current:[2,1,12,6,10],id3d11devic:6,slow:[1,12],locat:[3,6],a_1:2,simulatechunk:6,explain:[2,12],configur:[9,6],solut:[9,12],"2r_0":2,should:[3,9,12,6],computebound:[1,12],experiment:5,black:2,undesir:6,factor:[12,6],sierra:5,physx:[12,5,6],folder:9,libdev:9,dotprevcur:2,count:[3,1,12,6,2],unus:5,variou:9,get:[12,6],pxallocatorcallback:6,stomp:3,express:8,stop:2,fluid:[12,5,6],newradiu:6,bucketmask:1,cannot:[1,4,3,6],phasetypeinfo:6,longest:1,progress:12,increas:[12,6],sqrconehalflength:2,deploy:9,clothbound:4,target:[9,12,6],bat:9,enabl:[2,9,5,6],artist:6,a_0a_:2,gust:6,v8a:[9,5],"2m_":2,f_l:12,setlinearinertia:6,contain:[12,1,9,6,2,3],cudevicegetcount:6,where:[2,1,12,5],view:0,set:[1,12,4,6,2,9,3],sampl:[9,5],d3d11createdevic:6,frame:[2,12],maximum:[2,12],graphicscontextmanag:6,d3d_driver_type_hardwar:6,see:[2,9],sed:9,einvalid:6,result:[3,2,12,5,6],sqraxishalflength:2,mstiff:6,close:1,xxxxx:9,particl:4,deriv:2,closer:12,setangularinertia:6,pxerrorcallback:6,collisiondist:1,correctli:2,sphere_cent:12,vari:6,boundari:4,dll:10,enough:1,devicecount:6,"2r_1r_0":2,dynam:[5,6],movingaverag:5,between:[2,1,12,6],prebuilt:9,theta:12,awai:[1,4],previous:6,approach:2,across:6,altern:[9,3],oscil:6,attachmentposit:6,extend:2,osx64:9,coeffici:[2,12,5,6],flow:[12,5],condit:[3,12,2],rapidli:6,nvclothdestroyfactori:6,job:9,vc14winxx:9,solv:[2,12,6],group:6,come:6,inertia:6,addit:[4,12,5,6],mstretchlimit:6,both:[2,12,6],locate_cmak:9,last:[3,1,12,6],planesr:6,similar:[2,4,6],howev:2,equal:[12,6],against:[2,1,4],nearbi:1,etc:6,instanc:[12,6],equat:[2,12],context:6,stiffnessc:12,whole:[1,6],multithreadedsolverhelp:5,comment:[2,12],springi:6,simpli:9,author:5,point:[3,9,12,6,2],within:[2,1,6],schedul:3,int32_t:6,decrefcount:6,sweep:4,chmod:9,addcloth:[5,6],written:[3,12],cuctxdestroi:6,"4asr_0":2,sentinel:1,trianglecount:6,assum:2,duplic:[1,3],coupl:6,engwiki:2,aarch64:9,simdwidth:3,damp:[12,6],infinit:2,devic:6,invers:[12,6],setspher:6,mark:[2,1,4],proport:2,accumul:2,trigger:6,p_0:[2,12],modif:8,trajectori:2,dure:2,quickli:1,radii:[2,6],sphererang:6,clothfabricphasetyp:6,imag:2,densiti:[12,5,6],search:0,unnecessarili:2,argument:[9,6],assert:[5,6],r_2:2,lift:[12,5],togeth:6,oneminustoi:2,tangenti:2,nvclothcreatefactorydx11:6,"2q_0q_1":2,present:[5,6],"case":[2,9,12,6],highest:2,look:[2,6],influenc:[12,6],align:[2,12,6],properti:[8,4],mcloth:6,setgrav:6,air:[12,5,6],log_2:12,defin:[12,6],"while":[2,12,5,6],match:12,mindic:12,error:[9,12,5,6],report:6,"2r_0r_1":2,anchor:12,loop:[1,3],subsect:2,propag:12,use_dx11:9,stiffnessfrequ:12,cell:[2,1],mcompressionlimit:6,almost:5,getnumconvex:6,made:2,initializenvcloth:6,them:6,physic:[5,6],particle_posit:12,"default":[9,6],itself:6,setsolverfrequ:6,abov:[1,12,5,6,2,9],quadrat:2,primit:6,around:1,sap:2,let:6,paw:12,perform:[5,6],make:[1,12,5,6,2,9,3],belong:12,x64:5,same:[3,10,12,6,2],binari:[2,9],when:[1,12,5,6,2,3],html:9,pad:3,split:2,largest:1,automat:9,dimensionless:6,triangler:6,start:[1,12,5,6,2,3],conflict:3,higher:6,nvclothcreatefactorycuda:6,http:9,x86:9,unwant:6,again:[2,6],nvclothext:6,blue:2,effect:6,kit:9,getnorm:6,temporari:4,user:[2,1,12,10],mani:[1,12,6],extern:9,buildprojectsosx:9,bia:[1,12,6],respons:4,implement:[12,5,6],expand:2,sqrlength:12,usemultipli:12,task:10,equival:4,older:5,cuctxcreat:6,com:9,usual:[12,6],well:5,know:6,without:[8,1,12,3,6],exampl:[9,3,6],command:9,uint32_t:[3,6],choos:9,model:[12,5],powf:12,dimension:12,ubuntu:5,cmakegenerateproject:9,explan:12,distanc:[2,1,4],identifi:1,getnumphas:6,just:9,a_0:2,deltax:6,collidecon:2,deltaz:6,exclud:9,obtain:[2,1,9],"4th":6,detail:[2,1,12,6],mvelxyz:2,particleposit:6,"2q_1q_0":2,licensor:8,touch:2,deltai:6,rest:[2,1,12,6],roughli:2,speed:[12,5],yet:5,ps4:5,settransl:6,motionconstraint:6,element:[3,12],struct:6,easi:[0,6],r_i:2,iterationst:12,had:5,except:9,littl:0,add:6,other:[2,1,4,12,6],r13b:9,bank:3,timestep:12,els:12,hat:12,euler:12,build:[9,5],bin:[1,9],applic:[0,6],numteth:12,which:[1,12,4,5,6,2,10,3],format:1,meshdesc:6,fast:[0,5,6],"4m_":2,d3d_feature_level_11_0:6,game:[0,6],tabl:3,dxcontextmanagercallbackimpl:6,vacuum:6,pxvec4:[12,6],world:[4,6],bit:[2,1,9,6],a_l:2,you:[9,6],lowerbound:1,pxvec3:6,insert:6,like:[3,9,12,6,2],specif:[9,1,12],arbitrari:[1,6],cdot:[2,1,12],realtim:0,manual:[1,6],stiffnessmultipli:12,xbox:5,api:5,setfrict:6,use_cuda:9,corpor:8,resiz:3,architectur:5,r_m:2,manag:6,right:[8,12,2],old:5,often:[3,12,6],deal:4,simplifi:[2,6],flt_max_exp:12,numsweepcel:1,some:[2,9,4,12,6],back:[4,6],global:6,s_ok:6,llvm:5,csigg:2,mask:[2,6],diff:1,setrot:6,sizeof:6,successfulli:3,librari:[9,5,10],distribut:[8,9],mclothindic:4,scale:[2,1,12,5],mattachmentvertexoriginalposit:6,avoid:[2,3,5,6],size:[3,1,12,6],definit:2,overlap:[2,4],studio:[9,5],circ:12,compressionlimit:12,larg:[1,12,6],"__t100":5,visit:0,complic:6,constraintmot:12,spherecent:[2,6],core:10,particular:12,object:[4,6],tmin:2,reach:[12,6],locate_win8sdk:9,updatesleepst:12,agreement:8,symlink:9,interfac:[0,5,6],ltoi:2,broken:6,step:[2,12,6],durat:2,although:12,offset:[2,1,12],getnumplan:6,subtract:1,d3d11_sdk_version:6,stage:6,about:6,inter:11,toolchain:9,particlecount:6,applywind:12,deltatim:6,createsolv:6,shield:5,page:[0,12],stretch:[12,6],disclosur:8,cuda:[9,3,5,6],neighbor:1,span:2,t_2:2,t_3:2,underwat:6,t_1:2,disabl:[2,9,5,6],produc:3,particle_position1:12,setcentrifugalinertia:6,own:[1,6,10],liveli:6,centimet:6,d3d_feature_level:6,stretchi:[12,6],xyz:[2,12,6],"float":[12,6],bound:[2,1,4,3],particle_position0:12,due:[12,5,6],diagon:3,nullptr:6,framer:12,been:[2,6],vertexarrai:6,ensur:[3,1,12,6,2],mphaseindex:6,destructor:6,precomput:2,your:[9,6],setmotionconstraintscalebia:6,sqrtd:2,straightforward:6,accordingli:6,strechlimitc:12,triangl:[12,5,6,2,10,11,3],fabric:[1,10],wai:[3,4,12,6,2],area:[12,6],execut:[2,9,6],support:[9,5,10],rotat:[12,5],depenetr:2,"long":6,createfabr:6,avail:1,getnumspher:6,adjac:3,appl:5,restlength:12,editor:9,spring:6,twice:2,overhead:0,strictli:8,chunk:5,"function":[2,4,3,5,10],properli:6,setfluiddens:5,form:12,forc:[2,12,6],epsilon:[2,1,12],basic:[1,12],refcount:6,idea:6,a_1a_:2,cloth:[1,12,4,5,2,3],state:12,link:5,newer:9,scope:6,renam:9,line:[2,9],level:0,"true":4,bug:5,sdk:[9,5],reset:6,notat:12,numparticl:12,tetherlength:12,input:3,consist:6,possibl:[1,3,5],whether:9,cooker:6,displai:6,less:[2,12,6],directori:9,below:[2,1,12,6],limit:[12,6],arm64:[9,5],unlock:6,cit:2,getnumcapsul:6,otherwis:12,problem:[2,12,6],more:[2,1,3,5,6],even:[2,12,6],motion:12,featur:[0,12,6,10],constant:[2,12],creat:[3,9,12,6],"int":6,descript:10,inv:12,convex:[11,6],dotprevprev:2,stretchlimitc:12,mstiffnessmultipli:6,repres:6,time:[3,12,6,2],decreas:6,rule:6,file:9,home:0,improv:[5,6],check:[2,1,12,6],piw:12,incorrect:5,constrainmot:12,collid:[2,1,12,6],cmake:[9,5],nx0:9,buffer:1,plausibl:6,setdamp:[12,6],nan:6,green:2,virtual:5,generateprojectslinux:9,cleanup:6,capsuleindic:6,generateprojectsosx:9,normal:[2,12],setphaseconfig:6,test:[2,1,4,9,5],ignor:2,buildprojectslinux:9,logdamp:12,p_0c_1:2,multiplierc:12,relat:[7,8,10],regardless:6,symbol:12,center:[2,12,6],phaseconfig:[12,6],"return":6,pxasserthandl:6,gcc:5,"class":[3,6],drag:[12,5],track:[2,3],q_1:2,gridscal:1,halfb:2,doubl:[2,12],nvclothcreatefactorycpu:6,c_0p_1:2,cmakegenerateandroid:9,stai:[2,6],reduc:[2,12,6],axi:[2,1,4],id3d11devicecontext:6,featurelevelresult:6,algorithm:[7,3],coordin:[1,6],inaccuraci:12,callback:6,pseudo:12,indirectli:6,probabl:[12,6],microsoft:9,hresult:6,delta:[2,1,12,6],safe:6,mass:[2,12,5,6],potenti:6,settriangl:6,"export":9,mathrm:12,cpu:[3,5,6],stick:2},objtypes:{},objnames:{},filenames:["index","CollisionDetection/SelfCollision","CollisionDetection/SphereCapsuleCollision","Cooking/TripletScheduler","CollisionDetection/InterCollision","ReleaseNotes/index","UserGuide/Index","Cooking/Index","CopyRight/Index","Compiling/index","Modules/Index","CollisionDetection/Index","Solver/Index"],titles:["NvCloth","Self Collision","Sphere Capsule collision detection","TripletScheduler","Inter Collision","Release Notes","User Guide","Internal cooking documentation","NVIDIA Copyright Notice","Compiling","Modules","Internal collision detection documentation","Internal solver function/algorithm documentation"],objects:{},titleterms:{distanc:[12,6],edg:12,acceler:[2,1,4],capsul:2,simd:3,tripletschedul:3,copyright:8,window:9,local:6,adjacencyqueri:3,anim:6,initi:6,grid:1,cook:7,solver:[12,6],troubleshoot:6,stiff:12,calculatefrictionimpuls:2,separ:12,integr:12,inter:4,compil:9,frame:6,intern:[7,11,12],respons:1,tether:[12,6],todo:11,particl:[1,12],scale:6,space:6,broad:4,factori:6,common:6,kei:1,gener:2,usag:6,extens:10,releas:5,log:12,about:0,constraint:[12,6],mac:9,simul:[12,6],motion:6,nvcloth:[0,10],rang:1,overview:[7,11,1,4,12],modul:[7,11,10],sweep:1,linux:9,guid:6,unit:6,differ:[7,11,4],fabric:[12,6],compon:12,attach:6,warp:3,more:0,"function":12,notic:8,cloth:6,lift:6,retriev:6,slack:12,setup:[1,6],properti:6,structur:[2,1,4,12],charact:6,learn:0,sort:1,sphere:2,cone:2,invmass:12,disappear:6,self:[1,4],note:5,collis:[11,2,1,4,6],librari:6,android:9,document:[7,11,12],singl:6,drag:6,detect:[11,2,1,4,6],user:6,phase:4,collideparticl:2,data:[12,6],algorithm:12,part:6,nvidia:8,ccd:2,wind:[12,6]}})
\ No newline at end of file +Search.setIndex({envversion:42,terms:{represent:2,all:[1,2,5,4,6,7,9,10,12],code:[6,7,8,2,11,3],edg:[],orthogon:3,skip:[2,7],lack:6,yellow:1,minusa:2,signific:1,sleep:3,per:[1,3,7],capsul:[],skin:[2,7],follow:[12,4,5,7,2,3],calculatepotentialcollid:4,mupper:4,minusk:2,content:[8,11],depend:[3,1,12,7],sensit:7,adjacencycount:5,negativescal:2,setselfcollisiondist:1,program:12,gsimd4fon:2,those:[2,4],q_0:2,text:[3,12,2],vcxxwinxx:12,sens:2,setfrict:7,introduc:6,everyth:[12,7],certain:12,generateprojectsio:12,sourc:3,everi:[2,1,4],lrg:3,reproduct:9,far:2,offlin:10,strechlimitc:3,vertex:[2,7],assimp:12,volum:[2,4,3,7],friction:[2,6,7],setplan:7,fall:2,veri:[2,4,7],affect:[3,6],ajust:3,brows:0,tri:[1,4],pbw:3,info:2,dampen:7,doesn:[2,6,7],stiff:[],did:6,list:[5,4,3,7,10],prefix:5,iter:[2,4,3,7],"try":7,tunnel:7,race:5,swcollis:[2,1],d_o:2,sqdeltalegnth:2,small:[2,3],setdragcoeffici:7,freed:7,dir:3,setmotionconstraintstiff:7,upper:1,smaller:[1,3,7],p_j:3,unnorm:3,mdeltaxyz:2,natur:7,compens:3,direct:[2,3,7],transform:[4,3,7],sign:0,past:2,second:[2,3],cost:2,design:0,pass:7,download:12,massscal:3,p_t:3,setstiffnessfrequ:3,currentparticlekei:1,index:[3,1,12,7,5],lastkei:1,r15c:12,neg:[2,7],section:[2,3,7,5],prevradiu:2,abl:12,brief:10,access:[0,1,4],delet:7,version:12,run:[2,12,7],linux64:12,intersect:[2,1,4,7],"new":[5,3,6,7],impuls:[2,3,7],method:[2,6,7],movement:[2,3,7],cull:[2,1,4],mlower:4,intellectu:9,hash:1,mergeacceler:2,locate_cuda:12,cellcount:1,curradiu:2,getsimulationchunkcount:7,never:2,dotcurcur:2,onli:[1,4,6,7,2,5],here:[2,3,7,10],shape:[6,7],tangent:2,sortedindic:4,trunk:12,path:12,along:[2,1,7],vertic:[3,7],p_2:3,sinc:7,valu:[2,1,3,7,5],p_1:[2,3],box:4,x86_64:12,convert:[2,1],shift:7,anymor:6,larger:1,bot:2,precis:7,bitmask:2,r12b:[12,6],setposit:7,pick:[1,3,7],clearmotionconstraint:7,chang:[2,12,6,7],narrow:4,magnitud:2,overrid:6,eshear:7,via:6,sskeletonwidth:2,triplet:5,extra:[5,3],readabl:2,approxim:2,sphereradiu:[2,7],linearli:[2,6],c_1:[2,3],c_0:[2,3],c_2:[2,3],clothfabriccook:7,sr_0:2,instabl:[3,7],instal:12,decrement:5,total:5,unit:[],leav:2,from:[1,2,3,4,5,6,7,9,10,12],describ:[1,5,7,8,2,11,3],would:[2,6],memori:[4,7],subtract:1,fill:[2,5,7],give:[5,4,7,2,10,3],regist:2,two:[2,1,7],madjac:5,next:[3,1,12,5,2],live:6,solvefabr:3,call:7,shortest:1,taken:[1,7],suppos:1,type:[3,7],tell:7,reorder:5,"const":7,sort:[],flat:[2,6],desir:7,settetherconstraintstiff:[3,7],c_i:2,detail:[2,1,3,7],c_j:3,p_0p_1:2,finit:2,warn:6,packman:12,visual:[12,6],mparticleindic:4,c_t:3,"4ac":2,known:[1,6],ebend:7,hold:7,oldradiu:7,logarithm:3,madjacencyindeci:5,none:6,graphic:7,left:[2,3],stretchlimit:3,local:[],prepar:10,work:[6,7,8,2,11,3],uniqu:5,swcloth:5,remain:[1,3,7],pxquat:7,vertexcount:7,can:[1,12,4,5,7,2,10,3],particledelta:2,collidespher:2,d3d11:7,root:12,veloc:[2,3,7],tripletschedul:[],control:[12,7],nearest:3,overlapbound:4,process:[5,1,12],lock:7,share:[5,7],sln:12,gsimd4fepsilon:2,high:[3,6],sphere:[],minimum:[2,1,4],proprietari:9,bend:3,want:[1,3,7,10],setvirtualparticl:5,setconvex:7,simul:[],occur:2,q_0q_1:2,alwai:7,differenti:[3,7],multipl:[5,4,3,6,7],parralel:5,divid:[2,1,3,7,5],snippet:7,how:[5,1,3,7],low:0,env:12,instead:[1,5,4,7,2,3],getparticl:4,config:[3,7],sin:[2,3],updat:[3,7],product:2,collisionshap:7,frac:[2,3],clothdata:1,referenc:5,teleport:[6,7],tetherconstraintstiff:3,max:3,after:[12,4,5,7,2,3],surfac:[2,3],usabl:2,constraint:[],diagram:[2,1],befor:[2,12,7],mesh:[1,7,10],generatecon:2,buildacceler:2,mai:[3,7],end:[3,12,7,2],data:[],parallel:[5,12],averag:2,stabil:7,alloc:[5,6,7],setwindveloc:7,interpol:[2,3],"6th":2,createcloth:7,favorit:12,correspond:[2,7],exclud:12,issu:[6,7],inform:[3,7],"switch":[6,7],combin:[2,1,3,7,5],allow:[6,7],nvidia:[],exclus:5,attachmentvertic:7,"253x253":1,when:[1,5,6,7,2,3],order:[2,1,3,7,5],wind:[],vc14win64:12,oper:1,p_0c_0:2,help:[3,12,7],v_r:2,routin:2,gradual:7,over:[2,4,7],move:[2,3,6,7],becaus:[2,1,3],meter:7,cross:2,sphere_radiu:3,nv_cloth_delet:7,paper:3,through:[2,5,7],sqrt:[2,3],evert:7,v_l:2,still:[5,3,7],pointer:1,directx:6,paramet:[3,6,7],divis:3,typedef:6,outer:2,render:7,apex:6,fix:[3,12,6,7],constrainsepar:3,better:[6,7],platform:[3,12,6,7],pend:7,mrestvalu:3,requir:[1,12,7],bypass:10,clothimpl:[3,6],featurelevel:7,might:[3,12,7],arrai:[5,1,4,3,7],recip:2,non:[2,1,7],good:[2,7],crash:6,thei:[2,1,7],handl:[2,7,10],"2q_0":2,deiniti:7,sooner:3,number:[6,7],"break":7,mappedrang:7,intercollis:4,now:[1,4,6,7,2,5],"class":[5,7],discuss:2,bigger:2,makefil:12,somewher:7,name:3,anyth:7,edit:12,simpl:7,solver:[],mphaseindex:7,separ:[],easili:7,mode:6,ratio:1,each:[1,5,4,7,2,3],debug:[12,6],ndk:[12,6],penetr:[2,7],complet:6,mtriplet:5,mean:[3,7],clamp:[2,7],prohibit:9,eula:0,devrel:12,cudacontext:7,weight:3,replac:[3,7],individu:[1,4,5,7],continu:[2,1,5,7],realli:2,playstat:6,dx11:[12,6,7],"static":[6,7],connect:[3,12,7],someth:7,fluctuat:3,happen:[2,3],out:[5,7],variabl:[2,1,12],getnumcloth:6,won:2,space:[],goe:3,open:12,your:[12,7],profil:7,rewrit:[2,3],adjust:[3,7],suitabl:0,rel:[2,1,7],internet:12,hardwar:6,formula:2,chmod:12,gridbia:1,correct:[2,3,6,5,7],red:2,mphase:3,log2:3,linear:[2,7],insid:[2,12,6,5,7],advanc:7,midpoint:2,inclus:5,selfcollideparticl:3,reason:[1,3],base:[3,1,4,12,7],discrimin:2,removecloth:7,releas:[],org:12,"byte":[1,7],compressionlimitc:3,refer:[2,3,7],bash:12,care:[4,7],setliftcoeffici:7,reusabl:7,r_0r_1:2,thread:7,buildprojectsio:12,angl:3,frequenc:[3,7],could:[5,6,7],omit:2,put:12,keep:[1,5,4,7,2,3],recov:[3,7],thing:7,length:[2,1,3,7],enforc:3,place:[5,12],outsid:3,nvcloth:[],retain:9,onto:2,licens:9,first:[1,12,4,7,2,3],origin:[3,7],softwar:9,obviou:4,curesult:7,cuda_success:7,mise:6,independ:3,scene:[6,7],sometim:7,clear:7,alreadi:[6,7],done:[1,12,4,5,2,3],least:[1,5,7],setcapsul:[6,7],thick:2,miss:7,primari:2,mpaddedtriplet:5,given:[2,1,3,5],optim:[1,5,6],script:12,exp2:2,interact:0,flag:6,system:7,construct:[2,1,7],toi:2,halfb:2,circl:2,time:[2,3,7,5],gpu:[5,6,7],dt1:3,dt0:3,store:[1,5,4,7,2,3],too:[1,3,7],dampexpon:3,getnumtriangl:7,option:[12,7],especi:[6,7],namespac:6,tool:6,copi:[5,12],lower:[1,4,7],plane:[11,2,3,7,5],part:[],enclos:4,mostli:3,quad:[7,10],exactli:[2,3],than:[2,1,5,7],ehorizont:7,f_d:3,prune:2,provid:[0,1,7,10],remov:[6,7],d3d11createdevic:7,rate:[2,3,7],horizont:[3,7],project:[2,12],matter:7,reus:[2,1,3],includ:[3,12,7,10],were:[2,6],posit:[2,1,3,7],amount:[1,5],dxcontextmanagercallback:7,expf:3,lowest:2,vector:[3,7],comput:2,abov:[1,12,6,7,2,3],nicer:1,explicit:3,c_0c_1:2,getclothlist:6,ani:[9,4,7],nvclothcookfabricfrommesh:7,dash:2,thereto:9,constrainteth:3,have:[2,3,7,5],tabl:5,need:[0,1,3,4,5,7,2,12],clothmeshdesc:7,incompat:6,border:2,probabl:[3,7],caus:[3,6,7],rmin:2,strength:7,engin:7,squar:5,lib:[12,10],min:[2,1,3],r_p:2,destroi:7,self:[],endsimul:7,mid:2,accuraci:7,note:[],also:[2,1,3,7,5],discret:2,take:4,which:[1,5,4,6,7,2,10,3],environ:12,graviti:7,singl:[],clearinertia:7,compat:7,begin:[2,1,3,7,5],sure:12,android_ndk_root:12,thi:[0,1,2,3,4,5,7,8,9,10,11,12],safe:7,though:[2,1,3],multipli:[2,3,7],dxdevic:7,previou:[2,1,3,7],compress:7,what:2,react:[6,7],most:[3,7],beta:6,regular:[2,1],cucontext:7,specifi:[1,3,7],rho:3,pair:[2,1,4,3,7],alpha:2,cap:2,ltoi:2,"8x8x8":2,worldspac:4,cmakegenerateal:12,r_0:2,r_1:2,particle_invmass:3,later:[5,12,7],cover:1,collisionmask:2,doe:[2,1,4,3,7],settetherconstraintscal:7,runtim:[10,6,7],determin:[2,4,5],occasion:3,constrain:[3,7],unchang:7,blend:7,sum:[2,5],dot:2,slope:2,settodefault:7,radix:1,getcurrentparticl:7,show:7,opposit:3,xcode:[12,6],beginsimul:7,concurr:7,stiffnessexpon:3,radiu:[2,3,7],getnumcapsul:7,directli:[2,1,4,7,10],aabb:[1,6],dxdevicecontext:7,threshold:3,trianglecount:7,unfinish:3,find:5,setintercollisiondist:4,impact:2,current:[2,1,3,7,10],id3d11devic:7,slow:[1,3],locat:[5,7],a_1:2,simulatechunk:7,explain:[2,3],configur:[12,7],solut:[3,12],"2r_0":2,t4f:[2,1],computebound:[1,3],experiment:6,black:2,undesir:7,factor:[3,7],sierra:6,physx:[3,6,7],folder:12,libdev:12,dotprevcur:2,count:[2,1,3,7,5],unus:6,variou:12,get:[3,7],pxallocatorcallback:7,stomp:5,express:9,stop:2,fluid:[3,6,7],newradiu:7,bucketmask:1,getnumplan:7,cannot:[1,4,5,7],phasetypeinfo:7,longest:1,progress:3,increas:[3,7],sqrconehalflength:2,deploy:12,clothbound:4,target:[3,12,7],triangl:[5,6,7,2,10,11,3],bat:12,enabl:[2,12,6,7],artist:7,a_0a_:2,gust:7,v8a:[12,6],"2m_":2,f_l:3,contain:[1,12,5,7,2,3],cudevicegetcount:7,where:[2,1,3,6],view:0,set:[1,12,4,5,7,2,3],sampl:[12,6],sear:3,frame:[],maximum:[2,3],graphicscontextmanag:7,d3d_driver_type_hardwar:7,see:[2,12],sed:12,einvalid:7,result:[2,3,6,5,7],sqraxishalflength:2,reserv:[9,1,5],xxxxx:12,particl:[],deriv:2,closer:3,setangularinertia:7,pxerrorcallback:7,collisiondist:1,correctli:2,sphere_cent:3,vari:7,boundari:4,dll:10,enough:1,devicecount:7,"2r_1r_0":2,dynam:[6,7],movingaverag:6,between:[2,1,3,7],prebuilt:12,theta:3,awai:[1,4],settransl:7,approach:2,across:7,altern:[5,12],oscil:7,attachmentposit:7,numparticl:3,extend:2,osx64:12,coeffici:[2,3,6,7],close:1,flow:[3,6],condit:[2,3,5],nvclothdestroyfactori:7,job:12,vc14winxx:12,solv:[2,3,7],group:7,let:7,come:7,inertia:7,addit:[4,3,6,7],mstretchlimit:7,both:[2,3,7],locate_cmak:12,last:[5,1,3,7],planesr:7,avoid:[2,5,6,7],similar:[2,4,7],howev:2,equal:[3,7],against:[2,1,4],nearbi:1,etc:7,instanc:[3,7],processor:12,equat:[2,3],context:7,stiffnessc:3,whole:[1,7],multithreadedsolverhelp:6,comment:[2,3],springi:7,simpli:12,point:[3,12,7,5,2],within:[2,1,7],schedul:5,int32_t:7,decrefcount:7,sweep:[],pop:3,addcloth:[6,7],batch:[5,6],written:[5,3],"4asr_0":2,sentinel:1,diff:1,assum:2,duplic:[1,5],size:[5,1,3,7],coupl:7,engwiki:2,aarch64:12,simdwidth:5,damp:[3,7],infinit:2,devic:7,due:[3,6,7],been:[2,7],mark:[2,1,4],proport:2,accumul:2,trigger:7,setrot:7,p_0:[2,3],modif:9,trajectori:2,dure:2,quickli:1,radii:[2,7],sphererang:7,stride:7,clothfabricphasetyp:7,imag:2,densiti:[3,6,7],search:0,unnecessarili:2,argument:[12,7],assert:[6,7],coordin:[1,7],zero:[3,7],togeth:7,oneminustoi:2,tangenti:2,nvclothcreatefactorydx11:7,getmotionconstraint:7,present:[6,7],"case":[3,12,7,2],look:[2,7],influenc:[3,7],align:[2,3,7],properti:[],mcloth:7,setgrav:7,air:[3,6,7],log_2:3,defin:[3,7],calcul:[1,5,4,6,7,2,3],asr_0:2,mindic:3,error:[3,12,6,7],"2q_0q_1":2,"2r_0r_1":2,anchor:3,loop:[1,5],subsect:2,propag:3,use_dx11:12,stiffnessfrequ:3,helper:[5,6,7],mcompressionlimit:7,almost:6,getnumconvex:7,initializenvcloth:7,them:7,physic:[6,7],particle_posit:3,"default":[12,7],itself:7,r_2:2,setsolverfrequ:7,seen:3,quadrat:2,primit:7,mset:3,develop:12,author:6,perform:[6,7],make:[1,12,5,6,7,2,3],belong:3,x64:6,same:[2,3,7,5,10],"while":[2,3,6,7],binari:[2,12],report:7,html:12,pad:5,split:2,largest:1,automat:12,paw:3,dimensionless:7,triangler:7,start:[1,5,6,7,2,3],conflict:5,higher:7,nvclothcreatefactorycuda:7,http:12,x86:12,unwant:7,again:[2,7],nvclothext:7,blue:2,effect:7,kit:12,getnorm:7,temporari:4,user:[],mani:[1,3,7],extern:12,robust:0,particle_position1:3,bia:[1,3,7],respons:[],implement:[3,6,7],expand:2,sqrlength:3,usemultipli:3,task:10,equival:4,older:6,cuctxcreat:7,com:12,usual:[3,7],well:6,know:7,without:[9,1,3,7,5],exampl:[5,12,7],command:12,uint32_t:[5,7],choos:12,model:[3,6],powf:3,dimension:3,ubuntu:6,impulseaccumul:2,explan:3,distanc:[],identifi:1,getnumphas:7,just:12,a_0:2,deltax:7,collidecon:2,deltaz:7,obtain:[2,1,12],"4th":7,indic:[2,1,4,3,7],mvelxyz:2,should:[3,12,7,5],particleposit:7,"2q_1q_0":2,licensor:9,touch:2,deltai:7,rest:[2,1,3,7],roughli:2,speed:[3,6],yet:6,ps4:6,mstiff:7,motionconstraint:7,element:[5,3],struct:7,easi:[0,7],r_i:2,r_3:2,iterationst:3,had:6,except:12,littl:0,add:7,other:[2,1,4,3,7],r13b:12,bank:5,timestep:3,els:3,path_to_android_ndk:12,match:3,hat:3,euler:3,build:[12,6],bin:[1,12],applic:[0,7],numteth:3,sap:2,around:1,format:1,meshdesc:7,fast:[0,6,7],"4m_":2,game:[0,7],cell:[2,1],dxcontextmanagercallbackimpl:7,vacuum:7,pxvec4:[3,7],world:[4,7],bit:[2,1,12,7],a_l:2,you:[0,12,7],lowerbound:1,pxvec3:7,insert:7,ignor:2,like:[3,12,7,5,2],specif:[3,1,12],arbitrari:[1,7],cdot:[2,1,3],corpor:9,manual:[1,7],stiffnessmultipli:3,xbox:6,api:6,necessari:7,use_cuda:12,realtim:0,resiz:5,architectur:6,r_m:2,manag:7,right:[9,3,2],old:6,often:[5,3,7],deal:4,simplifi:[2,7],flt_max_exp:3,numsweepcel:1,some:[3,4,12,7,2],back:[4,7],global:7,s_ok:7,llvm:6,csigg:2,mask:[2,7],cmakegenerateproject:12,home:[],sizeof:7,successfulli:5,librari:[],distribut:[9,12],mclothindic:4,scale:[],mattachmentvertexoriginalposit:7,highest:2,setlinearinertia:7,definit:2,overlap:[2,4],rapidli:7,circ:3,compressionlimit:3,larg:[1,3,7],"__t100":6,visit:0,complic:7,constraintmot:3,spherecent:[2,7],core:10,particular:3,object:[4,7],tmin:2,reach:[3,7],locate_win8sdk:12,updatesleepst:3,agreement:9,symlink:12,interfac:[0,6,7],c_0p_1:2,broken:7,step:[2,3,7],durat:2,although:3,offset:[2,1,3],renam:12,appli:[2,3,7],don:[2,1,5],d3d11_sdk_version:7,stage:7,about:[],inter:[],toolchain:12,particlecount:7,applywind:3,deltatim:7,createsolv:7,shield:6,firstkei:1,page:[0,3],stretch:[3,7],disclosur:9,cuda:[5,12,6,7],neighbor:1,t_2:2,t_3:2,underwat:7,t_1:2,disabl:[2,12,6,7],produc:5,d3d_feature_level_11_0:7,setcentrifugalinertia:7,own:[1,7,10],liveli:7,centimet:7,d3d_feature_level:7,stretchi:[3,7],xyz:[2,3,7],"float":[3,7],bound:[2,1,4,5],particle_position0:3,invers:[3,7],diagon:5,nullptr:7,integrateparticl:3,vertexarrai:7,ensur:[2,1,3,7,5],framer:3,destructor:7,precomput:2,setspher:7,setmotionconstraintscalebia:7,sqrtd:2,straightforward:7,accordingli:7,git:0,span:2,fabric:[],wai:[2,4,3,7,5],area:[3,7],buildprojectsosx:12,execut:[2,12,7],support:[12,6,10],rotat:[3,6],depenetr:2,"long":7,createfabr:7,avail:1,getnumspher:7,adjac:5,appl:6,restlength:3,editor:12,spring:7,twice:2,overhead:0,strictli:9,chunk:6,"function":[],properli:7,setfluiddens:6,form:3,forc:[2,3,7],epsilon:[2,1,3],basic:[1,3],refcount:7,idea:7,a_1a_:2,cloth:[],state:3,link:6,newer:12,scope:7,id3d11devicecontext:7,line:[2,12],level:0,"true":4,bug:6,sdk:[12,6],reset:7,notat:3,made:2,tetherlength:3,input:5,consist:7,possibl:[1,5,6],whether:12,displai:7,directori:12,below:[2,1,3,7],limit:[3,7],arm64:[12,6],unlock:7,cit:2,pxprofilercallback:7,otherwis:3,problem:[2,3,7],more:[],even:[2,3,7],motion:[],featur:[0,3,7,10],constant:[2,3],creat:[3,12,7,5],"int":7,descript:10,inv:3,convex:[11,7],dotprevprev:2,stretchlimitc:3,mstiffnessmultipli:7,repres:7,decreas:7,file:12,behavior:[3,6,7],improv:[6,7],check:[2,1,3,7],piw:3,incorrect:6,constrainmot:3,collid:[2,1,3,7],cmake:[12,6],nx0:12,buffer:1,plausibl:7,setdamp:[3,7],nan:7,green:2,virtual:6,cuctxdestroi:7,cleanup:7,capsuleindic:7,generateprojectsosx:12,normal:[2,3],setphaseconfig:7,test:[2,1,4,12,6],generateprojectslinux:12,buildprojectslinux:12,logdamp:3,p_0c_1:2,multiplierc:3,relat:[8,9,10],regardless:7,repo:0,symbol:3,center:[2,3,7],phaseconfig:[3,7],"return":7,pxasserthandl:7,gcc:6,polynomi:2,drag:[],gridscal:1,track:[2,5],q_1:2,less:[2,3,7],previous:7,doubl:[2,3],nvclothcreatefactorycpu:7,cmakegenerateandroid:12,stai:[2,7],reduc:[2,3,7],axi:[2,1,4],studio:[12,6],featurelevelresult:7,algorithm:[],cooker:7,inaccuraci:3,callback:7,pseudo:3,indirectli:7,rule:7,microsoft:12,hresult:7,delta:[2,1,3,7],lift:[],mass:[2,3,6,7],potenti:7,settriangl:7,onc:1,"export":12,mathrm:3,cpu:[5,6,7],stick:2},objtypes:{},objnames:{},filenames:["index","CollisionDetection/SelfCollision","CollisionDetection/SphereCapsuleCollision","Solver/Index","CollisionDetection/InterCollision","Cooking/TripletScheduler","ReleaseNotes/index","UserGuide/Index","Cooking/Index","CopyRight/Index","Modules/Index","CollisionDetection/Index","Compiling/index"],titles:["NvCloth","Self Collision","Sphere Capsule collision detection","Internal solver function/algorithm documentation","Inter Collision","TripletScheduler","Release Notes","User Guide","Internal cooking documentation","NVIDIA Copyright Notice","Modules","Internal collision detection documentation","Compiling"],objects:{},titleterms:{distanc:[3,7],edg:3,acceler:[2,1,4],capsul:2,simd:5,tripletschedul:5,copyright:9,window:12,local:7,adjacencyqueri:5,anim:7,initi:7,grid:1,cook:8,solver:[3,7],troubleshoot:7,stiff:3,calculatefrictionimpuls:2,separ:3,integr:3,inter:4,compil:12,frame:7,intern:[8,11,3],respons:1,tether:[3,7],todo:11,particl:[1,3],scale:7,space:7,broad:4,factori:7,common:7,kei:1,gener:2,usag:7,extens:10,releas:6,log:3,about:0,constraint:[3,7],mac:12,simul:[3,7],motion:7,nvcloth:[0,10],rang:1,overview:[8,11,1,4,3],modul:[8,11,10],sweep:1,linux:12,guid:7,unit:7,differ:[8,11,4],fabric:[3,7],compon:3,attach:7,warp:5,more:0,"function":3,notic:9,cloth:7,lift:7,retriev:7,slack:3,setup:[1,7],properti:7,structur:[2,1,4,3],charact:7,learn:0,sort:1,sphere:2,cone:2,invmass:3,disappear:7,self:[1,4],note:6,collis:[11,2,1,4,7],librari:7,android:12,document:[8,11,3],singl:7,drag:7,detect:[11,2,1,4,7],user:7,phase:4,collideparticl:2,data:[3,7],algorithm:3,part:7,nvidia:9,ccd:2,wind:[3,7]}})
\ No newline at end of file diff --git a/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h b/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h index f2dada0..e01d72d 100644 --- a/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h +++ b/NvCloth/extensions/include/NvClothExt/ClothFabricCooker.h @@ -194,6 +194,7 @@ public: /** \brief Returns the fabric descriptor to create the fabric. */ virtual ClothFabricDesc getDescriptor() const = 0; + /** \brief Saves the fabric data to a platform and version dependent stream. */ virtual void save(physx::PxOutputStream& stream, bool platformMismatch) const = 0; }; diff --git a/NvCloth/extensions/src/ClothFabricCooker.cpp b/NvCloth/extensions/src/ClothFabricCooker.cpp index c6d0103..eda73de 100644 --- a/NvCloth/extensions/src/ClothFabricCooker.cpp +++ b/NvCloth/extensions/src/ClothFabricCooker.cpp @@ -30,9 +30,8 @@ #include "foundation/PxVec4.h" #include "foundation/PxIO.h" #include "foundation/PxStrideIterator.h" -#include "PsSort.h" -#include "PsMathUtils.h" - +#include "ps/PsSort.h" +#include "NvCloth/ps/PsMathUtils.h" #include "NvClothExt/ClothFabricCooker.h" #include "NvClothExt/ClothTetherCooker.h" #include "NvCloth/Fabric.h" diff --git a/NvCloth/extensions/src/ClothGeodesicTetherCooker.cpp b/NvCloth/extensions/src/ClothGeodesicTetherCooker.cpp index 65e2a3f..7557389 100644 --- a/NvCloth/extensions/src/ClothGeodesicTetherCooker.cpp +++ b/NvCloth/extensions/src/ClothGeodesicTetherCooker.cpp @@ -33,8 +33,8 @@ #include "NvClothExt/ClothTetherCooker.h" // from shared foundation -#include <PsSort.h> -#include <PsMathUtils.h> +#include "../../src/ps/PsSort.h" +#include "NvCloth/ps/PsMathUtils.h" #include "NvCloth/Allocator.h" using namespace physx; diff --git a/NvCloth/extensions/src/ClothMeshQuadifier.cpp b/NvCloth/extensions/src/ClothMeshQuadifier.cpp index 4ae081e..2250c09 100644 --- a/NvCloth/extensions/src/ClothMeshQuadifier.cpp +++ b/NvCloth/extensions/src/ClothMeshQuadifier.cpp @@ -31,9 +31,9 @@ #include "NvClothExt/ClothMeshQuadifier.h" // from shared foundation -#include <PsSort.h> -#include <Ps.h> -#include <PsMathUtils.h> +#include "../../src/ps/PsSort.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/ps/PsMathUtils.h" #include "NvCloth/Allocator.h" using namespace physx; diff --git a/NvCloth/include/NvCloth/Allocator.h b/NvCloth/include/NvCloth/Allocator.h index ade0698..e66f34a 100644 --- a/NvCloth/include/NvCloth/Allocator.h +++ b/NvCloth/include/NvCloth/Allocator.h @@ -35,10 +35,10 @@ /** \cond HIDDEN_SYMBOLS */ #pragma once -#include <PsArray.h> -#include <PsHashMap.h> -#include <PsAlignedMalloc.h> +#include "NvCloth/ps/PsArray.h" +#include "NvCloth/ps/PsHashMap.h" #include "NvCloth/Callbacks.h" +#include "NvCloth/ps/PsAlignedMalloc.h" namespace nv { diff --git a/NvCloth/include/NvCloth/Callbacks.h b/NvCloth/include/NvCloth/Callbacks.h index 72ebe24..f5b54a9 100644 --- a/NvCloth/include/NvCloth/Callbacks.h +++ b/NvCloth/include/NvCloth/Callbacks.h @@ -36,7 +36,7 @@ #pragma once #include <foundation/PxPreprocessor.h> #include <foundation/PxProfiler.h> -#include <foundation/PxAssert.h> +#include <foundation/PxAllocatorCallback.h> #ifndef NV_CLOTH_IMPORT #define NV_CLOTH_IMPORT PX_DLL_IMPORT #endif @@ -79,6 +79,25 @@ NV_CLOTH_API(void) //Allocator NV_CLOTH_API(physx::PxAllocatorCallback*) GetNvClothAllocator(); //Only use internally +#if !PX_DOXYGEN +namespace physx +{ +#endif + +/* Base class to handle assert failures */ +class PxAssertHandler +{ +public: + virtual ~PxAssertHandler() + { + } + virtual void operator()(const char* exp, const char* file, int line, bool& ignore) = 0; +}; + +#if !PX_DOXYGEN +} // namespace physx +#endif + namespace nv { namespace cloth @@ -107,7 +126,7 @@ NV_CLOTH_API(physx::PxAssertHandler*) GetNvClothAssertHandler(); //This function #else #if PX_VC #define PX_CODE_ANALYSIS_ASSUME(exp) \ - __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a PX_ASSERT is used + __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a NV_CLOTH_ASSERT is used // to "guard" illegal mem access, for example. #else #define PX_CODE_ANALYSIS_ASSUME(exp) @@ -121,7 +140,7 @@ NV_CLOTH_API(physx::PxAssertHandler*) GetNvClothAssertHandler(); //This function #define NV_CLOTH_ASSERT_WITH_MESSAGE(message, exp) \ { \ static bool _ignore = false; \ - ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(message, __FILE__, __LINE__, _ignore), false)))); \ + ((void)((!!(exp)) || (!_ignore && ((*nv::cloth::GetNvClothAssertHandler())(message, __FILE__, __LINE__, _ignore), false)))); \ PX_CODE_ANALYSIS_ASSUME(exp); \ } #endif diff --git a/NvCloth/include/NvCloth/Fabric.h b/NvCloth/include/NvCloth/Fabric.h index 02b1140..eb0fc5e 100644 --- a/NvCloth/include/NvCloth/Fabric.h +++ b/NvCloth/include/NvCloth/Fabric.h @@ -31,7 +31,7 @@ #include "NvCloth/Callbacks.h" #include "NvCloth/Allocator.h" -#include <PsAtomic.h> +#include "NvCloth/ps/PsAtomic.h" namespace nv { diff --git a/NvCloth/include/NvCloth/Solver.h b/NvCloth/include/NvCloth/Solver.h index 2ff0e9c..7ebe290 100644 --- a/NvCloth/include/NvCloth/Solver.h +++ b/NvCloth/include/NvCloth/Solver.h @@ -31,7 +31,7 @@ #include "NvCloth/Allocator.h" #include "NvCloth/Range.h" -#include "PsArray.h" +#include "NvCloth/ps/PsArray.h" namespace nv { diff --git a/PxShared/src/foundation/include/Ps.h b/NvCloth/include/NvCloth/ps/Ps.h index 89fc9c7..89fc9c7 100644 --- a/PxShared/src/foundation/include/Ps.h +++ b/NvCloth/include/NvCloth/ps/Ps.h diff --git a/PxShared/src/foundation/include/PsAlignedMalloc.h b/NvCloth/include/NvCloth/ps/PsAlignedMalloc.h index 4be8409..4be8409 100644 --- a/PxShared/src/foundation/include/PsAlignedMalloc.h +++ b/NvCloth/include/NvCloth/ps/PsAlignedMalloc.h diff --git a/PxShared/src/foundation/src/unix/PsUnixPrintString.cpp b/NvCloth/include/NvCloth/ps/PsAllocator.cpp index 3c937a4..4e6514f 100644 --- a/PxShared/src/foundation/src/unix/PsUnixPrintString.cpp +++ b/NvCloth/include/NvCloth/ps/PsAllocator.cpp @@ -27,25 +27,24 @@ // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. -#include "PsString.h" -#include <stdio.h> - -#if PX_ANDROID -#include <android/log.h> -#endif +#include "PsAllocator.h" +#include "NvCloth/Callbacks.h" namespace physx { namespace shdfnd { -void printString(const char* str) +void* Allocator::allocate(size_t size, const char* file, int line) +{ + if(!size) + return 0; + return GetNvClothAllocator()->allocate(size, "", file, line); +} +void Allocator::deallocate(void* ptr) { -#if PX_ANDROID - __android_log_print(ANDROID_LOG_INFO, "PsPrintString", "%s", str); -#else - puts(str); -#endif + if(ptr) + GetNvClothAllocator()->deallocate(ptr); } } // namespace shdfnd diff --git a/PxShared/src/foundation/include/PsAllocator.h b/NvCloth/include/NvCloth/ps/PsAllocator.h index f988b6c..37605ee 100644 --- a/PxShared/src/foundation/include/PsAllocator.h +++ b/NvCloth/include/NvCloth/ps/PsAllocator.h @@ -31,9 +31,9 @@ #define PSFOUNDATION_PSALLOCATOR_H #include "foundation/PxAllocatorCallback.h" -#include "foundation/PxFoundation.h" +//#include "foundation/PxFoundation.h" #include "Ps.h" -#include "foundation/PxAssert.h" +#include "../Callbacks.h" #if(PX_WINDOWS_FAMILY || PX_XBOXONE) #include <exception> @@ -46,11 +46,7 @@ #include <new> // Allocation macros going through user allocator -#if PX_CHECKED -#define PX_ALLOC(n, name) physx::shdfnd::NamedAllocator(name).allocate(n, __FILE__, __LINE__) -#else #define PX_ALLOC(n, name) physx::shdfnd::NonTrackingAllocator().allocate(n, __FILE__, __LINE__) -#endif #define PX_ALLOC_TEMP(n, name) PX_ALLOC(n, name) #define PX_FREE(x) physx::shdfnd::NonTrackingAllocator().deallocate(x) #define PX_FREE_AND_RESET(x) \ @@ -120,13 +116,13 @@ namespace physx namespace shdfnd { -PX_FOUNDATION_API PxAllocatorCallback& getAllocator(); +//NV_CLOTH_IMPORT PxAllocatorCallback& getAllocator(); /** Allocator used to access the global PxAllocatorCallback instance without providing additional information. */ -class PX_FOUNDATION_API Allocator +class NV_CLOTH_IMPORT Allocator { public: Allocator(const char* = 0) @@ -172,12 +168,12 @@ class NonTrackingAllocator } PX_FORCE_INLINE void* allocate(size_t size, const char* file, int line) { - return !size ? 0 : getAllocator().allocate(size, "NonTrackedAlloc", file, line); + return !size ? 0 : GetNvClothAllocator()->allocate(size, "NonTrackedAlloc", file, line); } PX_FORCE_INLINE void deallocate(void* ptr) { if(ptr) - getAllocator().deallocate(ptr); + GetNvClothAllocator()->deallocate(ptr); } }; @@ -215,14 +211,14 @@ class VirtualAllocator void* allocate(const size_t size, const char* file, const int line) { - PX_ASSERT(mCallback); + NV_CLOTH_ASSERT(mCallback); if(size) return mCallback->allocate(size, file, line); return NULL; } void deallocate(void* ptr) { - PX_ASSERT(mCallback); + NV_CLOTH_ASSERT(mCallback); if(ptr) mCallback->deallocate(ptr); } @@ -241,22 +237,6 @@ class VirtualAllocator VirtualAllocator& operator=(const VirtualAllocator&); }; -#if PX_USE_NAMED_ALLOCATOR // can be slow, so only use in debug/checked -class PX_FOUNDATION_API NamedAllocator -{ - public: - NamedAllocator(const PxEMPTY); - NamedAllocator(const char* name = 0); // todo: should not have default argument! - NamedAllocator(const NamedAllocator&); - ~NamedAllocator(); - NamedAllocator& operator=(const NamedAllocator&); - void* allocate(size_t size, const char* filename, int line); - void deallocate(void* ptr); -}; -#else -class NamedAllocator; -#endif // PX_DEBUG - /** Allocator used to access the global PxAllocatorCallback instance using a static name derived from T. */ @@ -266,7 +246,7 @@ class ReflectionAllocator { static const char* getName() { - if(!PxGetFoundation().getReportAllocationNames()) + if(true) return "<allocation names disabled>"; #if PX_GCC_FAMILY return __PRETTY_FUNCTION__; @@ -288,23 +268,19 @@ class ReflectionAllocator } void* allocate(size_t size, const char* filename, int line) { - return size ? getAllocator().allocate(size, getName(), filename, line) : 0; + return size ? GetNvClothAllocator()->allocate(size, getName(), filename, line) : 0; } void deallocate(void* ptr) { if(ptr) - getAllocator().deallocate(ptr); + GetNvClothAllocator()->deallocate(ptr); } }; template <typename T> struct AllocatorTraits { -#if PX_USE_NAMED_ALLOCATOR - typedef NamedAllocator Type; -#else typedef ReflectionAllocator<T> Type; -#endif }; // if you get a build error here, you are trying to PX_NEW a class diff --git a/PxShared/src/foundation/include/PsArray.h b/NvCloth/include/NvCloth/ps/PsArray.h index 2121c30..e5f6698 100644 --- a/PxShared/src/foundation/include/PsArray.h +++ b/NvCloth/include/NvCloth/ps/PsArray.h @@ -30,10 +30,10 @@ #ifndef PSFOUNDATION_PSARRAY_H #define PSFOUNDATION_PSARRAY_H -#include "foundation/PxAssert.h" +#include "../Callbacks.h" #include "foundation/PxIntrinsics.h" -#include "PsAllocator.h" #include "PsBasicTemplates.h" +#include "NvCloth/ps/PsAllocator.h" namespace physx { @@ -156,7 +156,7 @@ class Array : protected Alloc */ PX_FORCE_INLINE const T& operator[](uint32_t i) const { - PX_ASSERT(i < mSize); + NV_CLOTH_ASSERT(i < mSize); return mData[i]; } @@ -169,7 +169,7 @@ class Array : protected Alloc */ PX_FORCE_INLINE T& operator[](uint32_t i) { - PX_ASSERT(i < mSize); + NV_CLOTH_ASSERT(i < mSize); return mData[i]; } @@ -211,13 +211,13 @@ class Array : protected Alloc PX_FORCE_INLINE const T& front() const { - PX_ASSERT(mSize); + NV_CLOTH_ASSERT(mSize); return mData[0]; } PX_FORCE_INLINE T& front() { - PX_ASSERT(mSize); + NV_CLOTH_ASSERT(mSize); return mData[0]; } @@ -228,13 +228,13 @@ class Array : protected Alloc PX_FORCE_INLINE const T& back() const { - PX_ASSERT(mSize); + NV_CLOTH_ASSERT(mSize); return mData[mSize - 1]; } PX_FORCE_INLINE T& back() { - PX_ASSERT(mSize); + NV_CLOTH_ASSERT(mSize); return mData[mSize - 1]; } @@ -315,7 +315,7 @@ class Array : protected Alloc ///////////////////////////////////////////////////////////////////////// PX_INLINE T popBack() { - PX_ASSERT(mSize); + NV_CLOTH_ASSERT(mSize); T t = mData[mSize - 1]; mData[--mSize].~T(); @@ -349,7 +349,7 @@ class Array : protected Alloc ///////////////////////////////////////////////////////////////////////// PX_INLINE void replaceWithLast(uint32_t i) { - PX_ASSERT(i < mSize); + NV_CLOTH_ASSERT(i < mSize); mData[i] = mData[--mSize]; mData[mSize].~T(); @@ -392,7 +392,7 @@ class Array : protected Alloc ///////////////////////////////////////////////////////////////////////// PX_INLINE void remove(uint32_t i) { - PX_ASSERT(i < mSize); + NV_CLOTH_ASSERT(i < mSize); T* it = mData + i; it->~T(); @@ -417,8 +417,8 @@ class Array : protected Alloc ///////////////////////////////////////////////////////////////////////// PX_INLINE void removeRange(uint32_t begin, uint32_t count) { - PX_ASSERT(begin < mSize); - PX_ASSERT((begin + count) <= mSize); + NV_CLOTH_ASSERT(begin < mSize); + NV_CLOTH_ASSERT((begin + count) <= mSize); for(uint32_t i = 0; i < count; i++) mData[begin + i].~T(); // call the destructor on the ones being removed first. @@ -496,7 +496,7 @@ class Array : protected Alloc ////////////////////////////////////////////////////////////////////////// PX_FORCE_INLINE void forceSize_Unsafe(uint32_t size) { - PX_ASSERT(size <= mCapacity); + NV_CLOTH_ASSERT(size <= mCapacity); mSize = size; } @@ -607,7 +607,7 @@ definition for serialized classes is complete in checked builds. */ PX_INLINE void grow(uint32_t capacity) { - PX_ASSERT(this->capacity() < capacity); + NV_CLOTH_ASSERT(this->capacity() < capacity); recreate(capacity); } @@ -677,7 +677,7 @@ PX_NOINLINE T& Array<T, Alloc>::growAndPushBack(const T& a) uint32_t capacity = capacityIncrement(); T* newData = allocate(capacity); - PX_ASSERT((!capacity) || (newData && (newData != mData))); + NV_CLOTH_ASSERT((!capacity) || (newData && (newData != mData))); copy(newData, newData + mSize, mData); // inserting element before destroying old array @@ -698,7 +698,7 @@ template <class T, class Alloc> PX_NOINLINE void Array<T, Alloc>::recreate(uint32_t capacity) { T* newData = allocate(capacity); - PX_ASSERT((!capacity) || (newData && (newData != mData))); + NV_CLOTH_ASSERT((!capacity) || (newData && (newData != mData))); copy(newData, newData + mSize, mData); destroy(mData, mData + mSize); diff --git a/PxShared/src/foundation/include/PsAtomic.h b/NvCloth/include/NvCloth/ps/PsAtomic.h index 23df190..dad18fc 100644 --- a/PxShared/src/foundation/include/PsAtomic.h +++ b/NvCloth/include/NvCloth/ps/PsAtomic.h @@ -30,32 +30,33 @@ #ifndef PSFOUNDATION_PSATOMIC_H #define PSFOUNDATION_PSATOMIC_H -#include "Ps.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/Callbacks.h" namespace physx { namespace shdfnd { /* set *dest equal to val. Return the old value of *dest */ -PX_FOUNDATION_API int32_t atomicExchange(volatile int32_t* dest, int32_t val); +NV_CLOTH_IMPORT int32_t atomicExchange(volatile int32_t* dest, int32_t val); /* if *dest == comp, replace with exch. Return original value of *dest */ -PX_FOUNDATION_API int32_t atomicCompareExchange(volatile int32_t* dest, int32_t exch, int32_t comp); +NV_CLOTH_IMPORT int32_t atomicCompareExchange(volatile int32_t* dest, int32_t exch, int32_t comp); /* if *dest == comp, replace with exch. Return original value of *dest */ -PX_FOUNDATION_API void* atomicCompareExchangePointer(volatile void** dest, void* exch, void* comp); +NV_CLOTH_IMPORT void* atomicCompareExchangePointer(volatile void** dest, void* exch, void* comp); /* increment the specified location. Return the incremented value */ -PX_FOUNDATION_API int32_t atomicIncrement(volatile int32_t* val); +NV_CLOTH_IMPORT int32_t atomicIncrement(volatile int32_t* val); /* decrement the specified location. Return the decremented value */ -PX_FOUNDATION_API int32_t atomicDecrement(volatile int32_t* val); +NV_CLOTH_IMPORT int32_t atomicDecrement(volatile int32_t* val); /* add delta to *val. Return the new value */ -PX_FOUNDATION_API int32_t atomicAdd(volatile int32_t* val, int32_t delta); +NV_CLOTH_IMPORT int32_t atomicAdd(volatile int32_t* val, int32_t delta); /* compute the maximum of dest and val. Return the new value */ -PX_FOUNDATION_API int32_t atomicMax(volatile int32_t* val, int32_t val2); +NV_CLOTH_IMPORT int32_t atomicMax(volatile int32_t* val, int32_t val2); } // namespace shdfnd } // namespace physx diff --git a/PxShared/src/foundation/include/PsBasicTemplates.h b/NvCloth/include/NvCloth/ps/PsBasicTemplates.h index 514da05..514da05 100644 --- a/PxShared/src/foundation/include/PsBasicTemplates.h +++ b/NvCloth/include/NvCloth/ps/PsBasicTemplates.h diff --git a/PxShared/src/foundation/include/PsBitUtils.h b/NvCloth/include/NvCloth/ps/PsBitUtils.h index f69f47a..3d901ed 100644 --- a/PxShared/src/foundation/include/PsBitUtils.h +++ b/NvCloth/include/NvCloth/ps/PsBitUtils.h @@ -31,7 +31,7 @@ #define PSFOUNDATION_PSBITUTILS_H #include "foundation/PxIntrinsics.h" -#include "foundation/PxAssert.h" +#include "../Callbacks.h" #include "PsIntrinsics.h" #include "Ps.h" @@ -73,7 +73,7 @@ Return the index of the highest set bit. Not valid for zero arg. PX_INLINE uint32_t lowestSetBit(uint32_t x) { - PX_ASSERT(x); + NV_CLOTH_ASSERT(x); return lowestSetBitUnsafe(x); } @@ -83,7 +83,7 @@ Return the index of the highest set bit. Not valid for zero arg. PX_INLINE uint32_t highestSetBit(uint32_t x) { - PX_ASSERT(x); + NV_CLOTH_ASSERT(x); return highestSetBitUnsafe(x); } @@ -99,7 +99,7 @@ PX_INLINE uint32_t ilog2(uint32_t num) return i; } - PX_ASSERT(0); + NV_CLOTH_ASSERT(0); return uint32_t(-1); } diff --git a/PxShared/src/foundation/include/PsHash.h b/NvCloth/include/NvCloth/ps/PsHash.h index 6b74fb2..6b74fb2 100644 --- a/PxShared/src/foundation/include/PsHash.h +++ b/NvCloth/include/NvCloth/ps/PsHash.h diff --git a/PxShared/src/foundation/include/PsHashInternals.h b/NvCloth/include/NvCloth/ps/PsHashInternals.h index 809baa3..ec0d3dd 100644 --- a/PxShared/src/foundation/include/PsHashInternals.h +++ b/NvCloth/include/NvCloth/ps/PsHashInternals.h @@ -216,7 +216,7 @@ class HashBase : private Allocator PX_INLINE Entry* insertUnique(const Key& k) { - PX_ASSERT(find(k) == NULL); + NV_CLOTH_ASSERT(find(k) == NULL); uint32_t h = hash(k); uint32_t entryIndex = freeListGetNext(); @@ -252,7 +252,7 @@ class HashBase : private Allocator if(compacting) { mFreeList--; - PX_ASSERT(mFreeList == mEntriesCount); + NV_CLOTH_ASSERT(mFreeList == mEntriesCount); } else { @@ -270,7 +270,7 @@ class HashBase : private Allocator // link in old free list mEntriesNext[end - 1] = mFreeList; - PX_ASSERT(mFreeList != end - 1); + NV_CLOTH_ASSERT(mFreeList != end - 1); mFreeList = start; } else if(mFreeList == EOL) // don't reset the free ptr for the compacting hash unless it's empty @@ -279,10 +279,10 @@ class HashBase : private Allocator PX_INLINE uint32_t freeListGetNext() { - PX_ASSERT(!freeListEmpty()); + NV_CLOTH_ASSERT(!freeListEmpty()); if(compacting) { - PX_ASSERT(mFreeList == mEntriesCount); + NV_CLOTH_ASSERT(mFreeList == mEntriesCount); return mFreeList++; } else @@ -310,7 +310,7 @@ class HashBase : private Allocator uint32_t h = hash(GetKey()(mEntries[index])); uint32_t* ptr; for(ptr = mHash + h; *ptr != mEntriesCount; ptr = mEntriesNext + *ptr) - PX_ASSERT(*ptr != EOL); + NV_CLOTH_ASSERT(*ptr != EOL); *ptr = index; } @@ -347,7 +347,7 @@ class HashBase : private Allocator if(!isPowerOfTwo(size)) size = nextPowerOfTwo(size); - PX_ASSERT(!(size & (size - 1))); + NV_CLOTH_ASSERT(!(size & (size - 1))); // decide whether iteration can be done on the entries directly bool resizeCompact = compacting || freeListEmpty(); @@ -370,7 +370,7 @@ class HashBase : private Allocator uint32_t newBufferByteSize = newEntriesByteOffset + newEntriesCapacity * sizeof(Entry); newBuffer = reinterpret_cast<uint8_t*>(Allocator::allocate(newBufferByteSize, __FILE__, __LINE__)); - PX_ASSERT(newBuffer); + NV_CLOTH_ASSERT(newBuffer); newHash = reinterpret_cast<uint32_t*>(newBuffer + newHashByteOffset); newEntriesNext = reinterpret_cast<uint32_t*>(newBuffer + newEntriesNextBytesOffset); @@ -384,7 +384,7 @@ class HashBase : private Allocator if(resizeCompact) { // check that old free list is empty - we don't need to copy the next entries - PX_ASSERT(compacting || mFreeList == EOL); + NV_CLOTH_ASSERT(compacting || mFreeList == EOL); for(uint32_t index = 0; index < mEntriesCount; ++index) { @@ -408,7 +408,7 @@ class HashBase : private Allocator { uint32_t h = hash(GetKey()(mEntries[index]), newHashSize); newEntriesNext[index] = newHash[h]; - PX_ASSERT(index != newHash[h]); + NV_CLOTH_ASSERT(index != newHash[h]); newHash[h] = index; @@ -434,7 +434,7 @@ class HashBase : private Allocator void grow() { - PX_ASSERT((mFreeList == EOL) || (compacting && (mEntriesCount == mEntriesCapacity))); + NV_CLOTH_ASSERT((mFreeList == EOL) || (compacting && (mEntriesCount == mEntriesCapacity))); uint32_t size = mHashSize == 0 ? 16 : mHashSize * 2; reserve(size); @@ -466,7 +466,7 @@ class HashBase : private Allocator PX_INLINE void check() const { - PX_ASSERT(mTimestamp == mBase.mTimestamp); + NV_CLOTH_ASSERT(mTimestamp == mBase.mTimestamp); } PX_INLINE const Entry& operator*() const { @@ -619,7 +619,7 @@ HashBase<Entry, Key, HashFn, GetKey, Allocator, compacting>::copy(const HashBase bool exists; Entry* newEntry = create(GK()(otherEntry), exists); - PX_ASSERT(!exists); + NV_CLOTH_ASSERT(!exists); PX_PLACEMENT_NEW(newEntry, Entry)(otherEntry); } diff --git a/PxShared/src/foundation/include/PsHashMap.h b/NvCloth/include/NvCloth/ps/PsHashMap.h index 5091dee..5091dee 100644 --- a/PxShared/src/foundation/include/PsHashMap.h +++ b/NvCloth/include/NvCloth/ps/PsHashMap.h diff --git a/PxShared/src/foundation/include/PsIntrinsics.h b/NvCloth/include/NvCloth/ps/PsIntrinsics.h index 38b91ba..38b91ba 100644 --- a/PxShared/src/foundation/include/PsIntrinsics.h +++ b/NvCloth/include/NvCloth/ps/PsIntrinsics.h diff --git a/PxShared/src/foundation/include/PsMathUtils.h b/NvCloth/include/NvCloth/ps/PsMathUtils.h index 789cf3f..aeaeb93 100644 --- a/PxShared/src/foundation/include/PsMathUtils.h +++ b/NvCloth/include/NvCloth/ps/PsMathUtils.h @@ -33,8 +33,9 @@ #include "foundation/PxPreprocessor.h" #include "foundation/PxTransform.h" #include "foundation/PxMat33.h" -#include "Ps.h" -#include "PsIntrinsics.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/ps/PsIntrinsics.h" +#include "NvCloth/Callbacks.h" // General guideline is: if it's an abstract math function, it belongs here. // If it's a math function where the inputs have specific semantics (e.g. @@ -356,7 +357,7 @@ PX_CUDA_CALLABLE PX_INLINE PxVec3 log(const PxQuat& q) return PxVec3(0.0f); // force the half-angle to have magnitude <= pi/2 PxReal halfAngle = q.w < 0 ? PxAtan2(-s, -q.w) : PxAtan2(s, q.w); - PX_ASSERT(halfAngle >= -PxPi / 2 && halfAngle <= PxPi / 2); + NV_CLOTH_ASSERT(halfAngle >= -PxPi / 2 && halfAngle <= PxPi / 2); return q.getImaginaryPart().getNormalized() * 2.f * halfAngle; } @@ -498,9 +499,9 @@ PX_FORCE_INLINE void normalToTangents(const PxVec3& normal, PxVec3& tangent0, Px \param basis Input = skewed basis, Output = (normalized) orthogonal basis. \return Bounding box extent. */ -PX_FOUNDATION_API PxVec3 optimizeBoundingBox(PxMat33& basis); +NV_CLOTH_IMPORT PxVec3 optimizeBoundingBox(PxMat33& basis); -PX_FOUNDATION_API PxQuat slerp(const PxReal t, const PxQuat& left, const PxQuat& right); +NV_CLOTH_IMPORT PxQuat slerp(const PxReal t, const PxQuat& left, const PxQuat& right); PX_CUDA_CALLABLE PX_INLINE PxVec3 ellipseClamp(const PxVec3& point, const PxVec3& radii) { @@ -647,7 +648,7 @@ PX_INLINE PxMat33 rotFrom2Vectors(const PxVec3& from, const PxVec3& to) return R; } -PX_FOUNDATION_API void integrateTransform(const PxTransform& curTrans, const PxVec3& linvel, const PxVec3& angvel, +NV_CLOTH_IMPORT void integrateTransform(const PxTransform& curTrans, const PxVec3& linvel, const PxVec3& angvel, PxReal timeStep, PxTransform& result); PX_INLINE void computeBasis(const PxVec3& dir, PxVec3& right, PxVec3& up) diff --git a/PxShared/src/foundation/include/PsUserAllocated.h b/NvCloth/include/NvCloth/ps/PsUserAllocated.h index f41d29e..f41d29e 100644 --- a/PxShared/src/foundation/include/PsUserAllocated.h +++ b/NvCloth/include/NvCloth/ps/PsUserAllocated.h diff --git a/PxShared/src/foundation/include/unix/PsUnixIntrinsics.h b/NvCloth/include/NvCloth/ps/unix/PsUnixIntrinsics.h index e15b3b5..93d20b5 100644 --- a/PxShared/src/foundation/include/unix/PsUnixIntrinsics.h +++ b/NvCloth/include/NvCloth/ps/unix/PsUnixIntrinsics.h @@ -30,8 +30,8 @@ #ifndef PSFOUNDATION_PSUNIXINTRINSICS_H #define PSFOUNDATION_PSUNIXINTRINSICS_H -#include "Ps.h" -#include "foundation/PxAssert.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/Callbacks.h" #include <math.h> #if PX_ANDROID || (PX_LINUX && !(PX_X64 || PX_X64)) // x86[_64] Linux uses inline assembly for debug break diff --git a/PxShared/src/foundation/include/windows/PsWindowsIntrinsics.h b/NvCloth/include/NvCloth/ps/windows/PsWindowsIntrinsics.h index ca1e9c5..ac81f02 100644 --- a/PxShared/src/foundation/include/windows/PsWindowsIntrinsics.h +++ b/NvCloth/include/NvCloth/ps/windows/PsWindowsIntrinsics.h @@ -31,7 +31,6 @@ #define PSFOUNDATION_PSWINDOWSINTRINSICS_H #include "Ps.h" -#include "foundation/PxAssert.h" // this file is for internal intrinsics - that is, intrinsics that are used in // cross platform code but do not appear in the API diff --git a/NvCloth/samples/CmakeGenerateProjects.bat b/NvCloth/samples/CmakeGenerateProjects.bat index dcb2bbc..d1da2cf 100644 --- a/NvCloth/samples/CmakeGenerateProjects.bat +++ b/NvCloth/samples/CmakeGenerateProjects.bat @@ -1,11 +1,8 @@ rem @echo off CD /D %~dp0 -echo "Note: You need to run this with admin rights for the first time to set GW_DEPS_ROOT globally." -call "../scripts/locate_gw_root.bat" GW_DEPS_ROOT_F @echo on -setx GW_DEPS_ROOT "%GW_DEPS_ROOT_F% -echo GW_DEPS_ROOT = %GW_DEPS_ROOT% + REM Install cmake using packman set PACKMAN=call ../scripts/packman/packman.cmd @@ -21,9 +18,9 @@ REM Make sure the various variables that we need are set call "../scripts/locate_cuda.bat" CUDA_PATH_ echo CUDA_PATH_ = %CUDA_PATH_% -IF EXIST %~dp0..\Externals\CMakeModules ( - set GW_DEPS_ROOT=%~dp0..\ -) + +set GW_DEPS_ROOT=%~dp0..\..\ + IF NOT DEFINED GW_DEPS_ROOT GOTO GW_DEPS_ROOT_UNDEFINED @@ -34,12 +31,6 @@ set SAMPLES_ROOT_DIR=%~dp0 REM Generate projects here -rmdir /s /q compiler\vc14win32-cmake\ -mkdir compiler\vc14win32-cmake\ -pushd compiler\vc14win32-cmake\ -%CMAKE% ..\.. -G "Visual Studio 14 2015" -AWin32 -DCUDA_TOOLKIT_ROOT_DIR="%CUDA_PATH_%" -DTARGET_BUILD_PLATFORM=windows -DSTATIC_WINCRT=0 -DBL_DLL_OUTPUT_DIR=%OUTPUT_ROOT%\bin\vc14win32-cmake -DBL_LIB_OUTPUT_DIR=%OUTPUT_ROOT%\lib\vc14win32-cmake -DBL_EXE_OUTPUT_DIR=%OUTPUT_ROOT%\bin\vc14win32-cmake -popd - rmdir /s /q compiler\vc14win64-cmake\ mkdir compiler\vc14win64-cmake\ pushd compiler\vc14win64-cmake\ diff --git a/NvCloth/samples/SampleBase/renderer/Mesh.h b/NvCloth/samples/SampleBase/renderer/Mesh.h index 3a2885b..14a7081 100644 --- a/NvCloth/samples/SampleBase/renderer/Mesh.h +++ b/NvCloth/samples/SampleBase/renderer/Mesh.h @@ -12,8 +12,8 @@ #define MESH_H #include <vector> -#include "PxVec2.h" -#include "PxVec3.h" +#include <foundation/PxVec2.h> +#include <foundation/PxVec3.h> class Mesh diff --git a/NvCloth/samples/SampleBase/renderer/RenderMaterial.cpp b/NvCloth/samples/SampleBase/renderer/RenderMaterial.cpp index eb07c84..46d29dd 100644 --- a/NvCloth/samples/SampleBase/renderer/RenderMaterial.cpp +++ b/NvCloth/samples/SampleBase/renderer/RenderMaterial.cpp @@ -12,6 +12,7 @@ #include <DirectXMath.h> #include "ShaderUtils.h" #include "Renderer.h" +#include <NvCloth/Callbacks.h> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -116,7 +117,7 @@ void RenderMaterial::setBlending(BlendMode blendMode) desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; break; default: - PX_ALWAYS_ASSERT_MESSAGE("Unknown blend mode"); + NV_CLOTH_ASSERT_WITH_MESSAGE(false,"Unknown blend mode"); } ID3D11Device* device = GetDeviceManager()->GetDevice(); @@ -187,7 +188,7 @@ RenderMaterial::InstancePtr RenderMaterial::getMaterialInstance(const D3D11_INPU return materialInstance; } } - PX_ALWAYS_ASSERT(); + NV_CLOTH_ASSERT(false); return NULL; } diff --git a/NvCloth/samples/SampleBase/renderer/Renderable.cpp b/NvCloth/samples/SampleBase/renderer/Renderable.cpp index c0560fd..6151bc3 100644 --- a/NvCloth/samples/SampleBase/renderer/Renderable.cpp +++ b/NvCloth/samples/SampleBase/renderer/Renderable.cpp @@ -11,6 +11,7 @@ #include "Renderable.h" #include "Renderer.h" #include "RenderUtils.h" +#include <NvCloth/Callbacks.h> const DirectX::XMFLOAT4 DEFAULT_COLOR(0.5f, 0.5f, 0.5f, 1.0f); @@ -42,7 +43,7 @@ void Renderable::render(Renderer& renderer, bool depthStencilOnly) const auto& material = m_materialInstances[submeshId%getMaterialCount()]; if(!material->isValid()) { - PX_ALWAYS_ASSERT(); + NV_CLOTH_ASSERT(false); return; } diff --git a/NvCloth/samples/SampleBase/renderer/Renderer.cpp b/NvCloth/samples/SampleBase/renderer/Renderer.cpp index dffcebd..4c6c9d5 100644 --- a/NvCloth/samples/SampleBase/renderer/Renderer.cpp +++ b/NvCloth/samples/SampleBase/renderer/Renderer.cpp @@ -14,6 +14,8 @@ #include "SampleProfiler.h" #include "PxRenderBuffer.h" + +#include <NvCloth/Callbacks.h> using namespace physx; #include <set> @@ -692,7 +694,7 @@ IRenderMesh* Renderer::getPrimitiveRenderMesh(PrimitiveRenderMeshType::Enum type m_primitiveRenderMeshes[type] = new SphereRenderMesh(); break; default: - PX_ALWAYS_ASSERT_MESSAGE("Unsupported PxGeometryType"); + NV_CLOTH_ASSERT_WITH_MESSAGE(false,"Unsupported PxGeometryType"); return NULL; } } diff --git a/NvCloth/samples/SampleBase/renderer/ResourceManager.cpp b/NvCloth/samples/SampleBase/renderer/ResourceManager.cpp index fc76e1c..b7655ea 100644 --- a/NvCloth/samples/SampleBase/renderer/ResourceManager.cpp +++ b/NvCloth/samples/SampleBase/renderer/ResourceManager.cpp @@ -9,7 +9,7 @@ */ #include "ResourceManager.h" -#include "PxAssert.h" +#include <NvCloth/Callbacks.h> #include "Utils.h" #include <windows.h> @@ -58,7 +58,7 @@ const Resource* ResourceManager::requestResource(ResourceType type, const char* } else { - PX_ALWAYS_ASSERT_MESSAGE(name); + NV_CLOTH_ASSERT_WITH_MESSAGE(false,name); } } else if (type == eTEXTURE) @@ -85,7 +85,7 @@ const Resource* ResourceManager::requestResource(ResourceType type, const char* } else { - PX_ALWAYS_ASSERT_MESSAGE("Unsupported texture extension"); + NV_CLOTH_ASSERT_WITH_MESSAGE(false,"Unsupported texture extension"); } resource = textureResource; } @@ -98,7 +98,7 @@ const Resource* ResourceManager::requestResource(ResourceType type, const char* } else { - PX_ALWAYS_ASSERT_MESSAGE(name); + NV_CLOTH_ASSERT_WITH_MESSAGE(false,name); return nullptr; } } diff --git a/NvCloth/samples/SampleBase/renderer/SkinnedRenderMesh.cpp b/NvCloth/samples/SampleBase/renderer/SkinnedRenderMesh.cpp index deb518d..99a999c 100644 --- a/NvCloth/samples/SampleBase/renderer/SkinnedRenderMesh.cpp +++ b/NvCloth/samples/SampleBase/renderer/SkinnedRenderMesh.cpp @@ -11,10 +11,11 @@ #include "SkinnedRenderMesh.h" #include "Renderer.h" +#include <NvCloth/Callbacks.h> SkinnedRenderMesh::SkinnedRenderMesh(const std::vector<const SimpleMesh*>& meshes) { - PX_ASSERT_WITH_MESSAGE(meshes.size() <= MeshesCountMax, "meshes.size() have to be <= SkinnedRenderMesh::MeshesCountMax"); + NV_CLOTH_ASSERT_WITH_MESSAGE(meshes.size() <= MeshesCountMax, "meshes.size() have to be <= SkinnedRenderMesh::MeshesCountMax"); m_device = GetDeviceManager()->GetDevice(); @@ -179,7 +180,7 @@ void SkinnedRenderMesh::updateVisibleMeshes(const std::vector<uint32_t>& visible } context->Unmap(m_indexBuffer, 0); m_indexCount = indexCount; - PX_ASSERT(m_indexCount % 3 == 0); + NV_CLOTH_ASSERT(m_indexCount % 3 == 0); } } diff --git a/NvCloth/samples/SampleBase/scene/scenes/PlaneCollisionScene.cpp b/NvCloth/samples/SampleBase/scene/scenes/PlaneCollisionScene.cpp index 8a677f1..7ab5ca0 100644 --- a/NvCloth/samples/SampleBase/scene/scenes/PlaneCollisionScene.cpp +++ b/NvCloth/samples/SampleBase/scene/scenes/PlaneCollisionScene.cpp @@ -83,7 +83,7 @@ void PlaneCollisionScene::initializeCloth(int index, physx::PxVec3 offset) //assign as collision data nv::cloth::Range<const physx::PxVec4> planesR(&planes[0], &planes[0] + planes.size()); - mClothActor[index]->mCloth->setPlanes(planesR, 0, mClothActor[index]->mCloth->getNumPlanes()); + mClothActor[index]->mCloth->setPlanes(planesR, planesR); //assign convex indices std::vector<uint32_t> indices; diff --git a/NvCloth/samples/SampleBase/scene/scenes/SphereScene.cpp b/NvCloth/samples/SampleBase/scene/scenes/SphereScene.cpp index 2e6912e..8bb004e 100644 --- a/NvCloth/samples/SampleBase/scene/scenes/SphereScene.cpp +++ b/NvCloth/samples/SampleBase/scene/scenes/SphereScene.cpp @@ -84,7 +84,9 @@ void SphereScene::initializeCloth(int index, physx::PxVec3 offset) physx::PxVec4 spheres[1] = {physx::PxVec4(physx::PxVec3(0.f, 10.f, -1.f) + offset,1.5)}; - mClothActor[index]->mCloth->setSpheres(nv::cloth::Range<physx::PxVec4>(spheres, spheres + 1), 0, mClothActor[index]->mCloth->getNumSpheres()); + //mClothActor[index]->mCloth->setSpheres(nv::cloth::Range<physx::PxVec4>(spheres, spheres + 1), 0, mClothActor[index]->mCloth->getNumSpheres()); + mClothActor[index]->mCloth->setSpheres(nv::cloth::Range<physx::PxVec4>(spheres, spheres + 1), nv::cloth::Range<physx::PxVec4>(spheres, spheres + 1)); + // Setup phase configs std::vector<nv::cloth::PhaseConfig> phases(mFabric[index]->getNumPhases()); diff --git a/NvCloth/samples/SampleBase/task/PxTask.h b/NvCloth/samples/SampleBase/task/PxTask.h index 85d91da..e2b19e2 100644 --- a/NvCloth/samples/SampleBase/task/PxTask.h +++ b/NvCloth/samples/SampleBase/task/PxTask.h @@ -32,7 +32,6 @@ #include "task/PxTaskManager.h" #include "task/PxCpuDispatcher.h" #include "task/PxGpuDispatcher.h" -#include "foundation/PxAssert.h" namespace physx { @@ -117,7 +116,7 @@ public: //! \brief Release method implementation virtual void release() { - PX_ASSERT(mTm); + NV_CLOTH_ASSERT(mTm); // clear mTm before calling taskCompleted() for safety PxTaskManager* save = mTm; @@ -129,7 +128,7 @@ public: // task is allowed to start. PX_INLINE void finishBefore( PxTaskID taskID ) { - PX_ASSERT(mTm); + NV_CLOTH_ASSERT(mTm); mTm->finishBefore( *this, taskID); } @@ -137,7 +136,7 @@ public: // task has completed. PX_INLINE void startAfter( PxTaskID taskID ) { - PX_ASSERT(mTm); + NV_CLOTH_ASSERT(mTm); mTm->startAfter( *this, taskID ); } @@ -147,7 +146,7 @@ public: */ PX_INLINE void addReference() { - PX_ASSERT(mTm); + NV_CLOTH_ASSERT(mTm); mTm->addReference( mTaskID ); } @@ -157,7 +156,7 @@ public: */ PX_INLINE void removeReference() { - PX_ASSERT(mTm); + NV_CLOTH_ASSERT(mTm); mTm->decrReference( mTaskID ); } @@ -244,7 +243,7 @@ public: */ PX_INLINE void setContinuation(PxTaskManager& tm, PxBaseTask* c) { - PX_ASSERT( mRefCount == 0 ); + NV_CLOTH_ASSERT( mRefCount == 0 ); mRefCount = 1; mCont = c; mTm = &tm; @@ -263,15 +262,15 @@ public: */ PX_INLINE void setContinuation( PxBaseTask* c ) { - PX_ASSERT( c ); - PX_ASSERT( mRefCount == 0 ); + NV_CLOTH_ASSERT( c ); + NV_CLOTH_ASSERT( mRefCount == 0 ); mRefCount = 1; mCont = c; if( mCont ) { mCont->addReference(); mTm = mCont->getTaskManager(); - PX_ASSERT( mTm ); + NV_CLOTH_ASSERT( mTm ); } } diff --git a/NvCloth/samples/SampleBase/utils/CallbackImplementations.cpp b/NvCloth/samples/SampleBase/utils/CallbackImplementations.cpp index 0a257ba..3d00961 100644 --- a/NvCloth/samples/SampleBase/utils/CallbackImplementations.cpp +++ b/NvCloth/samples/SampleBase/utils/CallbackImplementations.cpp @@ -16,8 +16,6 @@ #include <d3d11.h> //#endif -#include <PsThread.h> - NvClothEnvironment* NvClothEnvironment::sEnv = nullptr; @@ -52,9 +50,6 @@ DxContextManagerCallbackImpl::DxContextManagerCallbackImpl(ID3D11Device* device, { mDevice->AddRef(); mDevice->GetImmediateContext(&mContext); -#ifdef _DEBUG - mLockCountTls = physx::shdfnd::TlsAlloc(); -#endif } DxContextManagerCallbackImpl::~DxContextManagerCallbackImpl() { @@ -72,24 +67,15 @@ DxContextManagerCallbackImpl::~DxContextManagerCallbackImpl() mDevice->Release(); -#if _DEBUG - physx::shdfnd::TlsFree(mLockCountTls); -#endif } void DxContextManagerCallbackImpl::acquireContext() { mMutex.lock(); -#if _DEBUG - physx::shdfnd::TlsSet(mLockCountTls, reinterpret_cast<void*>(reinterpret_cast<intptr_t>(physx::shdfnd::TlsGet(mLockCountTls)) + 1)); -#endif } void DxContextManagerCallbackImpl::releaseContext() { -#if _DEBUG - physx::shdfnd::TlsSet(mLockCountTls, reinterpret_cast<void*>(reinterpret_cast<intptr_t>(physx::shdfnd::TlsGet(mLockCountTls)) - 1)); -#endif mMutex.unlock(); } ID3D11Device* DxContextManagerCallbackImpl::getDevice() const @@ -98,9 +84,6 @@ ID3D11Device* DxContextManagerCallbackImpl::getDevice() const } ID3D11DeviceContext* DxContextManagerCallbackImpl::getContext() const { -#if _DEBUG - assert(reinterpret_cast<intptr_t>(physx::shdfnd::TlsGet(mLockCountTls)) > 0); -#endif return mContext; } bool DxContextManagerCallbackImpl::synchronizeResources() const diff --git a/NvCloth/samples/SampleBase/utils/CallbackImplementations.h b/NvCloth/samples/SampleBase/utils/CallbackImplementations.h index 38a4b17..214f689 100644 --- a/NvCloth/samples/SampleBase/utils/CallbackImplementations.h +++ b/NvCloth/samples/SampleBase/utils/CallbackImplementations.h @@ -12,7 +12,6 @@ #include <NvCloth/Callbacks.h> #include <foundation/PxAllocatorCallback.h> #include <foundation/PxErrorCallback.h> -#include <foundation/PxAssert.h> #include <foundation/PxProfiler.h> #include <vector> diff --git a/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.cpp b/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.cpp index a0c0d3a..c3781c2 100644 --- a/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.cpp +++ b/NvCloth/samples/SampleBase/utils/ClothMeshGenerator.cpp @@ -10,7 +10,7 @@ #include "ClothMeshGenerator.h" -#include "PsMathUtils.h" +#include <NvCloth/ps/PsMathUtils.h> #include <fstream> #include <iterator> diff --git a/NvCloth/samples/compiler/cmake/SampleBase.cmake b/NvCloth/samples/compiler/cmake/SampleBase.cmake index b552bb7..a1fdb67 100644 --- a/NvCloth/samples/compiler/cmake/SampleBase.cmake +++ b/NvCloth/samples/compiler/cmake/SampleBase.cmake @@ -5,6 +5,9 @@ MESSAGE("SampleBase.cmake [begin]") MESSAGE("CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH}) +SET(NVCLOTH_ROOT_DIR ${GW_DEPS_ROOT}/NvCloth) + +MESSAGE("NVCLOTH_ROOT_DIR: " ${NVCLOTH_ROOT_DIR}) SET(SB_SOURCE_DIR ${PROJECT_SOURCE_DIR}/SampleBase) SET(SB_CORE_SOURCE_DIR ${SB_SOURCE_DIR}/core) @@ -14,7 +17,6 @@ SET(SB_UI_SOURCE_DIR ${SB_SOURCE_DIR}/ui) SET(SB_UTILS_SOURCE_DIR ${SB_SOURCE_DIR}/utils) SET(SB_TASK_SOURCE_DIR ${SB_SOURCE_DIR}/task) -FIND_PACKAGE(PxShared "1.0.21467209.1" REQUIRED) FIND_PACKAGE(DXUT "9.15.2016.1" REQUIRED) FIND_PACKAGE(DirectXTex "10.5.2016.2" REQUIRED) FIND_PACKAGE(imgui "1.49" REQUIRED) @@ -152,7 +154,8 @@ SET(UTIL_FILES ${SB_UTILS_SOURCE_DIR}/MeshGenerator.h ${SB_UTILS_SOURCE_DIR}/DataStream.cpp ${SB_UTILS_SOURCE_DIR}/DataStream.h - + ${SB_UTILS_SOURCE_DIR}/AnimatedModelUtilities.cpp + ${SB_UTILS_SOURCE_DIR}/AnimatedModelUtilities.h ) SET(TASK_FILES @@ -243,11 +246,10 @@ TARGET_LINK_LIBRARIES(SampleBase PUBLIC d3dcompiler.lib d3d11.lib dxgi.lib comctl32.lib PUBLIC ${HBAO_LIB} ${SHADOW_LIB} ${DXUT_LIBRARIES} ${DIRECTXTEX_LIBRARIES} ${ASSIMP_LIBRARIES}) -TARGET_LINK_LIBRARIES(SampleBase PUBLIC PxFoundation) TARGET_LINK_LIBRARIES(SampleBase PUBLIC NvCloth) TARGET_LINK_LIBRARIES(SampleBase PUBLIC ${CUDA_CUDA_LIBRARY}) SET_TARGET_PROPERTIES(SampleBase PROPERTIES LINK_FLAGS ${SAMPLEBASE_LINK_FLAGS}) include(${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/SampleBase-AT.cmake OPTIONAL) -MESSAGE("SampleBase.cmake [end]")
\ No newline at end of file +MESSAGE("SampleBase.cmake [end]") diff --git a/NvCloth/samples/compiler/cmake/windows/CMakeLists.txt b/NvCloth/samples/compiler/cmake/windows/CMakeLists.txt index a7dc6b2..906fe15 100644 --- a/NvCloth/samples/compiler/cmake/windows/CMakeLists.txt +++ b/NvCloth/samples/compiler/cmake/windows/CMakeLists.txt @@ -3,17 +3,26 @@ MESSAGE("Windows/CMakeLists.txt [begin]") SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) +SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}NvCloth/Externals/CMakeModules) - -IF(EXISTS $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) -ELSE() - SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; $ENV{GW_DEPS_ROOT}/sw/physx/tools/CMakeModules) +# Add find modules to the path +IF(NOT EXISTS ${CMAKE_MODULE_PATH}) + MESSAGE(FATAL_ERROR "Could not find CMakeModules at ${CMAKE_MODULE_PATH}") ENDIF() -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/..") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeModules") -MESSAGE("CMAKE_MODULE_PATH: " ${CMAKE_MODULE_PATH}) + +IF(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeModules") + MESSAGE(FATAL_ERROR "Could not find CMakeModules at ${CMAKE_CURRENT_SOURCE_DIR}/external/CMakeModules") +ENDIF() + +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "$ENV{GW_DEPS_ROOT}/NvCloth") + +IF(NOT EXISTS "$ENV{GW_DEPS_ROOT}/NvCloth") + MESSAGE(FATAL_ERROR "Could not find CMakeModules for FindNvCloth.cmake at $ENV{GW_DEPS_ROOT}/NvCloth") +ENDIF() + +MESSAGE( "[samples]windows/CMakeLists.txt CMAKE_MODULE_PATH = ${CMAKE_MODULE_PATH}") #NOTE: Warnings lowered on the sample projects as it's got a lot of warnings. Defines below hide more. SET(CMAKE_CXX_FLAGS "/GR- /GF /MP /Gy /EHsc /d2Zi+ /errorReport:prompt /fp:fast /Gd /Gm- /GS- /nologo /W3 /WX /Zc:forScope /Zc:inline /Zc:wchar_t /Zi") @@ -59,21 +68,13 @@ SET(CMAKE_PROFILE_POSTFIX "${CMAKE_PROFILE_POSTFIX}_${LIBPATH_SUFFIX}") SET(CMAKE_CHECKED_POSTFIX "${CMAKE_CHECKED_POSTFIX}_${LIBPATH_SUFFIX}") SET(CMAKE_RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}_${LIBPATH_SUFFIX}") -SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/../../../..") +SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}; "${CMAKE_CURRENT_SOURCE_DIR}/../../../../..") SET(PX_SELECT_COMPONENTS PxFoundation) FIND_PACKAGE(PxShared REQUIRED) FIND_PACKAGE(NvCloth REQUIRED) - -# Include the PxShared-exports.cmake file that PxShared created. There's other ways to do this, but there's a bunch of issues with it in a CI environment -# such as - we don't want to be installing any built artifacts on this server, etc. So for now we hack it. - -# Add PxShared as a dependency so that we can use project references -#ADD_SUBDIRECTORY(${PXSHARED_ROOT_DIR}/src/compiler/cmake/windows "${CMAKE_CURRENT_BINARY_DIR}/pxshared_bin") -#MESSAGE("NVCLOTH_ROOT_DIR = ${NVCLOTH_ROOT_DIR}") ADD_SUBDIRECTORY(${NVCLOTH_ROOT_DIR}/compiler/cmake/windows "${CMAKE_CURRENT_BINARY_DIR}/NvCloth_bin") - # Include all of the projects INCLUDE(${PROJECT_CMAKE_FILES_DIR}/SampleBase.cmake) diff --git a/NvCloth/samples/compiler/cmake/windows/SampleBase-AT.cmake b/NvCloth/samples/compiler/cmake/windows/SampleBase-AT.cmake index 0673b96..e445e2a 100644 --- a/NvCloth/samples/compiler/cmake/windows/SampleBase-AT.cmake +++ b/NvCloth/samples/compiler/cmake/windows/SampleBase-AT.cmake @@ -16,5 +16,10 @@ ADD_CUSTOM_COMMAND(TARGET SampleBase POST_BUILD ${D3DCOMPILER_DLL} ${BL_EXE_OUTPUT_DIR} ) +#ADD_CUSTOM_COMMAND(TARGET SampleBase POST_BUILD +# COMMAND ${CMAKE_COMMAND} -E copy_if_different +# ${ASSIMP_DLLS} +# ${BL_EXE_OUTPUT_DIR} +#) -MESSAGE("Windows/SampleBase.cmake [end]")
\ No newline at end of file +MESSAGE("Windows/SampleBase.cmake [end]") diff --git a/NvCloth/samples/compiler/cmake/windows/SampleBase.cmake b/NvCloth/samples/compiler/cmake/windows/SampleBase.cmake index 46b865a..d98f49e 100644 --- a/NvCloth/samples/compiler/cmake/windows/SampleBase.cmake +++ b/NvCloth/samples/compiler/cmake/windows/SampleBase.cmake @@ -3,7 +3,7 @@ # MESSAGE("Windows/SampleBase.cmake [begin]") -FIND_PACKAGE(CUDA 8 REQUIRED) +FIND_PACKAGE(CUDA 10 REQUIRED) SET(SAMPLEBASE_PLATFORM_COMMON_FILES ) @@ -35,6 +35,7 @@ if (CMAKE_CL_64) SET(D3DCOMPILER_DLL "\"$(VC_ExecutablePath_x64_x64)/d3dcompiler_47.dll\"") +# SET(ASSIMP_DLLS ${ASSIMP_DLL_PATH}/Release/assimp-vc140-mt.dll) else() SET(SHADOW_LIB ${NVCLOTH_ROOT_DIR}/samples/external/shadow_lib/GFSDK_ShadowLib_DX11.win32.lib) SET(SHADOW_DLLS ${NVCLOTH_ROOT_DIR}/samples/external/shadow_lib/GFSDK_ShadowLib_DX11.win32.dll) @@ -44,7 +45,8 @@ else() SET(D3DCOMPILER_DLL "\"$(VC_ExecutablePath_x86_x86)/d3dcompiler_47.dll\"") +# SET(ASSIMP_DLLS ${ASSIMP_DLL_PATH}/Release/assimp-vc140-mt.dll) endif() -MESSAGE("Windows/SampleBase.cmake [end]")
\ No newline at end of file +MESSAGE("Windows/SampleBase.cmake [end]") diff --git a/NvCloth/samples/external/CMakeModules/FindPxShared.cmake b/NvCloth/samples/external/CMakeModules/FindPxShared.cmake index a252b47..3297996 100644 --- a/NvCloth/samples/external/CMakeModules/FindPxShared.cmake +++ b/NvCloth/samples/external/CMakeModules/FindPxShared.cmake @@ -10,7 +10,7 @@ FIND_PATH( PXSHARED_ROOT_DIR include/foundation/Px.h ${GW_DEPS_ROOT}/sw/physx/PxShared/1.0/trunk NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - + INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(PxShared DEFAULT_MSG PXSHARED_ROOT_DIR) diff --git a/NvCloth/scripts/locate_cuda.bat b/NvCloth/scripts/locate_cuda.bat index c6d7052..8348aad 100644 --- a/NvCloth/scripts/locate_cuda.bat +++ b/NvCloth/scripts/locate_cuda.bat @@ -2,7 +2,7 @@ setlocal enabledelayedexpansion rem use the following 2 lines to manually point to the google test folder \\sw\%FOLDER_NEEDLE% -set FOLDER=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0 +set FOLDER=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0 goto :manualfolder set FOLDER_NEEDLE=physx\externals\CUDA\8.0.44 @@ -15,4 +15,4 @@ set "returnVal=%FOLDER:\=/%" ( endlocal set "%~1=%returnVal%" ) -goto :eof
\ No newline at end of file +goto :eof diff --git a/NvCloth/scripts/locate_gw_root.bat b/NvCloth/scripts/locate_gw_root.bat index f8a9c2a..9d73032 100644 --- a/NvCloth/scripts/locate_gw_root.bat +++ b/NvCloth/scripts/locate_gw_root.bat @@ -11,9 +11,9 @@ rem set FOLDER_NEEDLE=NvCloth\src call "%~dp0/locate.bat" FOLDER %FOLDER_NEEDLE% :manualfolder -set returnVal=%FOLDER%\..\..\ +set returnVal=%FOLDER%\..\..\..\..\..\..\..\ ( endlocal set "%~1=%returnVal%" ) -goto :eof
\ No newline at end of file +goto :eof diff --git a/NvCloth/src/ClothImpl.h b/NvCloth/src/ClothImpl.h index 6686cd7..de8ac97 100644 --- a/NvCloth/src/ClothImpl.h +++ b/NvCloth/src/ClothImpl.h @@ -35,7 +35,7 @@ #include <foundation/PxVec3.h> #include "IndexPair.h" #include "MovingAverage.h" -#include <PsMathUtils.h> +#include "NvCloth/ps/PsMathUtils.h" #include <cmath> namespace nv diff --git a/NvCloth/src/IterationState.h b/NvCloth/src/IterationState.h index be046b5..85bfacc 100644 --- a/NvCloth/src/IterationState.h +++ b/NvCloth/src/IterationState.h @@ -34,9 +34,9 @@ #include <foundation/PxVec3.h> #include <foundation/PxMat44.h> #include <foundation/PxMat33.h> -#include <PsMathUtils.h> #include "Vec4T.h" #include <algorithm> +#include "NvCloth/ps/PsMathUtils.h" namespace nv { diff --git a/NvCloth/src/PhaseConfig.cpp b/NvCloth/src/PhaseConfig.cpp index b5db3b0..3397d5d 100644 --- a/NvCloth/src/PhaseConfig.cpp +++ b/NvCloth/src/PhaseConfig.cpp @@ -28,7 +28,7 @@ // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. #include "NvCloth/PhaseConfig.h" -#include "PsMathUtils.h" +#include "NvCloth/ps/PsMathUtils.h" #include <algorithm> #include "ClothImpl.h" diff --git a/NvCloth/src/SwClothData.cpp b/NvCloth/src/SwClothData.cpp index 84d85d4..d346d98 100644 --- a/NvCloth/src/SwClothData.cpp +++ b/NvCloth/src/SwClothData.cpp @@ -31,7 +31,7 @@ #include "SwCloth.h" #include "SwFabric.h" #include <foundation/Px.h> -#include <PsUtilities.h> +#include "ps/PsUtilities.h" using namespace physx; using namespace nv; diff --git a/NvCloth/src/SwCollision.cpp b/NvCloth/src/SwCollision.cpp index bd6cf7a..5c1466c 100644 --- a/NvCloth/src/SwCollision.cpp +++ b/NvCloth/src/SwCollision.cpp @@ -36,7 +36,7 @@ #include "SwCollisionHelpers.h" #include <foundation/PxProfiler.h> #include <cstring> // for memset -#include <PsSort.h> +#include "ps/PsSort.h" using namespace nv; using namespace physx; diff --git a/NvCloth/src/SwFabric.cpp b/NvCloth/src/SwFabric.cpp index b8d617f..bf4b110 100644 --- a/NvCloth/src/SwFabric.cpp +++ b/NvCloth/src/SwFabric.cpp @@ -29,10 +29,10 @@ #include "SwFabric.h" #include "SwFactory.h" -#include "PsSort.h" +#include "ps/PsSort.h" #include "limits.h" // for USHRT_MAX #include <algorithm> -#include "PsUtilities.h" +#include "../../src/ps/PsUtilities.h" using namespace nv; using namespace physx; diff --git a/NvCloth/src/SwFabric.h b/NvCloth/src/SwFabric.h index 29d0921..da2b9b5 100644 --- a/NvCloth/src/SwFabric.h +++ b/NvCloth/src/SwFabric.h @@ -57,7 +57,7 @@ class SwFabric : public Fabric #endif SwFabric(SwFactory& factory, uint32_t numParticles, Range<const uint32_t> phasesIndices, Range<const uint32_t> sets, - Range<const float> restvalues, Range<const float> stiffnessValues, Range<const uint32_t> indices, Range<const uint32_t> anchors, + Range<const float> restvalues, Range<const float> stiffnessValues, Range<const uint32_t> indices, Range<const uint32_t> anchors, Range<const float> tetherLengths, Range<const uint32_t> triangles, uint32_t id); SwFabric& operator = (const SwFabric&); diff --git a/NvCloth/src/SwFactory.cpp b/NvCloth/src/SwFactory.cpp index 5c4b625..de4ff3b 100644 --- a/NvCloth/src/SwFactory.cpp +++ b/NvCloth/src/SwFactory.cpp @@ -55,12 +55,12 @@ cloth::SwFactory::~SwFactory() } cloth::Fabric* cloth::SwFactory::createFabric(uint32_t numParticles, Range<const uint32_t> phaseIndices, - Range<const uint32_t> sets, Range<const float> restvalues, Range<const float> stiffnessValues, - Range<const uint32_t> indices, Range<const uint32_t> anchors, + Range<const uint32_t> sets, Range<const float> restvalues, Range<const float> stiffnessValues, + Range<const uint32_t> indices, Range<const uint32_t> anchors, Range<const float> tetherLengths, Range<const uint32_t> triangles) { return NV_CLOTH_NEW(SwFabric)(*this, numParticles, phaseIndices, sets, restvalues, stiffnessValues, indices, anchors, tetherLengths, triangles, - getNextFabricId()); + getNextFabricId()); } cloth::Cloth* cloth::SwFactory::createCloth(Range<const PxVec4> particles, Fabric& fabric) diff --git a/NvCloth/src/SwFactory.h b/NvCloth/src/SwFactory.h index 4cbee0c..183efb9 100644 --- a/NvCloth/src/SwFactory.h +++ b/NvCloth/src/SwFactory.h @@ -56,7 +56,7 @@ class SwFactory : public Factory virtual Platform getPlatform() const { return Platform::CPU; } virtual Fabric* createFabric(uint32_t numParticles, Range<const uint32_t> phaseIndices, Range<const uint32_t> sets, - Range<const float> restvalues, Range<const float> stiffnessValues, Range<const uint32_t> indices, + Range<const float> restvalues, Range<const float> stiffnessValues, Range<const uint32_t> indices, Range<const uint32_t> anchors, Range<const float> tetherLengths, Range<const uint32_t> triangles); diff --git a/NvCloth/src/SwInterCollision.cpp b/NvCloth/src/SwInterCollision.cpp index bc46ea6..efa57ba 100644 --- a/NvCloth/src/SwInterCollision.cpp +++ b/NvCloth/src/SwInterCollision.cpp @@ -34,7 +34,7 @@ #include <foundation/PxMat44.h> #include <foundation/PxBounds3.h> #include <algorithm> -#include <PsSort.h> +#include "ps/PsSort.h" #include "NvCloth/Allocator.h" using namespace nv; diff --git a/NvCloth/src/SwSolver.cpp b/NvCloth/src/SwSolver.cpp index f0f9152..a1f0cf8 100644 --- a/NvCloth/src/SwSolver.cpp +++ b/NvCloth/src/SwSolver.cpp @@ -36,8 +36,8 @@ #include "SwClothData.h" #include "SwSolverKernel.h" #include "SwInterCollision.h" -#include <PsFPU.h> -#include <PsSort.h> +#include "ps/PsFPU.h" +#include "ps/PsSort.h" using namespace physx; diff --git a/NvCloth/src/TripletScheduler.cpp b/NvCloth/src/TripletScheduler.cpp index 0116200..10ad430 100644 --- a/NvCloth/src/TripletScheduler.cpp +++ b/NvCloth/src/TripletScheduler.cpp @@ -29,7 +29,7 @@ #include "TripletScheduler.h" #include <algorithm> -#include <PsUtilities.h> +#include "../../src/ps/PsUtilities.h" using namespace physx; using namespace nv; diff --git a/NvCloth/src/cuda/CuCollision.h b/NvCloth/src/cuda/CuCollision.h index f9b69f7..d17e735 100644 --- a/NvCloth/src/cuda/CuCollision.h +++ b/NvCloth/src/cuda/CuCollision.h @@ -310,6 +310,7 @@ __device__ void CuCollision::buildSphereAcceleration(const CollisionData& data) { if (threadIdx.x >= 192) return; + unsigned int mask = __ballot_sync(0xffffffff, !(threadIdx.x >= 192)); int32_t sphereIdx = threadIdx.x & 31; int32_t axisIdx = threadIdx.x >> 6; // coordinate index (x, y, or z) @@ -325,7 +326,7 @@ __device__ void CuCollision::buildSphereAcceleration(const CollisionData& data) Pointer<Shared, uint32_t> dst = mShapeGrid + sGridSize * axisIdx; // #pragma unroll for (int32_t i = 0; i < sGridSize; ++i, ++index) - dst[i] |= __ballot(int32_t(index) <= 0); + dst[i] |= __ballot_sync(mask, int32_t(index) <= 0); } // generate cone masks from sphere masks @@ -333,7 +334,7 @@ __device__ void CuCollision::buildConeAcceleration() { if (threadIdx.x >= 192) return; - + unsigned int mask = __ballot_sync(0xffffffff, !(threadIdx.x >= 192)); int32_t coneIdx = threadIdx.x & 31; uint32_t sphereMask = @@ -345,7 +346,7 @@ __device__ void CuCollision::buildConeAcceleration() // #pragma unroll for (int32_t i = 0; i < sGridSize; ++i) - dst[i] |= __ballot(src[i] & sphereMask); + dst[i] |= __ballot_sync(mask,src[i] & sphereMask); } // convert right/left mask arrays into single overlap array @@ -366,17 +367,17 @@ __device__ void CuCollision::mergeAcceleration() namespace { #if __CUDA_ARCH__ >= 300 -__device__ float mergeBounds(Pointer<Shared, float> buffer) +__device__ float mergeBounds(unsigned int mask, Pointer<Shared, float> buffer) { float value = *buffer; - value = max(value, __shfl_down(value, 1)); - value = max(value, __shfl_down(value, 2)); - value = max(value, __shfl_down(value, 4)); - value = max(value, __shfl_down(value, 8)); - return max(value, __shfl_down(value, 16)); + value = max(value, __shfl_down_sync(mask, value, 1)); + value = max(value, __shfl_down_sync(mask, value, 2)); + value = max(value, __shfl_down_sync(mask, value, 4)); + value = max(value, __shfl_down_sync(mask, value, 8)); + return max(value, __shfl_down_sync(mask, value, 16)); } #else -__device__ float mergeBounds(Pointer<Shared, float> buffer) +__device__ float mergeBounds(unsigned int mask, Pointer<Shared, float> buffer) { // ensure that writes to buffer are visible to all threads __threadfence_block(); @@ -393,6 +394,7 @@ __device__ float mergeBounds(Pointer<Shared, float> buffer) __device__ float computeSphereBounds(const CuCollision::CollisionData& data, Pointer<Shared, float> buffer) { assert(threadIdx.x < 192); + unsigned int mask = __ballot_sync(0xffffffff, threadIdx.x < 192); int32_t sphereIdx = min(threadIdx.x & 31, gClothData.mNumSpheres - 1); // sphere index int32_t axisIdx = threadIdx.x >> 6; // coordinate index (x, y, or z) @@ -401,7 +403,7 @@ __device__ float computeSphereBounds(const CuCollision::CollisionData& data, Poi *buffer = data.mSphereW[sphereIdx] + signf * data.mSphereX[sphereIdx + gClothData.mNumSpheres * axisIdx]; - return mergeBounds(buffer); + return mergeBounds(mask, buffer); } #if __CUDA_ARCH__ >= 300 @@ -415,6 +417,7 @@ __device__ float computeParticleBounds(const CurrentT& current, Pointer<Shared, if (threadIdxInAxis < numThreadsPerAxis) { + unsigned int mask = __ballot_sync(0xffffffff, threadIdxInAxis < numThreadsPerAxis); typename CurrentT::ConstPointerType posIt = current[axis]; int32_t i = min(threadIdxInAxis, gClothData.mNumParticles - 1); float minX = posIt[i], maxX = minX; @@ -425,16 +428,16 @@ __device__ float computeParticleBounds(const CurrentT& current, Pointer<Shared, maxX = max(maxX, posX); } - minX = min(minX, __shfl_down(minX, 1)); - maxX = max(maxX, __shfl_down(maxX, 1)); - minX = min(minX, __shfl_down(minX, 2)); - maxX = max(maxX, __shfl_down(maxX, 2)); - minX = min(minX, __shfl_down(minX, 4)); - maxX = max(maxX, __shfl_down(maxX, 4)); - minX = min(minX, __shfl_down(minX, 8)); - maxX = max(maxX, __shfl_down(maxX, 8)); - minX = min(minX, __shfl_down(minX, 16)); - maxX = max(maxX, __shfl_down(maxX, 16)); + minX = min(minX, __shfl_down_sync(mask,minX, 1)); + maxX = max(maxX, __shfl_down_sync(mask,maxX, 1)); + minX = min(minX, __shfl_down_sync(mask,minX, 2)); + maxX = max(maxX, __shfl_down_sync(mask,maxX, 2)); + minX = min(minX, __shfl_down_sync(mask,minX, 4)); + maxX = max(maxX, __shfl_down_sync(mask,maxX, 4)); + minX = min(minX, __shfl_down_sync(mask,minX, 8)); + maxX = max(maxX, __shfl_down_sync(mask,maxX, 8)); + minX = min(minX, __shfl_down_sync(mask,minX, 16)); + maxX = max(maxX, __shfl_down_sync(mask,maxX, 16)); if (!laneIdx) { @@ -448,7 +451,7 @@ __device__ float computeParticleBounds(const CurrentT& current, Pointer<Shared, if (threadIdx.x >= 192) return 0.0f; - + unsigned int mask = __ballot_sync(0xffffffff, !(threadIdx.x >= 192)); float value = *buffer; if (laneIdx >= (numThreadsPerAxis >> 5)) value = -FLT_MAX; @@ -456,10 +459,10 @@ __device__ float computeParticleBounds(const CurrentT& current, Pointer<Shared, // blockDim.x <= 3 * 512, increase to 3 * 1024 by adding a shfl by 16 assert(numThreadsPerAxis <= 16 * 32); - value = max(value, __shfl_down(value, 1)); - value = max(value, __shfl_down(value, 2)); - value = max(value, __shfl_down(value, 4)); - return max(value, __shfl_down(value, 8)); + value = max(value, __shfl_down_sync(mask,value, 1)); + value = max(value, __shfl_down_sync(mask,value, 2)); + value = max(value, __shfl_down_sync(mask,value, 4)); + return max(value, __shfl_down_sync(mask,value, 8)); } #else template <typename CurrentT> @@ -467,6 +470,7 @@ __device__ float computeParticleBounds(const CurrentT& current, Pointer<Shared, { if (threadIdx.x >= 192) return 0.0f; + unsigned int mask = __ballot_sync(0xffffffff, !(threadIdx.x >= 192)); int32_t axisIdx = threadIdx.x >> 6; // x, y, or z int32_t signi = threadIdx.x << 26; // sign bit (min or max) @@ -480,7 +484,7 @@ __device__ float computeParticleBounds(const CurrentT& current, Pointer<Shared, while (pIt += 32, pIt < pEnd) *buffer = max(*buffer, *pIt * signf); - return mergeBounds(buffer); + return mergeBounds(mask, buffer); } #endif } diff --git a/NvCloth/src/cuda/CuDeviceVector.h b/NvCloth/src/cuda/CuDeviceVector.h index 4d97e5d..0fabb66 100644 --- a/NvCloth/src/cuda/CuDeviceVector.h +++ b/NvCloth/src/cuda/CuDeviceVector.h @@ -30,8 +30,8 @@ #pragma once #include "CuDevicePointer.h" -#include "PsArray.h" -#include "PsUtilities.h" +#include "NvCloth/ps/PsArray.h" +#include "../ps/PsUtilities.h" #include <algorithm> namespace nv diff --git a/NvCloth/src/cuda/CuFabric.cpp b/NvCloth/src/cuda/CuFabric.cpp index 6794fa5..48cc0ba 100644 --- a/NvCloth/src/cuda/CuFabric.cpp +++ b/NvCloth/src/cuda/CuFabric.cpp @@ -30,7 +30,7 @@ #include "CuFabric.h" #include "CuContextLock.h" #include "CuFactory.h" -#include <PsUtilities.h> +#include "../ps/PsUtilities.h" #include <limits.h> using namespace physx; diff --git a/NvCloth/src/cuda/CuFactory.h b/NvCloth/src/cuda/CuFactory.h index 3ff5752..8fae913 100644 --- a/NvCloth/src/cuda/CuFactory.h +++ b/NvCloth/src/cuda/CuFactory.h @@ -30,7 +30,7 @@ #pragma once #include "NvCloth/Factory.h" -#include <PsArray.h> +#include "NvCloth/ps/PsArray.h" #include <foundation/PxVec4.h> #include <foundation/PxVec3.h> #include <cuda.h> diff --git a/NvCloth/src/cuda/CuSelfCollision.h b/NvCloth/src/cuda/CuSelfCollision.h index 19d2723..32aa139 100644 --- a/NvCloth/src/cuda/CuSelfCollision.h +++ b/NvCloth/src/cuda/CuSelfCollision.h @@ -39,7 +39,7 @@ namespace { -#if __CUDA_ARCH__ >= 300 +/*#if __CUDA_ARCH__ >= 300 template <int> __device__ void scanWarp(Pointer<Shared, int32_t> counts) { @@ -60,7 +60,7 @@ __device__ void scanWarp(Pointer<Shared, int32_t> counts) : "+r"(*generic(counts)) :); } -#else +#else*/ template <int stride> __device__ void scanWarp(Pointer<Shared, int32_t> counts) { @@ -77,7 +77,7 @@ __device__ void scanWarp(Pointer<Shared, int32_t> counts) if (laneIdx >= 16) *ptr += ptr[-16 * stride]; } -#endif +//#endif // sorts array by upper 16bits // [keys] must be at least 2 * n in length, in/out in first n elements @@ -112,10 +112,10 @@ __device__ void radixSort(int32_t* keys, int32_t n, Pointer<Shared, int32_t> his for (int32_t i = startIndex; i < endIndex; i += 32) { int32_t key = i < n ? srcKeys[i] >> p : 15; - uint32_t ballot1 = __ballot(key & 1); - uint32_t ballot2 = __ballot(key & 2); - uint32_t ballot4 = __ballot(key & 4); - uint32_t ballot8 = __ballot(key & 8); + uint32_t ballot1 = __ballot_sync(0xffffffff,key & 1); + uint32_t ballot2 = __ballot_sync(0xffffffff,key & 2); + uint32_t ballot4 = __ballot_sync(0xffffffff,key & 4); + uint32_t ballot8 = __ballot_sync(0xffffffff,key & 8); warpCount += __popc((mask1 ^ ballot1) & (mask2 ^ ballot2) & (mask4 ^ ballot4) & (mask8 ^ ballot8)); } @@ -147,10 +147,10 @@ __device__ void radixSort(int32_t* keys, int32_t n, Pointer<Shared, int32_t> his for (int32_t i = startIndex; i < endIndex; i += 32) { int32_t key = i < n ? srcKeys[i] >> p : 15; - uint32_t ballot1 = __ballot(key & 1); - uint32_t ballot2 = __ballot(key & 2); - uint32_t ballot4 = __ballot(key & 4); - uint32_t ballot8 = __ballot(key & 8); + uint32_t ballot1 = __ballot_sync(0xffffffff,key & 1); + uint32_t ballot2 = __ballot_sync(0xffffffff,key & 2); + uint32_t ballot4 = __ballot_sync(0xffffffff,key & 4); + uint32_t ballot8 = __ballot_sync(0xffffffff,key & 8); uint32_t bits = ((key & 1) - 1 ^ ballot1) & (!!(key & 2) - 1 ^ ballot2) & (!!(key & 4) - 1 ^ ballot4) & (!!(key & 8) - 1 ^ ballot8); int32_t index = hIt[key & 15] + __popc(bits & laneMask); diff --git a/NvCloth/src/cuda/CuSolver.cpp b/NvCloth/src/cuda/CuSolver.cpp index 7ef1d32..86f32b3 100644 --- a/NvCloth/src/cuda/CuSolver.cpp +++ b/NvCloth/src/cuda/CuSolver.cpp @@ -36,7 +36,7 @@ #include "CuContextLock.h" #include "CuCheckSuccess.h" #include "../IterationState.h" -#include <PsSort.h> +#include "../Ps/PsSort.h" #include <foundation/PxProfiler.h> #if NV_NVTX @@ -489,8 +489,9 @@ void cloth::CuSolver::beginFrame() uint32_t numThreadsPerBlock = mFactory.mMaxThreadsPerBlock / numClothsPerSM & ~31; if (mFactory.mNumThreadsPerBlock != numThreadsPerBlock) { - checkSuccess( - cuFuncSetBlockShape(mKernelFunction, int(mFactory.mNumThreadsPerBlock = numThreadsPerBlock), 1, 1)); + mFactory.mNumThreadsPerBlock = numThreadsPerBlock; + //checkSuccess( + // cuFuncSetBlockShape(mKernelFunction, int(mFactory.mNumThreadsPerBlock = numThreadsPerBlock), 1, 1)); } // remember num cloths per SM in terms of max shared memory per block diff --git a/NvCloth/src/cuda/CuSolverKernel.cu b/NvCloth/src/cuda/CuSolverKernel.cu index 1ad5896..86f038d 100644 --- a/NvCloth/src/cuda/CuSolverKernel.cu +++ b/NvCloth/src/cuda/CuSolverKernel.cu @@ -851,7 +851,7 @@ __device__ void applyImpulse(SharedParticleData::ParticleReferenceType pos, cons float scale = -pos.mReferences[3]; #if CONVERT_ADDRESSES - //Use this instead of atomicAdd function to work around compiler issue treating the pointer as global memory instead of shared memory + // Use this instead of atomicAdd function to work around compiler issue treating the pointer as global memory instead of shared memory asm("red.shared.add.f32 [%0], %1;" ::POINTER_CONSTRAINT(pos.mReferences[0].mPtr), "f"(impulse.x * scale)); asm("red.shared.add.f32 [%0], %1;" ::POINTER_CONSTRAINT(pos.mReferences[1].mPtr), "f"(impulse.y * scale)); asm("red.shared.add.f32 [%0], %1;" ::POINTER_CONSTRAINT(pos.mReferences[2].mPtr), "f"(impulse.z * scale)); @@ -1394,6 +1394,7 @@ __launch_bounds__(512, 1) for (int32_t i = threadIdx.x; i < configDataSize; i += blockDim.x) gSharedUnsigned[i] = reinterpret_cast<const uint32_t*>(gClothData.mPhaseConfigs)[i]; + Pointer<Shared, uint32_t> scratchPtr = Pointer<Shared, uint32_t>( gSharedUnsigned + configDataSize + 4 * gFrameData.mNumSharedPositions * gClothData.mNumParticles); diff --git a/NvCloth/src/dx/DxFabric.cpp b/NvCloth/src/dx/DxFabric.cpp index cf6865a..f5adeaf 100644 --- a/NvCloth/src/dx/DxFabric.cpp +++ b/NvCloth/src/dx/DxFabric.cpp @@ -31,7 +31,7 @@ #include "DxContextLock.h" #include "DxFactory.h" #include <algorithm> -#include <PsUtilities.h> +#include "ps/PsUtilities.h" #if NV_CLOTH_ENABLE_DX11 diff --git a/NvCloth/src/dx/DxSolver.cpp b/NvCloth/src/dx/DxSolver.cpp index 21caa0b..c341aa8 100644 --- a/NvCloth/src/dx/DxSolver.cpp +++ b/NvCloth/src/dx/DxSolver.cpp @@ -34,7 +34,7 @@ #include "DxFactory.h" #include "DxContextLock.h" #include "../IterationState.h" -#include <PsSort.h> +#include "../ps/PsSort.h" #include <foundation/PxProfiler.h> #if NV_CLOTH_ENABLE_DX11 diff --git a/NvCloth/src/neon/NeonSolverKernel.cpp b/NvCloth/src/neon/NeonSolverKernel.cpp index 3e16b6f..6eb26cf 100644 --- a/NvCloth/src/neon/NeonSolverKernel.cpp +++ b/NvCloth/src/neon/NeonSolverKernel.cpp @@ -33,7 +33,7 @@ #include "SwSolverKernel.cpp" -#include <cpu-features.h> +#include "../ps/android/cpu-features.h" namespace { diff --git a/PxShared/src/foundation/include/PsAlloca.h b/NvCloth/src/ps/PsAlloca.h index add64c4..75a7bb2 100644 --- a/PxShared/src/foundation/include/PsAlloca.h +++ b/NvCloth/src/ps/PsAlloca.h @@ -30,20 +30,20 @@ #ifndef PSFOUNDATION_PSALLOCA_H #define PSFOUNDATION_PSALLOCA_H -#include "PsTempAllocator.h" +#include "NvCloth/Allocator.h" namespace physx { namespace shdfnd { -template <typename T, typename Alloc = TempAllocator> -class ScopedPointer : private Alloc +template <typename T, typename Unused = void> +class ScopedPointer { public: ~ScopedPointer() { if(mOwned) - Alloc::deallocate(mPointer); + GetNvClothAllocator()->deallocate(mPointer); } operator T*() const @@ -68,7 +68,7 @@ class ScopedPointer : private Alloc uint32_t size = sizeof(type) * (count); \ var.mOwned = size > 1024; \ if(var.mOwned) \ - var.mPointer = reinterpret_cast<type*>(physx::shdfnd::TempAllocator().allocate(size, __FILE__, __LINE__)); \ + var.mPointer = reinterpret_cast<type*>(GetNvClothAllocator()->allocate(size,#type,__FILE__,__LINE__)); \ else \ var.mPointer = reinterpret_cast<type*>(PxAlloca(size)); \ } diff --git a/PxShared/src/foundation/include/PsFPU.h b/NvCloth/src/ps/PsFPU.h index fd990a8..82b7ff2 100644 --- a/PxShared/src/foundation/include/PsFPU.h +++ b/NvCloth/src/ps/PsFPU.h @@ -30,8 +30,8 @@ #ifndef PSFOUNDATION_PSFPU_H #define PSFOUNDATION_PSFPU_H -#include "Ps.h" -#include "PsIntrinsics.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/ps/PsIntrinsics.h" #define PX_IR(x) ((uint32_t&)(x)) #define PX_SIR(x) ((int32_t&)(x)) @@ -53,7 +53,7 @@ namespace physx namespace shdfnd { // sets the default SDK state for scalar and SIMD units -class PX_FOUNDATION_API FPUGuard +class NV_CLOTH_IMPORT FPUGuard { public: FPUGuard(); // set fpu control word for PhysX @@ -77,12 +77,12 @@ class SIMDGuard /** \brief Enables floating point exceptions for the scalar and SIMD unit */ -PX_FOUNDATION_API void enableFPExceptions(); +NV_CLOTH_IMPORT void enableFPExceptions(); /** \brief Disables floating point exceptions for the scalar and SIMD unit */ -PX_FOUNDATION_API void disableFPExceptions(); +NV_CLOTH_IMPORT void disableFPExceptions(); } // namespace shdfnd } // namespace physx diff --git a/PxShared/src/foundation/include/PsSort.h b/NvCloth/src/ps/PsSort.h index 30808ae..8667244 100644 --- a/PxShared/src/foundation/include/PsSort.h +++ b/NvCloth/src/ps/PsSort.h @@ -72,7 +72,7 @@ void sort(T* elements, uint32_t count, const Predicate& compare, const Allocator { while(last > first) { - PX_ASSERT(first >= 0 && last < int32_t(count)); + NV_CLOTH_ASSERT(first >= 0 && last < int32_t(count)); if(uint32_t(last - first) < SMALL_SORT_CUTOFF) { internal::smallSort(elements, first, last, compare); @@ -104,7 +104,7 @@ void sort(T* elements, uint32_t count, const Predicate& compare, const Allocator } #if PX_SORT_PARANOIA for(uint32_t i = 1; i < count; i++) - PX_ASSERT(!compare(elements[i], elements[i - 1])); + NV_CLOTH_ASSERT(!compare(elements[i], elements[i - 1])); #endif } diff --git a/PxShared/src/foundation/include/PsSortInternals.h b/NvCloth/src/ps/PsSortInternals.h index 3aa0f7f..c7a7703 100644 --- a/PxShared/src/foundation/include/PsSortInternals.h +++ b/NvCloth/src/ps/PsSortInternals.h @@ -34,10 +34,9 @@ @{ */ -#include "foundation/PxAssert.h" -#include "foundation/PxIntrinsics.h" -#include "PsBasicTemplates.h" -#include "PsUserAllocated.h" +#include "ps/PxIntrinsics.h" +#include "NvCloth/ps/PsBasicTemplates.h" +#include "NvCloth/ps/PsUserAllocated.h" namespace physx { @@ -101,12 +100,12 @@ PX_INLINE int32_t partition(T* elements, int32_t first, int32_t last, Predicate& if(i >= j) break; - PX_ASSERT(i <= last && j >= first); + NV_CLOTH_ASSERT(i <= last && j >= first); swap(elements[i], elements[j]); } // put the pivot in place - PX_ASSERT(i <= last && first <= (last - 1)); + NV_CLOTH_ASSERT(i <= last && first <= (last - 1)); swap(elements[i], elements[last - 1]); return i; @@ -170,7 +169,7 @@ class Stack PX_INLINE void pop(int32_t& start, int32_t& end) { - PX_ASSERT(!empty()); + NV_CLOTH_ASSERT(!empty()); end = mMemory[--mSize]; start = mMemory[--mSize]; } diff --git a/PxShared/src/foundation/include/PsUtilities.h b/NvCloth/src/ps/PsUtilities.h index cd0f200..4e59ddc 100644 --- a/PxShared/src/foundation/include/PsUtilities.h +++ b/NvCloth/src/ps/PsUtilities.h @@ -31,10 +31,10 @@ #define PSFOUNDATION_PSUTILITIES_H #include "foundation/PxVec3.h" -#include "foundation/PxAssert.h" -#include "Ps.h" -#include "PsIntrinsics.h" -#include "PsBasicTemplates.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/ps/PsIntrinsics.h" +#include "NvCloth/ps/PsBasicTemplates.h" +#include "NvCloth/Callbacks.h" namespace physx { @@ -49,33 +49,33 @@ PX_INLINE char littleEndian() // PT: checked casts PX_CUDA_CALLABLE PX_FORCE_INLINE PxU32 to32(PxU64 value) { - PX_ASSERT(value <= 0xffffffff); + NV_CLOTH_ASSERT(value <= 0xffffffff); return PxU32(value); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxU16 to16(PxU32 value) { - PX_ASSERT(value <= 0xffff); + NV_CLOTH_ASSERT(value <= 0xffff); return PxU16(value); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 to8(PxU16 value) { - PX_ASSERT(value <= 0xff); + NV_CLOTH_ASSERT(value <= 0xff); return PxU8(value); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 to8(PxU32 value) { - PX_ASSERT(value <= 0xff); + NV_CLOTH_ASSERT(value <= 0xff); return PxU8(value); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxU8 to8(PxI32 value) { - PX_ASSERT(value <= 0xff); - PX_ASSERT(value >= 0); + NV_CLOTH_ASSERT(value <= 0xff); + NV_CLOTH_ASSERT(value >= 0); return PxU8(value); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxI8 toI8(PxU32 value) { - PX_ASSERT(value <= 0x7f); + NV_CLOTH_ASSERT(value <= 0x7f); return PxI8(value); } @@ -140,7 +140,7 @@ __attribute__((noreturn)) #elif PX_GCC_FAMILY __builtin_trap(); #else - PX_ASSERT(false); + NV_CLOTH_ASSERT(false); #endif } diff --git a/PxShared/src/foundation/include/PsInlineAoS.h b/NvCloth/src/ps/PxIntrinsics.h index 6ae15cf..b4aff28 100644 --- a/PxShared/src/foundation/include/PsInlineAoS.h +++ b/NvCloth/src/ps/PxIntrinsics.h @@ -27,22 +27,21 @@ // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. -#ifndef PSFOUNDATION_PSINLINEAOS_H -#define PSFOUNDATION_PSINLINEAOS_H +#ifndef PXFOUNDATION_PXINTRINSICS_H +#define PXFOUNDATION_PXINTRINSICS_H #include "foundation/PxPreprocessor.h" -#if PX_WINDOWS -#include "windows/PsWindowsTrigConstants.h" -#include "windows/PsWindowsInlineAoS.h" -#elif(PX_UNIX_FAMILY || PX_PS4 || PX_SWITCH) -#include "unix/PsUnixTrigConstants.h" -#include "unix/PsUnixInlineAoS.h" +#if PX_WINDOWS_FAMILY +#include "foundation/windows/PxWindowsIntrinsics.h" +#elif(PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4) +#include "foundation/unix/PxUnixIntrinsics.h" #elif PX_XBOXONE -#include "XboxOne/PsXboxOneTrigConstants.h" -#include "XboxOne/PsXboxOneInlineAoS.h" +#include "foundation/XboxOne/PxXboxOneIntrinsics.h" +#elif PX_SWITCH +#include "foundation/switch/PxSwitchIntrinsics.h" #else #error "Platform not supported!" #endif -#endif +#endif // #ifndef PXFOUNDATION_PXINTRINSICS_H diff --git a/PxShared/src/foundation/externals/src/android/cpu-features.c b/NvCloth/src/ps/android/cpu-features.c index 4754c46..4754c46 100644 --- a/PxShared/src/foundation/externals/src/android/cpu-features.c +++ b/NvCloth/src/ps/android/cpu-features.c diff --git a/PxShared/src/foundation/externals/src/android/cpu-features.h b/NvCloth/src/ps/android/cpu-features.h index 89f7666..89f7666 100644 --- a/PxShared/src/foundation/externals/src/android/cpu-features.h +++ b/NvCloth/src/ps/android/cpu-features.h diff --git a/PxShared/src/foundation/src/unix/PsUnixAtomic.cpp b/NvCloth/src/ps/unix/PsUnixAtomic.cpp index d4e933b..376f795 100644 --- a/PxShared/src/foundation/src/unix/PsUnixAtomic.cpp +++ b/NvCloth/src/ps/unix/PsUnixAtomic.cpp @@ -26,8 +26,8 @@ // Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. -#include "Ps.h" -#include "PsAtomic.h" +#include "NvCloth/ps/Ps.h" +#include "NvCloth/ps/PsAtomic.h" #if ! PX_EMSCRIPTEN #define PAUSE() asm("nop") diff --git a/PxShared/src/foundation/include/unix/PsUnixFPU.h b/NvCloth/src/ps/unix/PsUnixFPU.h index edd5522..edd5522 100644 --- a/PxShared/src/foundation/include/unix/PsUnixFPU.h +++ b/NvCloth/src/ps/unix/PsUnixFPU.h diff --git a/PxShared/src/foundation/src/unix/PsUnixMutex.cpp b/NvCloth/src/ps/unix/PsUnixMutex.cpp index 23b6549..23b6549 100644 --- a/PxShared/src/foundation/src/unix/PsUnixMutex.cpp +++ b/NvCloth/src/ps/unix/PsUnixMutex.cpp diff --git a/PxShared/src/foundation/src/windows/PsWindowsAtomic.cpp b/NvCloth/src/ps/windows/PsWindowsAtomic.cpp index 97cdba2..c78728f 100644 --- a/PxShared/src/foundation/src/windows/PsWindowsAtomic.cpp +++ b/NvCloth/src/ps/windows/PsWindowsAtomic.cpp @@ -27,8 +27,8 @@ // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. -#include "windows/PsWindowsInclude.h" -#include "PsAtomic.h" +#include "PsWindowsInclude.h" +#include "NvCloth/ps/PsAtomic.h" namespace physx { diff --git a/PxShared/src/foundation/include/windows/PsWindowsFPU.h b/NvCloth/src/ps/windows/PsWindowsFPU.h index d85e531..d85e531 100644 --- a/PxShared/src/foundation/include/windows/PsWindowsFPU.h +++ b/NvCloth/src/ps/windows/PsWindowsFPU.h diff --git a/PxShared/src/foundation/include/windows/PsWindowsInclude.h b/NvCloth/src/ps/windows/PsWindowsInclude.h index 75962e1..066abe7 100644 --- a/PxShared/src/foundation/include/windows/PsWindowsInclude.h +++ b/NvCloth/src/ps/windows/PsWindowsInclude.h @@ -30,7 +30,7 @@ #ifndef PSFOUNDATION_PSWINDOWSINCLUDE_H #define PSFOUNDATION_PSWINDOWSINCLUDE_H -#include "Ps.h" +#include "NvCloth/ps/Ps.h" #ifndef _WIN32 #error "This file should only be included by Windows builds!!" diff --git a/NvCloth/src/scalar/SwCollisionHelpers.h b/NvCloth/src/scalar/SwCollisionHelpers.h index c86d939..cad06e3 100644 --- a/NvCloth/src/scalar/SwCollisionHelpers.h +++ b/NvCloth/src/scalar/SwCollisionHelpers.h @@ -29,7 +29,7 @@ #pragma once -#include "PsMathUtils.h" +#include "NvCloth/ps/PsMathUtils.h" namespace nv { diff --git a/PxShared/.clang-format b/PxShared/.clang-format deleted file mode 100644 index a5296d6..0000000 --- a/PxShared/.clang-format +++ /dev/null @@ -1,48 +0,0 @@ ---- -# BasedOnStyle: LLVM -AccessModifierOffset: -2 -ConstructorInitializerIndentWidth: 0 -AlignEscapedNewlinesLeft: false -AlignEnumAssignments: true -AlignTrailingComments: true -AllowAllParametersOfDeclarationOnNextLine: true -AllowShortIfStatementsOnASingleLine: false -AllowShortLoopsOnASingleLine: false -AlwaysBreakTemplateDeclarations: true -AlwaysBreakBeforeMultilineStrings: false -BreakBeforeBinaryOperators: false -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: true -BinPackParameters: true -ColumnLimit: 120 -ConstructorInitializerAllOnOneLineOrOnePerLine: true -DerivePointerBinding: false -ExperimentalAutoDetectBinPacking: false -IndentCaseLabels: false -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: None -ObjCSpaceBeforeProtocolList: true -PenaltyBreakBeforeFirstCallParameter: 19 -PenaltyBreakComment: 16 -PenaltyBreakString: 1000 -PenaltyBreakFirstLessLess: 120 -PenaltyExcessCharacter: 10 -PenaltyReturnTypeOnItsOwnLine: 60 -PointerBindsToType: true -SpacesBeforeTrailingComments: 1 -Cpp11BracedListStyle: false -Standard: Cpp03 -IndentWidth: 4 -TabWidth: 4 -UseTab: ForIndentation -BreakBeforeBraces: Allman -IndentFunctionDeclarationAfterType: false -SpacesInParentheses: false -SpacesInAngles: false -SpaceInEmptyParentheses: false -SpacesInCStyleCastParentheses: false -SpaceAfterControlStatementKeyword: false -SpaceBeforeAssignmentOperators: true -ContinuationIndentWidth: 4 -... - diff --git a/PxShared/GenerateProjects.bat b/PxShared/GenerateProjects.bat deleted file mode 100644 index 7924d3f..0000000 --- a/PxShared/GenerateProjects.bat +++ /dev/null @@ -1,49 +0,0 @@ -@echo off - -REM Make sure the various variables that we need are set - -IF NOT DEFINED GW_DEPS_ROOT GOTO GW_DEPS_ROOT_UNDEFINED - -IF NOT DEFINED BOOST_ROOT GOTO BOOST_ROOT_UNDEFINED - -IF NOT DEFINED CUDA_BIN_PATH GOTO CUDA_ROOT_UNDEFINED - -IF EXIST GW_DEPS_ROOT\CMakeModules ( - set CMAKE_MODULE_PATH=%GW_DEPS_ROOT%\CMakeModules -) ELSE ( - set CMAKE_MODULE_PATH=%GW_DEPS_ROOT%\sw\physx\tools\CMakeModules -) - -REM Generate projects here - -rmdir /s /q compiler\vc12win32-cmake\ -mkdir compiler\vc12win32-cmake\ -pushd compiler\vc12win32-cmake\ -cmake ..\cmake\windows -G "Visual Studio 12 2013" -AWin32 -DTARGET_BUILD_PLATFORM=windows -popd - -rmdir /s /q compiler\vc12win64-cmake\ -mkdir compiler\vc12win64-cmake\ -pushd compiler\vc12win64-cmake\ -cmake ..\cmake\windows -G "Visual Studio 12 2013" -Ax64 -DTARGET_BUILD_PLATFORM=windows -popd - -popd - -GOTO :End - -:GW_DEPS_ROOT_UNDEFINED -ECHO GW_DEPS_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:BOOST_ROOT_UNDEFINED -ECHO BOOST_ROOT has to be defined, pointing to the root of your local Boost install. -PAUSE -GOTO END - -:CUDA_ROOT_UNDEFINED -ECHO CUDA_BIN_PATH has to be defined, pointing to the bin folder of your local CUDA install. -PAUSE - -:End diff --git a/PxShared/buildtools/clang-format/clang-format-all.bat b/PxShared/buildtools/clang-format/clang-format-all.bat deleted file mode 100644 index 1006b00..0000000 --- a/PxShared/buildtools/clang-format/clang-format-all.bat +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -setlocal enabledelayedexpansion - -set BLAST_PATH=..\.. - -set /a count=0 -set /a fail=0 -for /F %%d IN (directories.txt) do ( - call :check %BLAST_PATH%\%%d -) - -echo %fail% of %count% files reformatted. -exit /b %fail% - -:check -for /R "%1" %%f in (*.h, *.cpp, *.cu, *.hlsl) do ( - p4 edit %%f - clang-format.exe -i %%f - if errorlevel 1 ( - echo %%f - set /a fail += 1 - ) - set /a count += 1 -) diff --git a/PxShared/buildtools/clang-format/clang-format-p4.bat b/PxShared/buildtools/clang-format/clang-format-p4.bat deleted file mode 100644 index 0b246e3..0000000 --- a/PxShared/buildtools/clang-format/clang-format-p4.bat +++ /dev/null @@ -1,24 +0,0 @@ -@echo off -setlocal - -set BLAST_PATH=..\.. - -if "%*"=="" ( - echo Usage: format-change.bat ^<p4 changelist #^> - exit /b -) - -set change=%~1 -for /F %%d IN (directories.txt) do ( - call :format %BLAST_PATH%\%%d -) - -exit /b - -:format -for /F "delims=#" %%a in ('p4 opened -c %change% %~f1\....h, %~f1\....cpp, %~f1\....cu, %~f1\....hlsl 2^> NUL') do ( - for /F "tokens=3" %%f IN ('p4 where %%a') do ( - echo %%f - clang-format.exe -i %%f - ) -) diff --git a/PxShared/buildtools/clang-format/clang-format.exe b/PxShared/buildtools/clang-format/clang-format.exe Binary files differdeleted file mode 100644 index 9c91ddf..0000000 --- a/PxShared/buildtools/clang-format/clang-format.exe +++ /dev/null diff --git a/PxShared/buildtools/clang-format/directories.txt b/PxShared/buildtools/clang-format/directories.txt deleted file mode 100644 index 1dc947f..0000000 --- a/PxShared/buildtools/clang-format/directories.txt +++ /dev/null @@ -1,4 +0,0 @@ -source\common -source\extensions -source\solver -shared\utils diff --git a/PxShared/buildtools/cmake_projects_android.bat b/PxShared/buildtools/cmake_projects_android.bat deleted file mode 100644 index 8321e3f..0000000 --- a/PxShared/buildtools/cmake_projects_android.bat +++ /dev/null @@ -1,112 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_android-ndk_PATH %PM_android-ndk_PATH% -echo PM_android-ndk_VERSION %PM_android-ndk_VERSION% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating android mingw" - -REM Set android compiler variables for cmake -set ANDROID_PLATFORM=android-19 -set ANDROID_ABI="armeabi-v7a with NEON" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS=-DTARGET_BUILD_PLATFORM=android ^ --DCMAKE_TOOLCHAIN_FILE=%PM_CMakeModules_PATH%/android/android.toolchain.cmake ^ --DANDROID_NATIVE_API_LEVEL=%ANDROID_PLATFORM% ^ --DANDROID_ABI=%ANDROID_ABI% ^ --DANDROID_STL="gnustl_static" ^ --DCM_ANDROID_FP="softfp" ^ --DANDROID_NDK=%PM_AndroidNDK_PATH% ^ --DCM_ANDROID_NDK_VERSION=%PM_AndroidNDK_VERSION% ^ --DCMAKE_MAKE_PROGRAM=%PM_android-ndk_PATH%/prebuilt/windows/bin/make.exe ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%/ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%/ ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%/install/android19/ - - -REM Compiler dependend params -set CMAKE_MINGW_CMD_LINE_PARAMS=-G "MinGW Makefiles" -set CMAKE_MSYS_CMD_LINE_PARAMS=-G "MSYS Makefiles" - -SET CMAKE_OUTPUT_DIR=compiler\%ANDROID_PLATFORM%-debug -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=debug %CMAKE_MINGW_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - - -SET CMAKE_OUTPUT_DIR=compiler\%ANDROID_PLATFORM%-profile -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=profile %CMAKE_MINGW_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -SET CMAKE_OUTPUT_DIR=compiler\%ANDROID_PLATFORM%-checked -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=checked %CMAKE_MINGW_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -SET CMAKE_OUTPUT_DIR=compiler\%ANDROID_PLATFORM%-release -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=release %CMAKE_MINGW_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_ios.sh b/PxShared/buildtools/cmake_projects_ios.sh deleted file mode 100644 index b8c9878..0000000 --- a/PxShared/buildtools/cmake_projects_ios.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/bash +x - -DATE=$(date +"%m-%d-%Y") -TIME=$(date +"%T") -echo "#############################################################################################" -echo "Starting ${0##*/} $DATE $TIME " -echo "#############################################################################################" - -echo "PM_CMakeModules_VERSION $PM_CMakeModules_VERSION" -echo "PM_CMakeModules_PATH $PM_CMakeModules_PATH" -echo "PM_PATHS $PM_PATHS" - -[ -z "$PM_CMakeModules_VERSION" ] && echo "Don't run this batch file directly. Run generate_projects_(platform).bat instead." && exit 1; - -[ -z "$PM_PACKAGES_ROOT" ] && echo "PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree." && exit 1; - -# Now set up the CMake command from PM_PACKAGES_ROOT - -CMAKECMD=$PM_cmake_PATH/bin/cmake - -echo "Cmake: $CMAKECMD" - -echo "#############################################################################################" -echo "Creating Ios XCode projects" - - -# Common cmd line params -CMAKE_CMD_LINE_PARAMS="\ --DTARGET_BUILD_PLATFORM=ios \ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON \ --DAPPEND_CONFIG_NAME=OFF \ --DCMAKE_PREFIX_PATH=$PM_PATHS \ --DFORCE_64BIT_SUFFIX=ON \ --DPX_OUTPUT_ARCH=arm \ --DPX_OUTPUT_LIB_DIR=$PXSHARED_ROOT_DIR \ --DPX_OUTPUT_BIN_DIR=$PXSHARED_ROOT_DIR \ --DCMAKE_TOOLCHAIN_FILE=$PM_CMakeModules_PATH/ios/ios.toolchain.cmake \ --DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/ios \ --DUSE_DEBUG_WINCRT=OFF" - -# Generate projects here - -IOSPLATDIR=ios -mkdir -p compiler -CMAKE_OUTPUT_DIR=compiler/$IOSPLATDIR-xcode/ - -rm -r -f $CMAKE_OUTPUT_DIR -mkdir -p $CMAKE_OUTPUT_DIR -pushd $CMAKE_OUTPUT_DIR - -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Xcode" -DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/$IOSPLATDIR/ $CMAKE_CMD_LINE_PARAMS || exit 1 - -popd - -OSXPLATDIR=ios -mkdir -p compiler -for config in "debug" "profile" "checked" "release"; do -CMAKE_OUTPUT_DIR=compiler/$IOSPLATDIR-$config/ - -rm -r -f $CMAKE_OUTPUT_DIR -mkdir -p $CMAKE_OUTPUT_DIR -pushd $CMAKE_OUTPUT_DIR - -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/$IOSPLATDIR/ $CMAKE_CMD_LINE_PARAMS || exit 1 - -popd - -done - diff --git a/PxShared/buildtools/cmake_projects_linux.bat b/PxShared/buildtools/cmake_projects_linux.bat deleted file mode 100644 index e4f5417..0000000 --- a/PxShared/buildtools/cmake_projects_linux.bat +++ /dev/null @@ -1,101 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -SET LINUX_ROOT=%PM_ClangCrosscompile_PATH% - -echo "Cmake: %CMAKECMD%" -echo "LINUX_ROOT: %LINUX_ROOT%" - -echo. -echo ############################################################################################# -ECHO "Creating linux crosscompiler makefiles" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS= ^ --DTARGET_BUILD_PLATFORM=linux ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_OUTPUT_LIB_DIR="%PXSHARED_ROOT_DIR%" ^ --DPX_OUTPUT_BIN_DIR="%PXSHARED_ROOT_DIR%" ^ --DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/linux/" ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\linux\LinuxCrossToolchain.x86_64-unknown-linux-gnu.cmake" ^ --DARCHITECTURE_TRIPLE=x86_64-unknown-linux-gnu ^ --DCMAKE_MAKE_PROGRAM:PATH="%PM_MinGW_PATH%\bin\mingw32-make.exe" ^ --DGENERATE_STATIC_LIBRARIES=ON - - -REM Generate projects here -SET CMAKE_OUTPUT_DIR=compiler\linux-crosscompile-debug -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake --no-warn-unused-cli %CMAKE_CMD_LINE_PARAMS% -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=debug - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -SET CMAKE_OUTPUT_DIR=compiler\linux-crosscompile-profile -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -G "Unix Makefiles" %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=profile - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -SET CMAKE_OUTPUT_DIR=compiler\linux-crosscompile-checked -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -G "Unix Makefiles" %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=checked - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -SET CMAKE_OUTPUT_DIR=compiler\linux-crosscompile-release -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -G "Unix Makefiles" %CMAKE_CMD_LINE_PARAMS% -DCMAKE_BUILD_TYPE=release - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% -) - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_linux.sh b/PxShared/buildtools/cmake_projects_linux.sh deleted file mode 100644 index 2fbfcb7..0000000 --- a/PxShared/buildtools/cmake_projects_linux.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash +x - -DATE=$(date +"%m-%d-%Y") -TIME=$(date +"%T") -echo "#############################################################################################" -echo "Starting ${0##*/} $DATE $TIME " -echo "#############################################################################################" - -echo "PM_CMakeModules_VERSION $PM_CMakeModules_VERSION" -echo "PM_CMakeModules_PATH $PM_CMakeModules_PATH" -echo "PM_PATHS $PM_PATHS" - -[ -z "$PM_CMakeModules_VERSION" ] && echo "Don't run this batch file directly. Run generate_projects_(platform).bat instead." && exit 1; - -[ -z "$PM_PACKAGES_ROOT" ] && echo "PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree." && exit 1; - -# Now set up the CMake command from PM_PACKAGES_ROOT - -export CMAKECMD=$PM_cmake_PATH/bin/cmake - -echo "Cmake: $CMAKECMD" - -echo "PXshared Root: $PXSHARED_ROOT_DIR" - -# Generate projects here - -echo "#############################################################################################" -echo "Creating Unix Makefiles" - -# Common cmd line params -CMAKE_CMD_LINE_PARAMS="\ --DTARGET_BUILD_PLATFORM=linux \ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON \ --DAPPEND_CONFIG_NAME=OFF \ --DCMAKE_PREFIX_PATH=$PM_PATHS \ --DPX_OUTPUT_ARCH=x86 \ --DPX_OUTPUT_LIB_DIR=$PXSHARED_ROOT_DIR \ --DPX_OUTPUT_BIN_DIR=$PXSHARED_ROOT_DIR \ --DCUDA_TOOLKIT_ROOT_DIR=$PM_CUDA_PATH \ --DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/linux/ \ --DGENERATE_STATIC_LIBRARIES=ON \ --DPX_GENERATE_GPU_PROJECTS=ON" - -# Compiler dependend params -CMAKE_CLANG_CMD_LINE_PARAMS="-DCMAKE_C_COMPILER=clang-3.8 -DCMAKE_CXX_COMPILER=clang++-3.8" - -# Generate projects here -mkdir -p compiler -for config in "debug" "profile" "checked" "release"; do - -rm -r -f compiler/linux-$config-clang/ -mkdir -p compiler/linux-$config-clang/ -pushd compiler/linux-$config-clang/ -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Unix Makefiles" $CMAKE_CLANG_CMD_LINE_PARAMS -DCMAKE_BUILD_TYPE=$config $CMAKE_CMD_LINE_PARAMS || exit 1 -popd - -done diff --git a/PxShared/buildtools/cmake_projects_mac.sh b/PxShared/buildtools/cmake_projects_mac.sh deleted file mode 100644 index de49902..0000000 --- a/PxShared/buildtools/cmake_projects_mac.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/bash +x - -DATE=$(date +"%m-%d-%Y") -TIME=$(date +"%T") -echo "#############################################################################################" -echo "Starting ${0##*/} $DATE $TIME " -echo "#############################################################################################" - -echo "PM_CMakeModules_VERSION $PM_CMakeModules_VERSION" -echo "PM_CMakeModules_PATH $PM_CMakeModules_PATH" -echo "PM_PATHS $PM_PATHS" - -[ -z "$PM_CMakeModules_VERSION" ] && echo "Don't run this batch file directly. Run generate_projects_(platform).bat instead." && exit 1; - -[ -z "$PM_PACKAGES_ROOT" ] && echo "PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree." && exit 1; - -# Now set up the CMake command from PM_PACKAGES_ROOT - -CMAKECMD=$PM_cmake_PATH/bin/cmake - -echo "Cmake: $CMAKECMD" - -echo "#############################################################################################" -echo "Creating Mac XCode projects" - - -# Common cmd line params -CMAKE_CMD_LINE_PARAMS="\ --DTARGET_BUILD_PLATFORM=mac \ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON \ --DAPPEND_CONFIG_NAME=OFF \ --DCMAKE_PREFIX_PATH=$PM_PATHS \ --DPX_OUTPUT_ARCH=x86 \ --DPX_OUTPUT_LIB_DIR=$PXSHARED_ROOT_DIR \ --DPX_OUTPUT_BIN_DIR=$PXSHARED_ROOT_DIR \ --DGENERATE_STATIC_LIBRARIES=ON \ --DUSE_DEBUG_WINCRT=OFF" - -# Compiler dependend params -CMAKE_MAC32_CMD_LINE_PARAMS="-DFORCE_32BIT_SUFFIX=ON" - -CMAKE_MAC64_CMD_LINE_PARAMS="-DFORCE_64BIT_SUFFIX=ON" - -# Generate projects here - -MACPLATDIR=mac32 -mkdir -p compiler -for config in "debug" "profile" "checked" "release"; do -CMAKE_OUTPUT_DIR=compiler/$MACPLATDIR-$config/ - -rm -r -f $CMAKE_OUTPUT_DIR -mkdir -p $CMAKE_OUTPUT_DIR -pushd $CMAKE_OUTPUT_DIR - -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/$MACPLATDIR/ $CMAKE_CMD_LINE_PARAMS $CMAKE_MAC32_CMD_LINE_PARAMS || exit 1 - -popd - -done - -MACPLATDIR=mac64 -mkdir -p compiler -for config in "debug" "profile" "checked" "release"; do -CMAKE_OUTPUT_DIR=compiler/$MACPLATDIR-$config/ - -rm -r -f $CMAKE_OUTPUT_DIR -mkdir -p $CMAKE_OUTPUT_DIR -pushd $CMAKE_OUTPUT_DIR - -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/$MACPLATDIR/ $CMAKE_CMD_LINE_PARAMS $CMAKE_MAC64_CMD_LINE_PARAMS || exit 1 - -popd - -done - -MACPLATDIR=mac32 -mkdir -p compiler -CMAKE_OUTPUT_DIR=compiler/$MACPLATDIR-xcode/ - -rm -r -f $CMAKE_OUTPUT_DIR -mkdir -p $CMAKE_OUTPUT_DIR -pushd $CMAKE_OUTPUT_DIR - -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Xcode" -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/$MACPLATDIR/ $CMAKE_CMD_LINE_PARAMS $CMAKE_MAC32_CMD_LINE_PARAMS || exit 1 - -popd - -MACPLATDIR=mac64 -mkdir -p compiler -CMAKE_OUTPUT_DIR=compiler/$MACPLATDIR-xcode/ - -rm -r -f $CMAKE_OUTPUT_DIR -mkdir -p $CMAKE_OUTPUT_DIR -pushd $CMAKE_OUTPUT_DIR - -$CMAKECMD $PXSHARED_ROOT_DIR/src/compiler/cmake -G "Xcode" -DCMAKE_BUILD_TYPE=$config -DCMAKE_INSTALL_PREFIX=$PXSHARED_ROOT_DIR/install/$MACPLATDIR/ $CMAKE_CMD_LINE_PARAMS $CMAKE_MAC64_CMD_LINE_PARAMS || exit 1 - -popd diff --git a/PxShared/buildtools/cmake_projects_vc12win.bat b/PxShared/buildtools/cmake_projects_vc12win.bat deleted file mode 100644 index 27a489e..0000000 --- a/PxShared/buildtools/cmake_projects_vc12win.bat +++ /dev/null @@ -1,103 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS=-DTARGET_BUILD_PLATFORM=windows ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_OUTPUT_LIB_DIR="%PXSHARED_ROOT_DIR%" ^ --DPX_OUTPUT_BIN_DIR="%PXSHARED_ROOT_DIR%" ^ --DUSE_DEBUG_WINCRT=OFF - -REM Compiler dependend params -set CMAKE_VC12WIN32_CMD_LINE_PARAMS= ^ --G "Visual Studio 12 2013" -AWin32 ^ --DPX_GENERATE_GPU_PROJECTS=ON ^ --DCUDA_TOOLKIT_ROOT_DIR=%PM_CUDA_PATH% - -set CMAKE_VC12WIN64_CMD_LINE_PARAMS= ^ --G "Visual Studio 12 2013" -Ax64 ^ --DPX_GENERATE_GPU_PROJECTS=ON ^ --DCUDA_TOOLKIT_ROOT_DIR=%PM_CUDA_PATH% - -echo. -echo ############################################################################################# -ECHO "Creating VC12 VS2013" - -SET VCPLATDIR=vc12win64-md -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=OFF -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC12WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc12win64-mt -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=ON -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC12WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc12win32-mt -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=ON -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC12WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc12win32-md -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=OFF -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC12WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc14ps4.bat b/PxShared/buildtools/cmake_projects_vc14ps4.bat deleted file mode 100644 index 716f8b5..0000000 --- a/PxShared/buildtools/cmake_projects_vc14ps4.bat +++ /dev/null @@ -1,62 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating VC14 VS2015 Ps4" - -SET CMAKE_OUTPUT_DIR=compiler\vc14ps4\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake ^ --G "Visual Studio 14 2015" ^ --DTARGET_BUILD_PLATFORM=ps4 ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\ps4\PS4Toolchain.txt" ^ --DCMAKE_GENERATOR_PLATFORM=ORBIS ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\clangps4\ - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc14switch.bat b/PxShared/buildtools/cmake_projects_vc14switch.bat deleted file mode 100644 index 1b496a5..0000000 --- a/PxShared/buildtools/cmake_projects_vc14switch.bat +++ /dev/null @@ -1,62 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating VC14 VS2015 Switch" - -SET CMAKE_OUTPUT_DIR=compiler\vc14switch\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake ^ --G "Visual Studio 14 2015" ^ --DTARGET_BUILD_PLATFORM=switch ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\switch\NX64Toolchain.txt" ^ --DCMAKE_GENERATOR_PLATFORM=NX64 ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\clangswitch\ - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc14uwp.bat b/PxShared/buildtools/cmake_projects_vc14uwp.bat deleted file mode 100644 index 5f43473..0000000 --- a/PxShared/buildtools/cmake_projects_vc14uwp.bat +++ /dev/null @@ -1,100 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS=-DTARGET_BUILD_PLATFORM=uwp ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DUSE_DEBUG_WINCRT=OFF ^ --DCMAKE_SYSTEM_NAME=WindowsStore ^ --DCMAKE_SYSTEM_VERSION=10.0 - -REM Compiler dependend params -set CMAKE_VC14WIN32_CMD_LINE_PARAMS= ^ --G "Visual Studio 14" -AWin32 ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_GENERATE_GPU_PROJECTS=OFF - - -set CMAKE_VC14WIN64_CMD_LINE_PARAMS= ^ --G "Visual Studio 14" -Ax64 ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_GENERATE_GPU_PROJECTS=OFF - -set CMAKE_VC14ARM_CMD_LINE_PARAMS= ^ --G "Visual Studio 14" -Aarm ^ --DPX_OUTPUT_ARCH=arm ^ --DPX_GENERATE_GPU_PROJECTS=OFF - -echo. -echo ############################################################################################# -ECHO "Creating VC14 VS2015" - -SET VCPLATDIR=vc14uwp64 -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc14uwp32 -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -GOTO :End - -SET VCPLATDIR=vc14uwparm -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14ARM_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc14win.bat b/PxShared/buildtools/cmake_projects_vc14win.bat deleted file mode 100644 index af70161..0000000 --- a/PxShared/buildtools/cmake_projects_vc14win.bat +++ /dev/null @@ -1,104 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS=-DTARGET_BUILD_PLATFORM=windows ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_OUTPUT_LIB_DIR="%PXSHARED_ROOT_DIR%" ^ --DPX_OUTPUT_BIN_DIR="%PXSHARED_ROOT_DIR%" ^ --DUSE_DEBUG_WINCRT=OFF - -REM Compiler dependend params -set CMAKE_VC14WIN32_CMD_LINE_PARAMS= ^ --G "Visual Studio 14 2015" -AWin32 ^ --DPX_GENERATE_GPU_PROJECTS=ON ^ --DCUDA_TOOLKIT_ROOT_DIR=%PM_CUDA_PATH% - - -set CMAKE_VC14WIN64_CMD_LINE_PARAMS= ^ --G "Visual Studio 14 2015" -Ax64 ^ --DPX_GENERATE_GPU_PROJECTS=ON ^ --DCUDA_TOOLKIT_ROOT_DIR=%PM_CUDA_PATH% - -echo. -echo ############################################################################################# -ECHO "Creating VC14 VS2015" - -SET VCPLATDIR=vc14win64-md -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=OFF -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc14win64-mt -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=ON -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc14win32-md -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=OFF -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc14win32-mt -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% "%PXSHARED_ROOT_DIR%src/compiler/cmake" -DUSE_STATIC_WINCRT=ON -DCMAKE_INSTALL_PREFIX="%PXSHARED_ROOT_DIR%install/%VCPLATDIR%/" %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC14WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc14xboxone.bat b/PxShared/buildtools/cmake_projects_vc14xboxone.bat deleted file mode 100644 index 771737f..0000000 --- a/PxShared/buildtools/cmake_projects_vc14xboxone.bat +++ /dev/null @@ -1,62 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating VC14 VS2015 XboxOne" - -SET CMAKE_OUTPUT_DIR=compiler\vc14xboxone\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake ^ --G "Visual Studio 14 2015" ^ --DTARGET_BUILD_PLATFORM=xboxone ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\xboxone\XboxOneToolchain.txt" ^ --DCMAKE_GENERATOR_PLATFORM=Durango ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR% ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR% ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\vc14xboxone\ - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc15ps4.bat b/PxShared/buildtools/cmake_projects_vc15ps4.bat deleted file mode 100644 index 5538859..0000000 --- a/PxShared/buildtools/cmake_projects_vc15ps4.bat +++ /dev/null @@ -1,62 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating VC15 VS2017 Ps4" - -SET CMAKE_OUTPUT_DIR=compiler\vc15ps4\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake ^ --G "Visual Studio 15 2017" ^ --DTARGET_BUILD_PLATFORM=ps4 ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\ps4\PS4Toolchain.txt" ^ --DCMAKE_GENERATOR_PLATFORM=ORBIS ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\clangps4\ - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc15switch.bat b/PxShared/buildtools/cmake_projects_vc15switch.bat deleted file mode 100644 index 0e0c60a..0000000 --- a/PxShared/buildtools/cmake_projects_vc15switch.bat +++ /dev/null @@ -1,62 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating VC15 VS2017 Switch" - -SET CMAKE_OUTPUT_DIR=compiler\vc15switch\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake ^ --G "Visual Studio 15" ^ --T v141 ^ --DTARGET_BUILD_PLATFORM=switch ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\switch\NX64Toolchain.txt" ^ --DCMAKE_GENERATOR_PLATFORM=NX64 ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\clangswitch\ - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc15uwp.bat b/PxShared/buildtools/cmake_projects_vc15uwp.bat deleted file mode 100644 index 8065781..0000000 --- a/PxShared/buildtools/cmake_projects_vc15uwp.bat +++ /dev/null @@ -1,101 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS=-DTARGET_BUILD_PLATFORM=uwp ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DUSE_DEBUG_WINCRT=OFF ^ --DCMAKE_SYSTEM_NAME=WindowsStore ^ --DCMAKE_SYSTEM_VERSION=10.0 - -REM Compiler dependend params -set CMAKE_VC15WIN32_CMD_LINE_PARAMS= ^ --G "Visual Studio 15 2017" -AWin32 ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_GENERATE_GPU_PROJECTS=OFF - - -set CMAKE_VC15WIN64_CMD_LINE_PARAMS= ^ --G "Visual Studio 15 2017" -Ax64 ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_GENERATE_GPU_PROJECTS=OFF - -set CMAKE_VC15ARM_CMD_LINE_PARAMS= ^ --G "Visual Studio 15 2017" -Aarm ^ --DPX_OUTPUT_ARCH=arm ^ --DPX_GENERATE_GPU_PROJECTS=OFF - -echo. -echo ############################################################################################# -ECHO "Creating VC15 VS2017" - -SET VCPLATDIR=vc15uwp64 -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc15uwp32 -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -GOTO :End - -SET VCPLATDIR=vc15uwparm -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15ARM_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc15win.bat b/PxShared/buildtools/cmake_projects_vc15win.bat deleted file mode 100644 index f1b07bc..0000000 --- a/PxShared/buildtools/cmake_projects_vc15win.bat +++ /dev/null @@ -1,102 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -echo "Cmake: %CMAKECMD%" - -REM Common cmd line params -set CMAKE_CMD_LINE_PARAMS=-DTARGET_BUILD_PLATFORM=windows ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DPX_OUTPUT_ARCH=x86 ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR%\ ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR%\ ^ --DUSE_DEBUG_WINCRT=OFF - -REM Compiler dependend params -set CMAKE_VC15WIN32_CMD_LINE_PARAMS= ^ --G "Visual Studio 15 2017" -AWin32 ^ --DPX_GENERATE_GPU_PROJECTS=OFF - - -set CMAKE_VC15WIN64_CMD_LINE_PARAMS= ^ --G "Visual Studio 15 2017" -Ax64 ^ --DPX_GENERATE_GPU_PROJECTS=OFF - -echo. -echo ############################################################################################# -ECHO "Creating VC15 VS2017" - -SET VCPLATDIR=vc15win64-md -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DUSE_STATIC_WINCRT=OFF -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc15win64-mt -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DUSE_STATIC_WINCRT=ON -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15WIN64_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc15win32-md -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DUSE_STATIC_WINCRT=OFF -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - -SET VCPLATDIR=vc15win32-mt -SET CMAKE_OUTPUT_DIR=compiler\%VCPLATDIR%\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake -DUSE_STATIC_WINCRT=ON -DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\%VCPLATDIR%\ %CMAKE_CMD_LINE_PARAMS% %CMAKE_VC15WIN32_CMD_LINE_PARAMS% - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/cmake_projects_vc15xboxone.bat b/PxShared/buildtools/cmake_projects_vc15xboxone.bat deleted file mode 100644 index 0e4e8de..0000000 --- a/PxShared/buildtools/cmake_projects_vc15xboxone.bat +++ /dev/null @@ -1,73 +0,0 @@ -@echo off - -echo ############################################################################################# -echo Starting %~n0 %date% %time% -echo ############################################################################################# - -echo PM_CMakeModules_VERSION %PM_CMakeModules_VERSION% -echo PM_CMakeModules_PATH %PM_CMakeModules_PATH% -echo PM_PATHS %PM_PATHS% - -if NOT DEFINED PM_CMakeModules_VERSION GOTO DONT_RUN_STEP_2 - -IF NOT DEFINED PM_PACKAGES_ROOT GOTO PM_PACKAGES_ROOT_UNDEFINED - -REM Now set up the CMake command from PM_PACKAGES_ROOT - -SET CMAKECMD=%PM_cmake_PATH%\bin\cmake.exe - -SET VSWHERE=%PM_vswhere_PATH%\VsWhere.exe - -echo "Cmake: %CMAKECMD%" - -rem ## Try to get the VS 15 path using vswhere (see https://github.com/Microsoft/vswhere) -for /f "delims=" %%i in ('%VSWHERE% -latest -property installationPath') do ( - if exist "%%i" ( - set VS150PATH="%%i" - ) -) - -echo "VS150PATH: %VS150PATH%" - -REM Generate projects here - -echo. -echo ############################################################################################# -ECHO "Creating VC15 VS2017 XboxOne" - -SET CMAKE_OUTPUT_DIR=compiler\vc15xboxone\ -IF EXIST %CMAKE_OUTPUT_DIR% rmdir /S /Q %CMAKE_OUTPUT_DIR% -mkdir %CMAKE_OUTPUT_DIR% -pushd %CMAKE_OUTPUT_DIR% - - -%CMAKECMD% %PXSHARED_ROOT_DIR%\src\compiler\cmake ^ --G "Visual Studio 15 2017" ^ --DTARGET_BUILD_PLATFORM=xboxone ^ --DCMAKE_TOOLCHAIN_FILE="%PM_CMakeModules_PATH%\xboxone\XboxOneToolchainVC15.txt" ^ --DCMAKE_GENERATOR_PLATFORM=Durango ^ --DPX_OUTPUT_LIB_DIR=%PXSHARED_ROOT_DIR% ^ --DPX_OUTPUT_BIN_DIR=%PXSHARED_ROOT_DIR% ^ --DAPPEND_CONFIG_NAME=OFF ^ --DCMAKE_PREFIX_PATH="%PM_PATHS%" ^ --DUSE_GAMEWORKS_OUTPUT_DIRS=ON ^ --DCMAKE_VS150PATH=%VS150PATH% ^ --DCMAKE_INSTALL_PREFIX=%PXSHARED_ROOT_DIR%\install\vc15xboxone\ - -popd -if %ERRORLEVEL% NEQ 0 exit /b %ERRORLEVEL% - - -GOTO :End - -:PM_PACKAGES_ROOT_UNDEFINED -ECHO PM_PACKAGES_ROOT has to be defined, pointing to the root of the dependency tree. -PAUSE -GOTO END - -:DONT_RUN_STEP_2 -ECHO Don't run this batch file directly. Run generate_projects_(platform).bat instead -PAUSE -GOTO END - -:End diff --git a/PxShared/buildtools/packman/packman b/PxShared/buildtools/packman/packman deleted file mode 100644 index 4d0c292..0000000 --- a/PxShared/buildtools/packman/packman +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -PM_PACKMAN_VERSION=4.2-rc2 - -# Specify where configuration file could exist -export PM_CONFIG_PATH=$(dirname ${BASH_SOURCE})/packman_config.txt - -# The packages root may already be configured by the user -if [ -z "$PM_PACKAGES_ROOT" ]; then - # Set variable permanently using .profile for this user - echo "export PM_PACKAGES_ROOT=\$HOME/packman-repo" >> ~/.profile - # Set variable temporarily in this process so that the following execution will work - export PM_PACKAGES_ROOT="${HOME}/packman-repo" -fi - -# Ensure the packages root path exists: -if [ ! -d "$PM_PACKAGES_ROOT" ]; then - echo "Creating packman packages repository at $PM_PACKAGES_ROOT" - mkdir -p "$PM_PACKAGES_ROOT" -fi - -# The packman module may be externally configured -if [ -z "$PM_MODULE_EXT" ]; then - PM_MODULE_DIR="$PM_PACKAGES_ROOT/packman-common/$PM_PACKMAN_VERSION" - export PM_MODULE="$PM_MODULE_DIR/packman.py" -else - export PM_MODULE="$PM_MODULE_EXT" -fi - -fetch_file_from_s3() -{ - SOURCE=$1 - SOURCE_URL=http://packman.s3.amazonaws.com/$SOURCE - TARGET=$2 - echo "Fetching $SOURCE from S3 ..." - if command -v wget >/dev/null 2>&1; then - wget --quiet -O$TARGET $SOURCE_URL - else - curl -o $TARGET $SOURCE_URL -s -S - fi -} - -# Ensure the packman package exists: -if [ ! -f "$PM_MODULE" ]; then - PM_MODULE_PACKAGE="packman-common@$PM_PACKMAN_VERSION.zip" - TARGET="/tmp/$PM_MODULE_PACKAGE" - # We always fetch packman from S3: - fetch_file_from_s3 $PM_MODULE_PACKAGE $TARGET - if [ "$?" -eq "0" ]; then - echo "Unpacking ..." - mkdir -p "$PM_MODULE_DIR" - unzip -q $TARGET -d "$PM_MODULE_DIR" - rm $TARGET - else - echo "Failure while fetching packman module from S3!" - exit 1 - fi -fi - -# Generate temporary file name for environment variables: -PM_VAR_PATH=`mktemp -u -t tmp.XXXXX.$$.pmvars` - -python "$PM_MODULE" $* --var-path="$PM_VAR_PATH" -exit_code=$? - -# Export the variables if the file was used and remove the file: -if [ -f "$PM_VAR_PATH" ]; then - while read -r line - do - if [ ${#line} -gt 0 ]; then - export "$line" - fi - done < "$PM_VAR_PATH" - rm -f "$PM_VAR_PATH" -fi - -# Return the exit code from python -if [ "$exit_code" != 0 ]; then - exit $exit_code -fi diff --git a/PxShared/buildtools/packman/packman.cmd b/PxShared/buildtools/packman/packman.cmd deleted file mode 100644 index 8e98015..0000000 --- a/PxShared/buildtools/packman/packman.cmd +++ /dev/null @@ -1,41 +0,0 @@ -:: Reset errorlevel status so we are not inheriting this state from the calling process:
-@call :RESET_ERROR
-:: You can remove the call below if you do your own manual configuration of the dev machines
-@call "%~dp0\win-bootstrap\configure.bat"
-@if errorlevel 1 exit /b 1
-:: Everything below is mandatory
-@if not defined PM_PYTHON goto :PYTHON_ENV_ERROR
-@if not defined PM_MODULE goto :MODULE_ENV_ERROR
-
-:: Generate temporary path for variable file
-:TEMP_VAR_PATH_LOOP
-@set "PM_VAR_PATH=%tmp%\tmp.%RANDOM%.pmvars"
-@if exist "%PM_VAR_PATH%" goto :TEMP_VAR_PATH_LOOP
-
-@"%PM_PYTHON%" "%PM_MODULE%" %* --var-path="%PM_VAR_PATH%"
-@if errorlevel 1 goto :eof
-
-:: Marshall environment variables into the current environment if they have been generated and remove temporary file
-@if exist "%PM_VAR_PATH%" (
- @for /F "usebackq tokens=*" %%A in ("%PM_VAR_PATH%") do @set "%%A"
- @if errorlevel 1 goto :VAR_ERROR
- @del /F "%PM_VAR_PATH%"
-)
-@set PM_VAR_PATH=
-@goto :eof
-
-:: Subroutines below
-:PYTHON_ENV_ERROR
-@echo User environment variable PM_PYTHON is not set! Please configure machine for packman or call configure.bat.
-@exit /b 1
-
-:MODULE_ENV_ERROR
-@echo User environment variable PM_MODULE is not set! Please configure machine for packman or call configure.bat.
-@exit /b 1
-
-:VAR_ERROR
-@echo Error while processing and setting environment variables!
-@exit /b 1
-
-:RESET_ERROR
-@exit /b 0
\ No newline at end of file diff --git a/PxShared/buildtools/packman/packman_config.txt b/PxShared/buildtools/packman/packman_config.txt deleted file mode 100644 index a0a912b..0000000 --- a/PxShared/buildtools/packman/packman_config.txt +++ /dev/null @@ -1,5 +0,0 @@ -PM_PACKAGES_SOURCE=gtl -PM_GTL_USER=svcgtlautomate -PM_GTL_KEY=QHV0ME1AdDNHVEwkY3IxcHQk -PM_S3_READ_KEY_ID=AKIAJHPSPBMWMTZS6TJA -PM_S3_READ_SECRET_KEY=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 diff --git a/PxShared/buildtools/packman/win-bootstrap/configure.bat b/PxShared/buildtools/packman/win-bootstrap/configure.bat deleted file mode 100644 index b6b079b..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/configure.bat +++ /dev/null @@ -1,104 +0,0 @@ -@set PM_PACKMAN_VERSION=4.2-rc2 - -:: Specify where config file could exist -@set PM_CONFIG_PATH=%~dp0..\packman_config.txt - -:: The external root may already be configured and we should do minimal work in that case -@if defined PM_PACKAGES_ROOT goto ENSURE_DIR - -:: If the folder isn't set we assume that the best place for it is on the drive that we are currently -:: running from -@set PM_DRIVE=%CD:~0,2% - -@set PM_PACKAGES_ROOT=%PM_DRIVE%\packman-repo - -:: We use *setx* here so that the variable is persisted in the user environment -@echo Setting user environment variable PM_PACKAGES_ROOT to %PM_PACKAGES_ROOT% -@setx PM_PACKAGES_ROOT %PM_PACKAGES_ROOT% -@if errorlevel 1 goto ERROR - -:: The above doesn't work properly from a build step in VisualStudio because a separate process is -:: spawned for it so it will be lost for subsequent compilation steps - VisualStudio must -:: be launched from a new process. We catch this odd-ball case here: -@if defined PM_DISABLE_VS_WARNING goto ENSURE_DIR -@if not defined VSLANG goto ENSURE_DIR -@echo The above is a once-per-computer operation. Unfortunately VisualStudio cannot pick up environment change -@echo unless *VisualStudio is RELAUNCHED*. -@echo If you are launching VisualStudio from command line or command line utility make sure -@echo you have a fresh launch environment (relaunch the command line or utility). -@echo If you are using 'linkPath' and referring to packages via local folder links you can safely ignore this warning. -@echo You can disable this warning by setting the environment variable PM_DISABLE_VS_WARNING. -@echo. - -:: Check for the directory that we need. Note that mkdir will create any directories -:: that may be needed in the path -:ENSURE_DIR -@if not exist "%PM_PACKAGES_ROOT%" ( - @echo Creating directory %PM_PACKAGES_ROOT% - @mkdir "%PM_PACKAGES_ROOT%" - @if errorlevel 1 goto ERROR_MKDIR_PACKAGES_ROOT -) - -:: The Python interpreter may already be externally configured -@if defined PM_PYTHON_EXT ( - @set PM_PYTHON=%PM_PYTHON_EXT% - @goto PACKMAN -) - -@set PM_PYTHON_DIR=%PM_PACKAGES_ROOT%\python\2.7.6-windows-x86 -@set PM_PYTHON=%PM_PYTHON_DIR%\python.exe - -@if exist "%PM_PYTHON%" goto PACKMAN - -@set [email protected] -@for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do @set TEMP_FILE_NAME=%%a -@set TARGET=%TEMP_FILE_NAME%.exe -@call "%~dp0fetch_file_from_s3.cmd" %PM_PYTHON_PACKAGE% %TARGET% -@if errorlevel 1 goto ERROR - -@echo Unpacking ... -@%TARGET% -o"%PM_PYTHON_DIR%" -y 1> nul -@if errorlevel 1 goto ERROR - -@del %TARGET% - -:PACKMAN -:: The packman module may already be externally configured -@if defined PM_MODULE_EXT ( - @set PM_MODULE=%PM_MODULE_EXT% - @goto END -) - -@set PM_MODULE_DIR=%PM_PACKAGES_ROOT%\packman-common\%PM_PACKMAN_VERSION% -@set PM_MODULE=%PM_MODULE_DIR%\packman.py - -@if exist "%PM_MODULE%" goto END - -@set PM_MODULE_PACKAGE=packman-common@%PM_PACKMAN_VERSION%.zip -@for /f "delims=" %%a in ('powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0\generate_temp_file_name.ps1"') do @set TEMP_FILE_NAME=%%a -@set TARGET=%TEMP_FILE_NAME% -@call "%~dp0fetch_file_from_s3.cmd" %PM_MODULE_PACKAGE% %TARGET% -@if errorlevel 1 goto ERROR - -@echo Unpacking ... -@"%PM_PYTHON%" "%~dp0\install_package.py" %TARGET% "%PM_MODULE_DIR%" -@if errorlevel 1 goto ERROR - -@del %TARGET% - -@goto END - -:ERROR_MKDIR_PACKAGES_ROOT -@echo Failed to automatically create packman packages repo at %PM_PACKAGES_ROOT%. -@echo Please set a location explicitly that packman has permission to write to, by issuing: -@echo. -@echo setx PM_PACKAGES_ROOT {path-you-choose-for-storing-packman-packages-locally} -@echo. -@echo Then launch a new command console for the changes to take effect and run packman command again. -@exit /B 1 - -:ERROR -@echo !!! Failure while configuring local machine :( !!! -@exit /B 1 - -:END diff --git a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_gtl.ps1 b/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_gtl.ps1 deleted file mode 100644 index d4ae86b..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_gtl.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -param( -[Parameter(Mandatory=$true)][string]$sourceGUID=$null, -[string]$output="out.exe" -) -$source = "http://nvgtl/download/" + $sourceGUID -$filename = $output -$key64 = 'QHV0ME1AdDNHVEwkY3IxcHQk' -$key = [System.Text.Encoding]::GetEncoding(1252).GetString([Convert]::FromBase64String($key64)) -$key = $key | ConvertTo-SecureString -asPlainText -Force -$credential = New-Object System.Management.Automation.PSCredential('svcgtlautomate', $key) -$cache = New-Object System.Net.CredentialCache -$cache.Add( "http://sso.nvidia.com", "NTLM", $credential) - -$req = [System.Net.httpwebrequest]::Create($source) -$req.cookiecontainer = New-Object System.net.CookieContainer -$req.Credentials = $cache -Write-Host "Connecting to NVGTL ..." -$res = $req.GetResponse() - -if($res.StatusCode -eq "OK") { - Write-Host "Downloading ..." - [int]$goal = $res.ContentLength - $reader = $res.GetResponseStream() - $writer = new-object System.IO.FileStream $fileName, "Create" - [byte[]]$buffer = new-object byte[] 4096 - [int]$total = [int]$count = 0 - do - { - $count = $reader.Read($buffer, 0, $buffer.Length); - $writer.Write($buffer, 0, $count); - $total += $count - if($goal -gt 0) { - Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100) - } else { - Write-Progress "Downloading $url" "Saving $total bytes..." -id 0 - } - } while ($count -gt 0) - - $reader.Close() - $writer.Flush() - $writer.Close() -} - diff --git a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_s3.cmd b/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_s3.cmd deleted file mode 100644 index 550040f..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_s3.cmd +++ /dev/null @@ -1,19 +0,0 @@ -:: You need to specify <package-name> <target-name> as input to this command
-
-@set PACKAGE_NAME=%1
-@set TARGET=%2
-
-@echo Fetching %PACKAGE_NAME% from s3 ...
-
-@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% -output %TARGET%
-:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
-:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes:
-@if not exist %TARGET% goto ERROR_DOWNLOAD_FAILED
-@if %~z2==0 goto ERROR_DOWNLOAD_FAILED
-
-@exit /b 0
-
-:ERROR_DOWNLOAD_FAILED
-@echo Failed to download file from %1
-@echo Most likely because endpoint cannot be reached (VPN connection down?)
-@exit /b 1
\ No newline at end of file diff --git a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 b/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 deleted file mode 100644 index ad4c7d4..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_s3.ps1 +++ /dev/null @@ -1,60 +0,0 @@ -param(
-[Parameter(Mandatory=$true)][string]$sourceName=$null,
-[string]$output="out.exe"
-)
-$source = "http://packman.s3.amazonaws.com/" + $sourceName
-$filename = $output
-
-$triesLeft = 3
-
-do
-{
- $triesLeft -= 1
- $req = [System.Net.httpwebrequest]::Create($source)
- $req.cookiecontainer = New-Object System.net.CookieContainer
-
- try
- {
- Write-Host "Connecting to S3 ..."
- $res = $req.GetResponse()
- if($res.StatusCode -eq "OK") {
- Write-Host "Downloading ..."
- [int]$goal = $res.ContentLength
- $reader = $res.GetResponseStream()
- $writer = new-object System.IO.FileStream $fileName, "Create"
- [byte[]]$buffer = new-object byte[] 4096
- [int]$total = [int]$count = 0
- do
- {
- $count = $reader.Read($buffer, 0, $buffer.Length);
- $writer.Write($buffer, 0, $count);
- $total += $count
- if($goal -gt 0) {
- Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
- } else {
- Write-Progress "Downloading $url" "Saving $total bytes..." -id 0
- }
- } while ($count -gt 0)
-
- $triesLeft = 0
- }
- }
- catch
- {
- Write-Host "Error connecting to S3!"
- Write-Host $_.Exception|format-list -force
- }
- finally
- {
- if ($reader)
- {
- $reader.Close()
- }
- if ($writer)
- {
- $writer.Flush()
- $writer.Close()
- }
- }
-} while ($triesLeft -gt 0)
-
diff --git a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_url.ps1 b/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_url.ps1 deleted file mode 100644 index 9abaa46..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/fetch_file_from_url.ps1 +++ /dev/null @@ -1,37 +0,0 @@ -param(
-[Parameter(Mandatory=$true)][string]$sourceUrl=$null,
-[Parameter(Mandatory=$true)][string]$output=$null
-)
-$source = $sourceUrl
-$filename = $output
-
-$req = [System.Net.httpwebrequest]::Create($source)
-$req.cookiecontainer = New-Object System.net.CookieContainer
-
-Write-Host "Connecting to $source ..."
-$res = $req.GetResponse()
-
-if($res.StatusCode -eq "OK") {
- Write-Host "Downloading ..."
- [int]$goal = $res.ContentLength
- $reader = $res.GetResponseStream()
- $writer = new-object System.IO.FileStream $fileName, "Create"
- [byte[]]$buffer = new-object byte[] 4096
- [int]$total = [int]$count = 0
- do
- {
- $count = $reader.Read($buffer, 0, $buffer.Length);
- $writer.Write($buffer, 0, $count);
- $total += $count
- if($goal -gt 0) {
- Write-Progress "Downloading $url" "Saving $total of $goal" -id 0 -percentComplete (($total/$goal)*100)
- } else {
- Write-Progress "Downloading $url" "Saving $total bytes..." -id 0
- }
- } while ($count -gt 0)
-
- $reader.Close()
- $writer.Flush()
- $writer.Close()
-}
-
diff --git a/PxShared/buildtools/packman/win-bootstrap/generate_temp_file_name.ps1 b/PxShared/buildtools/packman/win-bootstrap/generate_temp_file_name.ps1 deleted file mode 100644 index 896cf14..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/generate_temp_file_name.ps1 +++ /dev/null @@ -1,2 +0,0 @@ -$out = [System.IO.Path]::GetTempFileName()
-Write-Host $out
\ No newline at end of file diff --git a/PxShared/buildtools/packman/win-bootstrap/install_package.py b/PxShared/buildtools/packman/win-bootstrap/install_package.py deleted file mode 100644 index ce50a3e..0000000 --- a/PxShared/buildtools/packman/win-bootstrap/install_package.py +++ /dev/null @@ -1,39 +0,0 @@ -import logging
-import zipfile
-import tempfile
-import sys
-import shutil
-
-__author__ = 'hfannar'
-logging.basicConfig(level=logging.WARNING, format="%(message)s")
-logger = logging.getLogger('install_package')
-
-
-class TemporaryDirectory:
- def __init__(self):
- self.path = None
-
- def __enter__(self):
- self.path = tempfile.mkdtemp()
- return self.path
-
- def __exit__(self, type, value, traceback ):
- # Remove temporary data created
- shutil.rmtree(self.path)
-
-
-def install_package(package_src_path, package_dst_path):
- with zipfile.ZipFile(package_src_path, allowZip64=True) as zip_file, TemporaryDirectory() as temp_dir:
- zip_file.extractall(temp_dir)
- # Recursively copy (temp_dir will be automatically cleaned up on exit)
- try:
- # Recursive copy is needed because both package name and version folder could be missing in
- # target directory:
- shutil.copytree(temp_dir, package_dst_path)
- except OSError, exc:
- logger.warning("Directory %s already present, packaged installation aborted" % package_dst_path)
- else:
- logger.info("Package successfully installed to %s" % package_dst_path)
-
-
-install_package(sys.argv[1], sys.argv[2])
\ No newline at end of file diff --git a/PxShared/buildtools/steps/build_all_linux.sh b/PxShared/buildtools/steps/build_all_linux.sh deleted file mode 100644 index 167912f..0000000 --- a/PxShared/buildtools/steps/build_all_linux.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash +x - -set -e - -# get number of CPU cores -if [ -f /proc/cpuinfo ]; then - CPUS=`grep processor /proc/cpuinfo | wc -l` -else - CPUS=1 -fi - -# Stackoverflow suggests jobs count of (CPU cores + 1) as a respctively good number! -JOBS=`expr $CPUS + 1` - -# run make for all configs -pushd "$(dirname "$0")/../../compiler/linux-debug-clang" -make -j$JOBS || exit 1 -popd - -pushd "$(dirname "$0")/../../compiler/linux-release-clang" -make -j$JOBS || exit 1 -popd diff --git a/PxShared/buildtools/steps/build_all_mac.sh b/PxShared/buildtools/steps/build_all_mac.sh deleted file mode 100644 index 57437a0..0000000 --- a/PxShared/buildtools/steps/build_all_mac.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash +x - -# exit script on first error -set -e - -# get number of CPU cores -CPUS=`sysctl -n hw.ncpu` - -# Stackoverflow suggests jobs count of (CPU cores + 1) as a respctively good number! -JOBS=`expr $CPUS + 1` - -build_config() -{ - CONFIG=$1 - echo "*** Building: $CONFIG ***" - pushd "$(dirname "$0")/../../compiler/$CONFIG" - make -j$JOBS install - popd -} - -# run make for all configs -build_config "osx32-checked" -build_config "osx32-debug" -build_config "osx32-profile" -build_config "osx32-release" -build_config "osx64-checked" -build_config "osx64-debug" -build_config "osx64-profile" -build_config "osx64-release" diff --git a/PxShared/buildtools/steps/build_all_windows.bat b/PxShared/buildtools/steps/build_all_windows.bat deleted file mode 100644 index 5708927..0000000 --- a/PxShared/buildtools/steps/build_all_windows.bat +++ /dev/null @@ -1,12 +0,0 @@ -@cmd /c "%~dp0build_all_windows_vc12.bat" -@if %ERRORLEVEL% neq 0 goto ERROR - -@cmd /c "%~dp0build_all_windows_vc14.bat" -@if %ERRORLEVEL% neq 0 goto ERROR - -:: Success -@exit /B 0 - -:ERROR -@echo !!! Failure while building for Windows!!! -@exit /B 1 diff --git a/PxShared/buildtools/steps/build_all_windows_vc12.bat b/PxShared/buildtools/steps/build_all_windows_vc12.bat deleted file mode 100644 index 695c20c..0000000 --- a/PxShared/buildtools/steps/build_all_windows_vc12.bat +++ /dev/null @@ -1,60 +0,0 @@ -:: Setup VS2013 build environment -@call "%VS120COMNTOOLS%VsdevCmd.bat" - -:: Note that we use /build rather than /rebuild because cmake cleans the directories when we -:: generate the projects (making /rebuild redundant since it's basically /clean + /build). -:: By using /build these bat files can be useful during regular development (to verify changes) -:: Will rename them from rebuild to build at a future point in time. - -@set ROOT_PATH=%~dp0..\..\compiler - -@set SOLUTION_PATH=vc12win32-mt\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -@set SOLUTION_PATH=vc12win32-md\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -@set SOLUTION_PATH=vc12win64-mt\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -@set SOLUTION_PATH=vc12win64-md\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -:: Success -@exit /B 0 - -:ERROR -@echo Failure while building *Windows vc12* targets! -@exit /B 1 - -:BUILD -@echo | set /p dummyName=** Building %SOLUTION_PATH% debug ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "debug" /Project INSTALL -@echo ** End of %SOLUTION_PATH% debug ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - -@echo | set /p dummyName=** Building %SOLUTION_PATH% profile ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "profile" /Project INSTALL -@echo ** End of %SOLUTION_PATH% profile ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - -@echo | set /p dummyName=** Building %SOLUTION_PATH% profile ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "checked" /Project INSTALL -@echo ** End of %SOLUTION_PATH% checked ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - -@echo | set /p dummyName=** Building %SOLUTION_PATH% profile ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "release" /Project INSTALL -@echo ** End of %SOLUTION_PATH% release ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - - -@exit /B
\ No newline at end of file diff --git a/PxShared/buildtools/steps/build_all_windows_vc14.bat b/PxShared/buildtools/steps/build_all_windows_vc14.bat deleted file mode 100644 index 3baec1d..0000000 --- a/PxShared/buildtools/steps/build_all_windows_vc14.bat +++ /dev/null @@ -1,61 +0,0 @@ -:: Setup VS2015 build environment -@call "%VS140COMNTOOLS%VsdevCmd.bat" - -:: Note that we use /build rather than /rebuild because cmake cleans the directories when we -:: generate the projects (making /rebuild redundant since it's basically /clean + /build). -:: By using /build these bat files can be useful during regular development (to verify changes) -:: Will rename them from rebuild to build at a future point in time. - -@set ROOT_PATH=%~dp0..\..\compiler - -:: Windows 'all' -@set SOLUTION_PATH=vc14win32-mt\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -@set SOLUTION_PATH=vc14win32-md\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -@set SOLUTION_PATH=vc14win64-mt\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -@set SOLUTION_PATH=vc14win64-md\PxShared.sln -@call :BUILD -@if %ERRORLEVEL% neq 0 goto ERROR - -:: Success -@exit /B 0 - -:ERROR -@echo Failure while building *Windows vc14* targets! -@exit /B 1 - -:BUILD -@echo | set /p dummyName=** Building %SOLUTION_PATH% debug ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "debug" /Project INSTALL -@echo ** End of %SOLUTION_PATH% debug ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - -@echo | set /p dummyName=** Building %SOLUTION_PATH% profile ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "profile" /Project INSTALL -@echo ** End of %SOLUTION_PATH% profile ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - -@echo | set /p dummyName=** Building %SOLUTION_PATH% profile ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "checked" /Project INSTALL -@echo ** End of %SOLUTION_PATH% checked ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - -@echo | set /p dummyName=** Building %SOLUTION_PATH% profile ... ** -@devenv "%ROOT_PATH%\%SOLUTION_PATH%" /build "release" /Project INSTALL -@echo ** End of %SOLUTION_PATH% release ** -@echo. -@if %ERRORLEVEL% neq 0 goto ERROR - - -@exit /B
\ No newline at end of file diff --git a/PxShared/buildtools/steps/package_all_linux.sh b/PxShared/buildtools/steps/package_all_linux.sh deleted file mode 100644 index 2b3d7af..0000000 --- a/PxShared/buildtools/steps/package_all_linux.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash +x - -set -e - -# build docs -pushd "$(dirname "$0")/../../docs/_compile" -./build_all.sh -popd - -# remove all zips -pushd "$(dirname "$0")/../.." -rm -f *.zip -popd - -# replace packman's config file to use s3 instead of gtl -echo "s3" > "$(dirname "$0")/../packman/source.conf" - -# run packager -if [ -z $1 ] ; then - OPTIONS="" -else - OPTIONS="-v $1" - shift -fi - -pushd "$(dirname "$0")/../packager/" -./create_packages.sh linux $OPTIONS $@ -popd
\ No newline at end of file diff --git a/PxShared/buildtools/steps/package_all_mac.sh b/PxShared/buildtools/steps/package_all_mac.sh deleted file mode 100644 index e7566bc..0000000 --- a/PxShared/buildtools/steps/package_all_mac.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash +x - -# exit script on first error -set -e - -#@set ROOT_PATH=%~dp0..\.. - -#::Remove old builds to keep things clean (important on build agents so we don't fill them up) -#@del /q /f "%ROOT_PATH%\pxshared*.zip" - -# run packager -if [ -z $1 ] ; then - VERSION=0 -else - VERSION=$1 -fi - -ROOT_PATH=$(dirname ${BASH_SOURCE})/../.. -PACKMAN_CMD=$ROOT_PATH/buildtools/packman/packman -echo $PACKMAN_CMD - -source "$PACKMAN_CMD" install packman-packager 1.0.3 -echo "Launching create_packman_packages" -python "$PM_packman_packager_PATH/create_packman_packages.py" "$ROOT_PATH/install" --output-dir="$ROOT_PATH" osx pxshared $VERSION "$PM_packman_packager_PATH/templates/CMakeConfigWrapperNIX.cmake" "$PM_packman_packager_PATH/templates/CMakeConfigVersionTemplate.cmake" diff --git a/PxShared/buildtools/steps/package_all_ps4.bat b/PxShared/buildtools/steps/package_all_ps4.bat deleted file mode 100644 index 87455e9..0000000 --- a/PxShared/buildtools/steps/package_all_ps4.bat +++ /dev/null @@ -1,20 +0,0 @@ -@set ROOT_PATH=%~dp0..\.. - -::Remove old builds to keep things clean (important on build agents so we don't fill them up) -@del /q /f "%ROOT_PATH%\blast_*.zip" - -@pushd "%ROOT_PATH%\docs\_compile" -@call build_all.bat -@popd -@if %errorlevel% NEQ 0 goto :ERROR - -@set VERSION=%1 -@set OPTIONS= -@if ["%VERSION%"] NEQ [""] set OPTIONS=-v %VERSION% - -@call "%ROOT_PATH%\buildtools\packager\create_packages.bat" %OPTIONS% ps4 -@if %ERRORLEVEL% EQU 0 goto :eof - -:ERROR -@echo Failure during packaging for PS4!!! -@exit /b 1
\ No newline at end of file diff --git a/PxShared/buildtools/steps/package_all_windows.bat b/PxShared/buildtools/steps/package_all_windows.bat deleted file mode 100644 index e55cb1b..0000000 --- a/PxShared/buildtools/steps/package_all_windows.bat +++ /dev/null @@ -1,26 +0,0 @@ -@set ROOT_PATH=%~dp0..\.. - -::Remove old builds to keep things clean (important on build agents so we don't fill them up) -@del /q /f "%ROOT_PATH%\pxshared*.zip" - -@set VERSION=%1 -@set OPTIONS= -@if ["%VERSION%"] EQU [""] set VERSION=0 - -@call "%ROOT_PATH%\buildtools\packman\packman" install python 2.7.6-windows-x86 -@if %ERRORLEVEL% NEQ 0 goto :ERROR - -@call "%ROOT_PATH%\buildtools\packman\packman" install packman-packager 1.0 -@if %ERRORLEVEL% NEQ 0 goto :ERROR - -%PM_PYTHON% "%PM_packman_packager_PATH%/create_packman_packages.py" "%ROOT_PATH%\install" --output-dir="%ROOT_PATH%" vc14win pxshared %VERSION% "%PM_packman_packager_PATH%/templates/CMakeConfigWrapperWindows.cmake" "%PM_packman_packager_PATH%/templates/CMakeConfigVersionTemplate.cmake" -@if %ERRORLEVEL% NEQ 0 goto :ERROR - -%PM_PYTHON% "%PM_packman_packager_PATH%/create_packman_packages.py" "%ROOT_PATH%\install" --output-dir="%ROOT_PATH%" vc12win pxshared %VERSION% "%PM_packman_packager_PATH%/templates/CMakeConfigWrapperWindows.cmake" "%PM_packman_packager_PATH%/templates/CMakeConfigVersionTemplate.cmake" -@if %ERRORLEVEL% NEQ 0 goto :ERROR - -@goto :eof - -:ERROR -@echo Failure during packaging for Windows!!! -@exit /b 1 diff --git a/PxShared/buildtools/steps/package_all_xboxone.bat b/PxShared/buildtools/steps/package_all_xboxone.bat deleted file mode 100644 index 86d5ff0..0000000 --- a/PxShared/buildtools/steps/package_all_xboxone.bat +++ /dev/null @@ -1,20 +0,0 @@ -@set ROOT_PATH=%~dp0..\.. - -::Remove old builds to keep things clean (important on build agents so we don't fill them up) -@del /q /f "%ROOT_PATH%\blast_*.zip" - -@pushd "%ROOT_PATH%\docs\_compile" -@call build_all.bat -@popd -@if %errorlevel% NEQ 0 goto :ERROR - -@set VERSION=%1 -@set OPTIONS= -@if ["%VERSION%"] NEQ [""] set OPTIONS=-v %VERSION% - -@call "%ROOT_PATH%\buildtools\packager\create_packages.bat" %OPTIONS% xboxone -@if %ERRORLEVEL% EQU 0 goto :eof - -:ERROR -@echo Failure during packaging for xboxone!!! -@exit /b 1
\ No newline at end of file diff --git a/PxShared/buildtools/steps/pre-build_linux.sh b/PxShared/buildtools/steps/pre-build_linux.sh deleted file mode 100644 index c6c3160..0000000 --- a/PxShared/buildtools/steps/pre-build_linux.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash +x - -set -e -pushd "$(dirname "$0")/../.." -./generate_projects_linux.sh -popd - diff --git a/PxShared/buildtools/steps/pre-build_mac.sh b/PxShared/buildtools/steps/pre-build_mac.sh deleted file mode 100644 index 3094938..0000000 --- a/PxShared/buildtools/steps/pre-build_mac.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash +x - -set -e -pushd "$(dirname "$0")/../.." -./generate_projects_mac.sh -popd - diff --git a/PxShared/buildtools/steps/pre-build_ps4.bat b/PxShared/buildtools/steps/pre-build_ps4.bat deleted file mode 100644 index 7be0ba8..0000000 --- a/PxShared/buildtools/steps/pre-build_ps4.bat +++ /dev/null @@ -1,5 +0,0 @@ -@pushd "%~dp0..\.." -@call generate_projects_vc14ps4.bat -@popd -@if %errorlevel% NEQ 0 exit /b 1 - diff --git a/PxShared/buildtools/steps/pre-build_windows.bat b/PxShared/buildtools/steps/pre-build_windows.bat deleted file mode 100644 index cd80520..0000000 --- a/PxShared/buildtools/steps/pre-build_windows.bat +++ /dev/null @@ -1,6 +0,0 @@ -@pushd "%~dp0..\.." -@call generate_projects_win.bat vc12 -@call generate_projects_win.bat vc14 -@popd -@if %errorlevel% NEQ 0 exit /b 1 - diff --git a/PxShared/buildtools/steps/pre-build_xboxone.bat b/PxShared/buildtools/steps/pre-build_xboxone.bat deleted file mode 100644 index 2e9c950..0000000 --- a/PxShared/buildtools/steps/pre-build_xboxone.bat +++ /dev/null @@ -1,5 +0,0 @@ -@pushd "%~dp0..\.." -@call generate_projects_vc14xboxone.bat -@popd -@if %errorlevel% NEQ 0 exit /b 1 - diff --git a/PxShared/buildtools/steps/rebuild_all_ps4.bat b/PxShared/buildtools/steps/rebuild_all_ps4.bat deleted file mode 100644 index 405b4ea..0000000 --- a/PxShared/buildtools/steps/rebuild_all_ps4.bat +++ /dev/null @@ -1,18 +0,0 @@ -:: Setup VS2015 build environment -@call "%VS140COMNTOOLS%VsdevCmd.bat" - -@set ROOT_PATH=%~dp0..\..\compiler -:: Xbox targets -@devenv "%ROOT_PATH%\vc14ps4-cmake\BlastAll.sln" /rebuild "debug" -@if %ERRORLEVEL% neq 0 goto ERROR - -@devenv "%ROOT_PATH%\vc14ps4-cmake\BlastAll.sln" /rebuild "profile" -@if %ERRORLEVEL% neq 0 goto ERROR - - -:: Success -@exit /B 0 - -:ERROR -@echo Failure while building *PS4* targets! -@exit /B 1 diff --git a/PxShared/buildtools/steps/rebuild_all_xboxone.bat b/PxShared/buildtools/steps/rebuild_all_xboxone.bat deleted file mode 100644 index 7c2d3f1..0000000 --- a/PxShared/buildtools/steps/rebuild_all_xboxone.bat +++ /dev/null @@ -1,17 +0,0 @@ -:: Setup VS2015 build environment -@call "%VS140COMNTOOLS%VsdevCmd.bat" - -@set ROOT_PATH=%~dp0..\..\compiler -:: Xbox targets -@devenv "%ROOT_PATH%\vc14xboxone-cmake\BlastAll.sln" /rebuild "debug" -@if %ERRORLEVEL% neq 0 goto ERROR - -@devenv "%ROOT_PATH%\vc14xboxone-cmake\BlastAll.sln" /rebuild "profile" -@if %ERRORLEVEL% neq 0 goto ERROR - -:: Success -@exit /B 0 - -:ERROR -@echo Failure while building *Xbox One* targets! -@exit /B 1 diff --git a/PxShared/buildtools/steps/run_tests_linux.sh b/PxShared/buildtools/steps/run_tests_linux.sh deleted file mode 100644 index 8770e39..0000000 --- a/PxShared/buildtools/steps/run_tests_linux.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash +x - -set -e - -# run tests -pushd "$(dirname "$0")/../../bin/linux64-gcc" -./BlastUnitTestsDEBUG.elf --gtest_output=xml:BlastUnitTestsDEBUG.xml -echo \#\#teamcity[importData type=\'gtest\' parseOutOfDate=\'true\' file=\'bin/linux64-gcc/BlastUnitTestsDEBUG.xml\'] -./BlastUnitTests.elf --gtest_output=xml:BlastUnitTests.xml -echo \#\#teamcity[importData type=\'gtest\' parseOutOfDate=\'true\' file=\'bin/linux64-gcc/BlastUnitTests.xml\'] -popd diff --git a/PxShared/buildtools/steps/run_tests_windows.bat b/PxShared/buildtools/steps/run_tests_windows.bat deleted file mode 100644 index b18e2b0..0000000 --- a/PxShared/buildtools/steps/run_tests_windows.bat +++ /dev/null @@ -1,6 +0,0 @@ -@set BIN_PATH=%~dp0..\..\bin\vc14win64-cmake -@pushd "%BIN_PATH%" -@call BlastUnitTestsDEBUG_x64.exe --gtest_output=xml:BlastUnitTestsDEBUG_x64.xml -@echo ##teamcity[importData type='gtest' parseOutOfDate='true' file='%BIN_PATH%\BlastUnitTestsDEBUG_x64.xml'] -@popd -@if %errorlevel% NEQ 0 exit /b 1
\ No newline at end of file diff --git a/PxShared/common.pm b/PxShared/common.pm deleted file mode 100644 index a4a7ceb..0000000 --- a/PxShared/common.pm +++ /dev/null @@ -1,112 +0,0 @@ -sub GetXPJ -{ - my $xpj = ""; - if ( $^O eq 'linux' ) - { - $xpj= "$ENV{P4ROOT_PATH}/physx/buildtools/xpj/1/linux/xpj4"; - } - elsif ( $^O eq 'darwin' ) - { - $xpj= "$ENV{P4ROOT_PATH}/physx/buildtools/xpj/1/osx32/xpj4"; - } - else - { - $xpj= "$ENV{P4ROOT_PATH}/physx/buildtools/xpj/1/win32/xpj4.exe"; - $xpj =~ s#/#\\#g; - } - return $xpj; -} - -sub EnsurePath -{ - my @missed_files; - - foreach (@_) - { - push @missed_files, $_ unless (-d $_ or -e $_); - } - - if ($#missed_files > 0) - { - print( "Not all necessaried directories in P4 were synced, please sync the following paths:\n" ); - foreach my $file (@missed_files) - { - print ("\t$file\n"); - } - - die "Missing files"; - } -} - -sub GenerateSolutions -{ - my $project = shift; - my $xpj = GetXPJ(); - if ( $^O eq 'MSWin32' ) - { - foreach my $platform (qw(win32 win64)) - { - $ENV{PLATFORM} = "windows"; - foreach my $tool (qw(vc11 vc12 vc14)) - { - print "Generating $tool for $platform ...\n"; - system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" ); - } - } - - foreach my $platform (qw(win32modern win64modern win8arm)) - { - $ENV{PLATFORM} = "windows"; - foreach my $tool (qw(vc11)) - { - print "Generating $tool for $platform ...\n"; - system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" ); - } - } - - foreach my $platform (qw(xboxone)) - { - $ENV{PLATFORM} = "xboxone"; - foreach my $tool (qw(vc11 vc14)) - { - print "Generating $tool for $platform ...\n"; - system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" ); - } - } - foreach my $platform (qw(ps4)) - { - $ENV{PLATFORM} = "ps4"; - foreach my $tool (qw(vc10 vc11 vc12 vc14)) - { - print "Generating $tool for $platform ...\n"; - system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" ); - } - } - } - elsif ( $^O eq 'darwin' ) - { - foreach my $platform (qw(osx32 osx64 ios ios64)) - { - $ENV{PLATFORM} = "unix"; - foreach my $tool (qw(make)) - { - print "Generating $tool for $platform ...\n"; - system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" ); - } - } - } - elsif ( $^O eq 'linux' ) - { - foreach my $platform (qw(linux32 linux64)) - { - $ENV{PLATFORM} = "unix"; - foreach my $tool (qw(make)) - { - print "Generating $tool for $platform ...\n"; - system( "\"$xpj\" -v 2 -t $tool -p $platform -x $project" ); - } - } - } -} - -1; diff --git a/PxShared/dependencies.xml b/PxShared/dependencies.xml deleted file mode 100644 index ae4ba72..0000000 --- a/PxShared/dependencies.xml +++ /dev/null @@ -1,62 +0,0 @@ -<project toolsVersion="4.0"> - <platform name="common"> - <dependency name="CMakeModules" version="1.27.trunk.23612594"/> - </platform> - <platform name="windows-common" inherit="common"> - <dependency name="cmake-x64" version="3.10.1" exportAs="cmake"/> - </platform> - <platform name="windows-switch" inherit="common"> - <dependency name="cmake-x64" version="3.7.0" exportAs="cmake"/> - </platform> - <platform name="windows-vc15" inherit="windows-common"> - <dependency name="VsWhere" version="1.0.0"/> - </platform> - <platform name="linux-common" inherit="common"> - <dependency name="cmake-linux-x86_64" version="3.7.2" exportAs="cmake"/> - </platform> - <platform name="mac-common" inherit="common"> - <dependency name="cmake-mac-x86_64" version="3.7.2" exportAs="cmake"/> - </platform> - <platform name="vc11win" inherit="windows-common"> - <dependency name="nvToolsExt" version="1.0"/> - </platform> - <platform name="vc12win" inherit="windows-common"> - <dependency name="nvToolsExt" version="1.0"/> - <dependency name="CUDA" version="8.0.61"/> - </platform> - <platform name="vc14win" inherit="windows-common"> - <dependency name="nvToolsExt" version="1.0"/> - </platform> - <platform name="vc15win" inherit="windows-vc15"> - <dependency name="nvToolsExt" version="1.0"/> - </platform> - <platform name="vc14uwp" inherit="windows-common"> - </platform> - <platform name="vc15uwp" inherit="windows-vc15"> - </platform> - <platform name="vc14ps4" inherit="windows-common"> - </platform> - <platform name="vc15ps4" inherit="windows-vc15"> - </platform> - <platform name="vc14xboxone" inherit="windows-common"> - </platform> - <platform name="vc15xboxone" inherit="windows-vc15"> - </platform> - <platform name="vc14switch" inherit="windows-switch"> - </platform> - <platform name="vc15switch" inherit="windows-switch"> - </platform> - <platform name="linux" inherit="linux-common"> - </platform> - <platform name="linux-crosscompile" inherit="windows-common"> - <dependency name="MinGW" version="0.6.2"/> - <dependency name="clang-crosscompile" version="3.7.0" exportAs="ClangCrosscompile"/> - </platform> - <platform name="mac" inherit="mac-common"> - </platform> - <platform name="ios" inherit="mac-common"> - </platform> - <platform name="android" inherit="windows-common"> - <dependency name="android-ndk" version="13.2" exportAs="AndroidNDK"/> - </platform> -</project> diff --git a/PxShared/generate_projects_android.bat b/PxShared/generate_projects_android.bat deleted file mode 100644 index 9fd9ab6..0000000 --- a/PxShared/generate_projects_android.bat +++ /dev/null @@ -1,19 +0,0 @@ -:: Reset errorlevel status so we are not inheriting this state from the calling process: -@call :CLEAN_EXIT - -:: Use the "short" path so that we don't have to quote paths in that calls below. If we don't do that spaces can break us. -@SET PXSHARED_ROOT_DIR=%~dp0 -@SET PXSHARED_ROOT_DIR=%PXSHARED_ROOT_DIR:\=/% - -:: Run packman to ensure dependencies are present and run cmake generation script afterwards -@echo Running packman in preparation for cmake ... -@echo. -call "%~dp0buildtools\packman\packman.cmd" pull "%~dp0dependencies.xml" --platform android --postscript "%~dp0buildtools\cmake_projects_android.bat" -@if %ERRORLEVEL% neq 0 ( - @exit /b %errorlevel% -) else ( - @echo Success! -) - -:CLEAN_EXIT -@exit /b 0
\ No newline at end of file diff --git a/PxShared/generate_projects_ios.sh b/PxShared/generate_projects_ios.sh deleted file mode 100644 index 200d4a3..0000000 --- a/PxShared/generate_projects_ios.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh +x - -export PXS_ROOT=$(dirname "$0") -export PXSHARED_ROOT_DIR=$PWD - -# Run packman to ensure dependencies are present and run cmake generation script afterwards -echo "Running packman in preparation for cmake ..." - -$PXS_ROOT/buildtools/packman/packman pull "$PXS_ROOT/dependencies.xml" --platform ios --postscript "$PXS_ROOT/buildtools/cmake_projects_ios.sh" -if [ "$?" -ne "0" ]; then - echo "Error $?" - exit 1 -fi - -echo "Success!"
\ No newline at end of file diff --git a/PxShared/generate_projects_linux.bat b/PxShared/generate_projects_linux.bat deleted file mode 100644 index bd489d2..0000000 --- a/PxShared/generate_projects_linux.bat +++ /dev/null @@ -1,21 +0,0 @@ -:: Reset errorlevel status so we are not inheriting this state from the calling process: -@call :CLEAN_EXIT - -@SET PXSHARED_ROOT_DIR=%~dp0 -@SET PXSHARED_ROOT_DIR=%PXSHARED_ROOT_DIR:\=/% - -:: Run packman to ensure dependencies are present and run cmake generation script afterwards -@echo Running packman in preparation for cmake ... -@echo/ - -call "%~dp0buildtools\packman\packman.cmd" pull "%~dp0dependencies.xml" --platform linux-crosscompile --postscript "%~dp0buildtools\cmake_projects_linux.bat" -@if %ERRORLEVEL% neq 0 ( - @exit /b %errorlevel% -) else ( - @echo Success! - @goto CLEAN_EXIT -) - -:CLEAN_EXIT -@exit /b 0 - diff --git a/PxShared/generate_projects_linux.sh b/PxShared/generate_projects_linux.sh deleted file mode 100644 index 361078e..0000000 --- a/PxShared/generate_projects_linux.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash +x - -export PXSHARED_ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -# Run packman to ensure dependencies are present and run cmake generation script afterwards -echo "Running packman in preparation for cmake ..." - -$PXSHARED_ROOT_DIR/buildtools/packman/packman pull "$PXSHARED_ROOT_DIR/dependencies.xml" --platform linux --postscript "$PXSHARED_ROOT_DIR/buildtools/cmake_projects_linux.sh" -if [ "$?" -ne "0" ]; then - echo "Error $?" - exit 1 -fi - -echo "Success!" - diff --git a/PxShared/generate_projects_mac.sh b/PxShared/generate_projects_mac.sh deleted file mode 100644 index f5d526e..0000000 --- a/PxShared/generate_projects_mac.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh +x - -export PXS_ROOT=$(dirname "$0") -export PXSHARED_ROOT_DIR=$PWD - -# Run packman to ensure dependencies are present and run cmake generation script afterwards -echo "Running packman in preparation for cmake ..." - -$PXS_ROOT/buildtools/packman/packman pull "$PXS_ROOT/dependencies.xml" --platform mac --postscript "$PXS_ROOT/buildtools/cmake_projects_mac.sh" -if [ "$?" -ne "0" ]; then - echo "Error $?" - exit 1 -fi - -echo "Success!"
\ No newline at end of file diff --git a/PxShared/generate_projects_uwp.bat b/PxShared/generate_projects_uwp.bat deleted file mode 100644 index 7a105fe..0000000 --- a/PxShared/generate_projects_uwp.bat +++ /dev/null @@ -1,25 +0,0 @@ -:: Reset errorlevel status so we are not inheriting this state from the calling process: -@call :CLEAN_EXIT - -@IF %1.==. GOTO ADDITIONAL_PARAMS_MISSING - -@SET PXSHARED_ROOT_DIR=%~dp0 -@SET PXSHARED_ROOT_DIR=%PXSHARED_ROOT_DIR:\=/% - -:: Run packman to ensure dependencies are present and run cmake generation script afterwards -@echo Running packman in preparation for cmake ... -@echo/ - -call "%~dp0buildtools\packman\packman.cmd" pull "%~dp0dependencies.xml" --platform %1uwp --postscript "%~dp0buildtools\cmake_projects_%1uwp.bat" -@if %ERRORLEVEL% neq 0 ( - @exit /b %errorlevel% -) else ( - @echo Success! - @goto CLEAN_EXIT -) - -:ADDITIONAL_PARAMS_MISSING -@echo Compiler needs to be specified (vc11, vc12, vc14, vc17 supported). Example: vc14 - -:CLEAN_EXIT -@exit /b 0
\ No newline at end of file diff --git a/PxShared/generate_projects_win.bat b/PxShared/generate_projects_win.bat deleted file mode 100644 index 9d8ef33..0000000 --- a/PxShared/generate_projects_win.bat +++ /dev/null @@ -1,25 +0,0 @@ -:: Reset errorlevel status so we are not inheriting this state from the calling process: -@call :CLEAN_EXIT - -@IF %1.==. GOTO ADDITIONAL_PARAMS_MISSING - -@SET PXSHARED_ROOT_DIR=%~dp0 -@SET PXSHARED_ROOT_DIR=%PXSHARED_ROOT_DIR:\=/% - -:: Run packman to ensure dependencies are present and run cmake generation script afterwards -@echo Running packman in preparation for cmake ... -@echo/ - -call "%~dp0buildtools\packman\packman.cmd" pull "%~dp0dependencies.xml" --platform %1win --postscript "%~dp0buildtools\cmake_projects_%1win.bat" -@if %ERRORLEVEL% neq 0 ( - @exit /b %errorlevel% -) else ( - @echo Success! - @goto CLEAN_EXIT -) - -:ADDITIONAL_PARAMS_MISSING -@echo Compiler needs to be specified (vc11, vc12, vc14, vc17 supported). Example: vc14 - -:CLEAN_EXIT -@exit /b 0
\ No newline at end of file diff --git a/PxShared/include/cudamanager/PxCudaContextManager.h b/PxShared/include/cudamanager/PxCudaContextManager.h deleted file mode 100644 index aca1112..0000000 --- a/PxShared/include/cudamanager/PxCudaContextManager.h +++ /dev/null @@ -1,425 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - - -#ifndef PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H -#define PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "foundation/PxSimpleTypes.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxFlags.h" -#include "task/PxTaskDefine.h" -#include "cudamanager/PxCudaMemoryManager.h" - -/* Forward decl to avoid inclusion of cuda.h */ -typedef struct CUctx_st *CUcontext; -typedef struct CUgraphicsResource_st *CUgraphicsResource; -typedef int CUdevice; - -namespace physx -{ - -class PxGpuDispatcher; - - -/** \brief Possible graphic/CUDA interoperability modes for context */ -struct PxCudaInteropMode -{ - /** - * \brief Possible graphic/CUDA interoperability modes for context - */ - enum Enum - { - NO_INTEROP = 0, - D3D10_INTEROP, - D3D11_INTEROP, - OGL_INTEROP, - - COUNT - }; -}; - -struct PxCudaInteropRegisterFlag -{ - enum Enum - { - eNONE = 0x00, - eREAD_ONLY = 0x01, - eWRITE_DISCARD = 0x02, - eSURFACE_LDST = 0x04, - eTEXTURE_GATHER = 0x08 - }; -}; - -/** -\brief collection of set bits defined in NxCudaInteropRegisterFlag. - -@see NxCudaInteropRegisterFlag -*/ -typedef PxFlags<PxCudaInteropRegisterFlag::Enum, uint32_t> PxCudaInteropRegisterFlags; -PX_FLAGS_OPERATORS(PxCudaInteropRegisterFlag::Enum, uint32_t) - -//! \brief Descriptor used to create a PxCudaContextManager -class PxCudaContextManagerDesc -{ -public: - /** - * \brief The CUDA context to manage - * - * If left NULL, the PxCudaContextManager will create a new context. If - * graphicsDevice is also not NULL, this new CUDA context will be bound to - * that graphics device, enabling the use of CUDA/Graphics interop features. - * - * If ctx is not NULL, the specified context must be applied to the thread - * that is allocating the PxCudaContextManager at creation time (aka, it - * cannot be popped). The PxCudaContextManager will take ownership of the - * context until the manager is released. All access to the context must be - * gated by lock acquisition. - * - * If the user provides a context for the PxCudaContextManager, the context - * _must_ have either been created on the GPU ordinal returned by - * PxGetSuggestedCudaDeviceOrdinal() or on your graphics device. - * - * It is perfectly acceptable to allocate device or host pinned memory from - * the context outside the scope of the PxCudaMemoryManager, so long as you - * manage its eventual cleanup. - */ - CUcontext *ctx; - - /** - * \brief D3D device pointer or OpenGl context handle - * - * Only applicable when ctx is NULL, thus forcing a new context to be - * created. In that case, the created context will be bound to this - * graphics device. - */ - void *graphicsDevice; - -#if PX_SUPPORT_GPU_PHYSX - /** - * \brief Application-specific GUID - * - * If your application employs PhysX modules that use CUDA you need to use a GUID - * so that patches for new architectures can be released for your game.You can obtain a GUID for your - * application from Nvidia. - */ - const char* appGUID; -#endif - /** - * \brief The CUDA/Graphics interop mode of this context - * - * If ctx is NULL, this value describes the nature of the graphicsDevice - * pointer provided by the user. Else it describes the nature of the - * context provided by the user. - */ - PxCudaInteropMode::Enum interopMode; - - - /** - * \brief Size of persistent memory - * - * This memory is allocated up front and stays allocated until the - * PxCudaContextManager is released. Size is in bytes, has to be power of two - * and bigger than the page size. Set to 0 to only use dynamic pages. - * - * Note: On Vista O/S and above, there is a per-memory allocation overhead - * to every CUDA work submission, so we recommend that you carefully tune - * this initial base memory size to closely approximate the amount of - * memory your application will consume. - - Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - uint32_t memoryBaseSize[PxCudaBufferMemorySpace::COUNT]; - - /** - * \brief Size of memory pages - * - * The memory manager will dynamically grow and shrink in blocks multiple of - * this page size. Size has to be power of two and bigger than 0. - - Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - uint32_t memoryPageSize[PxCudaBufferMemorySpace::COUNT]; - - /** - * \brief Maximum size of memory that the memory manager will allocate - - Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - uint32_t maxMemorySize[PxCudaBufferMemorySpace::COUNT]; - - PX_INLINE PxCudaContextManagerDesc() - { - ctx = NULL; - interopMode = PxCudaInteropMode::NO_INTEROP; - graphicsDevice = 0; -#if PX_SUPPORT_GPU_PHYSX - appGUID = NULL; -#endif - for(uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - memoryBaseSize[i] = 0; - memoryPageSize[i] = 2 * 1024*1024; - maxMemorySize[i] = UINT32_MAX; - } - } -}; - - -/** - * \brief Manages memory, thread locks, and task scheduling for a CUDA context - * - * A PxCudaContextManager manages access to a single CUDA context, allowing it to - * be shared between multiple scenes. Memory allocations are dynamic: starting - * with an initial heap size and growing on demand by a configurable page size. - * The context must be acquired from the manager before using any CUDA APIs. - * - * The PxCudaContextManager is based on the CUDA driver API and explictly does not - * support the CUDA runtime API (aka, CUDART). - * - * To enable CUDA use by an APEX scene, a PxCudaContextManager must be created - * (supplying your own CUDA context, or allowing a new context to be allocated - * for you), the PxGpuDispatcher for that context is retrieved via the - * getGpuDispatcher() method, and this is assigned to the TaskManager that is - * given to the scene via its NxApexSceneDesc. - */ -class PxCudaContextManager -{ -public: - /** - * \brief Acquire the CUDA context for the current thread - * - * Acquisitions are allowed to be recursive within a single thread. - * You can acquire the context multiple times so long as you release - * it the same count. - * - * The context must be acquired before using most CUDA functions. - * - * It is not necessary to acquire the CUDA context inside GpuTask - * launch functions, because the PxGpuDispatcher will have already - * acquired the context for its worker thread. However it is not - * harmfull to (re)acquire the context in code that is shared between - * GpuTasks and non-task functions. - */ - virtual void acquireContext() = 0; - - /** - * \brief Release the CUDA context from the current thread - * - * The CUDA context should be released as soon as practically - * possible, to allow other CPU threads (including the - * PxGpuDispatcher) to work efficiently. - */ - virtual void releaseContext() = 0; - - /** - * \brief Return the CUcontext - */ - virtual CUcontext getContext() = 0; - - /** - * \brief Return the PxCudaMemoryManager instance associated with this - * CUDA context - * Note: This is currently not used by PxSceneFlag::eENABLE_GPU_DYNAMICS. Memory allocation properties are configured - * for GPU rigid bodies using PxSceneDesc::gpuDynamicsConfig. - */ - virtual PxCudaMemoryManager *getMemoryManager() = 0; - - /** - * \brief Return the PxGpuDispatcher instance associated with this - * CUDA context - */ - virtual class physx::PxGpuDispatcher *getGpuDispatcher() = 0; - - /** - * \brief Context manager has a valid CUDA context - * - * This method should be called after creating a PxCudaContextManager, - * especially if the manager was responsible for allocating its own - * CUDA context (desc.ctx == NULL). If it returns false, there is - * no point in assigning this manager's PxGpuDispatcher to a - * TaskManager as it will be unable to execute GpuTasks. - */ - virtual bool contextIsValid() const = 0; - - /* Query CUDA context and device properties, without acquiring context */ - - virtual bool supportsArchSM10() const = 0; //!< G80 - virtual bool supportsArchSM11() const = 0; //!< G92 - virtual bool supportsArchSM12() const = 0; //!< GT200 - virtual bool supportsArchSM13() const = 0; //!< GT260 - virtual bool supportsArchSM20() const = 0; //!< GF100 - virtual bool supportsArchSM30() const = 0; //!< GK100 - virtual bool supportsArchSM35() const = 0; //!< GK110 - virtual bool supportsArchSM50() const = 0; //!< GM100 - virtual bool supportsArchSM52() const = 0; //!< GM200 - virtual bool supportsArchSM60() const = 0; //!< GP100 - virtual bool isIntegrated() const = 0; //!< true if GPU is an integrated (MCP) part - virtual bool canMapHostMemory() const = 0; //!< true if GPU map host memory to GPU (0-copy) - virtual int getDriverVersion() const = 0; //!< returns cached value of cuGetDriverVersion() - virtual size_t getDeviceTotalMemBytes() const = 0; //!< returns cached value of device memory size - virtual int getMultiprocessorCount() const = 0; //!< returns cache value of SM unit count - virtual unsigned int getClockRate() const = 0; //!< returns cached value of SM clock frequency - virtual int getSharedMemPerBlock() const = 0; //!< returns total amount of shared memory available per block in bytes - virtual int getSharedMemPerMultiprocessor() const = 0; //!< returns total amount of shared memory available per multiprocessor in bytes - virtual unsigned int getMaxThreadsPerBlock() const = 0; //!< returns the maximum number of threads per block - virtual const char *getDeviceName() const = 0; //!< returns device name retrieved from driver - virtual CUdevice getDevice() const = 0; //!< returns device handle retrieved from driver - virtual PxCudaInteropMode::Enum getInteropMode() const = 0; //!< interop mode the context was created with - - virtual void setUsingConcurrentStreams(bool) = 0; //!< turn on/off using concurrent streams for GPU work - virtual bool getUsingConcurrentStreams() const = 0; //!< true if GPU work can run in concurrent streams - /* End query methods that don't require context to be acquired */ - - /** - * \brief Register a rendering resource with CUDA - * - * This function is called to register render resources (allocated - * from OpenGL) with CUDA so that the memory may be shared - * between the two systems. This is only required for render - * resources that are designed for interop use. In APEX, each - * render resource descriptor that could support interop has a - * 'registerInCUDA' boolean variable. - * - * The function must be called again any time your graphics device - * is reset, to re-register the resource. - * - * Returns true if the registration succeeded. A registered - * resource must be unregistered before it can be released. - * - * \param resource [OUT] the handle to the resource that can be used with CUDA - * \param buffer [IN] GLuint buffer index to be mapped to cuda - * \param flags [IN] cuda interop registration flags - */ - virtual bool registerResourceInCudaGL(CUgraphicsResource &resource, uint32_t buffer, PxCudaInteropRegisterFlags flags = PxCudaInteropRegisterFlags()) = 0; - - /** - * \brief Register a rendering resource with CUDA - * - * This function is called to register render resources (allocated - * from Direct3D) with CUDA so that the memory may be shared - * between the two systems. This is only required for render - * resources that are designed for interop use. In APEX, each - * render resource descriptor that could support interop has a - * 'registerInCUDA' boolean variable. - * - * The function must be called again any time your graphics device - * is reset, to re-register the resource. - * - * Returns true if the registration succeeded. A registered - * resource must be unregistered before it can be released. - * - * \param resource [OUT] the handle to the resource that can be used with CUDA - * \param resourcePointer [IN] A pointer to either IDirect3DResource9, or ID3D10Device, or ID3D11Resource to be registered. - * \param flags [IN] cuda interop registration flags - */ - virtual bool registerResourceInCudaD3D(CUgraphicsResource &resource, void *resourcePointer, PxCudaInteropRegisterFlags flags = PxCudaInteropRegisterFlags()) = 0; - - /** - * \brief Unregister a rendering resource with CUDA - * - * If a render resource was successfully registered with CUDA using - * the registerResourceInCuda***() methods, this function must be called - * to unregister the resource before the it can be released. - */ - virtual bool unregisterResourceInCuda(CUgraphicsResource resource) = 0; - - /** - * \brief Determine if the user has configured a dedicated PhysX GPU in the NV Control Panel - * \note If using CUDA Interop, this will always return false - * \returns 1 if there is a dedicated GPU - * 0 if there is NOT a dedicated GPU - * -1 if the routine is not implemented - */ - virtual int usingDedicatedGPU() const = 0; - - /** - * \brief Release the PxCudaContextManager - * - * When the manager instance is released, it also releases its - * PxGpuDispatcher instance and PxCudaMemoryManager. Before the memory - * manager is released, it frees all allocated memory pages. If the - * PxCudaContextManager created the CUDA context it was responsible - * for, it also frees that context. - * - * Do not release the PxCudaContextManager if there are any scenes - * using its PxGpuDispatcher. Those scenes must be released first - * since there is no safe way to remove a PxGpuDispatcher from a - * TaskManager once the TaskManager has been given to a scene. - * - */ - virtual void release() = 0; - -protected: - - /** - * \brief protected destructor, use release() method - */ - virtual ~PxCudaContextManager() {} -}; - -/** - * \brief Convenience class for holding CUDA lock within a scope - */ -class PxScopedCudaLock -{ -public: - /** - * \brief ScopedCudaLock constructor - */ - PxScopedCudaLock(PxCudaContextManager& ctx) : mCtx(&ctx) - { - mCtx->acquireContext(); - } - - /** - * \brief ScopedCudaLock destructor - */ - ~PxScopedCudaLock() - { - mCtx->releaseContext(); - } - -protected: - - /** - * \brief CUDA context manager pointer (initialized in the constructor) - */ - PxCudaContextManager* mCtx; -}; - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXCUDACONTEXTMANAGER_H diff --git a/PxShared/include/cudamanager/PxCudaMemoryManager.h b/PxShared/include/cudamanager/PxCudaMemoryManager.h deleted file mode 100644 index c89b20d..0000000 --- a/PxShared/include/cudamanager/PxCudaMemoryManager.h +++ /dev/null @@ -1,281 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H -#define PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "task/PxTaskDefine.h" - -// some macros to keep the source code more readable -#define PX_ALLOC_INFO(name, ID) __FILE__, __LINE__, name, physx::PxAllocId::ID -#define PX_ALLOC_INFO_PARAMS_DECL(p0, p1, p2, p3) const char* file = p0, int line = p1, const char* allocName = p2, physx::PxAllocId::Enum allocId = physx::PxAllocId::p3 -#define PX_ALLOC_INFO_PARAMS_DEF() const char* file, int line, const char* allocName, physx::PxAllocId::Enum allocId -#define PX_ALLOC_INFO_PARAMS_INPUT() file, line, allocName, allocId -#define PX_ALLOC_INFO_PARAMS_INPUT_INFO(info) info.getFileName(), info.getLine(), info.getAllocName(), info.getAllocId() - -#ifndef NULL // don't want to include <string.h> -#define NULL 0 -#endif - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/** \brief ID of the Feature which owns/allocated memory from the heap - * - * Maximum of 64k IDs allowed. - */ -struct PxAllocId -{ - /** - * \brief ID of the Feature which owns/allocated memory from the heap - */ - enum Enum - { - UNASSIGNED, //!< default - APEX, //!< APEX stuff not further classified - PARTICLES, //!< all particle related - GPU_UTIL, //!< e.g. RadixSort (used in SPH and deformable self collision) - CLOTH, //!< all cloth related - NUM_IDS //!< number of IDs, be aware that ApexHeapStats contains PxAllocIdStats[NUM_IDS] - }; -}; - -/// \brief memory type managed by a heap -struct PxCudaBufferMemorySpace -{ - /** - * \brief memory type managed by a heap - */ - enum Enum - { - T_GPU, - T_PINNED_HOST, - T_WRITE_COMBINED, - T_HOST, - COUNT - }; -}; - -/// \brief class to track allocation statistics, see PxgMirrored -class PxAllocInfo -{ -public: - /** - * \brief AllocInfo default constructor - */ - PxAllocInfo() {} - - /** - * \brief AllocInfo constructor that initializes all of the members - */ - PxAllocInfo(const char* file, int line, const char* allocName, PxAllocId::Enum allocId) - : mFileName(file) - , mLine(line) - , mAllocName(allocName) - , mAllocId(allocId) - {} - - /// \brief get the allocation file name - inline const char* getFileName() const - { - return mFileName; - } - - /// \brief get the allocation line - inline int getLine() const - { - return mLine; - } - - /// \brief get the allocation name - inline const char* getAllocName() const - { - return mAllocName; - } - - /// \brief get the allocation ID - inline PxAllocId::Enum getAllocId() const - { - return mAllocId; - } - -private: - const char* mFileName; - int mLine; - const char* mAllocName; - PxAllocId::Enum mAllocId; -}; - -/// \brief statistics collected per AllocationId by HeapManager. -struct PxAllocIdStats -{ - size_t size; //!< currently allocated memory by this ID - size_t maxSize; //!< max allocated memory by this ID - size_t elements; //!< number of current allocations by this ID - size_t maxElements; //!< max number of allocations by this ID -}; - -class PxCudaMemoryManager; -typedef size_t PxCudaBufferPtr; - -/// \brief Hint flag to tell how the buffer will be used -struct PxCudaBufferFlags -{ -/// \brief Enumerations for the hint flag to tell how the buffer will be used - enum Enum - { - F_READ = (1 << 0), - F_WRITE = (1 << 1), - F_READ_WRITE = F_READ | F_WRITE - }; -}; - - -/// \brief Memory statistics struct returned by CudaMemMgr::getStats() -struct PxCudaMemoryManagerStats -{ - - size_t heapSize; //!< Size of all pages allocated for this memory type (allocated + free). - size_t totalAllocated; //!< Size occupied by the current allocations. - size_t maxAllocated; //!< High water mark of allocations since the SDK was created. - PxAllocIdStats allocIdStats[PxAllocId::NUM_IDS]; //!< Stats for each allocation ID, see PxAllocIdStats -}; - - -/// \brief Buffer type: made of hint flags and the memory space (Device Memory, Pinned Host Memory, ...) -struct PxCudaBufferType -{ - /// \brief PxCudaBufferType copy constructor - PX_INLINE PxCudaBufferType(const PxCudaBufferType& t) - : memorySpace(t.memorySpace) - , flags(t.flags) - {} - - /// \brief PxCudaBufferType constructor to explicitely assign members - PX_INLINE PxCudaBufferType(PxCudaBufferMemorySpace::Enum _memSpace, PxCudaBufferFlags::Enum _flags) - : memorySpace(_memSpace) - , flags(_flags) - {} - - PxCudaBufferMemorySpace::Enum memorySpace; //!< specifies which memory space for the buffer - PxCudaBufferFlags::Enum flags; //!< specifies the usage flags for the buffer -}; - - -/// \brief Buffer which keeps informations about allocated piece of memory. -class PxCudaBuffer -{ -public: - /// Retrieves the manager over which the buffer was allocated. - virtual PxCudaMemoryManager* getCudaMemoryManager() const = 0; - - /// Releases the buffer and the memory it used, returns true if successful. - virtual bool free() = 0; - - /// Realloc memory. Use to shrink or resize the allocated chunk of memory of this buffer. - /// Returns true if successful. Fails if the operation would change the address and need a memcopy. - /// In that case the user has to allocate, copy and free the memory with separate steps. - /// Realloc to size 0 always returns false and doesn't change the state. - virtual bool realloc(size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Returns the type of the allocated memory. - virtual const PxCudaBufferType& getType() const = 0; - - /// Returns the pointer to the allocated memory. - virtual PxCudaBufferPtr getPtr() const = 0; - - /// Returns the size of the allocated memory. - virtual size_t getSize() const = 0; - -protected: - /// \brief protected destructor - virtual ~PxCudaBuffer() {} -}; - - -/// \brief Allocator class for different kinds of CUDA related memory. -class PxCudaMemoryManager -{ -public: - /// Allocate memory of given type and size. Returns a CudaBuffer if successful. Returns NULL if failed. - virtual PxCudaBuffer* alloc(const PxCudaBufferType& type, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Basic heap allocator without PxCudaBuffer - virtual PxCudaBufferPtr alloc(PxCudaBufferMemorySpace::Enum memorySpace, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Basic heap deallocator without PxCudaBuffer - virtual bool free(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr) = 0; - - /// Basic heap realloc without PxCudaBuffer - virtual bool realloc(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - /// Retrieve stats for the memory of given type. See PxCudaMemoryManagerStats. - virtual void getStats(const PxCudaBufferType& type, PxCudaMemoryManagerStats& outStats) = 0; - - /// Ensure that a given amount of free memory is available. Triggers CUDA allocations in size of (2^n * pageSize) if necessary. - /// Returns false if page allocations failed. - virtual bool reserve(const PxCudaBufferType& type, size_t size) = 0; - - /// Set the page size. The managed memory grows by blocks 2^n * pageSize. Page allocations trigger CUDA driver allocations, - /// so the page size should be reasonably big. Returns false if input size was invalid, i.e. not power of two. - /// Default is 2 MB. - virtual bool setPageSize(const PxCudaBufferType& type, size_t size) = 0; - - /// Set the upper limit until which pages of a given memory type can be allocated. - /// Reducing the max when it is already hit does not shrink the memory until it is deallocated by releasing the buffers which own the memory. - virtual bool setMaxMemorySize(const PxCudaBufferType& type, size_t size) = 0; - - /// Returns the base size. The base memory block stays persistently allocated over the SDKs life time. - virtual size_t getBaseSize(const PxCudaBufferType& type) = 0; - - /// Returns the currently set page size. The memory grows and shrinks in blocks of size (2^n pageSize) - virtual size_t getPageSize(const PxCudaBufferType& type) = 0; - - /// Returns the upper limit until which the manager is allowed to allocate additional pages from the CUDA driver. - virtual size_t getMaxMemorySize(const PxCudaBufferType& type) = 0; - - /// Get device mapped pinned host mem ptr. Operation only valid for memory space PxCudaBufferMemorySpace::T_PINNED_HOST. - virtual PxCudaBufferPtr getMappedPinnedPtr(PxCudaBufferPtr hostPtr) = 0; - -protected: - /// \brief protected destructor - virtual ~PxCudaMemoryManager() {} -}; - -PX_POP_PACK - - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXCUDAMEMORYMANAGER_H diff --git a/PxShared/include/cudamanager/PxGpuCopyDesc.h b/PxShared/include/cudamanager/PxGpuCopyDesc.h deleted file mode 100644 index c6c240f..0000000 --- a/PxShared/include/cudamanager/PxGpuCopyDesc.h +++ /dev/null @@ -1,86 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PXGPUCOPYDESC_H -#define PXCUDACONTEXTMANAGER_PXGPUCOPYDESC_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "task/PxTaskDefine.h" - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/** - * \brief Input descriptor for the GpuDispatcher's built-in copy kernel - * - * All host memory involved in copy transactions must be page-locked. - * If more than one descriptor is passed to the copy kernel in one launch, - * the descriptors themselves must be in page-locked memory. - */ -struct PxGpuCopyDesc -{ - /** - * \brief Input descriptor for the GpuDispatcher's built-in copy kernel - */ - enum CopyType - { - HostToDevice, - DeviceToHost, - DeviceToDevice, - DeviceMemset32 - }; - - size_t dest; //!< the destination - size_t source; //!< the source (32bit value when type == DeviceMemset) - size_t bytes; //!< the size in bytes - CopyType type; //!< the memory transaction type - - /** - * \brief Copy is optimally performed as 64bit words, requires 64bit alignment. But it can - * gracefully degrade to 32bit copies if necessary - */ - PX_INLINE bool isValid() - { - bool ok = true; - ok &= ((dest & 0x3) == 0); - ok &= ((type == DeviceMemset32) || (source & 0x3) == 0); - ok &= ((bytes & 0x3) == 0); - return ok; - } -}; - -PX_POP_PACK - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXGPUCOPYDESC_H diff --git a/PxShared/include/cudamanager/PxGpuCopyDescQueue.h b/PxShared/include/cudamanager/PxGpuCopyDescQueue.h deleted file mode 100644 index 4b6d58e..0000000 --- a/PxShared/include/cudamanager/PxGpuCopyDescQueue.h +++ /dev/null @@ -1,149 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H -#define PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H - -#include "foundation/PxPreprocessor.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "foundation/PxAssert.h" -#include "task/PxTaskDefine.h" -#include "task/PxGpuDispatcher.h" -#include "cudamanager/PxGpuCopyDesc.h" -#include "cudamanager/PxCudaContextManager.h" - -/* forward decl to avoid including <cuda.h> */ -typedef struct CUstream_st* CUstream; - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/// \brief Container class for queueing PxGpuCopyDesc instances in pinned (non-pageable) CPU memory -class PxGpuCopyDescQueue -{ -public: - /// \brief PxGpuCopyDescQueue constructor - PxGpuCopyDescQueue(PxGpuDispatcher& d) - : mDispatcher(d) - , mBuffer(0) - , mStream(0) - , mReserved(0) - , mOccupancy(0) - , mFlushed(0) - { - } - - /// \brief PxGpuCopyDescQueue destructor - ~PxGpuCopyDescQueue() - { - if (mBuffer) - { - mDispatcher.getCudaContextManager()->getMemoryManager()->free(PxCudaBufferMemorySpace::T_PINNED_HOST, (size_t) mBuffer); - } - } - - /// \brief Reset the enqueued copy descriptor list - /// - /// Must be called at least once before any copies are enqueued, and each time the launched - /// copies are known to have been completed. The recommended use case is to call this at the - /// start of each simulation step. - void reset(CUstream stream, uint32_t reserveSize) - { - if (reserveSize > mReserved) - { - if (mBuffer) - { - mDispatcher.getCudaContextManager()->getMemoryManager()->free( - PxCudaBufferMemorySpace::T_PINNED_HOST, - (size_t) mBuffer); - mReserved = 0; - } - mBuffer = (PxGpuCopyDesc*) mDispatcher.getCudaContextManager()->getMemoryManager()->alloc( - PxCudaBufferMemorySpace::T_PINNED_HOST, - reserveSize * sizeof(PxGpuCopyDesc), - PX_ALLOC_INFO("PxGpuCopyDescQueue", GPU_UTIL)); - if (mBuffer) - { - mReserved = reserveSize; - } - } - - mOccupancy = 0; - mFlushed = 0; - mStream = stream; - } - - /// \brief Enqueue the specified copy descriptor, or launch immediately if no room is available - void enqueue(PxGpuCopyDesc& desc) - { - PX_ASSERT(desc.isValid()); - if (desc.bytes == 0) - { - return; - } - - if (mOccupancy < mReserved) - { - mBuffer[ mOccupancy++ ] = desc; - } - else - { - mDispatcher.launchCopyKernel(&desc, 1, mStream); - } - } - - /// \brief Launch all copies queued since the last flush or reset - void flushEnqueued() - { - if (mOccupancy > mFlushed) - { - mDispatcher.launchCopyKernel(mBuffer + mFlushed, mOccupancy - mFlushed, mStream); - mFlushed = mOccupancy; - } - } - -private: - PxGpuDispatcher& mDispatcher; - PxGpuCopyDesc* mBuffer; - CUstream mStream; - uint32_t mReserved; - uint32_t mOccupancy; - uint32_t mFlushed; - - void operator=(const PxGpuCopyDescQueue&); // prevent a warning... -}; - -PX_POP_PACK - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX -#endif // PXCUDACONTEXTMANAGER_PXGPUCOPYDESCQUEUE_H diff --git a/PxShared/include/filebuf/PxFileBuf.h b/PxShared/include/filebuf/PxFileBuf.h deleted file mode 100644 index 48f8b5d..0000000 --- a/PxShared/include/filebuf/PxFileBuf.h +++ /dev/null @@ -1,337 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PSFILEBUFFER_PXFILEBUF_H -#define PSFILEBUFFER_PXFILEBUF_H - -/** \addtogroup foundation - @{ -*/ - -#if !PX_DOXYGEN -namespace physx -{ - -namespace general_PxIOStream2 -{ -#endif - -PX_PUSH_PACK_DEFAULT - -/** -\brief Callback class for data serialization. - -The user needs to supply an PxFileBuf implementation to a number of methods to allow the SDK to read or write -chunks of binary data. This allows flexibility for the source/destination of the data. For example the PxFileBuf -could store data in a file, memory buffer or custom file format. - -\note It is the users responsibility to ensure that the data is written to the appropriate offset. - -*/ -class PxFileBuf -{ -public: - - enum EndianMode - { - ENDIAN_NONE = 0, // do no conversion for endian mode - ENDIAN_BIG = 1, // always read/write data as natively big endian (Power PC, etc.) - ENDIAN_LITTLE = 2 // always read/write data as natively little endian (Intel, etc.) Default Behavior! - }; - - PxFileBuf(EndianMode mode=ENDIAN_LITTLE) - { - setEndianMode(mode); - } - - virtual ~PxFileBuf(void) - { - - } - - /** - \brief Declares a constant to seek to the end of the stream. - * - * Does not support streams longer than 32 bits - */ - static const uint32_t STREAM_SEEK_END=0xFFFFFFFF; - - enum OpenMode - { - OPEN_FILE_NOT_FOUND, - OPEN_READ_ONLY, // open file buffer stream for read only access - OPEN_WRITE_ONLY, // open file buffer stream for write only access - OPEN_READ_WRITE_NEW, // open a new file for both read/write access - OPEN_READ_WRITE_EXISTING // open an existing file for both read/write access - }; - - virtual OpenMode getOpenMode(void) const = 0; - - bool isOpen(void) const - { - return getOpenMode()!=OPEN_FILE_NOT_FOUND; - } - - enum SeekType - { - SEEKABLE_NO = 0, - SEEKABLE_READ = 0x1, - SEEKABLE_WRITE = 0x2, - SEEKABLE_READWRITE = 0x3 - }; - - virtual SeekType isSeekable(void) const = 0; - - void setEndianMode(EndianMode e) - { - mEndianMode = e; - if ( (e==ENDIAN_BIG && !isBigEndian() ) || - (e==ENDIAN_LITTLE && isBigEndian() ) ) - { - mEndianSwap = true; - } - else - { - mEndianSwap = false; - } - } - - EndianMode getEndianMode(void) const - { - return mEndianMode; - } - - virtual uint32_t getFileLength(void) const = 0; - - /** - \brief Seeks the stream to a particular location for reading - * - * If the location passed exceeds the length of the stream, then it will seek to the end. - * Returns the location it ended up at (useful if you seek to the end) to get the file position - */ - virtual uint32_t seekRead(uint32_t loc) = 0; - - /** - \brief Seeks the stream to a particular location for writing - * - * If the location passed exceeds the length of the stream, then it will seek to the end. - * Returns the location it ended up at (useful if you seek to the end) to get the file position - */ - virtual uint32_t seekWrite(uint32_t loc) = 0; - - /** - \brief Reads from the stream into a buffer. - - \param[out] mem The buffer to read the stream into. - \param[in] len The number of bytes to stream into the buffer - - \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. - */ - virtual uint32_t read(void *mem,uint32_t len) = 0; - - - /** - \brief Reads from the stream into a buffer but does not advance the read location. - - \param[out] mem The buffer to read the stream into. - \param[in] len The number of bytes to stream into the buffer - - \return Returns the actual number of bytes read. If not equal to the length requested, then reached end of stream. - */ - virtual uint32_t peek(void *mem,uint32_t len) = 0; - - /** - \brief Writes a buffer of memory to the stream - - \param[in] mem The address of a buffer of memory to send to the stream. - \param[in] len The number of bytes to send to the stream. - - \return Returns the actual number of bytes sent to the stream. If not equal to the length specific, then the stream is full or unable to write for some reason. - */ - virtual uint32_t write(const void *mem,uint32_t len) = 0; - - /** - \brief Reports the current stream location read aqccess. - - \return Returns the current stream read location. - */ - virtual uint32_t tellRead(void) const = 0; - - /** - \brief Reports the current stream location for write access. - - \return Returns the current stream write location. - */ - virtual uint32_t tellWrite(void) const = 0; - - /** - \brief Causes any temporarily cached data to be flushed to the stream. - */ - virtual void flush(void) = 0; - - /** - \brief Close the stream. - */ - virtual void close(void) {} - - void release(void) - { - delete this; - } - - static PX_INLINE bool isBigEndian() - { - int32_t i = 1; - return *(reinterpret_cast<char*>(&i))==0; - } - - PX_INLINE void swap2Bytes(void* _data) const - { - char *data = static_cast<char *>(_data); - char one_byte; - one_byte = data[0]; data[0] = data[1]; data[1] = one_byte; - } - - PX_INLINE void swap4Bytes(void* _data) const - { - char *data = static_cast<char *>(_data); - char one_byte; - one_byte = data[0]; data[0] = data[3]; data[3] = one_byte; - one_byte = data[1]; data[1] = data[2]; data[2] = one_byte; - } - - PX_INLINE void swap8Bytes(void *_data) const - { - char *data = static_cast<char *>(_data); - char one_byte; - one_byte = data[0]; data[0] = data[7]; data[7] = one_byte; - one_byte = data[1]; data[1] = data[6]; data[6] = one_byte; - one_byte = data[2]; data[2] = data[5]; data[5] = one_byte; - one_byte = data[3]; data[3] = data[4]; data[4] = one_byte; - } - - - PX_INLINE void storeDword(uint32_t v) - { - if ( mEndianSwap ) - swap4Bytes(&v); - - write(&v,sizeof(v)); - } - - PX_INLINE void storeFloat(float v) - { - if ( mEndianSwap ) - swap4Bytes(&v); - write(&v,sizeof(v)); - } - - PX_INLINE void storeDouble(double v) - { - if ( mEndianSwap ) - swap8Bytes(&v); - write(&v,sizeof(v)); - } - - PX_INLINE void storeByte(uint8_t b) - { - write(&b,sizeof(b)); - } - - PX_INLINE void storeWord(uint16_t w) - { - if ( mEndianSwap ) - swap2Bytes(&w); - write(&w,sizeof(w)); - } - - uint8_t readByte(void) - { - uint8_t v=0; - read(&v,sizeof(v)); - return v; - } - - uint16_t readWord(void) - { - uint16_t v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap2Bytes(&v); - return v; - } - - uint32_t readDword(void) - { - uint32_t v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap4Bytes(&v); - return v; - } - - float readFloat(void) - { - float v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap4Bytes(&v); - return v; - } - - double readDouble(void) - { - double v=0; - read(&v,sizeof(v)); - if ( mEndianSwap ) - swap8Bytes(&v); - return v; - } - -private: - bool mEndianSwap; // whether or not the endian should be swapped on the current platform - EndianMode mEndianMode; // the current endian mode behavior for the stream -}; - -PX_POP_PACK - -#if !PX_DOXYGEN -} // end of namespace - -using namespace general_PxIOStream2; - -namespace general_PxIOStream = general_PxIOStream2; - -} // end of namespace -#endif - -/** @} */ - -#endif // PSFILEBUFFER_PXFILEBUF_H diff --git a/PxShared/include/foundation/Px.h b/PxShared/include/foundation/Px.h index 1b6b3f6..e4e5341 100644 --- a/PxShared/include/foundation/Px.h +++ b/PxShared/include/foundation/Px.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxAllocatorCallback.h b/PxShared/include/foundation/PxAllocatorCallback.h index 7545b60..4e9487d 100644 --- a/PxShared/include/foundation/PxAllocatorCallback.h +++ b/PxShared/include/foundation/PxAllocatorCallback.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxAssert.h b/PxShared/include/foundation/PxAssert.h deleted file mode 100644 index c422c27..0000000 --- a/PxShared/include/foundation/PxAssert.h +++ /dev/null @@ -1,95 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXFOUNDATION_PXASSERT_H -#define PXFOUNDATION_PXASSERT_H - -/** \addtogroup foundation -@{ */ - -#include "foundation/Px.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/* Base class to handle assert failures */ -class PxAssertHandler -{ - public: - virtual ~PxAssertHandler() - { - } - virtual void operator()(const char* exp, const char* file, int line, bool& ignore) = 0; -}; - -PX_FOUNDATION_API PxAssertHandler& PxGetAssertHandler(); -PX_FOUNDATION_API void PxSetAssertHandler(PxAssertHandler& handler); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -#if !PX_ENABLE_ASSERTS -#define PX_ASSERT(exp) ((void)0) -#define PX_ALWAYS_ASSERT_MESSAGE(exp) ((void)0) -#define PX_ASSERT_WITH_MESSAGE(condition, message) ((void)0) -#else -#if PX_VC -#define PX_CODE_ANALYSIS_ASSUME(exp) \ - __analysis_assume(!!(exp)) // This macro will be used to get rid of analysis warning messages if a PX_ASSERT is used -// to "guard" illegal mem access, for example. -#else -#define PX_CODE_ANALYSIS_ASSUME(exp) -#endif -#define PX_ASSERT(exp) \ - { \ - static bool _ignore = false; \ - ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(#exp, __FILE__, __LINE__, _ignore), false)))); \ - PX_CODE_ANALYSIS_ASSUME(exp); \ - } -#define PX_ALWAYS_ASSERT_MESSAGE(exp) \ - { \ - static bool _ignore = false; \ - if(!_ignore) \ - physx::PxGetAssertHandler()(exp, __FILE__, __LINE__, _ignore); \ - } -#define PX_ASSERT_WITH_MESSAGE(exp, message) \ - { \ - static bool _ignore = false; \ - ((void)((!!(exp)) || (!_ignore && (physx::PxGetAssertHandler()(message, __FILE__, __LINE__, _ignore), false)))); \ - PX_CODE_ANALYSIS_ASSUME(exp); \ - } -#endif - -#define PX_ALWAYS_ASSERT() PX_ASSERT(0) - -/** @} */ -#endif // #ifndef PXFOUNDATION_PXASSERT_H diff --git a/PxShared/include/foundation/PxBitAndData.h b/PxShared/include/foundation/PxBitAndData.h index 685c1a2..e569299 100644 --- a/PxShared/include/foundation/PxBitAndData.h +++ b/PxShared/include/foundation/PxBitAndData.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxBounds3.h b/PxShared/include/foundation/PxBounds3.h index 38d7282..ef8ead2 100644 --- a/PxShared/include/foundation/PxBounds3.h +++ b/PxShared/include/foundation/PxBounds3.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -321,40 +321,40 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::setMaximal() PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxVec3& v) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); minimum = minimum.minimum(v); maximum = maximum.maximum(v); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::include(const PxBounds3& b) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); minimum = minimum.minimum(b.minimum); maximum = maximum.maximum(b.maximum); } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isEmpty() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return minimum.x > maximum.x; } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects(const PxBounds3& b) const { - PX_ASSERT(isValid() && b.isValid()); + PX_SHARED_ASSERT(isValid() && b.isValid()); return !(b.minimum.x > maximum.x || minimum.x > b.maximum.x || b.minimum.y > maximum.y || minimum.y > b.maximum.y || b.minimum.z > maximum.z || minimum.z > b.maximum.z); } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::intersects1D(const PxBounds3& a, uint32_t axis) const { - PX_ASSERT(isValid() && a.isValid()); + PX_SHARED_ASSERT(isValid() && a.isValid()); return maximum[axis] >= a.minimum[axis] && a.maximum[axis] >= minimum[axis]; } PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::contains(const PxVec3& v) const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return !(v.x < minimum.x || v.x > maximum.x || v.y < minimum.y || v.y > maximum.y || v.z < minimum.z || v.z > maximum.z); @@ -362,7 +362,7 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::contains(const PxVec3& v) const PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isInside(const PxBounds3& box) const { - PX_ASSERT(isValid() && box.isValid()); + PX_SHARED_ASSERT(isValid() && box.isValid()); if(box.minimum.x > minimum.x) return false; if(box.minimum.y > minimum.y) @@ -380,57 +380,57 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE bool PxBounds3::isInside(const PxBounds3& box) PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getCenter() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return (minimum + maximum) * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getCenter(uint32_t axis) const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return (minimum[axis] + maximum[axis]) * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE float PxBounds3::getExtents(uint32_t axis) const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return (maximum[axis] - minimum[axis]) * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getDimensions() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return maximum - minimum; } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 PxBounds3::getExtents() const { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); return getDimensions() * 0.5f; } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleSafe(float scale) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); if(!isEmpty()) scaleFast(scale); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::scaleFast(float scale) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); *this = centerExtents(getCenter(), getExtents() * scale); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenSafe(float distance) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); if(!isEmpty()) fattenFast(distance); } PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenFast(float distance) { - PX_ASSERT(isValid()); + PX_SHARED_ASSERT(isValid()); minimum.x -= distance; minimum.y -= distance; minimum.z -= distance; @@ -442,25 +442,25 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE void PxBounds3::fattenFast(float distance) PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxMat33& matrix, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return !bounds.isEmpty() ? transformFast(matrix, bounds) : bounds; } PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxMat33& matrix, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return PxBounds3::basisExtent(matrix * bounds.getCenter(), matrix, bounds.getExtents()); } PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformSafe(const PxTransform& transform, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return !bounds.isEmpty() ? transformFast(transform, bounds) : bounds; } PX_CUDA_CALLABLE PX_INLINE PxBounds3 PxBounds3::transformFast(const PxTransform& transform, const PxBounds3& bounds) { - PX_ASSERT(bounds.isValid()); + PX_SHARED_ASSERT(bounds.isValid()); return PxBounds3::basisExtent(transform.transform(bounds.getCenter()), PxMat33(transform.q), bounds.getExtents()); } diff --git a/PxShared/include/foundation/PxErrorCallback.h b/PxShared/include/foundation/PxErrorCallback.h index 8b63374..c0517db 100644 --- a/PxShared/include/foundation/PxErrorCallback.h +++ b/PxShared/include/foundation/PxErrorCallback.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxErrors.h b/PxShared/include/foundation/PxErrors.h index fb341bb..cf86d3b 100644 --- a/PxShared/include/foundation/PxErrors.h +++ b/PxShared/include/foundation/PxErrors.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxFlags.h b/PxShared/include/foundation/PxFlags.h index 1aec096..85dce4e 100644 --- a/PxShared/include/foundation/PxFlags.h +++ b/PxShared/include/foundation/PxFlags.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -130,20 +130,22 @@ class PxFlags storagetype mBits; }; +#if !PX_DOXYGEN + #define PX_FLAGS_OPERATORS(enumtype, storagetype) \ - PX_INLINE PxFlags<enumtype, storagetype> operator|(enumtype a, enumtype b) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> operator|(enumtype a, enumtype b) \ { \ PxFlags<enumtype, storagetype> r(a); \ r |= b; \ return r; \ } \ - PX_INLINE PxFlags<enumtype, storagetype> operator&(enumtype a, enumtype b) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> operator&(enumtype a, enumtype b) \ { \ PxFlags<enumtype, storagetype> r(a); \ r &= b; \ return r; \ } \ - PX_INLINE PxFlags<enumtype, storagetype> operator~(enumtype a) \ + PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> operator~(enumtype a) \ { \ return ~PxFlags<enumtype, storagetype>(a); \ } @@ -153,95 +155,95 @@ class PxFlags PX_FLAGS_OPERATORS(x::Enum, y) template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(void) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(void) { mBits = 0; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(enumtype e) { mBits = static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(const PxFlags<enumtype, storagetype>& f) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(const PxFlags<enumtype, storagetype>& f) { mBits = f.mBits; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(storagetype b) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::PxFlags(storagetype b) { mBits = b; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::isSet(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::isSet(enumtype e) const { return (mBits & static_cast<storagetype>(e)) == static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::set(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::set(enumtype e) { mBits = static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(enumtype e) const { return mBits == static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(const PxFlags<enumtype, storagetype>& f) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(const PxFlags<enumtype, storagetype>& f) const { return mBits == f.mBits; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(bool b) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator==(bool b) const { return bool(*this) == b; } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(enumtype e) const { return mBits != static_cast<storagetype>(e); } template <typename enumtype, typename storagetype> -PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(const PxFlags<enumtype, storagetype>& f) const +PX_CUDA_CALLABLE PX_INLINE bool PxFlags<enumtype, storagetype>::operator!=(const PxFlags<enumtype, storagetype>& f) const { return mBits != f.mBits; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(enumtype e) { mBits = static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(const PxFlags<enumtype, storagetype>& f) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator=(const PxFlags<enumtype, storagetype>& f) { mBits = f.mBits; return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator|=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator|=(enumtype e) { mBits |= static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: operator|=(const PxFlags<enumtype, storagetype>& f) { mBits |= f.mBits; @@ -249,7 +251,7 @@ operator|=(const PxFlags<enumtype, storagetype>& f) } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator|(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator|(enumtype e) const { PxFlags<enumtype, storagetype> out(*this); out |= e; @@ -257,7 +259,7 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: operator|(const PxFlags<enumtype, storagetype>& f) const { PxFlags<enumtype, storagetype> out(*this); @@ -266,14 +268,14 @@ operator|(const PxFlags<enumtype, storagetype>& f) const } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator&=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator&=(enumtype e) { mBits &= static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: operator&=(const PxFlags<enumtype, storagetype>& f) { mBits &= f.mBits; @@ -281,7 +283,7 @@ operator&=(const PxFlags<enumtype, storagetype>& f) } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator&(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator&(enumtype e) const { PxFlags<enumtype, storagetype> out = *this; out.mBits &= static_cast<storagetype>(e); @@ -289,7 +291,7 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: operator&(const PxFlags<enumtype, storagetype>& f) const { PxFlags<enumtype, storagetype> out = *this; @@ -298,14 +300,14 @@ operator&(const PxFlags<enumtype, storagetype>& f) const } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator^=(enumtype e) +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>::operator^=(enumtype e) { mBits ^= static_cast<storagetype>(e); return *this; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>& PxFlags<enumtype, storagetype>:: operator^=(const PxFlags<enumtype, storagetype>& f) { mBits ^= f.mBits; @@ -313,7 +315,7 @@ operator^=(const PxFlags<enumtype, storagetype>& f) } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator^(enumtype e) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator^(enumtype e) const { PxFlags<enumtype, storagetype> out = *this; out.mBits ^= static_cast<storagetype>(e); @@ -321,7 +323,7 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>:: operator^(const PxFlags<enumtype, storagetype>& f) const { PxFlags<enumtype, storagetype> out = *this; @@ -330,7 +332,7 @@ operator^(const PxFlags<enumtype, storagetype>& f) const } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator~(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operator~(void) const { PxFlags<enumtype, storagetype> out; out.mBits = storagetype(~mBits); @@ -338,38 +340,37 @@ PX_INLINE PxFlags<enumtype, storagetype> PxFlags<enumtype, storagetype>::operato } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator bool(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator bool(void) const { return mBits ? true : false; } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator uint8_t(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator uint8_t(void) const { return static_cast<uint8_t>(mBits); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator uint16_t(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator uint16_t(void) const { return static_cast<uint16_t>(mBits); } template <typename enumtype, typename storagetype> -PX_INLINE PxFlags<enumtype, storagetype>::operator uint32_t(void) const +PX_CUDA_CALLABLE PX_INLINE PxFlags<enumtype, storagetype>::operator uint32_t(void) const { return static_cast<uint32_t>(mBits); } template <typename enumtype, typename storagetype> -PX_INLINE void PxFlags<enumtype, storagetype>::clear(enumtype e) +PX_CUDA_CALLABLE PX_INLINE void PxFlags<enumtype, storagetype>::clear(enumtype e) { mBits &= ~static_cast<storagetype>(e); } -#if !PX_DOXYGEN } // namespace physx -#endif +#endif //!PX_DOXYGEN /** @} */ #endif // #ifndef PXFOUNDATION_PXFLAGS_H diff --git a/PxShared/include/foundation/PxFoundation.h b/PxShared/include/foundation/PxFoundation.h deleted file mode 100644 index aae84a9..0000000 --- a/PxShared/include/foundation/PxFoundation.h +++ /dev/null @@ -1,158 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PX_FOUNDATION_PX_FOUNDATION_H -#define PX_FOUNDATION_PX_FOUNDATION_H - -/** \addtogroup foundation - @{ -*/ - -#include "foundation/Px.h" -#include "foundation/PxErrors.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/** -\brief Foundation SDK singleton class. - -You need to have an instance of this class to instance the higher level SDKs. -*/ -class PX_FOUNDATION_API PxFoundation -{ - public: - /** - \brief Destroys the instance it is called on. - - The operation will fail, if there are still modules referencing the foundation object. Release all dependent modules - prior - to calling this method. - - @see PxCreateFoundation() - */ - virtual void release() = 0; - - /** - retrieves error callback - */ - virtual PxErrorCallback& getErrorCallback() = 0; - - /** - Sets mask of errors to report. - */ - virtual void setErrorLevel(PxErrorCode::Enum mask = PxErrorCode::eMASK_ALL) = 0; - - /** - Retrieves mask of errors to be reported. - */ - virtual PxErrorCode::Enum getErrorLevel() const = 0; - - /** - Retrieves the allocator this object was created with. - */ - virtual PxAllocatorCallback& getAllocatorCallback() = 0; - - /** - Retrieves if allocation names are being passed to allocator callback. - */ - virtual bool getReportAllocationNames() const = 0; - - /** - Set if allocation names are being passed to allocator callback. - \details Enabled by default in debug and checked build, disabled by default in profile and release build. - */ - virtual void setReportAllocationNames(bool value) = 0; - - protected: - virtual ~PxFoundation() - { - } -}; - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** -\brief Creates an instance of the foundation class - -The foundation class is needed to initialize higher level SDKs. There may be only one instance per process. -Calling this method after an instance has been created already will result in an error message and NULL will be -returned. - -\param version Version number we are expecting (should be PX_FOUNDATION_VERSION) -\param allocator User supplied interface for allocating memory(see #PxAllocatorCallback) -\param errorCallback User supplied interface for reporting errors and displaying messages(see #PxErrorCallback) -\return Foundation instance on success, NULL if operation failed - -@see PxFoundation -*/ - -PX_C_EXPORT PX_FOUNDATION_API physx::PxFoundation* PX_CALL_CONV -PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator, physx::PxErrorCallback& errorCallback); -/** -\brief Retrieves the Foundation SDK after it has been created. - -\note The behavior of this method is undefined if the foundation instance has not been created already. - -@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 -{ -class PxProfilerCallback; -} - -/** -\brief Get the callback that will be used for all profiling. -*/ -PX_C_EXPORT PX_FOUNDATION_API physx::PxProfilerCallback* PX_CALL_CONV PxGetProfilerCallback(); - -/** -\brief Set the callback that will be used for all profiling. -*/ -PX_C_EXPORT PX_FOUNDATION_API void PX_CALL_CONV PxSetProfilerCallback(physx::PxProfilerCallback* profiler); - -/** @} */ -#endif // PX_FOUNDATION_PX_FOUNDATION_H diff --git a/PxShared/include/foundation/PxFoundationVersion.h b/PxShared/include/foundation/PxFoundationVersion.h deleted file mode 100644 index 6547405..0000000 --- a/PxShared/include/foundation/PxFoundationVersion.h +++ /dev/null @@ -1,65 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PX_FOUNDATION_VERSION_NUMBER_H -#define PX_FOUNDATION_VERSION_NUMBER_H - -/* -VersionNumbers: The combination of these -numbers uniquely identifies the API, and should -be incremented when the SDK API changes. This may -include changes to file formats. - -This header is included in the main SDK header files -so that the entire SDK and everything that builds on it -is completely rebuilt when this file changes. Thus, -this file is not to include a frequently changing -build number. See BuildNumber.h for that. - -Each of these three values should stay below 255 because -sometimes they are stored in a byte. -*/ -/** \addtogroup foundation - @{ -*/ - -#define PX_FOUNDATION_VERSION_MAJOR 1 -#define PX_FOUNDATION_VERSION_MINOR 0 -#define PX_FOUNDATION_VERSION_BUGFIX 0 - -/** -The constant PX_FOUNDATION_VERSION is used when creating certain PhysX module objects. -This is to ensure that the application is using the same header version as the library was built with. -*/ -#define PX_FOUNDATION_VERSION \ - ((PX_FOUNDATION_VERSION_MAJOR << 24) + (PX_FOUNDATION_VERSION_MINOR << 16) + (PX_FOUNDATION_VERSION_BUGFIX << 8) + 0) - -#endif // PX_FOUNDATION_VERSION_NUMBER_H - -/** @} */ diff --git a/PxShared/include/foundation/PxIO.h b/PxShared/include/foundation/PxIO.h index 77ea1b6..1db6a80 100644 --- a/PxShared/include/foundation/PxIO.h +++ b/PxShared/include/foundation/PxIO.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxIntrinsics.h b/PxShared/include/foundation/PxIntrinsics.h index b4aff28..8ddea2a 100644 --- a/PxShared/include/foundation/PxIntrinsics.h +++ b/PxShared/include/foundation/PxIntrinsics.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxMat33.h b/PxShared/include/foundation/PxMat33.h index a3977c5..3019ba2 100644 --- a/PxShared/include/foundation/PxMat33.h +++ b/PxShared/include/foundation/PxMat33.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -309,13 +309,13 @@ class PxMat33 } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const { return (*this)[col][row]; } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) { return (*this)[col][row]; } @@ -339,11 +339,11 @@ class PxMat33 return &column0.x; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator[](unsigned int num) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3& operator[](unsigned int num) { return (&column0)[num]; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& operator[](unsigned int num) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec3& operator[](unsigned int num) const { return (&column0)[num]; } diff --git a/PxShared/include/foundation/PxMat44.h b/PxShared/include/foundation/PxMat44.h index 95f4636..577a93f 100644 --- a/PxShared/include/foundation/PxMat44.h +++ b/PxShared/include/foundation/PxMat44.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -264,13 +264,13 @@ class PxMat44 } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const + PX_CUDA_CALLABLE PX_FORCE_INLINE float operator()(unsigned int row, unsigned int col) const { return (*this)[col][row]; } //! Element access, mathematical way! - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator()(unsigned int row, unsigned int col) { return (*this)[col][row]; } @@ -301,7 +301,7 @@ class PxMat44 PX_CUDA_CALLABLE PX_INLINE const PxVec3 getBasis(int num) const { - PX_ASSERT(num >= 0 && num < 3); + PX_SHARED_ASSERT(num >= 0 && num < 3); return (&column0)[num].getXYZ(); } @@ -322,11 +322,11 @@ class PxMat44 return &column0.x; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4& operator[](unsigned int num) + PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec4& operator[](unsigned int num) { return (&column0)[num]; } - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec4& operator[](unsigned int num) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const PxVec4& operator[](unsigned int num) const { return (&column0)[num]; } diff --git a/PxShared/include/foundation/PxMath.h b/PxShared/include/foundation/PxMath.h index 7cea398..d75d8bc 100644 --- a/PxShared/include/foundation/PxMath.h +++ b/PxShared/include/foundation/PxMath.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -47,7 +47,7 @@ #include <float.h> #include "foundation/PxIntrinsics.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" #if !PX_DOXYGEN namespace physx @@ -136,7 +136,7 @@ PX_CUDA_CALLABLE PX_FORCE_INLINE int32_t PxAbs(int32_t a) template <class T> PX_CUDA_CALLABLE PX_FORCE_INLINE T PxClamp(T v, T lo, T hi) { - PX_ASSERT(lo <= hi); + PX_SHARED_ASSERT(lo <= hi); return PxMin(hi, PxMax(lo, v)); } diff --git a/PxShared/include/foundation/PxMathUtils.h b/PxShared/include/foundation/PxMathUtils.h deleted file mode 100644 index 11ddde5..0000000 --- a/PxShared/include/foundation/PxMathUtils.h +++ /dev/null @@ -1,73 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXFOUNDATION_PXMATHUTILS_H -#define PXFOUNDATION_PXMATHUTILS_H - -/** \addtogroup common - @{ -*/ - -#include "foundation/Px.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/** -\brief finds the shortest rotation between two vectors. - -\param[in] from the vector to start from -\param[in] target the vector to rotate to -\return a rotation about an axis normal to the two vectors which takes one to the other via the shortest path -*/ - -PX_FOUNDATION_API PxQuat PxShortestRotation(const PxVec3& from, const PxVec3& target); - -/* \brief diagonalizes a 3x3 symmetric matrix y - -The returned matrix satisfies M = R * D * R', where R is the rotation matrix for the output quaternion, R' its -transpose, and D the diagonal matrix - -If the matrix is not symmetric, the result is undefined. - -\param[in] m the matrix to diagonalize -\param[out] axes a quaternion rotation which diagonalizes the matrix -\return the vector diagonal of the diagonalized matrix. -*/ - -PX_FOUNDATION_API PxVec3 PxDiagonalize(const PxMat33& m, PxQuat& axes); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** @} */ -#endif diff --git a/PxShared/include/foundation/PxMemory.h b/PxShared/include/foundation/PxMemory.h index 6a8a6ed..911b0d4 100644 --- a/PxShared/include/foundation/PxMemory.h +++ b/PxShared/include/foundation/PxMemory.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxPlane.h b/PxShared/include/foundation/PxPlane.h index dcd542a..76f63f2 100644 --- a/PxShared/include/foundation/PxPlane.h +++ b/PxShared/include/foundation/PxPlane.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. diff --git a/PxShared/include/foundation/PxPreprocessor.h b/PxShared/include/foundation/PxPreprocessor.h index ddbf258..55dc196 100644 --- a/PxShared/include/foundation/PxPreprocessor.h +++ b/PxShared/include/foundation/PxPreprocessor.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -38,6 +38,12 @@ @{ */ +#define PX_STRINGIZE_HELPER(X) #X +#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X) + +#define PX_CONCAT_HELPER(X, Y) X##Y +#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y) + /* The following preprocessor identifiers specify compiler, OS, and architecture. All definitions have a value of 1 or 0, use '#if' instead of '#ifdef'. @@ -64,6 +70,13 @@ Compiler defines, see http://sourceforge.net/p/predef/wiki/Compilers/ #endif #elif defined(__clang__) #define PX_CLANG 1 + #if defined (__clang_major__) + #define PX_CLANG_MAJOR __clang_major__ + #elif defined (_clang_major) + #define PX_CLANG_MAJOR _clang_major + #else + #define PX_CLANG_MAJOR 0 + #endif #elif defined(__GNUC__) // note: __clang__ implies __GNUC__ #define PX_GCC 1 #else @@ -75,6 +88,8 @@ Operating system defines, see http://sourceforge.net/p/predef/wiki/OperatingSyst */ #if defined(_XBOX_ONE) #define PX_XBOXONE 1 +#elif defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_APP +#define PX_UWP 1 #elif defined(_WIN64) // note: _XBOX_ONE implies _WIN64 #define PX_WIN64 1 #elif defined(_WIN32) // note: _M_PPC implies _WIN32 @@ -102,7 +117,7 @@ Architecture defines, see http://sourceforge.net/p/predef/wiki/Architectures/ #define PX_X64 1 #elif defined(__i386__) || defined(_M_IX86) || defined (__EMSCRIPTEN__) #define PX_X86 1 -#elif defined(__arm64__) || defined(__aarch64__) +#elif defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) #define PX_A64 1 #elif defined(__arm__) || defined(_M_ARM) #define PX_ARM 1 @@ -166,6 +181,9 @@ define anything not defined on this platform to 0 #ifndef PX_SWITCH #define PX_SWITCH 0 #endif +#ifndef PX_UWP +#define PX_UWP 0 +#endif #ifndef PX_X64 #define PX_X64 0 #endif @@ -203,6 +221,9 @@ define anything not defined through the command line to 0 #ifndef PX_PROFILE #define PX_PROFILE 0 #endif +#ifndef PX_DEBUG_CRT +#define PX_DEBUG_CRT 0 +#endif #ifndef PX_NVTX #define PX_NVTX 0 #endif @@ -216,7 +237,7 @@ family shortcuts // compiler #define PX_GCC_FAMILY (PX_CLANG || PX_GCC) // os -#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64) +#define PX_WINDOWS_FAMILY (PX_WIN32 || PX_WIN64 || PX_UWP) #define PX_MICROSOFT_FAMILY (PX_XBOXONE || PX_WINDOWS_FAMILY) #define PX_LINUX_FAMILY (PX_LINUX || PX_ANDROID) #define PX_APPLE_FAMILY (PX_IOS || PX_OSX) // equivalent to #if __APPLE__ @@ -234,7 +255,7 @@ family shortcuts /** C++ standard library defines */ -#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_PS4 || PX_XBOXONE || PX_EMSCRIPTEN +#if defined(_LIBCPP_VERSION) || PX_WIN64 || PX_WIN32 || PX_PS4 || PX_XBOXONE || PX_UWP || PX_EMSCRIPTEN #define PX_LIBCPP 1 #else #define PX_LIBCPP 0 @@ -280,31 +301,6 @@ DLL export macros #endif /** -Define API function declaration - -PX_FOUNDATION_DLL=1 - used by the DLL library (PhysXCommon) to export the API -PX_FOUNDATION_DLL=0 - for windows configurations where the PX_FOUNDATION_API is linked through standard static linking -no definition - this will allow DLLs and libraries to use the exported API from PhysXCommon - -*/ - -#if PX_WINDOWS_FAMILY && !PX_ARM_FAMILY -#ifndef PX_FOUNDATION_DLL -#define PX_FOUNDATION_API PX_DLL_IMPORT -#elif PX_FOUNDATION_DLL -#define PX_FOUNDATION_API PX_DLL_EXPORT -#endif -#elif PX_UNIX_FAMILY -#ifdef PX_FOUNDATION_DLL -#define PX_FOUNDATION_API PX_UNIX_EXPORT -#endif -#endif - -#ifndef PX_FOUNDATION_API -#define PX_FOUNDATION_API -#endif - -/** Calling convention */ #ifndef PX_CALL_CONV @@ -428,7 +424,7 @@ General defines // static assert #if(defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (PX_PS4) || (PX_APPLE_FAMILY) || (PX_SWITCH) || (PX_CLANG && PX_ARM) -#define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1] __attribute__((unused)) +#define PX_COMPILE_TIME_ASSERT(exp) typedef char PX_CONCAT(PxCompileTimeAssert_Dummy, __COUNTER__)[(exp) ? 1 : -1] __attribute__((unused)) #else #define PX_COMPILE_TIME_ASSERT(exp) typedef char PxCompileTimeAssert_Dummy[(exp) ? 1 : -1] #endif @@ -520,12 +516,6 @@ protected: Class(const Class&); \ Class& operator=(const Class&); -#define PX_STRINGIZE_HELPER(X) #X -#define PX_STRINGIZE(X) PX_STRINGIZE_HELPER(X) - -#define PX_CONCAT_HELPER(X, Y) X##Y -#define PX_CONCAT(X, Y) PX_CONCAT_HELPER(X, Y) - #ifndef DISABLE_CUDA_PHYSX //CUDA is currently supported only on windows #define PX_SUPPORT_GPU_PHYSX ((PX_WINDOWS_FAMILY) || (PX_LINUX && PX_X64)) diff --git a/PxShared/include/foundation/PxProfiler.h b/PxShared/include/foundation/PxProfiler.h index 4864969..a949b72 100644 --- a/PxShared/include/foundation/PxProfiler.h +++ b/PxShared/include/foundation/PxProfiler.h @@ -1,34 +1,34 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. #ifndef PXFOUNDATION_PXPROFILER_H #define PXFOUNDATION_PXPROFILER_H -#include "foundation/PxFoundation.h" +#include "foundation/Px.h" namespace physx { @@ -71,7 +71,7 @@ public: class PxProfileScoped { public: - PX_FORCE_INLINE PxProfileScoped(const char* eventName, bool detached, uint64_t contextId) : mCallback(PxGetProfilerCallback()), mProfilerData(NULL) + PX_FORCE_INLINE PxProfileScoped(PxProfilerCallback* callback, const char* eventName, bool detached, uint64_t contextId) : mCallback(callback), mProfilerData(NULL) { if(mCallback) { @@ -87,7 +87,7 @@ class PxProfileScoped if(mCallback) mCallback->zoneEnd(mProfilerData, mEventName, mDetached, mContextId); } - physx::PxProfilerCallback* mCallback; + PxProfilerCallback* mCallback; const char* mEventName; void* mProfilerData; uint64_t mContextId; @@ -96,21 +96,4 @@ class PxProfileScoped } // end of physx namespace -#if PX_DEBUG || PX_CHECKED || PX_PROFILE - #define PX_PROFILE_ZONE(x, y) \ - physx::PxProfileScoped PX_CONCAT(_scoped, __LINE__)(x, false, y) - #define PX_PROFILE_START_CROSSTHREAD(x, y) \ - if(PxGetProfilerCallback()) \ - PxGetProfilerCallback()->zoneStart(x, true, y) - #define PX_PROFILE_STOP_CROSSTHREAD(x, y) \ - if(PxGetProfilerCallback()) \ - PxGetProfilerCallback()->zoneEnd(NULL, x, true, y) -#else - #define PX_PROFILE_ZONE(x, y) - #define PX_PROFILE_START_CROSSTHREAD(x, y) - #define PX_PROFILE_STOP_CROSSTHREAD(x, y) -#endif - -#define PX_PROFILE_POINTER_TO_U64(pointer) static_cast<uint64_t>(reinterpret_cast<size_t>(pointer)) - #endif // PXFOUNDATION_PXPROFILER_H diff --git a/PxShared/include/foundation/PxQuat.h b/PxShared/include/foundation/PxQuat.h index 1313b0e..f29a372 100644 --- a/PxShared/include/foundation/PxQuat.h +++ b/PxShared/include/foundation/PxQuat.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -87,7 +87,7 @@ class PxQuat */ PX_CUDA_CALLABLE PX_INLINE PxQuat(float angleRadians, const PxVec3& unitAxis) { - PX_ASSERT(PxAbs(1.0f - unitAxis.magnitude()) < 1e-3f); + PX_SHARED_ASSERT(PxAbs(1.0f - unitAxis.magnitude()) < 1e-3f); const float a = angleRadians * 0.5f; const float s = PxSin(a); w = PxCos(a); diff --git a/PxShared/include/foundation/PxSharedAssert.h b/PxShared/include/foundation/PxSharedAssert.h new file mode 100644 index 0000000..1cb05cb --- /dev/null +++ b/PxShared/include/foundation/PxSharedAssert.h @@ -0,0 +1,46 @@ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. +// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. + +#ifndef PXFOUNDATION_PXASSERT_H +#define PXFOUNDATION_PXASSERT_H + +/** \addtogroup foundation +@{ */ + +#include "foundation/Px.h" + +#if !PX_ENABLE_ASSERTS + #define PX_SHARED_ASSERT(exp) ((void)0) +#else + #include <assert.h> + #define PX_SHARED_ASSERT(exp) assert(exp); +#endif // !PX_ENABLE_ASSERTS + +/** @} */ +#endif // #ifndef PXFOUNDATION_PXASSERT_H diff --git a/PxShared/include/foundation/PxSimpleTypes.h b/PxShared/include/foundation/PxSimpleTypes.h index 655fbb3..a9ced08 100644 --- a/PxShared/include/foundation/PxSimpleTypes.h +++ b/PxShared/include/foundation/PxSimpleTypes.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -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 && !PX_SWITCH +#if !PX_PS4 && !PX_APPLE_FAMILY #define __STDC_FORMAT_MACROS #endif #include <inttypes.h> diff --git a/PxShared/include/foundation/PxStrideIterator.h b/PxShared/include/foundation/PxStrideIterator.h index 1e4c448..dd6dd10 100644 --- a/PxShared/include/foundation/PxStrideIterator.h +++ b/PxShared/include/foundation/PxStrideIterator.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -31,7 +31,7 @@ #define PXFOUNDATION_PXSTRIDEITERATOR_H #include "foundation/Px.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" /** \addtogroup foundation @{ @@ -106,7 +106,7 @@ class PxStrideIterator */ explicit PX_INLINE PxStrideIterator(T* ptr = NULL, PxU32 stride = sizeof(T)) : mPtr(ptr), mStride(stride) { - PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + PX_SHARED_ASSERT(mStride == 0 || sizeof(T) <= mStride); } /** @@ -117,7 +117,7 @@ class PxStrideIterator PX_INLINE PxStrideIterator(const PxStrideIterator<typename StripConst<T>::Type>& strideIterator) : mPtr(strideIterator.ptr()), mStride(strideIterator.stride()) { - PX_ASSERT(mStride == 0 || sizeof(T) <= mStride); + PX_SHARED_ASSERT(mStride == 0 || sizeof(T) <= mStride); } /** @@ -237,7 +237,7 @@ class PxStrideIterator */ PX_INLINE int operator-(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); int byteDiff = static_cast<int>(reinterpret_cast<const PxU8*>(mPtr) - reinterpret_cast<const PxU8*>(other.mPtr)); return byteDiff / static_cast<int>(stride()); } @@ -247,7 +247,7 @@ class PxStrideIterator */ PX_INLINE bool operator==(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr == other.mPtr; } @@ -256,7 +256,7 @@ class PxStrideIterator */ PX_INLINE bool operator!=(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr != other.mPtr; } @@ -265,7 +265,7 @@ class PxStrideIterator */ PX_INLINE bool operator<(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr < other.mPtr; } @@ -274,7 +274,7 @@ class PxStrideIterator */ PX_INLINE bool operator>(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr > other.mPtr; } @@ -283,7 +283,7 @@ class PxStrideIterator */ PX_INLINE bool operator<=(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr <= other.mPtr; } @@ -292,7 +292,7 @@ class PxStrideIterator */ PX_INLINE bool operator>=(const PxStrideIterator& other) const { - PX_ASSERT(isCompatible(other)); + PX_SHARED_ASSERT(isCompatible(other)); return mPtr >= other.mPtr; } diff --git a/PxShared/include/foundation/PxTransform.h b/PxShared/include/foundation/PxTransform.h index ddba031..f639903 100644 --- a/PxShared/include/foundation/PxTransform.h +++ b/PxShared/include/foundation/PxTransform.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -66,7 +66,7 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxQuat& orientation) : q(orientation), p(0) { - PX_ASSERT(orientation.isSane()); + PX_SHARED_ASSERT(orientation.isSane()); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(float x, float y, float z, PxQuat aQ = PxQuat(PxIdentity)) @@ -76,7 +76,7 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform(const PxVec3& p0, const PxQuat& q0) : q(q0), p(p0) { - PX_ASSERT(q0.isSane()); + PX_SHARED_ASSERT(q0.isSane()); } PX_CUDA_CALLABLE PX_FORCE_INLINE explicit PxTransform(const PxMat44& m); // defined in PxMat44.h @@ -91,7 +91,7 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform operator*(const PxTransform& x) const { - PX_ASSERT(x.isSane()); + PX_SHARED_ASSERT(x.isSane()); return transform(x); } @@ -104,39 +104,39 @@ class PxTransform PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform getInverse() const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return PxTransform(q.rotateInv(-p), q.getConjugate()); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transform(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotate(input) + p; } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 transformInv(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotateInv(input - p); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotate(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotate(input); } PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec3 rotateInv(const PxVec3& input) const { - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(isFinite()); return q.rotateInv(input); } //! Transform transform to parent (returns compound transform: first src, then *this) PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform transform(const PxTransform& src) const { - PX_ASSERT(src.isSane()); - PX_ASSERT(isSane()); + PX_SHARED_ASSERT(src.isSane()); + PX_SHARED_ASSERT(isSane()); // src = [srct, srcr] -> [r*srct + t, r*srcr] return PxTransform(q.rotate(src.p) + p, q * src.q); } @@ -171,8 +171,8 @@ class PxTransform //! Transform transform from parent (returns compound transform: first src, then this->inverse) PX_CUDA_CALLABLE PX_FORCE_INLINE PxTransform transformInv(const PxTransform& src) const { - PX_ASSERT(src.isSane()); - PX_ASSERT(isFinite()); + PX_SHARED_ASSERT(src.isSane()); + PX_SHARED_ASSERT(isFinite()); // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] PxQuat qinv = q.getConjugate(); return PxTransform(qinv.rotate(src.p - p), qinv * src.q); diff --git a/PxShared/include/foundation/PxUnionCast.h b/PxShared/include/foundation/PxUnionCast.h index 7bead42..007493c 100644 --- a/PxShared/include/foundation/PxUnionCast.h +++ b/PxShared/include/foundation/PxUnionCast.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -41,6 +41,13 @@ namespace physx { #endif +// Needed for clang 7 +#if PX_CLANG && PX_CLANG_MAJOR >= 7 + #define USE_VOLATILE_UNION volatile +#else + #define USE_VOLATILE_UNION +#endif + template <class A, class B> PX_FORCE_INLINE A PxUnionCast(B b) { @@ -49,12 +56,14 @@ PX_FORCE_INLINE A PxUnionCast(B b) AB(B bb) : _b(bb) { } - B _b; - A _a; - } u(b); + B _b; + A _a; + } USE_VOLATILE_UNION u(b); return u._a; } +#undef USE_VOLATILE_UNION + #if !PX_DOXYGEN } // namespace physx #endif diff --git a/PxShared/include/foundation/PxVec2.h b/PxShared/include/foundation/PxVec2.h index bee58e8..1128111 100644 --- a/PxShared/include/foundation/PxVec2.h +++ b/PxShared/include/foundation/PxVec2.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -107,9 +107,9 @@ class PxVec2 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](int index) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](int index) { - PX_ASSERT(index >= 0 && index <= 1); + PX_SHARED_ASSERT(index >= 0 && index <= 1); return reinterpret_cast<float*>(this)[index]; } @@ -117,9 +117,9 @@ class PxVec2 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](int index) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](int index) const { - PX_ASSERT(index >= 0 && index <= 1); + PX_SHARED_ASSERT(index >= 0 && index <= 1); return reinterpret_cast<const float*>(this)[index]; } diff --git a/PxShared/include/foundation/PxVec3.h b/PxShared/include/foundation/PxVec3.h index 7c15afb..d3baead 100644 --- a/PxShared/include/foundation/PxVec3.h +++ b/PxShared/include/foundation/PxVec3.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -109,9 +109,9 @@ class PxVec3 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](unsigned int index) + PX_CUDA_CALLABLE PX_FORCE_INLINE float& operator[](unsigned int index) { - PX_ASSERT(index <= 2); + PX_SHARED_ASSERT(index <= 2); return reinterpret_cast<float*>(this)[index]; } @@ -119,12 +119,13 @@ class PxVec3 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](unsigned int index) const + PX_CUDA_CALLABLE PX_FORCE_INLINE const float& operator[](unsigned int index) const { - PX_ASSERT(index <= 2); + PX_SHARED_ASSERT(index <= 2); return reinterpret_cast<const float*>(this)[index]; } + /** \brief returns true if the two vectors are exactly equal. */ @@ -324,7 +325,7 @@ class PxVec3 PX_CUDA_CALLABLE PX_FORCE_INLINE float normalizeFast() { const float mag = magnitude(); - PX_ASSERT(mag >= PX_NORMALIZATION_EPSILON); + PX_SHARED_ASSERT(mag >= PX_NORMALIZATION_EPSILON); *this *= 1.0f / mag; return mag; } diff --git a/PxShared/include/foundation/PxVec4.h b/PxShared/include/foundation/PxVec4.h index e33eddf..711e531 100644 --- a/PxShared/include/foundation/PxVec4.h +++ b/PxShared/include/foundation/PxVec4.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -34,7 +34,7 @@ */ #include "foundation/PxMath.h" #include "foundation/PxVec3.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" /** \brief 4 Element vector class. @@ -130,9 +130,9 @@ class PxVec4 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_INLINE float& operator[](unsigned int index) + PX_CUDA_CALLABLE PX_INLINE float& operator[](unsigned int index) { - PX_ASSERT(index <= 3); + PX_SHARED_ASSERT(index <= 3); return reinterpret_cast<float*>(this)[index]; } @@ -140,9 +140,9 @@ class PxVec4 /** \brief element access */ - PX_DEPRECATED PX_CUDA_CALLABLE PX_INLINE const float& operator[](unsigned int index) const + PX_CUDA_CALLABLE PX_INLINE const float& operator[](unsigned int index) const { - PX_ASSERT(index <= 3); + PX_SHARED_ASSERT(index <= 3); return reinterpret_cast<const float*>(this)[index]; } diff --git a/PxShared/include/foundation/unix/PxUnixIntrinsics.h b/PxShared/include/foundation/unix/PxUnixIntrinsics.h index 5f492bc..1095b13 100644 --- a/PxShared/include/foundation/unix/PxUnixIntrinsics.h +++ b/PxShared/include/foundation/unix/PxUnixIntrinsics.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -31,7 +31,7 @@ #define PXFOUNDATION_PXUNIXINTRINSICS_H #include "foundation/Px.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" #if !(PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY) #error "This file should only be included by Unix builds!!" @@ -175,7 +175,7 @@ Set 128B to zero starting at \c dst+offset. Must be aligned. */ PX_FORCE_INLINE void memZero128(void* dest, uint32_t offset = 0) { - PX_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); + PX_SHARED_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); memSet(reinterpret_cast<char*>(dest) + offset, 0, 128); } diff --git a/PxShared/include/foundation/windows/PxWindowsFoundationDelayLoadHook.h b/PxShared/include/foundation/windows/PxWindowsFoundationDelayLoadHook.h deleted file mode 100644 index 1d42185..0000000 --- a/PxShared/include/foundation/windows/PxWindowsFoundationDelayLoadHook.h +++ /dev/null @@ -1,71 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PX_FOUNDATION_DELAY_LOAD_HOOK -#define PX_FOUNDATION_DELAY_LOAD_HOOK - -#include "foundation/PxPreprocessor.h" - -/** \addtogroup foundation -@{ -*/ - -#if !PX_DOXYGEN -namespace physx -{ -#endif - /** - \brief PxFoundationDelayLoadHook - - This is a helper class for delay loading the PxFoundation dll. - If a PxFoundation dll with a non-default file name needs to be loaded, - PxFoundationDelayLoadHook can be sub-classed to provide the custom file names. - - Once the names are set, the instance must be set for use by the loading dll. - */ - class PxFoundationDelayLoadHook - { - public: - PxFoundationDelayLoadHook() {} - virtual ~PxFoundationDelayLoadHook() {} - - virtual const char* getPxFoundationDEBUGDllName() const = 0; - virtual const char* getPxFoundationCHECKEDDllName() const = 0; - virtual const char* getPxFoundationPROFILEDllName() const = 0; - virtual const char* getPxFoundationDllName() const = 0; - - protected: - private: - }; - -#if !PX_DOXYGEN -} // namespace physx -#endif -/** @} */ -#endif diff --git a/PxShared/include/foundation/windows/PxWindowsIntrinsics.h b/PxShared/include/foundation/windows/PxWindowsIntrinsics.h index 3cc63b5..804c20b 100644 --- a/PxShared/include/foundation/windows/PxWindowsIntrinsics.h +++ b/PxShared/include/foundation/windows/PxWindowsIntrinsics.h @@ -1,29 +1,29 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. // -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions +// are met: +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of NVIDIA CORPORATION nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. // -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. +// Copyright (c) 2008-2019 NVIDIA Corporation. All rights reserved. // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. // Copyright (c) 2001-2004 NovodeX AG. All rights reserved. @@ -31,7 +31,7 @@ #define PXFOUNDATION_PXWINDOWSINTRINSICS_H #include "foundation/Px.h" -#include "foundation/PxAssert.h" +#include "foundation/PxSharedAssert.h" #if !PX_WINDOWS_FAMILY #error "This file should only be included by Windows builds!!" @@ -176,7 +176,7 @@ Set 128B to zero starting at \c dst+offset. Must be aligned. */ PX_FORCE_INLINE void memZero128(void* dest, uint32_t offset = 0) { - PX_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); + PX_SHARED_ASSERT(((size_t(dest) + offset) & 0x7f) == 0); memSet(reinterpret_cast<char*>(dest) + offset, 0, 128); } diff --git a/PxShared/include/pvd/PxPvd.h b/PxShared/include/pvd/PxPvd.h deleted file mode 100644 index 277ac4f..0000000 --- a/PxShared/include/pvd/PxPvd.h +++ /dev/null @@ -1,193 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVD_H -#define PXPVDSDK_PXPVD_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxFlags.h" -#include "foundation/PxProfiler.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -class PxPvdTransport; - -#if PX_WINDOWS_FAMILY && !PX_ARM_FAMILY -#ifndef PX_PVDSDK_DLL -#define PX_PVDSDK_API PX_DLL_IMPORT -#elif PX_PVDSDK_DLL -#define PX_PVDSDK_API PX_DLL_EXPORT -#endif -#elif PX_UNIX_FAMILY -#ifdef PX_PVDSDK_DLL -#define PX_PVDSDK_API PX_UNIX_EXPORT -#endif -#endif - -#ifndef PX_PVDSDK_API -#define PX_PVDSDK_API -#endif - -/** -\brief types of instrumentation that PVD can do. -*/ -struct PxPvdInstrumentationFlag -{ - enum Enum - { - /** - \brief Send debugging information to PVD. - - This information is the actual object data of the rigid statics, shapes, - articulations, etc. Sending this information has a noticeable impact on - performance and thus this flag should not be set if you want an accurate - performance profile. - */ - eDEBUG = 1 << 0, - - /** - \brief Send profile information to PVD. - - This information populates PVD's profile view. It has (at this time) negligible - cost compared to Debug information and makes PVD *much* more useful so it is quite - highly recommended. - - This flag works together with a PxCreatePhysics parameter. - Using it allows the SDK to send profile events to PVD. - */ - ePROFILE = 1 << 1, - - /** - \brief Send memory information to PVD. - - The PVD sdk side hooks into the Foundation memory controller and listens to - allocation/deallocation events. This has a noticable hit on the first frame, - however, this data is somewhat compressed and the PhysX SDK doesn't allocate much - once it hits a steady state. This information also has a fairly negligible - impact and thus is also highly recommended. - - This flag works together with a PxCreatePhysics parameter, - trackOutstandingAllocations. Using both of them together allows users to have - an accurate view of the overall memory usage of the simulation at the cost of - a hashtable lookup per allocation/deallocation. Again, PhysX makes a best effort - attempt not to allocate or deallocate during simulation so this hashtable lookup - tends to have no effect past the first frame. - - Sending memory information without tracking outstanding allocations means that - PVD will accurate information about the state of the memory system before the - actual connection happened. - */ - eMEMORY = 1 << 2, - - eALL = (eDEBUG | ePROFILE | eMEMORY) - }; -}; - -/** -\brief Bitfield that contains a set of raised flags defined in PxPvdInstrumentationFlag. - -@see PxPvdInstrumentationFlag -*/ -typedef PxFlags<PxPvdInstrumentationFlag::Enum, uint8_t> PxPvdInstrumentationFlags; -PX_FLAGS_OPERATORS(PxPvdInstrumentationFlag::Enum, uint8_t) - -/** -\brief PxPvd is the top-level class for the PVD framework, and the main customer interface for PVD -configuration.It is a singleton class, instantiated and owned by the application. -*/ -class PxPvd : public physx::PxProfilerCallback -{ - public: - /** - Connects the SDK to the PhysX Visual Debugger application. - \param transport transport for pvd captured data. - \param flags Flags to set. - return True if success - */ - virtual bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) = 0; - - /** - Disconnects the SDK from the PhysX Visual Debugger application. - If we are still connected, this will kill the entire debugger connection. - */ - virtual void disconnect() = 0; - - /** - * Return if connection to PVD is created. - \param useCachedStatus - 1> When useCachedStaus is false, isConnected() checks the lowlevel network status. - This can be slow because it needs to lock the lowlevel network stream. If isConnected() is - called frequently, the expense of locking can be significant. - 2> When useCachedStatus is true, isConnected() checks the highlevel cached status with atomic access. - It is faster than locking, but the status may be different from the lowlevel network with latency of up to - one frame. - The reason for this is that the cached status is changed inside socket listener, which is not - called immediately when the lowlevel connection status changes. - */ - virtual bool isConnected(bool useCachedStatus = true) = 0; - - /** - returns the PVD data transport - returns NULL if no transport is present. - */ - virtual PxPvdTransport* getTransport() = 0; - - /** - Retrieves the PVD flags. See PxPvdInstrumentationFlags. - */ - virtual PxPvdInstrumentationFlags getInstrumentationFlags() = 0; - - /** - \brief Releases the pvd instance. - */ - virtual void release() = 0; - - protected: - virtual ~PxPvd() - { - } -}; - -/** - \brief Create a pvd instance. - \param foundation is the foundation instance that stores the allocator and error callbacks. -*/ -PX_PVDSDK_API PxPvd* PX_CALL_CONV PxCreatePvd(PxFoundation& foundation); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVD_H diff --git a/PxShared/include/pvd/PxPvdTransport.h b/PxShared/include/pvd/PxPvdTransport.h deleted file mode 100644 index dbaf878..0000000 --- a/PxShared/include/pvd/PxPvdTransport.h +++ /dev/null @@ -1,129 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDTRANSPORT_H -#define PXPVDSDK_PXPVDTRANSPORT_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxErrors.h" -#include "foundation/PxFlags.h" -#include "pvd/PxPvd.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -/** -\brief PxPvdTransport is an interface representing the data transport mechanism. -This class defines all services associated with the transport: configuration, connection, reading, writing etc. -It is owned by the application, and can be realized as a file or a socket (using one-line PxDefault<...> methods in -PhysXExtensions) or in a custom implementation. This is a class that is intended for use by PVD, not by the -application, the application entry points are PxPvd and PvdClient. -*/ - -class PxPvdTransport -{ - public: - // connect, isConnected, disconnect, read, write, flush - - /** - Connects to the Visual Debugger application. - return True if success - */ - virtual bool connect() = 0; - - /** - Disconnects from the Visual Debugger application. - If we are still connected, this will kill the entire debugger connection. - */ - virtual void disconnect() = 0; - - /** - * Return if connection to PVD is created. - */ - virtual bool isConnected() = 0; - - /** - * write bytes to the other endpoint of the connection. should lock before witre. If an error occurs - * this connection will assume to be dead. - */ - virtual bool write(const uint8_t* inBytes, uint32_t inLength) = 0; - - /* - lock this transport and return it - */ - virtual PxPvdTransport& lock() = 0; - - /* - unlock this transport - */ - virtual void unlock() = 0; - - /** - * send any data and block until we know it is at least on the wire. - */ - virtual void flush() = 0; - - /** - * Return size of written data. - */ - virtual uint64_t getWrittenDataSize() = 0; - - virtual void release() = 0; - - protected: - virtual ~PxPvdTransport() - { - } -}; - -/** - \brief Create a default socket transport. - \param host host address of the pvd application. - \param port ip port used for pvd, should same as the port setting in pvd application. - \param timeoutInMilliseconds timeout when connect to pvd host. -*/ -PX_PVDSDK_API PxPvdTransport* PX_CALL_CONV -PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds); - -/** - \brief Create a default file transport. - \param name full path filename used save captured pvd data. -*/ -PX_PVDSDK_API PxPvdTransport* PX_CALL_CONV PxDefaultPvdFileTransportCreate(const char* name); - -#if !PX_DOXYGEN -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDTRANSPORT_H diff --git a/PxShared/include/pvd/windows/PxWindowsPvdDelayLoadHook.h b/PxShared/include/pvd/windows/PxWindowsPvdDelayLoadHook.h deleted file mode 100644 index 13bd7e9..0000000 --- a/PxShared/include/pvd/windows/PxWindowsPvdDelayLoadHook.h +++ /dev/null @@ -1,60 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PX_PVD_DELAY_LOAD_HOOK -#define PX_PVD_DELAY_LOAD_HOOK - -#include "foundation/PxPreprocessor.h" -#include "foundation/windows/PxWindowsFoundationDelayLoadHook.h" -#include "../PxPvd.h" - -/** \addtogroup pvd -@{ -*/ - -#if !PX_DOXYGEN -namespace physx -{ -#endif - - /** - \brief Sets delay load hook instance for Foundation dll. - - \param[in] hook Delay load hook. - - @see PxFoundationDelayLoadHook - */ - PX_C_EXPORT PX_PVDSDK_API void PX_CALL_CONV PxPvdSetFoundationDelayLoadHook(const physx::PxFoundationDelayLoadHook* hook); - -#if !PX_DOXYGEN -} // namespace physx -#endif -/** @} */ -#endif diff --git a/PxShared/include/task/PxCpuDispatcher.h b/PxShared/include/task/PxCpuDispatcher.h deleted file mode 100644 index ffd5cfd..0000000 --- a/PxShared/include/task/PxCpuDispatcher.h +++ /dev/null @@ -1,79 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXCPUDISPATCHER_H -#define PXTASK_PXCPUDISPATCHER_H - -#include "task/PxTaskDefine.h" -#include "foundation/PxSimpleTypes.h" - -namespace physx -{ - -class PxBaseTask; - -/** - \brief A CpuDispatcher is responsible for scheduling the execution of tasks passed to it by the SDK. - - A typical implementation would for example use a thread pool with the dispatcher - pushing tasks onto worker thread queues or a global queue. - - @see PxBaseTask - @see PxTask - @see PxTaskManager -*/ -class PxCpuDispatcher -{ -public: - /** - \brief Called by the TaskManager when a task is to be queued for execution. - - Upon receiving a task, the dispatcher should schedule the task - to run when resource is available. After the task has been run, - it should call the release() method and discard it's pointer. - - \param[in] task The task to be run. - - @see PxBaseTask - */ - virtual void submitTask( PxBaseTask& task ) = 0; - - /** - \brief Returns the number of available worker threads for this dispatcher. - - The SDK will use this count to control how many tasks are submitted. By - matching the number of tasks with the number of execution units task - overhead can be reduced. - */ - virtual uint32_t getWorkerCount() const = 0; - - virtual ~PxCpuDispatcher() {} -}; - -} // end physx namespace - -#endif // PXTASK_PXCPUDISPATCHER_H diff --git a/PxShared/include/task/PxGpuDispatcher.h b/PxShared/include/task/PxGpuDispatcher.h deleted file mode 100644 index 6cd4c3b..0000000 --- a/PxShared/include/task/PxGpuDispatcher.h +++ /dev/null @@ -1,248 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXGPUDISPATCHER_H -#define PXTASK_PXGPUDISPATCHER_H - -#include "task/PxTaskDefine.h" -#include "task/PxTask.h" - -/* forward decl to avoid including <cuda.h> */ -typedef struct CUstream_st* CUstream; - -namespace physx -{ - -struct PxGpuCopyDesc; -class PxCudaContextManager; - -PX_PUSH_PACK_DEFAULT - -class PxTaskManager; - -/** \brief A GpuTask dispatcher - * - * A PxGpuDispatcher executes GpuTasks submitted by one or more TaskManagers (one - * or more scenes). It maintains a CPU worker thread which waits on GpuTask - * "groups" to be submitted. The submission API is explicitly sessioned so that - * GpuTasks are dispatched together as a group whenever possible to improve - * parallelism on the GPU. - * - * A PxGpuDispatcher cannot be allocated ad-hoc, they are created as a result of - * creating a PxCudaContextManager. Every PxCudaContextManager has a PxGpuDispatcher - * instance that can be queried. In this way, each PxGpuDispatcher is tied to - * exactly one CUDA context. - * - * A scene will use CPU fallback Tasks for GpuTasks if the PxTaskManager provided - * to it does not have a PxGpuDispatcher. For this reason, the PxGpuDispatcher must - * be assigned to the PxTaskManager before the PxTaskManager is given to a scene. - * - * Multiple TaskManagers may safely share a single PxGpuDispatcher instance, thus - * enabling scenes to share a CUDA context. - * - * Only failureDetected() is intended for use by the user. The rest of the - * nvGpuDispatcher public methods are reserved for internal use by only both - * TaskManagers and GpuTasks. - */ -class PxGpuDispatcher -{ -public: - /** \brief Record the start of a simulation step - * - * A PxTaskManager calls this function to record the beginning of a simulation - * step. The PxGpuDispatcher uses this notification to initialize the - * profiler state. - */ - virtual void startSimulation() = 0; - - /** \brief Record the start of a GpuTask batch submission - * - * A PxTaskManager calls this function to notify the PxGpuDispatcher that one or - * more GpuTasks are about to be submitted for execution. The PxGpuDispatcher - * will not read the incoming task queue until it receives one finishGroup() - * call for each startGroup() call. This is to ensure as many GpuTasks as - * possible are executed together as a group, generating optimal parallelism - * on the GPU. - */ - virtual void startGroup() = 0; - - /** \brief Submit a GpuTask for execution - * - * Submitted tasks are pushed onto an incoming queue. The PxGpuDispatcher - * will take the contents of this queue every time the pending group count - * reaches 0 and run the group of submitted GpuTasks as an interleaved - * group. - */ - virtual void submitTask(PxTask& task) = 0; - - /** \brief Record the end of a GpuTask batch submission - * - * A PxTaskManager calls this function to notify the PxGpuDispatcher that it is - * done submitting a group of GpuTasks (GpuTasks which were all make ready - * to run by the same prerequisite dependency becoming resolved). If no - * other group submissions are in progress, the PxGpuDispatcher will execute - * the set of ready tasks. - */ - virtual void finishGroup() = 0; - - /** \brief Add a CUDA completion prerequisite dependency to a task - * - * A GpuTask calls this function to add a prerequisite dependency on another - * task (usually a CpuTask) preventing that task from starting until all of - * the CUDA kernels and copies already launched have been completed. The - * PxGpuDispatcher will increment that task's reference count, blocking its - * execution, until the CUDA work is complete. - * - * This is generally only required when a CPU task is expecting the results - * of the CUDA kernels to have been copied into host memory. - * - * This mechanism is not at all not required to ensure CUDA kernels and - * copies are issued in the correct order. Kernel issue order is determined - * by normal task dependencies. The rule of thumb is to only use a blocking - * completion prerequisite if the task in question depends on a completed - * GPU->Host DMA. - * - * The PxGpuDispatcher issues a blocking event record to CUDA for the purposes - * of tracking the already submitted CUDA work. When this event is - * resolved, the PxGpuDispatcher manually decrements the reference count of - * the specified task, allowing it to execute (assuming it does not have - * other pending prerequisites). - */ - virtual void addCompletionPrereq(PxBaseTask& task) = 0; - - /** \brief Retrieve the PxCudaContextManager associated with this - * PxGpuDispatcher - * - * Every PxCudaContextManager has one PxGpuDispatcher, and every PxGpuDispatcher - * has one PxCudaContextManager. - */ - virtual PxCudaContextManager* getCudaContextManager() = 0; - - /** \brief Record the end of a simulation frame - * - * A PxTaskManager calls this function to record the completion of its - * dependency graph. If profiling is enabled, the PxGpuDispatcher will - * trigger the retrieval of profiling data from the GPU at this point. - */ - virtual void stopSimulation() = 0; - - /** \brief Returns true if a CUDA call has returned a non-recoverable error - * - * A return value of true indicates a fatal error has occurred. To protect - * itself, the PxGpuDispatcher enters a fall through mode that allows GpuTasks - * to complete without being executed. This allows simulations to continue - * but leaves GPU content static or corrupted. - * - * The user may try to recover from these failures by deleting GPU content - * so the visual artifacts are minimized. But there is no way to recover - * the state of the GPU actors before the failure. Once a CUDA context is - * in this state, the only recourse is to create a new CUDA context, a new - * scene, and start over. - * - * This is our "Best Effort" attempt to not turn a soft failure into a hard - * failure because continued use of a CUDA context after it has returned an - * error will usually result in a driver reset. However if the initial - * failure was serious enough, a reset may have already occurred by the time - * we learn of it. - */ - virtual bool failureDetected() const = 0; - - /** \brief Force the PxGpuDispatcher into failure mode - * - * This API should be used if user code detects a non-recoverable CUDA - * error. This ensures the PxGpuDispatcher does not launch any further - * CUDA work. Subsequent calls to failureDetected() will return true. - */ - virtual void forceFailureMode() = 0; - - /** \brief Launch a copy kernel with arbitrary number of copy commands - * - * This method is intended to be called from Kernel GpuTasks, but it can - * function outside of that context as well. - * - * If count is 1, the descriptor is passed to the kernel as arguments, so it - * may be declared on the stack. - * - * If count is greater than 1, the kernel will read the descriptors out of - * host memory. Because of this, the descriptor array must be located in - * page locked (pinned) memory. The provided descriptors may be modified by - * this method (converting host pointers to their GPU mapped equivalents) - * and should be considered *owned* by CUDA until the current batch of work - * has completed, so descriptor arrays should not be freed or modified until - * you have received a completion notification. - * - * If your GPU does not support mapping of page locked memory (SM>=1.1), - * this function degrades to calling CUDA copy methods. - */ - virtual void launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream) = 0; - - /** \brief Query pre launch task that runs before launching gpu kernels. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Do *not* set the continuation on the returned task, but use addPreLaunchDependent(). - */ - virtual PxBaseTask& getPreLaunchTask() = 0; - - /** \brief Adds a gpu launch task that gets executed after the pre launch task. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Each call adds a reference to the pre-launch task. - */ - virtual void addPreLaunchDependent(PxBaseTask& dependent) = 0; - - /** \brief Query post launch task that runs after the gpu is done. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Do *not* set the continuation on the returned task, but use addPostLaunchDependent(). - */ - virtual PxBaseTask& getPostLaunchTask() = 0; - - /** \brief Adds a task that gets executed after the post launch task. - * - * This is part of an optional feature to schedule multiple gpu features - * at the same time to get kernels to run in parallel. - * \note Each call adds a reference to the pre-launch task. - */ - virtual void addPostLaunchDependent(PxBaseTask& dependent) = 0; - -protected: - /** \brief protected destructor - * - * GpuDispatchers are allocated and freed by their PxCudaContextManager. - */ - virtual ~PxGpuDispatcher() {} -}; - -PX_POP_PACK - -} // end physx namespace - - -#endif // PXTASK_PXGPUDISPATCHER_H diff --git a/PxShared/include/task/PxGpuTask.h b/PxShared/include/task/PxGpuTask.h deleted file mode 100644 index 197fc3d..0000000 --- a/PxShared/include/task/PxGpuTask.h +++ /dev/null @@ -1,118 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - - -#ifndef PXTASK_PXGPUTASK_H -#define PXTASK_PXGPUTASK_H - -#include "task/PxTaskDefine.h" -#include "task/PxTask.h" -#include "task/PxGpuDispatcher.h" - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -/** \brief Define the 'flavor' of a PxGpuTask - * - * Each PxGpuTask should have a specific function; either copying data to the - * device, running kernels on that data, or copying data from the device. - * - * For optimal performance, the dispatcher should run all available HtoD tasks - * before running all Kernel tasks, and all Kernel tasks before running any DtoH - * tasks. This provides maximal kernel overlap and the least number of CUDA - * flushes. - */ -struct PxGpuTaskHint -{ - /// \brief Enums for the type of GPU task - enum Enum - { - HostToDevice, - Kernel, - DeviceToHost, - - NUM_GPU_TASK_HINTS - }; -}; - -/** - * \brief PxTask implementation for launching CUDA work - */ -class PxGpuTask : public PxTask -{ -public: - PxGpuTask() : mComp(NULL) {} - - /** - * \brief iterative "run" function for a PxGpuTask - * - * The GpuDispatcher acquires the CUDA context for the duration of this - * function call, and it is highly recommended that the PxGpuTask use the - * provided CUstream for all kernels. - * - * kernelIndex will be 0 for the initial call and incremented before each - * subsequent call. Once launchInstance() returns false, its PxGpuTask is - * considered completed and is released. - */ - virtual bool launchInstance(CUstream stream, int kernelIndex) = 0; - - /** - * \brief Returns a hint indicating the function of this task - */ - virtual PxGpuTaskHint::Enum getTaskHint() const = 0; - - /** - * \brief Specify a task that will have its reference count decremented - * when this task is released - */ - void setCompletionTask(PxBaseTask& task) - { - mComp = &task; - } - - void release() - { - if (mComp) - { - mComp->removeReference(); - mComp = NULL; - } - PxTask::release(); - } - -protected: - /// \brief A pointer to the completion task - PxBaseTask* mComp; -}; - -PX_POP_PACK - -} // end physx namespace - -#endif // PXTASK_PXGPUTASK_H diff --git a/PxShared/include/task/PxTask.h b/PxShared/include/task/PxTask.h deleted file mode 100644 index 85d91da..0000000 --- a/PxShared/include/task/PxTask.h +++ /dev/null @@ -1,335 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXTASK_H -#define PXTASK_PXTASK_H - -#include "task/PxTaskDefine.h" -#include "task/PxTaskManager.h" -#include "task/PxCpuDispatcher.h" -#include "task/PxGpuDispatcher.h" -#include "foundation/PxAssert.h" - -namespace physx -{ - -/** - * \brief Base class of all task types - * - * PxBaseTask defines a runnable reference counted task with built-in profiling. - */ -class PxBaseTask -{ -public: - PxBaseTask() : mContextID(0), mTm(NULL) {} - virtual ~PxBaseTask() {} - - /** - * \brief The user-implemented run method where the task's work should be performed - * - * run() methods must be thread safe, stack friendly (no alloca, etc), and - * must never block. - */ - virtual void run() = 0; - - /** - * \brief Return a user-provided task name for profiling purposes. - * - * It does not have to be unique, but unique names are helpful. - * - * \return The name of this task - */ - virtual const char* getName() const = 0; - - //! \brief Implemented by derived implementation classes - virtual void addReference() = 0; - //! \brief Implemented by derived implementation classes - virtual void removeReference() = 0; - //! \brief Implemented by derived implementation classes - virtual int32_t getReference() const = 0; - - /** \brief Implemented by derived implementation classes - * - * A task may assume in its release() method that the task system no longer holds - * references to it - so it may safely run its destructor, recycle itself, etc. - * provided no additional user references to the task exist - */ - virtual void release() = 0; - - /** - * \brief Return PxTaskManager to which this task was submitted - * - * Note, can return NULL if task was not submitted, or has been - * completed. - */ - PX_FORCE_INLINE PxTaskManager* getTaskManager() const - { - return mTm; - } - - PX_FORCE_INLINE void setContextId(PxU64 id) { mContextID = id; } - PX_FORCE_INLINE PxU64 getContextId() const { return mContextID; } - -protected: - PxU64 mContextID; //!< Context ID for profiler interface - PxTaskManager* mTm; //!< Owning PxTaskManager instance - - friend class PxTaskMgr; -}; - - -/** - * \brief A PxBaseTask implementation with deferred execution and full dependencies - * - * A PxTask must be submitted to a PxTaskManager to to be executed, Tasks may - * optionally be named when they are submitted. - */ -class PxTask : public PxBaseTask -{ -public: - PxTask() : mTaskID(0) {} - virtual ~PxTask() {} - - //! \brief Release method implementation - virtual void release() - { - PX_ASSERT(mTm); - - // clear mTm before calling taskCompleted() for safety - PxTaskManager* save = mTm; - mTm = NULL; - save->taskCompleted( *this ); - } - - //! \brief Inform the PxTaskManager this task must finish before the given - // task is allowed to start. - PX_INLINE void finishBefore( PxTaskID taskID ) - { - PX_ASSERT(mTm); - mTm->finishBefore( *this, taskID); - } - - //! \brief Inform the PxTaskManager this task cannot start until the given - // task has completed. - PX_INLINE void startAfter( PxTaskID taskID ) - { - PX_ASSERT(mTm); - mTm->startAfter( *this, taskID ); - } - - /** - * \brief Manually increment this task's reference count. The task will - * not be allowed to run until removeReference() is called. - */ - PX_INLINE void addReference() - { - PX_ASSERT(mTm); - mTm->addReference( mTaskID ); - } - - /** - * \brief Manually decrement this task's reference count. If the reference - * count reaches zero, the task will be dispatched. - */ - PX_INLINE void removeReference() - { - PX_ASSERT(mTm); - mTm->decrReference( mTaskID ); - } - - /** - * \brief Return the ref-count for this task - */ - PX_INLINE int32_t getReference() const - { - return mTm->getReference( mTaskID ); - } - - /** - * \brief Return the unique ID for this task - */ - PX_INLINE PxTaskID getTaskID() const - { - return mTaskID; - } - - /** - * \brief Called by PxTaskManager at submission time for initialization - * - * Perform simulation step initialization here. - */ - virtual void submitted() - { - mStreamIndex = 0; - mPreSyncRequired = false; - } - - /** - * \brief Specify that the GpuTask sync flag be set - */ - PX_INLINE void requestSyncPoint() - { - mPreSyncRequired = true; - } - - -protected: - PxTaskID mTaskID; //!< ID assigned at submission - uint32_t mStreamIndex; //!< GpuTask CUDA stream index - bool mPreSyncRequired; //!< GpuTask sync flag - - friend class PxTaskMgr; - friend class PxGpuWorkerThread; -}; - - -/** - * \brief A PxBaseTask implementation with immediate execution and simple dependencies - * - * A PxLightCpuTask bypasses the PxTaskManager launch dependencies and will be - * submitted directly to your scene's CpuDispatcher. When the run() function - * completes, it will decrement the reference count of the specified - * continuation task. - * - * You must use a full-blown PxTask if you want your task to be resolved - * by another PxTask, or you need more than a single dependency to be - * resolved when your task completes, or your task will not run on the - * CpuDispatcher. - */ -class PxLightCpuTask : public PxBaseTask -{ -public: - PxLightCpuTask() - : mCont( NULL ) - , mRefCount( 0 ) - { - } - virtual ~PxLightCpuTask() - { - mTm = NULL; - } - - /** - * \brief Initialize this task and specify the task that will have its ref count decremented on completion. - * - * Submission is deferred until the task's mRefCount is decremented to zero. - * Note that we only use the PxTaskManager to query the appropriate dispatcher. - * - * \param[in] tm The PxTaskManager this task is managed by - * \param[in] c The task to be executed when this task has finished running - */ - PX_INLINE void setContinuation(PxTaskManager& tm, PxBaseTask* c) - { - PX_ASSERT( mRefCount == 0 ); - mRefCount = 1; - mCont = c; - mTm = &tm; - if( mCont ) - { - mCont->addReference(); - } - } - - /** - * \brief Initialize this task and specify the task that will have its ref count decremented on completion. - * - * This overload of setContinuation() queries the PxTaskManager from the continuation - * task, which cannot be NULL. - * \param[in] c The task to be executed after this task has finished running - */ - PX_INLINE void setContinuation( PxBaseTask* c ) - { - PX_ASSERT( c ); - PX_ASSERT( mRefCount == 0 ); - mRefCount = 1; - mCont = c; - if( mCont ) - { - mCont->addReference(); - mTm = mCont->getTaskManager(); - PX_ASSERT( mTm ); - } - } - - /** - * \brief Retrieves continuation task - */ - PX_INLINE PxBaseTask* getContinuation() const - { - return mCont; - } - - /** - * \brief Manually decrement this task's reference count. If the reference - * count reaches zero, the task will be dispatched. - */ - PX_INLINE void removeReference() - { - mTm->decrReference(*this); - } - - /** \brief Return the ref-count for this task */ - PX_INLINE int32_t getReference() const - { - return mRefCount; - } - - /** - * \brief Manually increment this task's reference count. The task will - * not be allowed to run until removeReference() is called. - */ - PX_INLINE void addReference() - { - mTm->addReference(*this); - } - - /** - * \brief called by CpuDispatcher after run method has completed - * - * Decrements the continuation task's reference count, if specified. - */ - PX_INLINE void release() - { - if( mCont ) - { - mCont->removeReference(); - } - } - -protected: - - PxBaseTask* mCont; //!< Continuation task, can be NULL - volatile int32_t mRefCount; //!< PxTask is dispatched when reaches 0 - - friend class PxTaskMgr; -}; - - -}// end physx namespace - - -#endif // PXTASK_PXTASK_H diff --git a/PxShared/include/task/PxTaskDefine.h b/PxShared/include/task/PxTaskDefine.h deleted file mode 100644 index c1daea7..0000000 --- a/PxShared/include/task/PxTaskDefine.h +++ /dev/null @@ -1,37 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXTASKDEFINE_H -#define PXTASK_PXTASKDEFINE_H - -#include "foundation/PxPreprocessor.h" - -#ifndef PX_SUPPORT_PXTASK_PROFILING -#define PX_SUPPORT_PXTASK_PROFILING 1 -#endif - -#endif // PXTASK_PXTASKDEFINE_H diff --git a/PxShared/include/task/PxTaskManager.h b/PxShared/include/task/PxTaskManager.h deleted file mode 100644 index f40f7b1..0000000 --- a/PxShared/include/task/PxTaskManager.h +++ /dev/null @@ -1,231 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_PXTASKMANAGER_H -#define PXTASK_PXTASKMANAGER_H - -#include "task/PxTaskDefine.h" -#include "foundation/PxSimpleTypes.h" -#include "foundation/PxErrorCallback.h" - -namespace physx -{ - -PX_PUSH_PACK_DEFAULT - -class PxBaseTask; -class PxTask; -class PxLightCpuTask; -typedef unsigned int PxTaskID; - -/** -\brief Identifies the type of each heavyweight PxTask object - -\note This enum type is only used by PxTask and GpuTask objects, LightCpuTasks do not use this enum. - -@see PxTask -@see PxLightCpuTask -*/ -struct PxTaskType -{ - /** - * \brief Identifies the type of each heavyweight PxTask object - */ - enum Enum - { - TT_CPU, //!< PxTask will be run on the CPU - TT_GPU, //!< PxTask will be run on the GPU - TT_NOT_PRESENT, //!< Return code when attempting to find a task that does not exist - TT_COMPLETED //!< PxTask execution has been completed - }; -}; - -class PxCpuDispatcher; -class PxGpuDispatcher; - -/** - \brief The PxTaskManager interface - - A PxTaskManager instance holds references to user-provided dispatcher objects, when tasks are - submitted the PxTaskManager routes them to the appropriate dispatcher and handles task profiling if enabled. - Users should not implement the PxTaskManager interface, the SDK creates it's own concrete PxTaskManager object - per-scene which users can configure by passing dispatcher objects into the PxSceneDesc. - - - @see CpuDispatcher - @see PxGpuDispatcher - -*/ -class PxTaskManager -{ -public: - - /** - \brief Set the user-provided dispatcher object for CPU tasks - - \param[in] ref The dispatcher object. - - @see CpuDispatcher - */ - virtual void setCpuDispatcher(PxCpuDispatcher& ref) = 0; - - /** - \brief Set the user-provided dispatcher object for GPU tasks - - \param[in] ref The dispatcher object. - - @see PxGpuDispatcher - */ - virtual void setGpuDispatcher(PxGpuDispatcher& ref) = 0; - - /** - \brief Get the user-provided dispatcher object for CPU tasks - - \return The CPU dispatcher object. - - @see CpuDispatcher - */ - virtual PxCpuDispatcher* getCpuDispatcher() const = 0; - - /** - \brief Get the user-provided dispatcher object for GPU tasks - - \return The GPU dispatcher object. - - @see PxGpuDispatcher - */ - virtual PxGpuDispatcher* getGpuDispatcher() const = 0; - - /** - \brief Reset any dependencies between Tasks - - \note Will be called at the start of every frame before tasks are submitted. - - @see PxTask - */ - virtual void resetDependencies() = 0; - - /** - \brief Called by the owning scene to start the task graph. - - \note All tasks with with ref count of 1 will be dispatched. - - @see PxTask - */ - virtual void startSimulation() = 0; - - /** - \brief Called by the owning scene at the end of a simulation step to synchronize the PxGpuDispatcher - - @see PxGpuDispatcher - */ - virtual void stopSimulation() = 0; - - /** - \brief Called by the worker threads to inform the PxTaskManager that a task has completed processing - - \param[in] task The task which has been completed - */ - virtual void taskCompleted(PxTask& task) = 0; - - /** - \brief Retrieve a task by name - - \param[in] name The unique name of a task - \return The ID of the task with that name, or TT_NOT_PRESENT if not found - */ - virtual PxTaskID getNamedTask(const char* name) = 0; - - /** - \brief Submit a task with a unique name. - - \param[in] task The task to be executed - \param[in] name The unique name of a task - \param[in] type The type of the task (default TT_CPU) - \return The ID of the task with that name, or TT_NOT_PRESENT if not found - - */ - virtual PxTaskID submitNamedTask(PxTask* task, const char* name, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0; - - /** - \brief Submit an unnamed task. - - \param[in] task The task to be executed - \param[in] type The type of the task (default TT_CPU) - - \return The ID of the task with that name, or TT_NOT_PRESENT if not found - */ - virtual PxTaskID submitUnnamedTask(PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU) = 0; - - /** - \brief Retrieve a task given a task ID - - \param[in] id The ID of the task to return, a valid ID must be passed or results are undefined - - \return The task associated with the ID - */ - virtual PxTask* getTaskFromID(PxTaskID id) = 0; - - /** - \brief Release the PxTaskManager object, referenced dispatchers will not be released - */ - virtual void release() = 0; - - /** - \brief Construct a new PxTaskManager instance with the given [optional] dispatchers - */ - static PxTaskManager* createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* = 0, PxGpuDispatcher* = 0); - -protected: - virtual ~PxTaskManager() {} - - /*! \cond PRIVATE */ - - virtual void finishBefore(PxTask& task, PxTaskID taskID) = 0; - virtual void startAfter(PxTask& task, PxTaskID taskID) = 0; - - virtual void addReference(PxTaskID taskID) = 0; - virtual void decrReference(PxTaskID taskID) = 0; - virtual int32_t getReference(PxTaskID taskID) const = 0; - - virtual void decrReference(PxLightCpuTask&) = 0; - virtual void addReference(PxLightCpuTask&) = 0; - - /*! \endcond */ - - friend class PxBaseTask; - friend class PxTask; - friend class PxLightCpuTask; - friend class PxGpuWorkerThread; -}; - -PX_POP_PACK - -} // end physx namespace - - -#endif // PXTASK_PXTASKMANAGER_H diff --git a/PxShared/src/compiler/cmake/Android/CMakeLists.txt b/PxShared/src/compiler/cmake/Android/CMakeLists.txt deleted file mode 100644 index 08757c1..0000000 --- a/PxShared/src/compiler/cmake/Android/CMakeLists.txt +++ /dev/null @@ -1,46 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -PROJECT(PxShared ) -include(../common/CMakeLists.txt) - -STRING(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) - -IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to android - SET(TARGET_BUILD_PLATFORM "android") -ENDIF() - -SET(PLATFORM_LIST android) - -IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) - MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) -ENDIF() - -if(${ANDROID_ABI} STREQUAL "armeabi-v7a") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -funwind-tables -fomit-frame-pointer -funswitch-loops -finline-limit=300 -fno-strict-aliasing -fstack-protector -Wno-invalid-offsetof ") -elseif(${ANDROID_ABI} STREQUAL "armeabi-v7a with NEON") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -ffast-math -fno-exceptions -ffunction-sections -funwind-tables -fomit-frame-pointer -funswitch-loops -finline-limit=300 -fno-strict-aliasing -fstack-protector -Wno-invalid-offsetof ") -elseif(${ANDROID_ABI} STREQUAL "arm64-v8a") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Wno-invalid-offsetof ") -elseif(${ANDROID_ABI} STREQUAL "x86") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Wno-invalid-offsetof -fpack-struct=8 -malign-double ") -elseif(${ANDROID_ABI} STREQUAL "x86_64") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-rtti -fno-exceptions -ffunction-sections -fdata-sections -Wno-invalid-offsetof -mstackrealign -msse3 ") -endif() - -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_CXX_FLAGS_CHECKED "-O3") -SET(CMAKE_CXX_FLAGS_PROFILE "-O3") -SET(CMAKE_CXX_FLAGS_RELEASE "-O3") - -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) -SET(PXSHARED_ANDROID_RELEASE_COMPILE_DEFS NDEBUG) - -# NOTE: PxCudaContextManager excluded on this platform - -# Include project cmake files here -INCLUDE(PxFoundation.cmake) -INCLUDE(PsFastXml.cmake) -INCLUDE(PxPvdSDK.cmake) -INCLUDE(PxTask.cmake) diff --git a/PxShared/src/compiler/cmake/Android/PsFastXml.cmake b/PxShared/src/compiler/cmake/Android/PsFastXml.cmake deleted file mode 100644 index f5dce60..0000000 --- a/PxShared/src/compiler/cmake/Android/PsFastXml.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Build PsFastXml -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) - -# Use generator expressions to set config specific preprocessor definitions -SET(PSFASTXML_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_ANDROID_COMPILE_DEFS};PX_FOUNDATION_DLL=0;PxShared_STATIC_LIB; - - $<$<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) - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PsFastXml PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Android/PxFoundation.cmake b/PxShared/src/compiler/cmake/Android/PxFoundation.cmake deleted file mode 100644 index d069e41..0000000 --- a/PxShared/src/compiler/cmake/Android/PxFoundation.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# -# Build PxFoundation -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -SET(PXFOUNDATION_LIBTYPE STATIC) - -SET(PXFOUNDATION_PLATFORM_FILES - ${LL_SOURCE_DIR}/src/unix/PsUnixAtomic.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixCpu.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixFPU.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixMutex.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixPrintString.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSList.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSocket.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSync.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixThread.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixTime.cpp - ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - ${LL_SOURCE_DIR}/include/linux - ${ANDROID_NDK}/sources/android/cpufeatures -) - -SET(PXFOUNDATION_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_ANDROID_COMPILE_DEFS};PxShared_STATIC_LIB; - - $<$<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) - -TARGET_LINK_LIBRARIES(PxFoundation PUBLIC log) - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxFoundation PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake deleted file mode 100644 index ea39cdb..0000000 --- a/PxShared/src/compiler/cmake/Android/PxPvdSDK.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# -# Build PxPvdSDK -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/pvd) - -SET(PXPVDSDK_LIBTYPE STATIC) - -# Use generator expressions to set config specific preprocessor definitions -SET(PXPVDSDK_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_ANDROID_COMPILE_DEFS};PxShared_STATIC_LIB; - - $<$<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) - -# Add linked libraries -TARGET_LINK_LIBRARIES(PxPvdSDK PRIVATE PxFoundation) - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxPvdSDK PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Android/PxTask.cmake b/PxShared/src/compiler/cmake/Android/PxTask.cmake deleted file mode 100644 index eabe075..0000000 --- a/PxShared/src/compiler/cmake/Android/PxTask.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Build PxTask -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/task) - -SET(PXTASK_COMPILE_DEFS - ${PXSHARED_ANDROID_COMPILE_DEFS};PxShared_STATIC_LIB; - - $<$<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) - -# include PxTask common -INCLUDE(../common/PxTask.cmake) - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxTask PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/CMakeLists.txt b/PxShared/src/compiler/cmake/CMakeLists.txt deleted file mode 100644 index 680a8ca..0000000 --- a/PxShared/src/compiler/cmake/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -cmake_minimum_required(VERSION 3.7) -PROJECT(PxShared C CXX) - -OPTION(PX_GENERATE_GPU_PROJECTS "Generate the GPU projects" ON) -OPTION(PX_SCALAR_MATH "Forces the usage of non-SIMD vector math" OFF) - -SET(PXSHARED_MAJOR_VERSION 1) -SET(PXSHARED_MINOR_VERSION 1) -SET(PXSHARED_PATCH_VERSION 0) -SET(PXSHARED_VERSION ${PXSHARED_MAJOR_VERSION}.${PXSHARED_MINOR_VERSION}.${PXSHARED_PATCH_VERSION}) - -CMAKE_POLICY(SET CMP0057 NEW) # Enable IN_LIST -CMAKE_POLICY(SET CMP0007 OLD) # Stop complaining about empty entries in lists - -IF(NOT DEFINED PXSHARED_ROOT_DIR) - - STRING(REPLACE "\\" "/" BRD_TEMP $ENV{PXSHARED_ROOT_DIR}) - - # This env variable is set by GenerateProjects.bat, and is no longer available when CMake rebuilds, so this stores it in the cache - SET(PXSHARED_ROOT_DIR ${BRD_TEMP} CACHE INTERNAL "Root of the PxShared source tree") - -ENDIF() - -MESSAGE("PXSHARED ROOT ${PXSHARED_ROOT_DIR}") - -IF(NOT EXISTS ${PXSHARED_ROOT_DIR}) - MESSAGE(FATAL_ERROR "PXSHARED_ROOT_DIR environment variable wasn't set or was invalid.") -ENDIF() - -# GW_DEPS_ROOT can be defined by user to avoid packman usage -IF(NOT EXISTS ${GW_DEPS_ROOT}) - SET(GW_DEPS_ROOT $ENV{PM_PACKAGES_ROOT}) -ENDIF() - -IF(NOT DEFINED CMAKEMODULES_VERSION) - SET(CMAKEMODULES_PATH $ENV{PM_CMakeModules_PATH} CACHE INTERNAL "Path to CMakeModules") - SET(CMAKEMODULES_NAME $ENV{PM_CMakeModules_NAME} CACHE INTERNAL "CMakeModules name") - SET(CMAKEMODULES_VERSION $ENV{PM_CMakeModules_VERSION} CACHE INTERNAL "CMakeModules version from generation batch") -ENDIF() - -#TODO: More elegance -IF(NOT EXISTS ${CMAKEMODULES_PATH}) - MESSAGE(FATAL_ERROR "Could not find ${CMAKEMODULES_PATH}") -ENDIF() - -SET(CMAKE_MODULE_PATH "${CMAKEMODULES_PATH}") - -# Now set the paths - -INCLUDE(NvidiaBuildOptions) - -IF(CMAKE_CONFIGURATION_TYPES) - SET(CMAKE_CONFIGURATION_TYPES debug checked profile release) - SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING - "Reset config to what we need" - FORCE) - - SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") - SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "") - - # Build PDBs for all configurations - SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") - -ENDIF() - -# Prevent failure due to command line limitations -IF(USE_RESPONSE_FILES) - SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) - SET(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1) - SET(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1) - SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) - SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1) - SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1) -ENDIF() - -SET(PROJECT_CMAKE_FILES_DIR src/compiler/cmake) -SET(PLATFORM_CMAKELISTS ${PXSHARED_ROOT_DIR}/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) - -IF(NOT EXISTS ${PLATFORM_CMAKELISTS}) - MESSAGE(FATAL_ERROR "Unable to find platform CMakeLists.txt for ${TARGET_BUILD_PLATFORM} at ${PLATFORM_CMAKELISTS}") -ENDIF() - -# Include the platform specific CMakeLists -INCLUDE(${PXSHARED_ROOT_DIR}/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/CMakeLists.txt) diff --git a/PxShared/src/compiler/cmake/IOS/CMakeLists.txt b/PxShared/src/compiler/cmake/IOS/CMakeLists.txt deleted file mode 100644 index 7b05731..0000000 --- a/PxShared/src/compiler/cmake/IOS/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -PROJECT(PxShared CXX) -include(../common/CMakeLists.txt) - - -IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to ios - SET(TARGET_BUILD_PLATFORM "ios") -ENDIF() - -SET(PLATFORM_LIST ios) - -IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) - MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) -ENDIF() - -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 "") - -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_CXX_FLAGS_CHECKED "-O3 -g") -SET(CMAKE_CXX_FLAGS_PROFILE "-O3 -g") -SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g") - -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) -SET(PXSHARED_IOS_PROFILE_COMPILE_DEFS NDEBUG;PX_PROFILE=1) -SET(PXSHARED_IOS_RELEASE_COMPILE_DEFS NDEBUG) - -# NOTE: PxCudaContextManager excluded on this platform - -# Include project cmake files here -INCLUDE(PxFoundation.cmake) -INCLUDE(PsFastXml.cmake) -INCLUDE(PxPvdSDK.cmake) -INCLUDE(PxTask.cmake) diff --git a/PxShared/src/compiler/cmake/IOS/PsFastXml.cmake b/PxShared/src/compiler/cmake/IOS/PsFastXml.cmake deleted file mode 100644 index 28b2a1b..0000000 --- a/PxShared/src/compiler/cmake/IOS/PsFastXml.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# Build PsFastXml -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) - -# Use generator expressions to set config specific preprocessor definitions -SET(PSFASTXML_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_IOS_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - - $<$<CONFIG:debug>:${PXSHARED_IOS_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_IOS_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_IOS_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_IOS_RELEASE_COMPILE_DEFS};> -) - -# include PsFastXml common -INCLUDE(../common/PsFastXml.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/IOS/PxFoundation.cmake b/PxShared/src/compiler/cmake/IOS/PxFoundation.cmake deleted file mode 100644 index 7d022cf..0000000 --- a/PxShared/src/compiler/cmake/IOS/PxFoundation.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# -# Build PxFoundation -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -SET(PXFOUNDATION_LIBTYPE STATIC) - -SET(PXFOUNDATION_PLATFORM_FILES - ${LL_SOURCE_DIR}/src/unix/PsUnixAtomic.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixCpu.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixFPU.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixMutex.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixPrintString.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSList.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSocket.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSync.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixThread.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixTime.cpp -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - ${LL_SOURCE_DIR}/include/ios -) - -SET(PXFOUNDATION_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_IOS_COMPILE_DEFS} - - $<$<CONFIG:debug>:${PXSHARED_IOS_DEBUG_COMPILE_DEFS}> - $<$<CONFIG:checked>:${PXSHARED_IOS_CHECKED_COMPILE_DEFS}> - $<$<CONFIG:profile>:${PXSHARED_IOS_PROFILE_COMPILE_DEFS}> - $<$<CONFIG:release>:${PXSHARED_IOS_RELEASE_COMPILE_DEFS}> -) - -# include PxFoundation common -INCLUDE(../common/PxFoundation.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/IOS/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/IOS/PxPvdSDK.cmake deleted file mode 100644 index 85e7e1f..0000000 --- a/PxShared/src/compiler/cmake/IOS/PxPvdSDK.cmake +++ /dev/null @@ -1,24 +0,0 @@ -# -# Build PxPvdSDK -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/pvd) - -SET(PXPVDSDK_LIBTYPE STATIC) - -# Use generator expressions to set config specific preprocessor definitions -SET(PXPVDSDK_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_IOS_COMPILE_DEFS} - - $<$<CONFIG:debug>:${PXSHARED_IOS_DEBUG_COMPILE_DEFS}> - $<$<CONFIG:checked>:${PXSHARED_IOS_CHECKED_COMPILE_DEFS}> - $<$<CONFIG:profile>:${PXSHARED_IOS_PROFILE_COMPILE_DEFS}> - $<$<CONFIG:release>:${PXSHARED_IOS_RELEASE_COMPILE_DEFS}> -) - -# include PxPvdSDK common -INCLUDE(../common/PxPvdSDK.cmake) diff --git a/PxShared/src/compiler/cmake/IOS/PxTask.cmake b/PxShared/src/compiler/cmake/IOS/PxTask.cmake deleted file mode 100644 index 197e241..0000000 --- a/PxShared/src/compiler/cmake/IOS/PxTask.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# -# Build PxTask -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/task) - -SET(PXTASK_COMPILE_DEFS - ${PXSHARED_IOS_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - $<$<CONFIG:debug>:${PXSHARED_IOS_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_IOS_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_IOS_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_IOS_RELEASE_COMPILE_DEFS};> -) - -# include PxTask common -INCLUDE(../common/PxTask.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/Linux/CMakeLists.txt b/PxShared/src/compiler/cmake/Linux/CMakeLists.txt deleted file mode 100644 index 543a7b1..0000000 --- a/PxShared/src/compiler/cmake/Linux/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -PROJECT(PxShared CXX) -include(../common/CMakeLists.txt) - -STRING(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWERCASE) - -IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to linux - SET(TARGET_BUILD_PLATFORM "linux") -ENDIF() - -SET(PLATFORM_LIST linux) - -IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) - MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) -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 -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 -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 -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 -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") - - -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -gdwarf-3") -SET(CMAKE_CXX_FLAGS_CHECKED "-O3 -g -gdwarf-3") -SET(CMAKE_CXX_FLAGS_PROFILE "-O3 -g -gdwarf-3") -SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -gdwarf-3") - -IF(DEFINED GENERATE_GPU_PROJECTS) -SET(PXSHARED_LINUX_COMPILE_DEFS _LIB) -ELSE() -# Disable cuda and dx for all projects on windows -SET(PXSHARED_LINUX_COMPILE_DEFS _LIB;DISABLE_CUDA_PHYSX;) -ENDIF() -SET(PXSHARED_LINUX_DEBUG_COMPILE_DEFS _DEBUG;PX_DEBUG=1;PX_CHECKED=1) -SET(PXSHARED_LINUX_CHECKED_COMPILE_DEFS NDEBUG;PX_CHECKED=1) -SET(PXSHARED_LINUX_PROFILE_COMPILE_DEFS NDEBUG;PX_PROFILE=1) -SET(PXSHARED_LINUX_RELEASE_COMPILE_DEFS NDEBUG) - -IF(DEFINED LIBPATH_SUFFIX) - SET(CMAKE_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}_${LIBPATH_SUFFIX}") - SET(CMAKE_PROFILE_POSTFIX "${CMAKE_PROFILE_POSTFIX}_${LIBPATH_SUFFIX}") - SET(CMAKE_CHECKED_POSTFIX "${CMAKE_CHECKED_POSTFIX}_${LIBPATH_SUFFIX}") - SET(CMAKE_RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}_${LIBPATH_SUFFIX}") -ENDIF() - -# NOTE: PxCudaContextManager excluded on this platform - -# Include project cmake files here -IF(DEFINED PX_SELECT_COMPONENTS) - if ("PxFoundation" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxFoundation.cmake) - endif() - if ("PsFastXml" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PsFastXml.cmake) - endif() - if ("PxPvdSDK" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxPvdSDK.cmake) - endif() - if ("PxTask" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxTask.cmake) - endif() - if ("PxCudaContextManager" IN_LIST PX_SELECT_COMPONENTS) - IF(DEFINED GENERATE_GPU_PROJECTS) - INCLUDE(PxCudaContextManager.cmake) - ENDIF() - endif() -ELSE() -INCLUDE(PxFoundation.cmake) -INCLUDE(PsFastXml.cmake) -INCLUDE(PxPvdSDK.cmake) -INCLUDE(PxTask.cmake) -IF(DEFINED GENERATE_GPU_PROJECTS) - INCLUDE(PxCudaContextManager.cmake) -ENDIF() -ENDIF() - diff --git a/PxShared/src/compiler/cmake/Linux/PsFastXml.cmake b/PxShared/src/compiler/cmake/Linux/PsFastXml.cmake deleted file mode 100644 index 3c90c49..0000000 --- a/PxShared/src/compiler/cmake/Linux/PsFastXml.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# -# Build PsFastXml -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) - -# Use generator expressions to set config specific preprocessor definitions -SET(PSFASTXML_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_LINUX_COMPILE_DEFS};PX_FOUNDATION_DLL=0; -) - -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_LINUX_DEBUG_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_LINUX_CHECKED_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_LINUX_PROFILE_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PSFASTXML_COMPILE_DEFS - ${PXSHARED_LINUX_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") - - -# include PsFastXml common -INCLUDE(../common/PsFastXml.cmake) - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PsFastXml PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Linux/PxCudaContextManager.cmake b/PxShared/src/compiler/cmake/Linux/PxCudaContextManager.cmake deleted file mode 100644 index 3454323..0000000 --- a/PxShared/src/compiler/cmake/Linux/PxCudaContextManager.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# -# Build PxCudaContextManager -# - -FIND_PACKAGE(CUDA REQUIRED) - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/cudamanager) - -SET(CUDA_COMPILER_OPTION_DEBUG "--compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden") -SET(CUDA_COMPILER_OPTION_CHECKED "--compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden") -SET(CUDA_COMPILER_OPTION_PROFILE "--compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden") -SET(CUDA_COMPILER_OPTION_RELEASE "--compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden") - -# include PxCudaContextManager common -INCLUDE(../common/PxCudaContextManager.cmake) - -# Use generator expressions to set config specific preprocessor definitions -TARGET_COMPILE_DEFINITIONS(PxCudaContextManager - - # Common to all configurations - PRIVATE ${PXSHARED_LINUX_COMPILE_DEFS}; - - PRIVATE $<$<CONFIG:debug>:${PXSHARED_LINUX_DEBUG_COMPILE_DEFS};> - PRIVATE $<$<CONFIG:checked>:${PXSHARED_LINUX_CHECKED_COMPILE_DEFS};> - PRIVATE $<$<CONFIG:profile>:${PXSHARED_LINUX_PROFILE_COMPILE_DEFS};> - PRIVATE $<$<CONFIG:release>:${PXSHARED_LINUX_RELEASE_COMPILE_DEFS};> -) diff --git a/PxShared/src/compiler/cmake/Linux/PxFoundation.cmake b/PxShared/src/compiler/cmake/Linux/PxFoundation.cmake deleted file mode 100644 index f074805..0000000 --- a/PxShared/src/compiler/cmake/Linux/PxFoundation.cmake +++ /dev/null @@ -1,67 +0,0 @@ -# -# Build PxFoundation -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -IF(DEFINED PX_STATIC_LIBRARIES) - SET(PXFOUNDATION_LIBTYPE STATIC) -ELSE() - SET(PXFOUNDATION_LIBTYPE SHARED) - SET(PXFOUNDATION_SHARED_LIBRARY_DEFS PX_PVDSDK_DLL=1;PX_FOUNDATION_DLL=1;) -ENDIF() - -SET(PXFOUNDATION_PLATFORM_FILES - ${LL_SOURCE_DIR}/src/unix/PsUnixAtomic.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixCpu.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixFPU.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixMutex.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixPrintString.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSList.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSocket.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSync.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixThread.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixTime.cpp -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - ${LL_SOURCE_DIR}/include/linux -) - -SET(PXFOUNDATION_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_LINUX_COMPILE_DEFS} -) - -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_LINUX_DEBUG_COMPILE_DEFS};${PXFOUNDATION_SHARED_LIBRARY_DEFS}; - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_LINUX_CHECKED_COMPILE_DEFS};${PXFOUNDATION_SHARED_LIBRARY_DEFS}; - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_LINUX_PROFILE_COMPILE_DEFS};${PXFOUNDATION_SHARED_LIBRARY_DEFS}; - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PXFOUNDATION_COMPILE_DEFS - ${PXSHARED_LINUX_RELEASE_COMPILE_DEFS};${PXFOUNDATION_SHARED_LIBRARY_DEFS}; - ) -else(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - MESSAGE(FATAL_ERROR "Unknown configuration ${CMAKE_BUILD_TYPE}") -endif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - - -# include PxFoundation common -INCLUDE(../common/PxFoundation.cmake) - -IF(NOT DEFINED PX_STATIC_LIBRARIES) -TARGET_LINK_LIBRARIES(PxFoundation PUBLIC rt) -ENDIF() - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxFoundation PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Linux/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/Linux/PxPvdSDK.cmake deleted file mode 100644 index 81692a0..0000000 --- a/PxShared/src/compiler/cmake/Linux/PxPvdSDK.cmake +++ /dev/null @@ -1,53 +0,0 @@ -# -# Build PxPvdSDK -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/pvd) - -IF(DEFINED PX_STATIC_LIBRARIES) - SET(PXPVDSDK_LIBTYPE STATIC) -ELSE() - SET(PXPVDSDK_LIBTYPE SHARED) - SET(PXPVDSDK_SHARED_LIBRARY_DEFS PX_PVDSDK_DLL=1;PX_FOUNDATION_DLL=1;) -ENDIF() - -# Use generator expressions to set config specific preprocessor definitions -SET(PXPVDSDK_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_LINUX_COMPILE_DEFS} -) - -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_LINUX_DEBUG_COMPILE_DEFS};${PXPVDSDK_SHARED_LIBRARY_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_LINUX_CHECKED_COMPILE_DEFS};${PXPVDSDK_SHARED_LIBRARY_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_LINUX_PROFILE_COMPILE_DEFS};${PXPVDSDK_SHARED_LIBRARY_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PXPVDSDK_COMPILE_DEFS - ${PXSHARED_LINUX_RELEASE_COMPILE_DEFS};${PXPVDSDK_SHARED_LIBRARY_DEFS} - ) -else(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - MESSAGE(FATAL_ERROR "Unknown configuration ${CMAKE_BUILD_TYPE}") -endif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - -# include PxPvdSDK common -INCLUDE(../common/PxPvdSDK.cmake) - -# Add linked libraries -IF(DEFINED PX_STATIC_LIBRARIES) -TARGET_LINK_LIBRARIES(PxPvdSDK PRIVATE PxFoundation ) -ELSE() -TARGET_LINK_LIBRARIES(PxPvdSDK PRIVATE PxFoundation rt) -ENDIF() - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxPvdSDK PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Linux/PxTask.cmake b/PxShared/src/compiler/cmake/Linux/PxTask.cmake deleted file mode 100644 index 86689c4..0000000 --- a/PxShared/src/compiler/cmake/Linux/PxTask.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# -# Build PxTask -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/task) - -SET(PXTASK_COMPILE_DEFS - ${PXSHARED_LINUX_COMPILE_DEFS}; -) - -if(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "debug") - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_LINUX_DEBUG_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "checked") - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_LINUX_CHECKED_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL "profile") - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_LINUX_PROFILE_COMPILE_DEFS} - ) -elseif(${CMAKE_BUILD_TYPE_LOWERCASE} STREQUAL release) - LIST(APPEND PXTASK_COMPILE_DEFS - ${PXSHARED_LINUX_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") - -IF(DEFINED PX_STATIC_LIBRARIES) - SET(PXTASK_LIBTYPE OBJECT) -ELSE() - SET(PXTASK_LIBTYPE STATIC) -ENDIF() - -# include PxTask common -INCLUDE(../common/PxTask.cmake) - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxTask PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/Mac/CMakeLists.txt b/PxShared/src/compiler/cmake/Mac/CMakeLists.txt deleted file mode 100644 index 3242b46..0000000 --- a/PxShared/src/compiler/cmake/Mac/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -PROJECT(PxShared CXX) -include(../common/CMakeLists.txt) - - -IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to mac - SET(TARGET_BUILD_PLATFORM "mac") -ENDIF() - -SET(PLATFORM_LIST mac) - -IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) - MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) -ENDIF() - -SET(CMAKE_CXX_FLAGS "-msse2 -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") - -IF (DEFINED PX_32BIT) -SET(CMAKE_CXX_FLAGS "-arch i386 ${CMAKE_CXX_FLAGS}") -ENDIF() -IF (DEFINED PX_64BIT) -SET(CMAKE_CXX_FLAGS "-arch x86_64 ${CMAKE_CXX_FLAGS}") -ENDIF() - -SET(CMAKE_SHARED_LINKER_FLAGS "") - -SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g") -SET(CMAKE_CXX_FLAGS_CHECKED "-O3 -g") -SET(CMAKE_CXX_FLAGS_PROFILE "-O3 -g") -SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g") - -# Build libs compatible with OS X 10.9 -SET(CMAKE_OSX_DEPLOYMENT_TARGET "10.9") - -#set(CMAKE_XCODE_ATTRIBUTE_DEBUG_INFORMATION_FORMAT "dwarf-with-dsym") - -SET(PXSHARED_MAC_COMPILE_DEFS _LIB;DISABLE_CUDA_PHYSX;DISABLE_COMPUTE_PHYSX) -SET(PXSHARED_MAC_DEBUG_COMPILE_DEFS _DEBUG;PX_DEBUG=1;PX_CHECKED=1) -SET(PXSHARED_MAC_CHECKED_COMPILE_DEFS NDEBUG;PX_CHECKED=1) -SET(PXSHARED_MAC_PROFILE_COMPILE_DEFS NDEBUG;PX_PROFILE=1) -SET(PXSHARED_MAC_RELEASE_COMPILE_DEFS NDEBUG) - -# NOTE: PxCudaContextManager excluded on this platform - -# Include project cmake files here -INCLUDE(PxFoundation.cmake) -INCLUDE(PsFastXml.cmake) -INCLUDE(PxPvdSDK.cmake) -INCLUDE(PxTask.cmake) diff --git a/PxShared/src/compiler/cmake/Mac/PsFastXml.cmake b/PxShared/src/compiler/cmake/Mac/PsFastXml.cmake deleted file mode 100644 index 7f140e0..0000000 --- a/PxShared/src/compiler/cmake/Mac/PsFastXml.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# Build PsFastXml -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) - -# Use generator expressions to set config specific preprocessor definitions -SET(PSFASTXML_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_MAC_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - - $<$<CONFIG:debug>:${PXSHARED_MAC_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_MAC_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_MAC_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_MAC_RELEASE_COMPILE_DEFS};> -) - -# include PsFastXml common -INCLUDE(../common/PsFastXml.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/Mac/PxFoundation.cmake b/PxShared/src/compiler/cmake/Mac/PxFoundation.cmake deleted file mode 100644 index 2a21910..0000000 --- a/PxShared/src/compiler/cmake/Mac/PxFoundation.cmake +++ /dev/null @@ -1,40 +0,0 @@ -# -# Build PxFoundation -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -SET(PXFOUNDATION_LIBTYPE SHARED) - -SET(PXFOUNDATION_PLATFORM_FILES - ${LL_SOURCE_DIR}/src/unix/PsUnixAtomic.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixCpu.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixFPU.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixMutex.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixPrintString.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSList.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSocket.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSync.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixThread.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixTime.cpp -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - ${LL_SOURCE_DIR}/include/mac -) - -SET(PXFOUNDATION_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_MAC_COMPILE_DEFS} - - $<$<CONFIG:debug>:${PXSHARED_MAC_DEBUG_COMPILE_DEFS}> - $<$<CONFIG:checked>:${PXSHARED_MAC_CHECKED_COMPILE_DEFS}> - $<$<CONFIG:profile>:${PXSHARED_MAC_PROFILE_COMPILE_DEFS}> - $<$<CONFIG:release>:${PXSHARED_MAC_RELEASE_COMPILE_DEFS}> -) - -# include PxFoundation common -INCLUDE(../common/PxFoundation.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/Mac/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/Mac/PxPvdSDK.cmake deleted file mode 100644 index c236882..0000000 --- a/PxShared/src/compiler/cmake/Mac/PxPvdSDK.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# Build PxPvdSDK -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/pvd) - -SET(PXPVDSDK_LIBTYPE SHARED) - -# Use generator expressions to set config specific preprocessor definitions -SET(PXPVDSDK_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_MAC_COMPILE_DEFS} - - $<$<CONFIG:debug>:${PXSHARED_MAC_DEBUG_COMPILE_DEFS}> - $<$<CONFIG:checked>:${PXSHARED_MAC_CHECKED_COMPILE_DEFS}> - $<$<CONFIG:profile>:${PXSHARED_MAC_PROFILE_COMPILE_DEFS}> - $<$<CONFIG:release>:${PXSHARED_MAC_RELEASE_COMPILE_DEFS}> -) - -# include PxPvdSDK common -INCLUDE(../common/PxPvdSDK.cmake) - -# Add linked libraries -TARGET_LINK_LIBRARIES(PxPvdSDK PRIVATE PxFoundation) - diff --git a/PxShared/src/compiler/cmake/Mac/PxTask.cmake b/PxShared/src/compiler/cmake/Mac/PxTask.cmake deleted file mode 100644 index 2326a1f..0000000 --- a/PxShared/src/compiler/cmake/Mac/PxTask.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# -# Build PxTask -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/task) - -SET(PXTASK_COMPILE_DEFS - ${PXSHARED_MAC_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - $<$<CONFIG:debug>:${PXSHARED_MAC_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_MAC_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_MAC_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_MAC_RELEASE_COMPILE_DEFS};> -) - -# include PxTask common -INCLUDE(../common/PxTask.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/Modules/FindPxShared.cmake b/PxShared/src/compiler/cmake/Modules/FindPxShared.cmake deleted file mode 100644 index ea90ab6..0000000 --- a/PxShared/src/compiler/cmake/Modules/FindPxShared.cmake +++ /dev/null @@ -1,18 +0,0 @@ -# - Try to find PxShared -# Once done this will define -# PXSHARED_FOUND - System has PxShared -# PXSHARED_INCLUDE_DIRS - The PxShared include directories - -# NOTE: We're including a version in this, but the first hint is without one - we should use that! -FIND_PATH( PXSHARED_INCLUDE_DIRS include/cudamanager/PxGpuCopyDesc.h - HINTS - ${GW_DEPS_ROOT}/PxShared - ${GW_DEPS_ROOT}/sw/physx/PxShared/1.0/trunk/ - ) - -MESSAGE(${PXSHARED_INCLUDE_DIRS}) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PxShared DEFAULT_MSG PXSHARED_INCLUDE_DIRS) - -mark_as_advanced(PXSHARED_INCLUDE_DIRS) diff --git a/PxShared/src/compiler/cmake/Modules/FindnvToolsExt.cmake b/PxShared/src/compiler/cmake/Modules/FindnvToolsExt.cmake deleted file mode 100644 index f7bc761..0000000 --- a/PxShared/src/compiler/cmake/Modules/FindnvToolsExt.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# - Try to find nvToolsExt -# Once done this will define -# NVTOOLSEXT_FOUND - System has nvToolsExt -# NVTOOLSEXT_INCLUDE_DIRS - The nvToolsExt include directories -# NVTOOLSEXT_LIBRARIES - The libraries needed to use nvToolsExt -# NVTOOLSEXT_DEFINITIONS - Compiler switches required for using nvToolsExt - -FIND_PATH( NVTOOLSEXT_INCLUDE_DIRS nvToolsExt.h - HINTS - ${GW_DEPS_ROOT}/PhysX_3.4/externals/nvToolsExt - ${GW_DEPS_ROOT}/sw/physx/externals/nvToolsExt/1 - PATH_SUFFIXES include) - -INCLUDE(FindPackageHandleStandardArgs) - -IF(TARGET_BUILD_PLATFORM STREQUAL "windows") - # NOTE: Doesn't make sense for all platforms - ARM - IF(CMAKE_CL_64) - SET(NVTOOLSEXT_LIBNAME "nvToolsExt64_1") - SET(NVTOOLSEXT_LIBPATH_SUFFIX "x64") - ELSE(CMAKE_CL_64) - SET(NVTOOLSEXT_LIBNAME nvToolsExt32_1) - SET(NVTOOLSEXT_LIBPATH_SUFFIX "Win32") - ENDIF(CMAKE_CL_64) - - - FIND_LIBRARY( NVTOOLSEXT_LIBRARIES ${NVTOOLSEXT_LIBNAME} - ${GW_DEPS_ROOT}/PhysX_3.4/externals/nvToolsExt/lib/${NVTOOLSEXT_LIBPATH_SUFFIX} - ${GW_DEPS_ROOT}/sw/physx/externals/nvToolsExt/1/lib/${NVTOOLSEXT_LIBPATH_SUFFIX} - ) - - FIND_PACKAGE_HANDLE_STANDARD_ARGS(nvToolsExt DEFAULT_MSG NVTOOLSEXT_LIBRARIES NVTOOLSEXT_INCLUDE_DIRS) -ELSE() - # Exclude the libraries for non-windows platforms - FIND_PACKAGE_HANDLE_STANDARD_ARGS(nvToolsExt DEFAULT_MSG NVTOOLSEXT_INCLUDE_DIRS) -ENDIF() - -mark_as_advanced(NVTOOLSEXT_INCLUDE_DIRS NVTOOLSEXT_LIBRARIES)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/PxFoundation.cmake b/PxShared/src/compiler/cmake/PxFoundation.cmake deleted file mode 100644 index 098b216..0000000 --- a/PxShared/src/compiler/cmake/PxFoundation.cmake +++ /dev/null @@ -1,171 +0,0 @@ -# -# Build PxFoundation common -# - -SET(PXSHARED_SOURCE_DIR ${PXSHARED_ROOT_DIR}/src) -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -# Include here after the directories are defined so that the platform specific file can use the variables. -include(${PXSHARED_ROOT_DIR}/${PROJECT_CMAKE_FILES_DIR}/${TARGET_BUILD_PLATFORM}/PxFoundation.cmake) - -SET(PXFOUNDATION_HEADERS - ${PXSHARED_ROOT_DIR}/include/foundation/Px.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxAllocatorCallback.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxAssert.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxBitAndData.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxBounds3.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxErrorCallback.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxErrors.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxFlags.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxFoundation.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxFoundationVersion.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxIntrinsics.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxIO.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxMat33.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxMat44.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxMath.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxMathUtils.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxMemory.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxPlane.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxPreprocessor.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxProfiler.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxQuat.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxSimpleTypes.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxStrideIterator.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxTransform.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxUnionCast.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxVec2.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxVec3.h - ${PXSHARED_ROOT_DIR}/include/foundation/PxVec4.h -) -SOURCE_GROUP(include FILES ${PXFOUNDATION_HEADERS}) - -SET(PXFOUNDATION_SOURCE - ${LL_SOURCE_DIR}/src/PsAllocator.cpp - ${LL_SOURCE_DIR}/src/PsAssert.cpp - ${LL_SOURCE_DIR}/src/PsFoundation.cpp - ${LL_SOURCE_DIR}/src/PsMathUtils.cpp - ${LL_SOURCE_DIR}/src/PsString.cpp - ${LL_SOURCE_DIR}/src/PsTempAllocator.cpp - ${LL_SOURCE_DIR}/src/PsUtilities.cpp -) -SOURCE_GROUP(src\\src FILES ${PXFOUNDATION_SOURCE}) - -SET(PXFOUNDATION_SOURCE_HEADERS - ${LL_SOURCE_DIR}/include/Ps.h - ${LL_SOURCE_DIR}/include/PsAlignedMalloc.h - ${LL_SOURCE_DIR}/include/PsAlloca.h - ${LL_SOURCE_DIR}/include/PsAllocator.h - ${LL_SOURCE_DIR}/include/PsAoS.h - ${LL_SOURCE_DIR}/include/PsArray.h - ${LL_SOURCE_DIR}/include/PsAtomic.h - ${LL_SOURCE_DIR}/include/PsBasicTemplates.h - ${LL_SOURCE_DIR}/include/PsBitUtils.h - ${LL_SOURCE_DIR}/include/PsBroadcast.h - ${LL_SOURCE_DIR}/include/PsCpu.h - ${LL_SOURCE_DIR}/include/PsFoundation.h - ${LL_SOURCE_DIR}/include/PsFPU.h - ${LL_SOURCE_DIR}/include/PsHash.h - ${LL_SOURCE_DIR}/include/PsHashInternals.h - ${LL_SOURCE_DIR}/include/PsHashMap.h - ${LL_SOURCE_DIR}/include/PsHashSet.h - ${LL_SOURCE_DIR}/include/PsInlineAllocator.h - ${LL_SOURCE_DIR}/include/PsInlineAoS.h - ${LL_SOURCE_DIR}/include/PsInlineArray.h - ${LL_SOURCE_DIR}/include/PsIntrinsics.h - ${LL_SOURCE_DIR}/include/PsMathUtils.h - ${LL_SOURCE_DIR}/include/PsMutex.h - ${LL_SOURCE_DIR}/include/PsPool.h - ${LL_SOURCE_DIR}/include/PsSList.h - ${LL_SOURCE_DIR}/include/PsSocket.h - ${LL_SOURCE_DIR}/include/PsSort.h - ${LL_SOURCE_DIR}/include/PsSortInternals.h - ${LL_SOURCE_DIR}/include/PsString.h - ${LL_SOURCE_DIR}/include/PsSync.h - ${LL_SOURCE_DIR}/include/PsTempAllocator.h - ${LL_SOURCE_DIR}/include/PsThread.h - ${LL_SOURCE_DIR}/include/PsTime.h - ${LL_SOURCE_DIR}/include/PsUserAllocated.h - ${LL_SOURCE_DIR}/include/PsUtilities.h - ${LL_SOURCE_DIR}/include/PsVecMath.h - ${LL_SOURCE_DIR}/include/PsVecMathAoSScalar.h - ${LL_SOURCE_DIR}/include/PsVecMathAoSScalarInline.h - ${LL_SOURCE_DIR}/include/PsVecMathSSE.h - ${LL_SOURCE_DIR}/include/PsVecMathUtilities.h - ${LL_SOURCE_DIR}/include/PsVecQuat.h - ${LL_SOURCE_DIR}/include/PsVecTransform.h -) -SOURCE_GROUP("src\\include" FILES ${PXFOUNDATION_SOURCE_HEADERS}) - -ADD_LIBRARY(PxFoundation ${PXFOUNDATION_LIBTYPE} - ${PXFOUNDATION_SOURCE} - ${PXFOUNDATION_SOURCE_HEADERS} - ${PXFOUNDATION_HEADERS} - - ${PXFOUNDATION_PLATFORM_FILES} -) - -# Add the headers to the install -INSTALL(FILES ${PXFOUNDATION_HEADERS} DESTINATION include/foundation) - -INSTALL(FILES ${PXFOUNDATION_SOURCE_HEADERS} DESTINATION src/foundation/include) - -TARGET_INCLUDE_DIRECTORIES(PxFoundation - PRIVATE ${PXSHARED_ROOT_DIR}/include - PRIVATE ${LL_SOURCE_DIR}/include - - PRIVATE ${PXFOUNDATION_PLATFORM_INCLUDES} - - INTERFACE $<INSTALL_INTERFACE:include>$<BUILD_INTERFACE:${PXSHARED_ROOT_DIR}/include> ${PXFOUNDATION_PLATFORM_INTERFACE_HEADERS} - INTERFACE $<INSTALL_INTERFACE:include/foundation>$<BUILD_INTERFACE:${PXSHARED_ROOT_DIR}/include/foundation> - #INTERFACE $<INSTALL_INTERFACE:include/foundation/windows>$<BUILD_INTERFACE:${PXSHARED_ROOT_DIR}/include/foundation/windows> - - # FIXME: This is really terrible! Don't export src directories - INTERFACE $<INSTALL_INTERFACE:src/foundation/include>$<BUILD_INTERFACE:${PXSHARED_ROOT_DIR}/src/foundation/include> - -) - -TARGET_COMPILE_DEFINITIONS(PxFoundation - PRIVATE ${PXFOUNDATION_COMPILE_DEFS} -) - -# Add linked libraries -TARGET_LINK_LIBRARIES(PxFoundation - PRIVATE ${PXFOUNDATION_PLATFORM_LINKED_LIBS} -) - - -IF(USE_GAMEWORKS_OUTPUT_DIRS AND PXFOUNDATION_LIBTYPE STREQUAL "STATIC") - SET_TARGET_PROPERTIES(PxFoundation PROPERTIES - ARCHIVE_OUTPUT_NAME_DEBUG "PxFoundation_static" - ARCHIVE_OUTPUT_NAME_CHECKED "PxFoundation_static" - ARCHIVE_OUTPUT_NAME_PROFILE "PxFoundation_static" - ARCHIVE_OUTPUT_NAME_RELEASE "PxFoundation_static" - ) - - IF(DEFINED CMAKE_DEBUG_POSTFIX) - SET_TARGET_PROPERTIES(PxFoundation PROPERTIES - COMPILE_PDB_NAME_DEBUG "PxFoundation_static_${CMAKE_DEBUG_POSTFIX}" - COMPILE_PDB_NAME_CHECKED "PxFoundation_static_${CMAKE_CHECKED_POSTFIX}" - COMPILE_PDB_NAME_PROFILE "PxFoundation_static_${CMAKE_PROFILE_POSTFIX}" - COMPILE_PDB_NAME_RELEASE "PxFoundation_static_${CMAKE_RELEASE_POSTFIX}" - ) - ELSE() - SET_TARGET_PROPERTIES(PxFoundation PROPERTIES - COMPILE_PDB_NAME_DEBUG "PxFoundation_static" - COMPILE_PDB_NAME_CHECKED "PxFoundation_static" - COMPILE_PDB_NAME_PROFILE "PxFoundation_static" - COMPILE_PDB_NAME_RELEASE "PxFoundation_static" - ) - ENDIF() -ELSE() - SET_TARGET_PROPERTIES(PxFoundation PROPERTIES - COMPILE_PDB_NAME_DEBUG "PxFoundation${CMAKE_DEBUG_POSTFIX}" - COMPILE_PDB_NAME_CHECKED "PxFoundation${CMAKE_CHECKED_POSTFIX}" - COMPILE_PDB_NAME_PROFILE "PxFoundation${CMAKE_PROFILE_POSTFIX}" - COMPILE_PDB_NAME_RELEASE "PxFoundation${CMAKE_RELEASE_POSTFIX}" - ) -ENDIF() - -# enable -fPIC so we can link static libs with the editor -SET_TARGET_PROPERTIES(PxFoundation PROPERTIES POSITION_INDEPENDENT_CODE TRUE) diff --git a/PxShared/src/compiler/cmake/RegenProjects.bat b/PxShared/src/compiler/cmake/RegenProjects.bat deleted file mode 100644 index bdde57f..0000000 --- a/PxShared/src/compiler/cmake/RegenProjects.bat +++ /dev/null @@ -1,4 +0,0 @@ -rmdir CMakeFiles /s /q -del CMakeCache.txt -cmake ../../.. -A x64 - diff --git a/PxShared/src/compiler/cmake/common/CMakeLists.txt b/PxShared/src/compiler/cmake/common/CMakeLists.txt deleted file mode 100644 index 3bbb57a..0000000 --- a/PxShared/src/compiler/cmake/common/CMakeLists.txt +++ /dev/null @@ -1,82 +0,0 @@ -cmake_minimum_required(VERSION 3.3) - -CMAKE_POLICY(SET CMP0057 NEW) # Enable IN_LIST - -IF(DEFINED ENV{GW_DEPS_ROOT}) - SET(GW_DEPS_ROOT $ENV{GW_DEPS_ROOT}) - - SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}/sw/physx/tools/CMakeModules) - - IF(EXISTS $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - SET(CMAKE_MODULE_PATH $ENV{GW_DEPS_ROOT}/Externals/CMakeModules) - ENDIF() -ENDIF() - -# Add find modules to the path -IF(NOT EXISTS ${CMAKE_MODULE_PATH}) - MESSAGE(FATAL_ERROR "Could not find CMakeModules at ${CMAKE_MODULE_PATH}") -ENDIF() - -MESSAGE("PxShared Build Platform: " ${TARGET_BUILD_PLATFORM}) -MESSAGE("Using CXX Compiler: " ${CMAKE_CXX_COMPILER}) - -# TODO: Fail if we didn't find deps - -# Tell MSVC to stop doing MBCS -#ADD_DEFINITIONS(-D_UNICODE -DUNICODE) - -IF(CMAKE_CONFIGURATION_TYPES) - SET(CMAKE_CONFIGURATION_TYPES debug checked profile release) - SET(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING - "Reset config to what we need" - FORCE) - - SET(CMAKE_SHARED_LINKER_FLAGS_CHECKED "") - SET(CMAKE_SHARED_LINKER_FLAGS_PROFILE "") - - # Build PDBs for all configurations - SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") - -ENDIF() - -# Default to appending "DEBUG", "PROFILE", etc to produced artifacts -IF(NOT DEFINED APPEND_CONFIG_NAME) - SET(APPEND_CONFIG_NAME ON) -ENDIF() - -IF (APPEND_CONFIG_NAME) - MESSAGE("Appending config to output names") - - SET(CMAKE_DEBUG_POSTFIX "DEBUG") - SET(CMAKE_PROFILE_POSTFIX "PROFILE") - SET(CMAKE_CHECKED_POSTFIX "CHECKED") - SET(CMAKE_RELEASE_POSTFIX "") -ENDIF() - -SET(PROJECT_ROOT_DIR ${PROJECT_SOURCE_DIR}/../../../../) - -INCLUDE(SetOutputPaths) - -IF(DEFINED PX_OUTPUT_EXE_DIR) - SetExeOutputPath(${PX_OUTPUT_EXE_DIR}) -ENDIF() -IF(DEFINED PX_OUTPUT_DLL_DIR) - SetDllOutputPath(${PX_OUTPUT_DLL_DIR}) -ENDIF() -IF(DEFINED PX_OUTPUT_LIB_DIR) - SetLibOutputPath(${PX_OUTPUT_LIB_DIR}) -ENDIF() -# All EXE/DLL/LIB output will be overwritten if PX_OUTPUT_ALL_DIR is defined -IF(DEFINED PX_OUTPUT_ALL_DIR) - SetSingleOutputPath(${PX_OUTPUT_ALL_DIR}) -ENDIF() - -# Prevent failure due to command line limitations -IF(USE_RESPONSE_FILES) - SET(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) - SET(CMAKE_C_USE_RESPONSE_FILE_FOR_INCLUDES 1) - SET(CMAKE_C_USE_RESPONSE_FILE_FOR_LIBRARIES 1) - SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) - SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 1) - SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_LIBRARIES 1) -ENDIF() diff --git a/PxShared/src/compiler/cmake/common/PsFastXml.cmake b/PxShared/src/compiler/cmake/common/PsFastXml.cmake deleted file mode 100644 index 06c1282..0000000 --- a/PxShared/src/compiler/cmake/common/PsFastXml.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# -# Build PsFastXml common -# - -SET(PSFASTXML_HEADERS - ${LL_SOURCE_DIR}/include/PsFastXml.h -) -SOURCE_GROUP(include FILES ${PSFASTXML_HEADERS}) - -SET(PSFASTXML_SOURCE - ${LL_SOURCE_DIR}/src/PsFastXml.cpp -) -SOURCE_GROUP(src FILES ${PSFASTXML_SOURCE}) - -ADD_LIBRARY(PsFastXml STATIC - ${PSFASTXML_HEADERS} - ${PSFASTXML_SOURCE} -) - -TARGET_INCLUDE_DIRECTORIES(PsFastXml - PRIVATE ${PXSHARED_SOURCE_DIR}/../include - PRIVATE ${PXSHARED_SOURCE_DIR}/foundation/include - PRIVATE ${LL_SOURCE_DIR}/include - - PRIVATE ${PLATFORM_INCLUDES} -) - -TARGET_COMPILE_DEFINITIONS(PsFastXml - PRIVATE ${PSFASTXML_COMPILE_DEFS} -) - -SET_TARGET_PROPERTIES(PsFastXml PROPERTIES - COMPILE_PDB_NAME_DEBUG "PsFastXml${CMAKE_DEBUG_POSTFIX}" - COMPILE_PDB_NAME_CHECKED "PsFastXml${CMAKE_CHECKED_POSTFIX}" - COMPILE_PDB_NAME_PROFILE "PsFastXml${CMAKE_PROFILE_POSTFIX}" - COMPILE_PDB_NAME_RELEASE "PsFastXml${CMAKE_RELEASE_POSTFIX}" -)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/common/PxCudaContextManager.cmake b/PxShared/src/compiler/cmake/common/PxCudaContextManager.cmake deleted file mode 100644 index ab76997..0000000 --- a/PxShared/src/compiler/cmake/common/PxCudaContextManager.cmake +++ /dev/null @@ -1,77 +0,0 @@ -# -# Build PxCudaContextManager common -# - - -# CUDA! -SET(CUDA_NVCC_FLAGS "-lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=sm_50 -gencode arch=compute_50,code=compute_50 -D_CONSOLE -D_WIN32_WINNT=0x0501") - -CUDA_INCLUDE_DIRECTORIES( - ${PXSHARED_SOURCE_DIR}/../include - ${PXSHARED_SOURCE_DIR}/foundation/include - ${PXSHARED_SOURCE_DIR}/cudamanager/include -) - -SET(CUDA_PROPAGATE_HOST_FLAGS OFF) - -# Compile the CuKernelSolver - it has different options than the other CUDA files -SET(CUDA_NVCC_FLAGS_DEBUG "-D_DEBUG -D_CONSOLE -D_WIN32_WINNT=0x0501 ${CUDA_COMPILER_OPTION_DEBUG}") -SET(CUDA_NVCC_FLAGS_CHECKED "-DNDEBUG -D_CONSOLE -D_WIN32_WINNT=0x0501 ${CUDA_COMPILER_OPTION_CHECKED}") -SET(CUDA_NVCC_FLAGS_PROFILE "-DNDEBUG -D_CONSOLE -D_WIN32_WINNT=0x0501 ${CUDA_COMPILER_OPTION_PROFILE}") -SET(CUDA_NVCC_FLAGS_RELEASE "-DNDEBUG -D_CONSOLE -D_WIN32_WINNT=0x0501 ${CUDA_COMPILER_OPTION_RELEASE}") - -SET(CUDACONTEXTMANAGER_HEADERS - ${PXSHARED_SOURCE_DIR}/../include/cudamanager/PxCudaContextManager.h - ${PXSHARED_SOURCE_DIR}/../include/cudamanager/PxCudaMemoryManager.h - ${PXSHARED_SOURCE_DIR}/../include/cudamanager/PxGpuCopyDesc.h - ${PXSHARED_SOURCE_DIR}/../include/cudamanager/PxGpuCopyDescQueue.h -) -SOURCE_GROUP(include FILES ${CUDACONTEXTMANAGER_HEADERS}) - -SET(CUDACONTEXTMANAGER_KERNELS - ${LL_SOURCE_DIR}/src/CUDA/UtilKernels.cu -) -SOURCE_GROUP("src kernels" FILES ${CUDACONTEXTMANAGER_KERNELS}) - -SET(CUDACONTEXTMANAGER_SOURCE - ${LL_SOURCE_DIR}/src/CudaContextManager.cpp - ${LL_SOURCE_DIR}/src/CudaKernelWrangler.cpp - ${LL_SOURCE_DIR}/src/CudaMemoryManager.cpp - ${LL_SOURCE_DIR}/src/HeapManagerRef.cpp - ${LL_SOURCE_DIR}/src/GpuDispatcher.cpp - ${LL_SOURCE_DIR}/src/BlockingWait.cpp - ${LL_SOURCE_DIR}/src/PhysXDeviceSettings.cpp -) -SOURCE_GROUP(src\\src FILES ${CUDACONTEXTMANAGER_SOURCE}) - -SET(CUDACONTEXTMANAGER_SOURCE_HEADERS - ${LL_SOURCE_DIR}/include/CudaContextManager.h - ${LL_SOURCE_DIR}/include/CudaKernelWrangler.h - ${LL_SOURCE_DIR}/include/GpuDispatcher.h - ${LL_SOURCE_DIR}/include/PhysXDeviceSettings.h -) -SOURCE_GROUP(src\\src FILES ${CUDACONTEXTMANAGER_SOURCE_HEADERS}) - -CUDA_ADD_LIBRARY(PxCudaContextManager STATIC - ${CUDACONTEXTMANAGER_HEADERS} - ${CUDACONTEXTMANAGER_SOURCE} - ${CUDACONTEXTMANAGER_SOURCE_HEADERS} - - ${CUDACONTEXTMANAGER_KERNELS} -) - -# Target specific compile options - - -TARGET_INCLUDE_DIRECTORIES(PxCudaContextManager - PRIVATE ${PXSHARED_SOURCE_DIR}/../include - PRIVATE ${PXSHARED_SOURCE_DIR}/foundation/include - PRIVATE ${PXSHARED_SOURCE_DIR}/task/include - PRIVATE ${PXSHARED_SOURCE_DIR}/cudamanager/include - PRIVATE ${LL_SOURCE_DIR}/include - PRIVATE ${CUDA_INCLUDE_DIRS} - -) - - - diff --git a/PxShared/src/compiler/cmake/common/PxFoundation.cmake b/PxShared/src/compiler/cmake/common/PxFoundation.cmake deleted file mode 100644 index 99905e2..0000000 --- a/PxShared/src/compiler/cmake/common/PxFoundation.cmake +++ /dev/null @@ -1,118 +0,0 @@ -# -# Build PxFoundation common -# - -SET(PXFOUNDATION_HEADERS - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/Px.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxAllocatorCallback.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxAssert.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxBitAndData.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxBounds3.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxErrorCallback.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxErrors.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxFlags.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxFoundation.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxFoundationVersion.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxIntrinsics.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxIO.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxMat33.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxMat44.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxMath.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxMathUtils.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxMemory.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxPlane.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxPreprocessor.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxProfiler.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxQuat.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxSimpleTypes.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxStrideIterator.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxTransform.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxUnionCast.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxVec2.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxVec3.h - ${PROJECT_SOURCE_DIR}/../../../../include/foundation/PxVec4.h -) -SOURCE_GROUP(include FILES ${PXFOUNDATION_HEADERS}) - -SET(PXFOUNDATION_SOURCE - ${LL_SOURCE_DIR}/src/PsAllocator.cpp - ${LL_SOURCE_DIR}/src/PsAssert.cpp - ${LL_SOURCE_DIR}/src/PsFoundation.cpp - ${LL_SOURCE_DIR}/src/PsMathUtils.cpp - ${LL_SOURCE_DIR}/src/PsString.cpp - ${LL_SOURCE_DIR}/src/PsTempAllocator.cpp - ${LL_SOURCE_DIR}/src/PsUtilities.cpp -) -SOURCE_GROUP(src\\src FILES ${PXFOUNDATION_SOURCE}) - -SET(PXFOUNDATION_SOURCE_HEADERS - ${LL_SOURCE_DIR}/include/Ps.h - ${LL_SOURCE_DIR}/include/PsAlignedMalloc.h - ${LL_SOURCE_DIR}/include/PsAlloca.h - ${LL_SOURCE_DIR}/include/PsAllocator.h - ${LL_SOURCE_DIR}/include/PsAoS.h - ${LL_SOURCE_DIR}/include/PsArray.h - ${LL_SOURCE_DIR}/include/PsAtomic.h - ${LL_SOURCE_DIR}/include/PsBasicTemplates.h - ${LL_SOURCE_DIR}/include/PsBitUtils.h - ${LL_SOURCE_DIR}/include/PsBroadcast.h - ${LL_SOURCE_DIR}/include/PsCpu.h - ${LL_SOURCE_DIR}/include/PsFoundation.h - ${LL_SOURCE_DIR}/include/PsFPU.h - ${LL_SOURCE_DIR}/include/PsHash.h - ${LL_SOURCE_DIR}/include/PsHashInternals.h - ${LL_SOURCE_DIR}/include/PsHashMap.h - ${LL_SOURCE_DIR}/include/PsHashSet.h - ${LL_SOURCE_DIR}/include/PsInlineAllocator.h - ${LL_SOURCE_DIR}/include/PsInlineAoS.h - ${LL_SOURCE_DIR}/include/PsInlineArray.h - ${LL_SOURCE_DIR}/include/PsIntrinsics.h - ${LL_SOURCE_DIR}/include/PsMathUtils.h - ${LL_SOURCE_DIR}/include/PsMutex.h - ${LL_SOURCE_DIR}/include/PsPool.h - ${LL_SOURCE_DIR}/include/PsSList.h - ${LL_SOURCE_DIR}/include/PsSocket.h - ${LL_SOURCE_DIR}/include/PsSort.h - ${LL_SOURCE_DIR}/include/PsSortInternals.h - ${LL_SOURCE_DIR}/include/PsString.h - ${LL_SOURCE_DIR}/include/PsSync.h - ${LL_SOURCE_DIR}/include/PsTempAllocator.h - ${LL_SOURCE_DIR}/include/PsThread.h - ${LL_SOURCE_DIR}/include/PsTime.h - ${LL_SOURCE_DIR}/include/PsUserAllocated.h - ${LL_SOURCE_DIR}/include/PsUtilities.h - ${LL_SOURCE_DIR}/include/PsVecMath.h - ${LL_SOURCE_DIR}/include/PsVecMathAoSScalar.h - ${LL_SOURCE_DIR}/include/PsVecMathAoSScalarInline.h - ${LL_SOURCE_DIR}/include/PsVecMathSSE.h - ${LL_SOURCE_DIR}/include/PsVecMathUtilities.h - ${LL_SOURCE_DIR}/include/PsVecQuat.h - ${LL_SOURCE_DIR}/include/PsVecTransform.h -) -SOURCE_GROUP(src\\include FILES ${PXFOUNDATION_SOURCE_HEADERS}) - -ADD_LIBRARY(PxFoundation ${PXFOUNDATION_LIBTYPE} - ${PXFOUNDATION_SOURCE} - ${PXFOUNDATION_SOURCE_HEADERS} - ${PXFOUNDATION_HEADERS} - - ${PXFOUNDATION_PLATFORM_FILES} -) - -TARGET_INCLUDE_DIRECTORIES(PxFoundation - PRIVATE ${PXSHARED_SOURCE_DIR}/../include - PRIVATE ${LL_SOURCE_DIR}/include - - PRIVATE ${PXFOUNDATION_PLATFORM_INCLUDES} -) - -TARGET_COMPILE_DEFINITIONS(PxFoundation - PRIVATE ${PXFOUNDATION_COMPILE_DEFS} -) - -SET_TARGET_PROPERTIES(PxFoundation PROPERTIES - COMPILE_PDB_NAME_DEBUG "PxFoundation${CMAKE_DEBUG_POSTFIX}" - COMPILE_PDB_NAME_CHECKED "PxFoundation${CMAKE_CHECKED_POSTFIX}" - COMPILE_PDB_NAME_PROFILE "PxFoundation${CMAKE_PROFILE_POSTFIX}" - COMPILE_PDB_NAME_RELEASE "PxFoundation${CMAKE_RELEASE_POSTFIX}" -)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/common/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/common/PxPvdSDK.cmake deleted file mode 100644 index 7014209..0000000 --- a/PxShared/src/compiler/cmake/common/PxPvdSDK.cmake +++ /dev/null @@ -1,123 +0,0 @@ -# -# Build PxPvdSDK common -# - -SET(PXPVDSDK_HEADERS - ${PROJECT_SOURCE_DIR}/../../../../include/pvd/PxPvd.h - ${PROJECT_SOURCE_DIR}/../../../../include/pvd/PxPvdTransport.h -) -SOURCE_GROUP(include FILES ${PXPVDSDK_HEADERS}) - -SET(PXPVDSDK_SOURCE - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileBase.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileCompileTimeEventFilter.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileContextProvider.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileContextProviderImpl.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileDataBuffer.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileDataParsing.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventBuffer.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventBufferAtomic.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventBufferClient.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventBufferClientManager.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventFilter.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventHandler.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventId.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventImpl.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventMutex.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventNames.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventParser.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEvents.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventSender.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventSerialization.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileEventSystem.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemory.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryBuffer.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEventBuffer.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEventParser.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEventRecorder.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEventReflexiveWriter.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEvents.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEventSummarizer.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileMemoryEventTypes.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileScopedEvent.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileScopedMutexLock.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileZone.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileZoneImpl.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileZoneManager.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxProfileZoneManagerImpl.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvd.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdBits.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdByteStreams.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdCommStreamEvents.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdCommStreamEventSink.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdCommStreamSDKEventTypes.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdCommStreamTypes.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdDataStream.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdDefaultFileTransport.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdDefaultFileTransport.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdDefaultSocketTransport.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdDefaultSocketTransport.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdFoundation.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdImpl.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdImpl.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdInternalByteStreams.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdMarshalling.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdMemClient.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdMemClient.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectModel.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectModelInternalTypeDefs.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectModelInternalTypes.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectModelMetaData.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectModelMetaData.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectRegistrar.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdObjectRegistrar.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdProfileZoneClient.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdProfileZoneClient.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdUserRenderer.cpp - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdUserRenderImpl.h - ${PXSHARED_SOURCE_DIR}/pvd/src/PxPvdUserRenderTypes.h -) -SOURCE_GROUP(src\\src FILES ${PXPVDSDK_SOURCE}) - -SET(PXPVDSDK_INTERNAL_HEADERS - ${PXSHARED_SOURCE_DIR}/pvd/include/PsPvd.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxProfileAllocatorWrapper.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdClient.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdDataStream.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdDataStreamHelpers.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdErrorCodes.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdObjectModelBaseTypes.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdRenderBuffer.h - ${PXSHARED_SOURCE_DIR}/pvd/include/PxPvdUserRenderer.h -) -SOURCE_GROUP(src\\include FILES ${PXPVDSDK_INTERNAL_HEADERS}) - -ADD_LIBRARY(PxPvdSDK ${PXPVDSDK_LIBTYPE} - ${PXPVDSDK_HEADERS} - - ${PXPVDSDK_INTERNAL_HEADERS} - ${PXPVDSDK_SOURCE} - - ${PXPVDSDK_PLATFORM_FILES} -) - -TARGET_INCLUDE_DIRECTORIES(PxPvdSDK - PRIVATE ${PXSHARED_SOURCE_DIR}/../include - PRIVATE ${PXSHARED_SOURCE_DIR}/foundation/include - PRIVATE ${PXSHARED_SOURCE_DIR}/pvd/include - PRIVATE ${PXSHARED_SOURCE_DIR}/filebuf/include - - PRIVATE ${PXPVDSDK_PLATFORM_INCLUDES} - -) - -TARGET_COMPILE_DEFINITIONS(PxPvdSDK - PRIVATE ${PXPVDSDK_COMPILE_DEFS} -) - -SET_TARGET_PROPERTIES(PxPvdSDK PROPERTIES - COMPILE_PDB_NAME_DEBUG "PxPvdSDK${CMAKE_DEBUG_POSTFIX}" - COMPILE_PDB_NAME_CHECKED "PxPvdSDK${CMAKE_CHECKED_POSTFIX}" - COMPILE_PDB_NAME_PROFILE "PxPvdSDK${CMAKE_PROFILE_POSTFIX}" - COMPILE_PDB_NAME_RELEASE "PxPvdSDK${CMAKE_RELEASE_POSTFIX}" -)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/common/PxTask.cmake b/PxShared/src/compiler/cmake/common/PxTask.cmake deleted file mode 100644 index 0d1cd1f..0000000 --- a/PxShared/src/compiler/cmake/common/PxTask.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# -# Build PxTask common -# - -SET(PXTASK_HEADERS - ${PROJECT_SOURCE_DIR}/../../../../include/task/PxCpuDispatcher.h - ${PROJECT_SOURCE_DIR}/../../../../include/task/PxGpuDispatcher.h - ${PROJECT_SOURCE_DIR}/../../../../include/task/PxGpuTask.h - ${PROJECT_SOURCE_DIR}/../../../../include/task/PxTask.h - ${PROJECT_SOURCE_DIR}/../../../../include/task/PxTaskDefine.h - ${PROJECT_SOURCE_DIR}/../../../../include/task/PxTaskManager.h -) -SOURCE_GROUP(include FILES ${PXTASK_HEADERS}) - -SET(PXTASK_SOURCE - ${PXSHARED_SOURCE_DIR}/task/src/TaskManager.cpp -) -SOURCE_GROUP(src FILES ${PXTASK_SOURCE}) - -ADD_LIBRARY(PxTask ${PXTASK_LIBTYPE} - ${PXTASK_HEADERS} - ${PXTASK_SOURCE} -) - -TARGET_INCLUDE_DIRECTORIES(PxTask - PRIVATE ${PXSHARED_SOURCE_DIR}/../include - PRIVATE ${PXSHARED_SOURCE_DIR}/cudamanager/include - PRIVATE ${PXSHARED_SOURCE_DIR}/foundation/include - - PRIVATE ${PXTASK_PLATFORM_INCLUDES} -) - -TARGET_COMPILE_DEFINITIONS(PxTask - PRIVATE ${PXTASK_COMPILE_DEFS} -) - -IF(NOT ${PXTASK_LIBTYPE} STREQUAL "OBJECT") - SET_TARGET_PROPERTIES(PxTask PROPERTIES - COMPILE_PDB_NAME_DEBUG "PxTask${CMAKE_DEBUG_POSTFIX}" - COMPILE_PDB_NAME_CHECKED "PxTask${CMAKE_CHECKED_POSTFIX}" - COMPILE_PDB_NAME_PROFILE "PxTask${CMAKE_PROFILE_POSTFIX}" - COMPILE_PDB_NAME_RELEASE "PxTask${CMAKE_RELEASE_POSTFIX}" - ) -ENDIF()
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/findfileswithspec.py b/PxShared/src/compiler/cmake/findfileswithspec.py deleted file mode 100644 index 484ff4f..0000000 --- a/PxShared/src/compiler/cmake/findfileswithspec.py +++ /dev/null @@ -1,23 +0,0 @@ -import os,argparse,sys,string - -# -# Simple helper program - give it a path and it will list all of the files of the specified extension in relative format, using the -# pathroot variable as a substitution. This greatly simplifies one part of the process of creating a CMake file for a project -# -parser = argparse.ArgumentParser() -parser.add_argument("dir", help="Path to find files in") -parser.add_argument("extension", help="Spec to find (ie .cpp)") -parser.add_argument("--pathroot", help="Path variable to prepend to each line, example: ${PX_ROOT}", default="${DUDER}") - -args = parser.parse_args() - -if not os.path.exists(args.dir): - print("Unable to find path {}".format(args.dir)) - exit(1) - -for root, dirs, files in os.walk(args.dir): - for file in files: - if file.endswith(args.extension): - result = os.path.join(root, file) - - print(result.replace(args.dir, args.pathroot)) diff --git a/PxShared/src/compiler/cmake/html5/CMakeLists.txt b/PxShared/src/compiler/cmake/html5/CMakeLists.txt deleted file mode 100644 index e0d2776..0000000 --- a/PxShared/src/compiler/cmake/html5/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -PROJECT(PxShared CXX) -#set(CMAKE_VERBOSE_MAKEFILE ON) -include(../common/CMakeLists.txt) - - -IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to HTML5 - SET(TARGET_BUILD_PLATFORM "html5") -ENDIF() - -SET(PLATFORM_LIST HTML5) - -IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) - MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) -ENDIF() - -SET(CMAKE_CXX_FLAGS "${EPIC_BUILD_FLAGS} -fdiagnostics-show-option -fno-rtti -fno-exceptions -ffast-math -ffunction-sections -fdata-sections -Werror -ferror-limit=0 -Wall -Wextra -fstrict-aliasing -Wstrict-aliasing=2 -pedantic -Weverything -Wno-c++11-long-long -Wno-padded -Wno-reserved-id-macro -Wno-float-equal -Wno-sign-conversion -Wno-covered-switch-default -Wno-documentation-unknown-command -Wno-weak-vtables -Wno-missing-prototypes -Wno-unused-local-typedef -Wno-float-conversion -Wno-global-constructors -Wno-missing-variable-declarations -Wno-exit-time-destructors -Wno-unused-macros -Wno-undef -Wno-c++11-extra-semi -Wno-c++11-extensions -Wno-non-virtual-dtor -Wno-unknown-pragmas -Wno-old-style-cast -Wno-extra-semi -Wno-cast-align -Wno-documentation -Wno-shadow -Wno-conversion -Wno-newline-eof -Wno-header-hygiene -Wno-switch-enum -Wno-undefined-reinterpret-cast -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -Wno-overloaded-virtual -Wno-dynamic-class-memaccess -Wno-nested-anon-types -Wno-invalid-offsetof -Wno-reorder -Wno-local-type-template-args -Wno-unreachable-code -Wno-unreachable-code-return -Wno-format-pedantic -Wno-unused-private-field -Wno-unused-parameter -Wno-unused-member-function -Wno-used-but-marked-unused -Wno-unused-variable -Wno-format-nonliteral -Wno-shift-sign-overflow -Wno-comma -Wno-expansion-to-defined -Wno-undefined-func-template -Wno-weak-template-vtables -Wno-double-promotion -Wno-nonportable-include-path -Wno-disabled-macro-expansion -Wno-missing-noreturn") -SET(CMAKE_STATIC_LIBRARY_PREFIX "") - -SET(PXSHARED_HTML5_COMPILE_DEFS _LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE) -SET(PXSHARED_HTML5_DEBUG_COMPILE_DEFS _DEBUG;PX_DEBUG=1;PX_CHECKED=1) -SET(PXSHARED_HTML5_CHECKED_COMPILE_DEFS NDEBUG;PX_CHECKED=1) -SET(PXSHARED_HTML5_PROFILE_COMPILE_DEFS NDEBUG;PX_PROFILE=1) -SET(PXSHARED_HTML5_RELEASE_COMPILE_DEFS NDEBUG) - -SET(CMAKE_DEBUG_POSTFIX $ENV{LIB_SUFFIX}) -SET(CMAKE_PROFILE_POSTFIX $ENV{LIB_SUFFIX}) -SET(CMAKE_CHECKED_POSTFIX $ENV{LIB_SUFFIX}) -SET(CMAKE_RELEASE_POSTFIX $ENV{LIB_SUFFIX}) - -# Include project cmake files here -INCLUDE(PxFoundation.cmake) -INCLUDE(PsFastXml.cmake) -INCLUDE(PxPvdSDK.cmake) -INCLUDE(PxTask.cmake) -# INCLUDE(PxCudaContextManager.cmake) - diff --git a/PxShared/src/compiler/cmake/html5/PsFastXml.cmake b/PxShared/src/compiler/cmake/html5/PsFastXml.cmake deleted file mode 100644 index 3279134..0000000 --- a/PxShared/src/compiler/cmake/html5/PsFastXml.cmake +++ /dev/null @@ -1,26 +0,0 @@ -# -# Build PsFastXml -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) - -SET(PLATFORM_INCLUDES - $ENV{EMSCRIPTEN}/system/include -) - -# Use generator expressions to set config specific preprocessor definitions -SET(PSFASTXML_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_HTML5_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - - $<$<CONFIG:debug>:${PXSHARED_HTML5_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_HTML5_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_HTML5_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_HTML5_RELEASE_COMPILE_DEFS};> -) - -# include PsFastXml common -INCLUDE(../common/PsFastXml.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/html5/PxFoundation.cmake b/PxShared/src/compiler/cmake/html5/PxFoundation.cmake deleted file mode 100644 index a78e4e6..0000000 --- a/PxShared/src/compiler/cmake/html5/PxFoundation.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# -# Build PxFoundation -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -SET(PXFOUNDATION_LIBTYPE STATIC) - -SET(PXFOUNDATION_PLATFORM_FILES - ${LL_SOURCE_DIR}/src/unix/PsUnixAtomic.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixCpu.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixFPU.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixMutex.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixPrintString.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSList.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSocket.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixSync.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixThread.cpp - ${LL_SOURCE_DIR}/src/unix/PsUnixTime.cpp -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - $ENV{EMSCRIPTEN}/system/include - ${LL_SOURCE_DIR}/include/unix -) - -SET(PXFOUNDATION_COMPILE_DEFS - - # Common to all configurations - ${PXSHARED_HTML5_COMPILE_DEFS} - - $<$<CONFIG:debug>:${PXSHARED_HTML5_DEBUG_COMPILE_DEFS}> - $<$<CONFIG:checked>:${PXSHARED_HTML5_CHECKED_COMPILE_DEFS}> - $<$<CONFIG:profile>:${PXSHARED_HTML5_PROFILE_COMPILE_DEFS}> - $<$<CONFIG:release>:${PXSHARED_HTML5_RELEASE_COMPILE_DEFS}> -) - -# include PxFoundation common -INCLUDE(../common/PxFoundation.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/html5/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/html5/PxPvdSDK.cmake deleted file mode 100644 index 36a465f..0000000 --- a/PxShared/src/compiler/cmake/html5/PxPvdSDK.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# -# Build PxPvdSDK -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/pvd) - - SET(PXPVDSDK_LIBTYPE STATIC) - - SET(PXPVDSDK_PLATFORM_INCLUDES - $ENV{EMSCRIPTEN}/system/include - ) - - # Use generator expressions to set config specific preprocessor definitions - SET(PXPVDSDK_COMPILE_DEFS - ${PXSHARED_HTML5_COMPILE_DEFS} - - $<$<CONFIG:debug>:${PXSHARED_HTML5_DEBUG_COMPILE_DEFS}> - $<$<CONFIG:checked>:${PXSHARED_HTML5_CHECKED_COMPILE_DEFS}> - $<$<CONFIG:profile>:${PXSHARED_HTML5_PROFILE_COMPILE_DEFS}> - $<$<CONFIG:release>:${PXSHARED_HTML5_RELEASE_COMPILE_DEFS}> - ) - -# include PxPvdSDK common -INCLUDE(../common/PxPvdSDK.cmake) - -# Add linked libraries -TARGET_LINK_LIBRARIES(PxPvdSDK PRIVATE PxFoundation) - - diff --git a/PxShared/src/compiler/cmake/html5/PxTask.cmake b/PxShared/src/compiler/cmake/html5/PxTask.cmake deleted file mode 100644 index 5c00c13..0000000 --- a/PxShared/src/compiler/cmake/html5/PxTask.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# Build PxTask -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/task) - -SET(PXTASK_PLATFORM_INCLUDES - $ENV{EMSCRIPTEN}/system/include -) - -SET(PXTASK_COMPILE_DEFS - ${PXSHARED_HTML5_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - $<$<CONFIG:debug>:${PXSHARED_HTML5_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_HTML5_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_HTML5_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_HTML5_RELEASE_COMPILE_DEFS};> -) - -# include PxTask common -INCLUDE(../common/PxTask.cmake) diff --git a/PxShared/src/compiler/cmake/templates/ProjectVersion.cmake.in b/PxShared/src/compiler/cmake/templates/ProjectVersion.cmake.in deleted file mode 100644 index 650b862..0000000 --- a/PxShared/src/compiler/cmake/templates/ProjectVersion.cmake.in +++ /dev/null @@ -1,24 +0,0 @@ -set(PACKAGE_VERSION "@PXSHARED_VERSION@") - -if("@PXSHARED_VERSION@" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version - set(CVF_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") -else() - set(CVF_VERSION_NO_TWEAK "1.1.0") -endif() - -if(PACKAGE_FIND_VERSION MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)\\.") # strip the tweak version - set(REQUESTED_VERSION_NO_TWEAK "${CMAKE_MATCH_1}") -else() - set(REQUESTED_VERSION_NO_TWEAK "${PACKAGE_FIND_VERSION}") -endif() - -if(REQUESTED_VERSION_NO_TWEAK STREQUAL CVF_VERSION_NO_TWEAK) - set(PACKAGE_VERSION_COMPATIBLE TRUE) -else() - set(PACKAGE_VERSION_COMPATIBLE FALSE) -endif() - -if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) - set(PACKAGE_VERSION_EXACT TRUE) -endif() - diff --git a/PxShared/src/compiler/cmake/uwp/CMakeLists.txt b/PxShared/src/compiler/cmake/uwp/CMakeLists.txt deleted file mode 100644 index dd3250e..0000000 --- a/PxShared/src/compiler/cmake/uwp/CMakeLists.txt +++ /dev/null @@ -1,64 +0,0 @@ - -SET(CMAKE_CXX_FLAGS "/Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4577 /wd4530 /d2Zi+ /WX /W4 /ZW /GF /GS- /GR- /Gd /fp:fast ${DISABLE_ITERATOR_DEBUGGING}") - -SET(CMAKE_CXX_FLAGS_DEBUG "/Od ${WINCRT_NDEBUG} /Zi") -SET(CMAKE_CXX_FLAGS_CHECKED "/Ox ${WINCRT_NDEBUG} /Zi") -SET(CMAKE_CXX_FLAGS_PROFILE "/Ox ${WINCRT_NDEBUG} /Zi") -SET(CMAKE_CXX_FLAGS_RELEASE "/Ox ${WINCRT_NDEBUG} /Zi") - -# Build PDBs for all configurations -SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") - -# Controls PX_NVTX for all projects on windows -SET(PXSHARED_UWP_ENABLE_NVTX 0) - -# Disable cuda and dx for all projects on windows -SET(PXSHARED_UWP_COMPILE_DEFS WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;DISABLE_CUDA_PHYSX;) - -SET(PXSHARED_UWP_DEBUG_COMPILE_DEFS PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=${PXSHARED_UWP_ENABLE_NVTX}) -SET(PXSHARED_UWP_CHECKED_COMPILE_DEFS PX_CHECKED=1;PX_NVTX=${PXSHARED_UWP_ENABLE_NVTX}) -SET(PXSHARED_UWP_PROFILE_COMPILE_DEFS PX_PROFILE=1;PX_NVTX=${PXSHARED_UWP_ENABLE_NVTX}) -SET(PXSHARED_UWP_RELEASE_COMPILE_DEFS ) - -IF(PX_SCALAR_MATH) - ADD_DEFINITIONS(-DPX_SIMD_DISABLED) -ENDIF() - -IF(CMAKE_CL_64) - ADD_DEFINITIONS(-DWIN64) -ENDIF(CMAKE_CL_64) - - -# Include project cmake files here -IF(DEFINED PX_SELECT_COMPONENTS) - if ("PxFoundation" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxFoundation.cmake) - endif() -ELSE() - INCLUDE(PxFoundation.cmake) - - INCLUDE(CMakePackageConfigHelpers) - - configure_file(templates/ProjectVersion.cmake.in ${PXSHARED_ROOT_DIR}/pxshared-config-version.cmake @ONLY) - -# WRITE_BASIC_PACKAGE_VERSION_FILE(${PXSHARED_ROOT_DIR}/pxshared-config-version.cmake VERSION ${PXSHARED_VERSION} COMPATIBILITY ExactVersion) - - SET(PXSHARED_LIBS PxFoundation) - - # PX_ROOT_LIB_DIR is set by NvidiaBuildOptions and put into the cache. It's a relative path to the lib dir without config - - install( - TARGETS ${PXSHARED_LIBS} - EXPORT PxShared - DESTINATION $<$<CONFIG:debug>:${PX_ROOT_LIB_DIR}/debug>$<$<CONFIG:release>:${PX_ROOT_LIB_DIR}/release>$<$<CONFIG:checked>:${PX_ROOT_LIB_DIR}/checked>$<$<CONFIG:profile>:${PX_ROOT_LIB_DIR}/profile> ) - - install(EXPORT PxShared FILE pxshared-config.cmake DESTINATION cmake) - - install(FILES ${PXSHARED_ROOT_DIR}/pxshared-config-version.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake) - - # This doesn't use libpath-suffix, as it won't have the "wrapper" top - export(EXPORT PxShared FILE ${PXSHARED_ROOT_DIR}/pxshared-config.cmake) - - -ENDIF() - diff --git a/PxShared/src/compiler/cmake/uwp/PxFoundation.cmake b/PxShared/src/compiler/cmake/uwp/PxFoundation.cmake deleted file mode 100644 index a4b666d..0000000 --- a/PxShared/src/compiler/cmake/uwp/PxFoundation.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# -# Build PxFoundation -# - -# Can no longer just use LIBPATH_SUFFIX since it depends on build type -IF(CMAKE_CL_64) - SET(RESOURCE_LIBPATH_SUFFIX "x64") -ELSEIF(${PX_OUTPUT_ARCH} STREQUAL "arm") - SET(RESOURCE_LIBPATH_SUFFIX "arm") -ELSE(CMAKE_CL_64) - SET(RESOURCE_LIBPATH_SUFFIX "x86") -ENDIF(CMAKE_CL_64) - -SET(PXFOUNDATION_LIBTYPE SHARED) - -SET(PXFOUNDATION_RESOURCE_FILE - ${PXSHARED_SOURCE_DIR}/compiler/resource_${RESOURCE_LIBPATH_SUFFIX}/PxFoundation.rc -) -SOURCE_GROUP(resource FILES ${PXFOUNDATION_RESOURCE_FILE}) - -SET(PXFOUNDATION_PLATFORM_HEADERS - ${PXSHARED_ROOT_DIR}/include/foundation/windows/PxWindowsIntrinsics.h -) -SOURCE_GROUP("include\\windows" FILES ${PXFOUNDATION_PLATFORM_HEADERS}) - -SET(PXFOUNDATION_PLATFORM_SOURCE - ${LL_SOURCE_DIR}/src/windows/PsWindowsAtomic.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsCpu.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsFPU.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsMutex.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsPrintString.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsSList.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsSocket.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsSync.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsTime.cpp -) -SOURCE_GROUP("src\\src\\windows" FILES ${PXFOUNDATION_PLATFORM_SOURCE}) - -SET(PXFOUNDATION_UWP_PLATFORM_SOURCE - ${LL_SOURCE_DIR}/src/windows/PsUWPThread.cpp -) -SOURCE_GROUP("src\\src\\uwp" FILES ${PXFOUNDATION_UWP_PLATFORM_SOURCE}) - - -SET(PXFOUNDATION_PLATFORM_SOURCE_HEADERS - ${LL_SOURCE_DIR}/include/windows/PsWindowsAoS.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsFPU.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsInclude.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsInlineAoS.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsIntrinsics.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsLoadLibrary.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsTrigConstants.h -) -SOURCE_GROUP("src\\include\\windows" FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS}) - -SET(PXFOUNDATION_PLATFORM_SOURCE_HEADERS_2 - ${LL_SOURCE_DIR}/include/unix/PsUnixInlineAoS.h - ${LL_SOURCE_DIR}/include/unix/PsUnixTrigConstants.h -) -SOURCE_GROUP("src\\include\\unix" FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS_2}) - -SET(PXFOUNDATION_PLATFORM_SOURCE_HEADERS_3 - ${LL_SOURCE_DIR}/include/unix/neon/PsUnixNeonAoS.h - ${LL_SOURCE_DIR}/include/unix/neon/PsUnixNeonInlineAoS.h -) -SOURCE_GROUP("src\\include\\unix\\neon" FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS_3}) - -INSTALL(FILES ${PXFOUNDATION_PLATFORM_HEADERS} DESTINATION include/foundation/windows) - -INSTALL(FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS} DESTINATION src/foundation/include/windows) -INSTALL(FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS_2} DESTINATION src/foundation/include/unix) -INSTALL(FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS_3} DESTINATION src/foundation/include/unix/neon) - -SET(PXFOUNDATION_PLATFORM_FILES - ${PXFOUNDATION_PLATFORM_HEADERS} - ${PXFOUNDATION_PLATFORM_SOURCE} - ${PXFOUNDATION_UWP_PLATFORM_SOURCE} - ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS} - ${PXFOUNDATION_RESOURCE_FILE} -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - ${LL_SOURCE_DIR}/include/windows -) - -SET(PXFOUNDATION_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_UWP_COMPILE_DEFS};PX_FOUNDATION_DLL=1; - - $<$<CONFIG:debug>:${PXSHARED_UWP_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_UWP_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_UWP_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_UWP_RELEASE_COMPILE_DEFS};> -) - -SET(PXFOUNDATION_PLATFORM_INTERFACE_HEADERS "$<INSTALL_INTERFACE:include/foundation/windows>$<BUILD_INTERFACE:${PXSHARED_ROOT_DIR}/include/foundation/windows>") - diff --git a/PxShared/src/compiler/cmake/windows/CMakeLists.txt b/PxShared/src/compiler/cmake/windows/CMakeLists.txt deleted file mode 100644 index fe2b00d..0000000 --- a/PxShared/src/compiler/cmake/windows/CMakeLists.txt +++ /dev/null @@ -1,95 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -PROJECT(PxShared CXX) -include(../common/CMakeLists.txt) - - -IF(NOT DEFINED TARGET_BUILD_PLATFORM) # Not defined, default to windows - SET(TARGET_BUILD_PLATFORM "windows") -ENDIF() - -SET(PLATFORM_LIST windows) - -IF (NOT ${TARGET_BUILD_PLATFORM} IN_LIST PLATFORM_LIST) - MESSAGE(FATAL_ERROR "Invalid platform:" ${TARGET_BUILD_PLATFORM}) -ENDIF() - -SET(CMAKE_CXX_FLAGS "/Wall /wd4514 /wd4820 /wd4127 /wd4710 /wd4711 /wd4577 /d2Zi+ /WX /W4 /GF /GS- /GR- /Gd /fp:fast") - -IF(DEFINED STATIC_WINCRT) - SET(WINCRT_NDEBUG "/MT") - SET(WINCRT_DEBUG "/MTd") -ELSE() - SET(WINCRT_NDEBUG "/MD") - SET(WINCRT_DEBUG "/MDd") -ENDIF() - -SET(CMAKE_CXX_FLAGS_DEBUG "/Od ${WINCRT_DEBUG} /RTCu /Zi") -SET(CMAKE_CXX_FLAGS_CHECKED "/Ox ${WINCRT_NDEBUG} /Zi") -SET(CMAKE_CXX_FLAGS_PROFILE "/Ox ${WINCRT_NDEBUG} /Zi") -SET(CMAKE_CXX_FLAGS_RELEASE "/Ox ${WINCRT_NDEBUG} /Zi") - -# Build PDBs for all configurations -SET(CMAKE_SHARED_LINKER_FLAGS "/DEBUG") - -# Controls PX_NVTX for all projects on windows -SET(PXSHARED_WINDOWS_ENABLE_NVTX 0) - -IF(DEFINED LINK_GPU_BINARIES) -SET(PXSHARED_WINDOWS_COMPILE_DEFS WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;) -ELSE() -# Disable cuda and dx for all projects on windows -SET(PXSHARED_WINDOWS_COMPILE_DEFS WIN32;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;_WINSOCK_DEPRECATED_NO_WARNINGS;DISABLE_CUDA_PHYSX;) -ENDIF() -SET(PXSHARED_WINDOWS_DEBUG_COMPILE_DEFS _DEBUG;PX_DEBUG=1;PX_CHECKED=1;PX_NVTX=${PXSHARED_WINDOWS_ENABLE_NVTX}) -SET(PXSHARED_WINDOWS_CHECKED_COMPILE_DEFS NDEBUG;PX_CHECKED=1;PX_NVTX=${PXSHARED_WINDOWS_ENABLE_NVTX}) -SET(PXSHARED_WINDOWS_PROFILE_COMPILE_DEFS NDEBUG;PX_PROFILE=1;PX_NVTX=${PXSHARED_WINDOWS_ENABLE_NVTX}) -SET(PXSHARED_WINDOWS_RELEASE_COMPILE_DEFS NDEBUG) - -IF(DEFINED PX_SCALAR_MATH) - ADD_DEFINITIONS(-DPX_SIMD_DISABLED) -ENDIF() - -IF(CMAKE_CL_64) - ADD_DEFINITIONS(-DWIN64) -ENDIF(CMAKE_CL_64) - -IF(CMAKE_CL_64) - SET(LIBPATH_SUFFIX "x64") -ELSE(CMAKE_CL_64) - SET(LIBPATH_SUFFIX "x86") -ENDIF(CMAKE_CL_64) - -SET(CMAKE_DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}_${LIBPATH_SUFFIX}") -SET(CMAKE_PROFILE_POSTFIX "${CMAKE_PROFILE_POSTFIX}_${LIBPATH_SUFFIX}") -SET(CMAKE_CHECKED_POSTFIX "${CMAKE_CHECKED_POSTFIX}_${LIBPATH_SUFFIX}") -SET(CMAKE_RELEASE_POSTFIX "${CMAKE_RELEASE_POSTFIX}_${LIBPATH_SUFFIX}") - -# Include project cmake files here -IF(DEFINED PX_SELECT_COMPONENTS) - if ("PxFoundation" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxFoundation.cmake) - endif() - if ("PsFastXml" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PsFastXml.cmake) - endif() - if ("PxPvdSDK" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxPvdSDK.cmake) - endif() - if ("PxTask" IN_LIST PX_SELECT_COMPONENTS) - INCLUDE(PxTask.cmake) - endif() - if ("PxCudaContextManager" IN_LIST PX_SELECT_COMPONENTS) - IF(DEFINED GENERATE_GPU_PROJECTS) - INCLUDE(PxCudaContextManager.cmake) - ENDIF() - endif() -ELSE() -INCLUDE(PxFoundation.cmake) -INCLUDE(PsFastXml.cmake) -INCLUDE(PxPvdSDK.cmake) -INCLUDE(PxTask.cmake) -IF(DEFINED GENERATE_GPU_PROJECTS) - INCLUDE(PxCudaContextManager.cmake) -ENDIF() -ENDIF() - diff --git a/PxShared/src/compiler/cmake/windows/PsFastXml.cmake b/PxShared/src/compiler/cmake/windows/PsFastXml.cmake deleted file mode 100644 index 862b06e..0000000 --- a/PxShared/src/compiler/cmake/windows/PsFastXml.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# -# Build PsFastXml -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/fastxml) - -# Use generator expressions to set config specific preprocessor definitions -SET(PSFASTXML_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_WINDOWS_COMPILE_DEFS};PX_FOUNDATION_DLL=0; - - $<$<CONFIG:debug>:${PXSHARED_WINDOWS_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_WINDOWS_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_WINDOWS_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_WINDOWS_RELEASE_COMPILE_DEFS};> -) - -# include PsFastXml common -INCLUDE(../common/PsFastXml.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/windows/PxCudaContextManager.cmake b/PxShared/src/compiler/cmake/windows/PxCudaContextManager.cmake deleted file mode 100644 index 6b59d6e..0000000 --- a/PxShared/src/compiler/cmake/windows/PxCudaContextManager.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# -# Build PxCudaContextManager -# -FIND_PACKAGE(CUDA REQUIRED) - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/cudamanager) - -SET(CUDA_COMPILER_OPTION_DEBUG "--compiler-options=/W3,/nologo,/Ot,/Ox,/Zi,${WINCRT_DEBUG}") -SET(CUDA_COMPILER_OPTION_CHECKED "--compiler-options=/W3,/nologo,/Ot,/Ox,/Zi,${WINCRT_NDEBUG}") -SET(CUDA_COMPILER_OPTION_PROFILE "--compiler-options=/W3,/nologo,/Ot,/Ox,/Zi,${WINCRT_NDEBUG}") -SET(CUDA_COMPILER_OPTION_RELEASE "--compiler-options=/W3,/nologo,/Ot,/Ox,/Zi,${WINCRT_NDEBUG}") - -# include PxCudaContextManager common -INCLUDE(../common/PxCudaContextManager.cmake) - -# No linked libraries - -# Use generator expressions to set config specific preprocessor definitions -TARGET_COMPILE_DEFINITIONS(PxCudaContextManager - - # Common to all configurations - PRIVATE ${PXSHARED_WINDOWS_COMPILE_DEFS}; - - PRIVATE $<$<CONFIG:debug>:${PXSHARED_WINDOWS_DEBUG_COMPILE_DEFS};> - PRIVATE $<$<CONFIG:checked>:${PXSHARED_WINDOWS_CHECKED_COMPILE_DEFS};> - PRIVATE $<$<CONFIG:profile>:${PXSHARED_WINDOWS_PROFILE_COMPILE_DEFS};> - PRIVATE $<$<CONFIG:release>:${PXSHARED_WINDOWS_RELEASE_COMPILE_DEFS};> -) - -#TODO: Link flags diff --git a/PxShared/src/compiler/cmake/windows/PxFoundation.cmake b/PxShared/src/compiler/cmake/windows/PxFoundation.cmake deleted file mode 100644 index 31de53b..0000000 --- a/PxShared/src/compiler/cmake/windows/PxFoundation.cmake +++ /dev/null @@ -1,70 +0,0 @@ -# -# Build PxFoundation -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/foundation) - -SET(PXFOUNDATION_LIBTYPE SHARED) - -SET(PXFOUNDATION_RESOURCE_FILE - ${PXSHARED_SOURCE_DIR}/compiler/resource_${LIBPATH_SUFFIX}/PxFoundation.rc -) -SOURCE_GROUP(resource FILES ${PXFOUNDATION_RESOURCE_FILE}) - -SET(PXFOUNDATION_PLATFORM_HEADERS - ${PXSHARED_SOURCE_DIR}/../include/foundation/windows/PxWindowsIntrinsics.h - ${PXSHARED_SOURCE_DIR}/../include/foundation/windows/PxWindowsFoundationDelayLoadHook.h -) -SOURCE_GROUP(include\\windows FILES ${PXFOUNDATION_PLATFORM_HEADERS}) - -SET(PXFOUNDATION_PLATFORM_SOURCE - ${LL_SOURCE_DIR}/src/windows/PsWindowsAtomic.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsCpu.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsFPU.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsMutex.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsPrintString.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsSList.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsSocket.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsSync.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsThread.cpp - ${LL_SOURCE_DIR}/src/windows/PsWindowsTime.cpp -) -SOURCE_GROUP(src\\src\\windows FILES ${PXFOUNDATION_PLATFORM_SOURCE}) - -SET(PXFOUNDATION_PLATFORM_SOURCE_HEADERS - ${LL_SOURCE_DIR}/include/windows/PsWindowsAoS.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsFPU.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsInclude.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsInlineAoS.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsIntrinsics.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsLoadLibrary.h - ${LL_SOURCE_DIR}/include/windows/PsWindowsTrigConstants.h -) -SOURCE_GROUP(src\\include\\windows FILES ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS}) - - -SET(PXFOUNDATION_PLATFORM_FILES - ${PXFOUNDATION_PLATFORM_SOURCE} - ${PXFOUNDATION_PLATFORM_SOURCE_HEADERS} - ${PXFOUNDATION_PLATFORM_HEADERS} - ${PXFOUNDATION_RESOURCE_FILE} -) - -SET(PXFOUNDATION_PLATFORM_INCLUDES - ${LL_SOURCE_DIR}/include/windows -) - -SET(PXFOUNDATION_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_WINDOWS_COMPILE_DEFS};PX_FOUNDATION_DLL=1; - - $<$<CONFIG:debug>:${PXSHARED_WINDOWS_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_WINDOWS_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_WINDOWS_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_WINDOWS_RELEASE_COMPILE_DEFS};> -) - -# include PxFoundation common -INCLUDE(../common/PxFoundation.cmake)
\ No newline at end of file diff --git a/PxShared/src/compiler/cmake/windows/PxPvdSDK.cmake b/PxShared/src/compiler/cmake/windows/PxPvdSDK.cmake deleted file mode 100644 index 287ec1c..0000000 --- a/PxShared/src/compiler/cmake/windows/PxPvdSDK.cmake +++ /dev/null @@ -1,55 +0,0 @@ -# -# Build PxPvdSDK -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(LL_SOURCE_DIR ${PXSHARED_SOURCE_DIR}/pvd) - -FIND_PACKAGE(nvToolsExt REQUIRED) - -SET(PXPVDSDK_LIBTYPE SHARED) - -SET(PXPVDSDK_RESOURCE_FILE - ${PXSHARED_SOURCE_DIR}/compiler/resource_${LIBPATH_SUFFIX}/PxPvdSDK.rc -) -SOURCE_GROUP(resource FILES ${PXPVDSDK_RESOURCE_FILE}) - -SET(PXPVDSDK_PLATFORM_HEADERS - ${PXSHARED_SOURCE_DIR}/../include/pvd/windows/PxWindowsPvdDelayLoadHook.h -) -SOURCE_GROUP(include\\windows FILES ${PXPVDSDK_PLATFORM_HEADERS}) - -SET(PXPVDSDK_PLATFORM_SOURCE - ${PXSHARED_SOURCE_DIR}/pvd/src/windows/PxWindowsPvdDelayLoadHook.cpp -) -SOURCE_GROUP(src\\src\\windows FILES ${PXPVDSDK_PLATFORM_SOURCE}) - -SET(PXPVDSDK_PLATFORM_FILES - ${PXPVDSDK_RESOURCE_FILE} - ${PXPVDSDK_PLATFORM_HEADERS} - ${PXPVDSDK_PLATFORM_SOURCE} -) - -SET(PXPVDSDK_PLATFORM_INCLUDES - ${NVTOOLSEXT_INCLUDE_DIRS} -) - -# Use generator expressions to set config specific preprocessor definitions -SET(PXPVDSDK_COMPILE_DEFS - # Common to all configurations - ${PXSHARED_WINDOWS_COMPILE_DEFS};PX_PVDSDK_DLL=1;PX_FOUNDATION_DLL=1; - - $<$<CONFIG:debug>:${PXSHARED_WINDOWS_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_WINDOWS_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_WINDOWS_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_WINDOWS_RELEASE_COMPILE_DEFS};> -) - -# include PxPvdSDK common -INCLUDE(../common/PxPvdSDK.cmake) - -# Add linked libraries -TARGET_LINK_LIBRARIES(PxPvdSDK PUBLIC ${NVTOOLSEXT_LIBRARIES} PxFoundation) - - diff --git a/PxShared/src/compiler/cmake/windows/PxTask.cmake b/PxShared/src/compiler/cmake/windows/PxTask.cmake deleted file mode 100644 index 32d4b39..0000000 --- a/PxShared/src/compiler/cmake/windows/PxTask.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# -# Build PxTask -# - -SET(PXSHARED_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../../../../src) - -SET(PXTASK_COMPILE_DEFS - ${PXSHARED_WINDOWS_COMPILE_DEFS};_LIB - - $<$<CONFIG:debug>:${PXSHARED_WINDOWS_DEBUG_COMPILE_DEFS};> - $<$<CONFIG:checked>:${PXSHARED_WINDOWS_CHECKED_COMPILE_DEFS};> - $<$<CONFIG:profile>:${PXSHARED_WINDOWS_PROFILE_COMPILE_DEFS};> - $<$<CONFIG:release>:${PXSHARED_WINDOWS_RELEASE_COMPILE_DEFS};> -) - -SET(PXTASK_LIBTYPE STATIC) - -# include PxTask common -INCLUDE(../common/PxTask.cmake) diff --git a/PxShared/src/compiler/linux32/Makefile b/PxShared/src/compiler/linux32/Makefile deleted file mode 100644 index 1815d2e..0000000 --- a/PxShared/src/compiler/linux32/Makefile +++ /dev/null @@ -1,209 +0,0 @@ -#!/usr/bin/make -# Makefile generated by XPJ for linux32 - -DEPSDIR = .deps -#default defines -OBJS_DIR = build -RMDIR = rm -fr -ECHO = echo -CCLD = g++ -CXX = g++ -CC = gcc -RANLIB = ranlib -AR = ar -STRIP = strip -OBJDUMP = objdump -OBJCOPY = objcopy --include Makedefs.linux32.mk - -all: checked debug profile release - -checked: build_PxCudaContextManager_checked - -debug: build_PxCudaContextManager_debug - -profile: build_PxCudaContextManager_profile - -release: build_PxCudaContextManager_release - -clean: clean_PxCudaContextManager_debug clean_PxCudaContextManager_checked clean_PxCudaContextManager_profile clean_PxCudaContextManager_release - rm -rf $(DEPSDIR) - - -clean_debug: clean_PxCudaContextManager_debug - rm -rf $(DEPSDIR) - - -clean_checked: clean_PxCudaContextManager_checked - rm -rf $(DEPSDIR) - - -clean_profile: clean_PxCudaContextManager_profile - rm -rf $(DEPSDIR) - - -clean_release: clean_PxCudaContextManager_release - rm -rf $(DEPSDIR) - - -include Makefile.PxCudaContextManager.mk - - -# Disable implicit rules to speedup build -.SUFFIXES: -SUFFIXES := -%.out: -%.a: -%.ln: -%.o: -%: %.o -%.c: -%: %.c -%.ln: %.c -%.o: %.c -%.cc: -%: %.cc -%.o: %.cc -%.C: -%: %.C -%.o: %.C -%.cpp: -%: %.cpp -%.o: %.cpp -%.p: -%: %.p -%.o: %.p -%.f: -%: - %.f%.o: %.f -%.F: -%: %.F -%.o: %.F -%.f: %.F -%.r: -%: %.r -%.o: %.r -%.f: %.r -%.y: -%.ln: %.y -%.c: %.y -%.l: -%.ln: %.l -%.c: %.l -%.r: %.l -%.s: -%: %.s -%.o: %.s -%.S: -%: %.S -%.o: %.S -%.s: %.S -%.mod: -%: %.mod -%.o: %.mod -%.sym: -%.def: -%.sym: %.def -%.h: -%.info: -%.dvi: -%.tex: -%.dvi: %.tex -%.texinfo: -%.info: %.texinfo -%.dvi: %.texinfo -%.texi: -%.info: %.texi -%.dvi: %.texi -%.txinfo: -%.info: %.txinfo -%.dvi: %.txinfo -%.w: -%.c: %.w -%.tex: %.w -%.ch: -%.web: -%.p: %.web -%.tex: %.web -%.sh: -%: %.sh -%.elc: -%.el: -(%): % -%.out: % -%.c: %.w %.ch -%.tex: %.w %.ch -%: %,v -%: RCS/%,v -%: RCS/% -%: s.% -%: SCCS/s.% -.web.p: -.l.r: -.dvi: -.F.o: -.l: -.y.ln: -.o: -.y: -.def.sym: -.p.o: -.p: -.txinfo.dvi: -.a: -.l.ln: -.w.c: -.texi.dvi: -.sh: -.cc: -.cc.o: -.def: -.c.o: -.r.o: -.r: -.info: -.elc: -.l.c: -.out: -.C: -.r.f: -.S: -.texinfo.info: -.c: -.w.tex: -.c.ln: -.s.o: -.s: -.texinfo.dvi: -.el: -.texinfo: -.y.c: -.web.tex: -.texi.info: -.DEFAULT: -.h: -.tex.dvi: -.cpp.o: -.cpp: -.C.o: -.ln: -.texi: -.txinfo: -.tex: -.txinfo.info: -.ch: -.S.s: -.mod: -.mod.o: -.F.f: -.w: -.S.o: -.F: -.web: -.sym: -.f: -.f.o: -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux32/Makefile.PsFastXml.mk b/PxShared/src/compiler/linux32/Makefile.PsFastXml.mk deleted file mode 100644 index 0177779..0000000 --- a/PxShared/src/compiler/linux32/Makefile.PsFastXml.mk +++ /dev/null @@ -1,356 +0,0 @@ -# Makefile generated by XPJ for linux32 --include Makefile.custom -ProjectName = PsFastXml -PsFastXml_cppfiles += ./../../fastxml/src/PsFastXml.cpp - -PsFastXml_cpp_debug_dep = $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_debug_dep = $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_debug_dep = $(PsFastXml_cpp_debug_dep) $(PsFastXml_cc_debug_dep) $(PsFastXml_c_debug_dep) --include $(PsFastXml_debug_dep) -PsFastXml_cpp_release_dep = $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_release_dep = $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_release_dep = $(PsFastXml_cpp_release_dep) $(PsFastXml_cc_release_dep) $(PsFastXml_c_release_dep) --include $(PsFastXml_release_dep) -PsFastXml_cpp_checked_dep = $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_checked_dep = $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_checked_dep = $(PsFastXml_cpp_checked_dep) $(PsFastXml_cc_checked_dep) $(PsFastXml_c_checked_dep) --include $(PsFastXml_checked_dep) -PsFastXml_cpp_profile_dep = $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_profile_dep = $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_profile_dep = $(PsFastXml_cpp_profile_dep) $(PsFastXml_cc_profile_dep) $(PsFastXml_c_profile_dep) --include $(PsFastXml_profile_dep) -PsFastXml_debug_hpaths := -PsFastXml_debug_hpaths += ./../../../include -PsFastXml_debug_hpaths += ./../../foundation/include -PsFastXml_debug_hpaths += ./../../fastxml/include -PsFastXml_debug_lpaths := -PsFastXml_debug_defines := $(PsFastXml_custom_defines) -PsFastXml_debug_defines += PX_FOUNDATION_DLL=0 -PsFastXml_debug_defines += _DEBUG -PsFastXml_debug_defines += PX_DEBUG=1 -PsFastXml_debug_defines += PX_CHECKED=1 -PsFastXml_debug_libraries := -PsFastXml_debug_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_debug_common_cflags += -MMD -PsFastXml_debug_common_cflags += $(addprefix -D, $(PsFastXml_debug_defines)) -PsFastXml_debug_common_cflags += $(addprefix -I, $(PsFastXml_debug_hpaths)) -PsFastXml_debug_common_cflags += -m32 -PsFastXml_debug_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_debug_common_cflags += -Wno-missing-field-initializers -PsFastXml_debug_common_cflags += -g3 -gdwarf-2 -PsFastXml_debug_cflags := $(PsFastXml_debug_common_cflags) -PsFastXml_debug_cppflags := $(PsFastXml_debug_common_cflags) -PsFastXml_debug_lflags := $(PsFastXml_custom_lflags) -PsFastXml_debug_lflags += $(addprefix -L, $(PsFastXml_debug_lpaths)) -PsFastXml_debug_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_debug_libraries)) -Wl,--end-group -PsFastXml_debug_lflags += -lrt -PsFastXml_debug_lflags += -m32 -PsFastXml_debug_objsdir = $(OBJS_DIR)/PsFastXml_debug -PsFastXml_debug_cpp_o = $(addprefix $(PsFastXml_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_debug_cc_o = $(addprefix $(PsFastXml_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_debug_c_o = $(addprefix $(PsFastXml_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_debug_obj = $(PsFastXml_debug_cpp_o) $(PsFastXml_debug_cc_o) $(PsFastXml_debug_c_o) -PsFastXml_debug_bin := ./../../../lib/linux32/libPsFastXmlDEBUG.a - -clean_PsFastXml_debug: - @$(ECHO) clean PsFastXml debug - @$(RMDIR) $(PsFastXml_debug_objsdir) - @$(RMDIR) $(PsFastXml_debug_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/debug - -build_PsFastXml_debug: postbuild_PsFastXml_debug -postbuild_PsFastXml_debug: mainbuild_PsFastXml_debug -mainbuild_PsFastXml_debug: prebuild_PsFastXml_debug $(PsFastXml_debug_bin) -prebuild_PsFastXml_debug: - -$(PsFastXml_debug_bin): $(PsFastXml_debug_obj) - mkdir -p `dirname ./../../../lib/linux32/libPsFastXmlDEBUG.a` - @$(AR) rcs $(PsFastXml_debug_bin) $(PsFastXml_debug_obj) - $(ECHO) building $@ complete! - -PsFastXml_debug_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_debug_cpp_o): $(PsFastXml_debug_objsdir)/%.o: - $(ECHO) PsFastXml: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_debug_DEPDIR).d - -$(PsFastXml_debug_cc_o): $(PsFastXml_debug_objsdir)/%.o: - $(ECHO) PsFastXml: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles))))).debug.P; \ - rm -f $(PsFastXml_debug_DEPDIR).d - -$(PsFastXml_debug_c_o): $(PsFastXml_debug_objsdir)/%.o: - $(ECHO) PsFastXml: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_debug_DEPDIR).d - -PsFastXml_release_hpaths := -PsFastXml_release_hpaths += ./../../../include -PsFastXml_release_hpaths += ./../../foundation/include -PsFastXml_release_hpaths += ./../../fastxml/include -PsFastXml_release_lpaths := -PsFastXml_release_defines := $(PsFastXml_custom_defines) -PsFastXml_release_defines += PX_FOUNDATION_DLL=0 -PsFastXml_release_defines += NDEBUG -PsFastXml_release_libraries := -PsFastXml_release_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_release_common_cflags += -MMD -PsFastXml_release_common_cflags += $(addprefix -D, $(PsFastXml_release_defines)) -PsFastXml_release_common_cflags += $(addprefix -I, $(PsFastXml_release_hpaths)) -PsFastXml_release_common_cflags += -m32 -PsFastXml_release_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_release_common_cflags += -Wno-missing-field-initializers -PsFastXml_release_common_cflags += -O3 -fno-strict-aliasing -PsFastXml_release_cflags := $(PsFastXml_release_common_cflags) -PsFastXml_release_cppflags := $(PsFastXml_release_common_cflags) -PsFastXml_release_lflags := $(PsFastXml_custom_lflags) -PsFastXml_release_lflags += $(addprefix -L, $(PsFastXml_release_lpaths)) -PsFastXml_release_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_release_libraries)) -Wl,--end-group -PsFastXml_release_lflags += -lrt -PsFastXml_release_lflags += -m32 -PsFastXml_release_objsdir = $(OBJS_DIR)/PsFastXml_release -PsFastXml_release_cpp_o = $(addprefix $(PsFastXml_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_release_cc_o = $(addprefix $(PsFastXml_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_release_c_o = $(addprefix $(PsFastXml_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_release_obj = $(PsFastXml_release_cpp_o) $(PsFastXml_release_cc_o) $(PsFastXml_release_c_o) -PsFastXml_release_bin := ./../../../lib/linux32/libPsFastXml.a - -clean_PsFastXml_release: - @$(ECHO) clean PsFastXml release - @$(RMDIR) $(PsFastXml_release_objsdir) - @$(RMDIR) $(PsFastXml_release_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/release - -build_PsFastXml_release: postbuild_PsFastXml_release -postbuild_PsFastXml_release: mainbuild_PsFastXml_release -mainbuild_PsFastXml_release: prebuild_PsFastXml_release $(PsFastXml_release_bin) -prebuild_PsFastXml_release: - -$(PsFastXml_release_bin): $(PsFastXml_release_obj) - mkdir -p `dirname ./../../../lib/linux32/libPsFastXml.a` - @$(AR) rcs $(PsFastXml_release_bin) $(PsFastXml_release_obj) - $(ECHO) building $@ complete! - -PsFastXml_release_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_release_cpp_o): $(PsFastXml_release_objsdir)/%.o: - $(ECHO) PsFastXml: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_release_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_release_DEPDIR).d - -$(PsFastXml_release_cc_o): $(PsFastXml_release_objsdir)/%.o: - $(ECHO) PsFastXml: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles))))).release.P; \ - rm -f $(PsFastXml_release_DEPDIR).d - -$(PsFastXml_release_c_o): $(PsFastXml_release_objsdir)/%.o: - $(ECHO) PsFastXml: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_release_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_release_DEPDIR).d - -PsFastXml_checked_hpaths := -PsFastXml_checked_hpaths += ./../../../include -PsFastXml_checked_hpaths += ./../../foundation/include -PsFastXml_checked_hpaths += ./../../fastxml/include -PsFastXml_checked_lpaths := -PsFastXml_checked_defines := $(PsFastXml_custom_defines) -PsFastXml_checked_defines += PX_FOUNDATION_DLL=0 -PsFastXml_checked_defines += NDEBUG -PsFastXml_checked_defines += PX_CHECKED=1 -PsFastXml_checked_libraries := -PsFastXml_checked_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_checked_common_cflags += -MMD -PsFastXml_checked_common_cflags += $(addprefix -D, $(PsFastXml_checked_defines)) -PsFastXml_checked_common_cflags += $(addprefix -I, $(PsFastXml_checked_hpaths)) -PsFastXml_checked_common_cflags += -m32 -PsFastXml_checked_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_checked_common_cflags += -Wno-missing-field-initializers -PsFastXml_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PsFastXml_checked_cflags := $(PsFastXml_checked_common_cflags) -PsFastXml_checked_cppflags := $(PsFastXml_checked_common_cflags) -PsFastXml_checked_lflags := $(PsFastXml_custom_lflags) -PsFastXml_checked_lflags += $(addprefix -L, $(PsFastXml_checked_lpaths)) -PsFastXml_checked_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_checked_libraries)) -Wl,--end-group -PsFastXml_checked_lflags += -lrt -PsFastXml_checked_lflags += -m32 -PsFastXml_checked_objsdir = $(OBJS_DIR)/PsFastXml_checked -PsFastXml_checked_cpp_o = $(addprefix $(PsFastXml_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_checked_cc_o = $(addprefix $(PsFastXml_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_checked_c_o = $(addprefix $(PsFastXml_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_checked_obj = $(PsFastXml_checked_cpp_o) $(PsFastXml_checked_cc_o) $(PsFastXml_checked_c_o) -PsFastXml_checked_bin := ./../../../lib/linux32/libPsFastXmlCHECKED.a - -clean_PsFastXml_checked: - @$(ECHO) clean PsFastXml checked - @$(RMDIR) $(PsFastXml_checked_objsdir) - @$(RMDIR) $(PsFastXml_checked_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/checked - -build_PsFastXml_checked: postbuild_PsFastXml_checked -postbuild_PsFastXml_checked: mainbuild_PsFastXml_checked -mainbuild_PsFastXml_checked: prebuild_PsFastXml_checked $(PsFastXml_checked_bin) -prebuild_PsFastXml_checked: - -$(PsFastXml_checked_bin): $(PsFastXml_checked_obj) - mkdir -p `dirname ./../../../lib/linux32/libPsFastXmlCHECKED.a` - @$(AR) rcs $(PsFastXml_checked_bin) $(PsFastXml_checked_obj) - $(ECHO) building $@ complete! - -PsFastXml_checked_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_checked_cpp_o): $(PsFastXml_checked_objsdir)/%.o: - $(ECHO) PsFastXml: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_checked_DEPDIR).d - -$(PsFastXml_checked_cc_o): $(PsFastXml_checked_objsdir)/%.o: - $(ECHO) PsFastXml: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles))))).checked.P; \ - rm -f $(PsFastXml_checked_DEPDIR).d - -$(PsFastXml_checked_c_o): $(PsFastXml_checked_objsdir)/%.o: - $(ECHO) PsFastXml: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_checked_DEPDIR).d - -PsFastXml_profile_hpaths := -PsFastXml_profile_hpaths += ./../../../include -PsFastXml_profile_hpaths += ./../../foundation/include -PsFastXml_profile_hpaths += ./../../fastxml/include -PsFastXml_profile_lpaths := -PsFastXml_profile_defines := $(PsFastXml_custom_defines) -PsFastXml_profile_defines += PX_FOUNDATION_DLL=0 -PsFastXml_profile_defines += NDEBUG -PsFastXml_profile_defines += PX_PROFILE=1 -PsFastXml_profile_libraries := -PsFastXml_profile_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_profile_common_cflags += -MMD -PsFastXml_profile_common_cflags += $(addprefix -D, $(PsFastXml_profile_defines)) -PsFastXml_profile_common_cflags += $(addprefix -I, $(PsFastXml_profile_hpaths)) -PsFastXml_profile_common_cflags += -m32 -PsFastXml_profile_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_profile_common_cflags += -Wno-missing-field-initializers -PsFastXml_profile_common_cflags += -O3 -fno-strict-aliasing -PsFastXml_profile_cflags := $(PsFastXml_profile_common_cflags) -PsFastXml_profile_cppflags := $(PsFastXml_profile_common_cflags) -PsFastXml_profile_lflags := $(PsFastXml_custom_lflags) -PsFastXml_profile_lflags += $(addprefix -L, $(PsFastXml_profile_lpaths)) -PsFastXml_profile_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_profile_libraries)) -Wl,--end-group -PsFastXml_profile_lflags += -lrt -PsFastXml_profile_lflags += -m32 -PsFastXml_profile_objsdir = $(OBJS_DIR)/PsFastXml_profile -PsFastXml_profile_cpp_o = $(addprefix $(PsFastXml_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_profile_cc_o = $(addprefix $(PsFastXml_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_profile_c_o = $(addprefix $(PsFastXml_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_profile_obj = $(PsFastXml_profile_cpp_o) $(PsFastXml_profile_cc_o) $(PsFastXml_profile_c_o) -PsFastXml_profile_bin := ./../../../lib/linux32/libPsFastXmlPROFILE.a - -clean_PsFastXml_profile: - @$(ECHO) clean PsFastXml profile - @$(RMDIR) $(PsFastXml_profile_objsdir) - @$(RMDIR) $(PsFastXml_profile_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/profile - -build_PsFastXml_profile: postbuild_PsFastXml_profile -postbuild_PsFastXml_profile: mainbuild_PsFastXml_profile -mainbuild_PsFastXml_profile: prebuild_PsFastXml_profile $(PsFastXml_profile_bin) -prebuild_PsFastXml_profile: - -$(PsFastXml_profile_bin): $(PsFastXml_profile_obj) - mkdir -p `dirname ./../../../lib/linux32/libPsFastXmlPROFILE.a` - @$(AR) rcs $(PsFastXml_profile_bin) $(PsFastXml_profile_obj) - $(ECHO) building $@ complete! - -PsFastXml_profile_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_profile_cpp_o): $(PsFastXml_profile_objsdir)/%.o: - $(ECHO) PsFastXml: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_profile_DEPDIR).d - -$(PsFastXml_profile_cc_o): $(PsFastXml_profile_objsdir)/%.o: - $(ECHO) PsFastXml: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles))))).profile.P; \ - rm -f $(PsFastXml_profile_DEPDIR).d - -$(PsFastXml_profile_c_o): $(PsFastXml_profile_objsdir)/%.o: - $(ECHO) PsFastXml: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_profile_DEPDIR).d - -clean_PsFastXml: clean_PsFastXml_debug clean_PsFastXml_release clean_PsFastXml_checked clean_PsFastXml_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux32/Makefile.PxCudaContextManager.mk b/PxShared/src/compiler/linux32/Makefile.PxCudaContextManager.mk deleted file mode 100644 index 620a468..0000000 --- a/PxShared/src/compiler/linux32/Makefile.PxCudaContextManager.mk +++ /dev/null @@ -1,391 +0,0 @@ -# Makefile generated by XPJ for linux32 --include Makefile.custom -ProjectName = PxCudaContextManager -PxCudaContextManager_cppfiles += ./../../cudamanager/src/BlockingWait.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/CudaContextManager.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/CudaKernelWrangler.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/CudaMemoryManager.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/GpuDispatcher.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/HeapManagerRef.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/PhysXDeviceSettings.cpp -PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu += ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_debug_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_debug_dep = $(PxCudaContextManager_cpp_debug_dep) $(PxCudaContextManager_cc_debug_dep) $(PxCudaContextManager_c_debug_dep) --include $(PxCudaContextManager_debug_dep) -PxCudaContextManager_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_checked_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_checked_dep = $(PxCudaContextManager_cpp_checked_dep) $(PxCudaContextManager_cc_checked_dep) $(PxCudaContextManager_c_checked_dep) --include $(PxCudaContextManager_checked_dep) -PxCudaContextManager_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_profile_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_profile_dep = $(PxCudaContextManager_cpp_profile_dep) $(PxCudaContextManager_cc_profile_dep) $(PxCudaContextManager_c_profile_dep) --include $(PxCudaContextManager_profile_dep) -PxCudaContextManager_cpp_release_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_release_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_release_dep = $(PxCudaContextManager_cpp_release_dep) $(PxCudaContextManager_cc_release_dep) $(PxCudaContextManager_c_release_dep) --include $(PxCudaContextManager_release_dep) -PxCudaContextManager_debug_hpaths := -PxCudaContextManager_debug_hpaths += ./../../../include -PxCudaContextManager_debug_hpaths += ./../../foundation/include -PxCudaContextManager_debug_hpaths += ./../../task/include -PxCudaContextManager_debug_hpaths += ./../../cudamanager/include -PxCudaContextManager_debug_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_debug_lpaths := -PxCudaContextManager_debug_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_debug_defines += _DEBUG -PxCudaContextManager_debug_defines += PX_DEBUG=1 -PxCudaContextManager_debug_defines += PX_CHECKED=1 -PxCudaContextManager_debug_libraries := -PxCudaContextManager_debug_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_debug_common_cflags += -MMD -PxCudaContextManager_debug_common_cflags += $(addprefix -D, $(PxCudaContextManager_debug_defines)) -PxCudaContextManager_debug_common_cflags += $(addprefix -I, $(PxCudaContextManager_debug_hpaths)) -PxCudaContextManager_debug_common_cflags += -m32 -PxCudaContextManager_debug_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_debug_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_debug_common_cflags += -g3 -gdwarf-2 -PxCudaContextManager_debug_cflags := $(PxCudaContextManager_debug_common_cflags) -PxCudaContextManager_debug_cppflags := $(PxCudaContextManager_debug_common_cflags) -PxCudaContextManager_debug_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_debug_lflags += $(addprefix -L, $(PxCudaContextManager_debug_lpaths)) -PxCudaContextManager_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_debug_libraries)) -Wl,--end-group -PxCudaContextManager_debug_lflags += -lrt -PxCudaContextManager_debug_lflags += -m32 -PxCudaContextManager_debug_objsdir = $(OBJS_DIR)/PxCudaContextManager_debug -PxCudaContextManager_debug_cpp_o = $(addprefix $(PxCudaContextManager_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_debug_cc_o = $(addprefix $(PxCudaContextManager_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_debug_c_o = $(addprefix $(PxCudaContextManager_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_debug_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_debug_obj = $(PxCudaContextManager_debug_cpp_o) $(PxCudaContextManager_debug_cc_o) $(PxCudaContextManager_debug_c_o) $(PxCudaContextManager_debug_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_debug_bin := ./../../../lib/linux32/libPxCudaContextManagerDEBUG.a - -clean_PxCudaContextManager_debug: - @$(ECHO) clean PxCudaContextManager debug - @$(RMDIR) $(PxCudaContextManager_debug_objsdir) - @$(RMDIR) $(PxCudaContextManager_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/debug - -build_PxCudaContextManager_debug: postbuild_PxCudaContextManager_debug -postbuild_PxCudaContextManager_debug: mainbuild_PxCudaContextManager_debug -mainbuild_PxCudaContextManager_debug: prebuild_PxCudaContextManager_debug $(PxCudaContextManager_debug_bin) -prebuild_PxCudaContextManager_debug: - -$(PxCudaContextManager_debug_bin): $(PxCudaContextManager_debug_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxCudaContextManagerDEBUG.a` - @$(AR) rcs $(PxCudaContextManager_debug_bin) $(PxCudaContextManager_debug_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_debug_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -D_DEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -D_DEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_debug_cpp_o): $(PxCudaContextManager_debug_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_debug_DEPDIR).d - -$(PxCudaContextManager_debug_cc_o): $(PxCudaContextManager_debug_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).debug.P; \ - rm -f $(PxCudaContextManager_debug_DEPDIR).d - -$(PxCudaContextManager_debug_c_o): $(PxCudaContextManager_debug_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_debug_DEPDIR).d - -PxCudaContextManager_checked_hpaths := -PxCudaContextManager_checked_hpaths += ./../../../include -PxCudaContextManager_checked_hpaths += ./../../foundation/include -PxCudaContextManager_checked_hpaths += ./../../task/include -PxCudaContextManager_checked_hpaths += ./../../cudamanager/include -PxCudaContextManager_checked_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_checked_lpaths := -PxCudaContextManager_checked_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_checked_defines += NDEBUG -PxCudaContextManager_checked_defines += PX_CHECKED=1 -PxCudaContextManager_checked_libraries := -PxCudaContextManager_checked_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_checked_common_cflags += -MMD -PxCudaContextManager_checked_common_cflags += $(addprefix -D, $(PxCudaContextManager_checked_defines)) -PxCudaContextManager_checked_common_cflags += $(addprefix -I, $(PxCudaContextManager_checked_hpaths)) -PxCudaContextManager_checked_common_cflags += -m32 -PxCudaContextManager_checked_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_checked_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxCudaContextManager_checked_cflags := $(PxCudaContextManager_checked_common_cflags) -PxCudaContextManager_checked_cppflags := $(PxCudaContextManager_checked_common_cflags) -PxCudaContextManager_checked_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_checked_lflags += $(addprefix -L, $(PxCudaContextManager_checked_lpaths)) -PxCudaContextManager_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_checked_libraries)) -Wl,--end-group -PxCudaContextManager_checked_lflags += -lrt -PxCudaContextManager_checked_lflags += -m32 -PxCudaContextManager_checked_objsdir = $(OBJS_DIR)/PxCudaContextManager_checked -PxCudaContextManager_checked_cpp_o = $(addprefix $(PxCudaContextManager_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_checked_cc_o = $(addprefix $(PxCudaContextManager_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_checked_c_o = $(addprefix $(PxCudaContextManager_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_checked_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_checked_obj = $(PxCudaContextManager_checked_cpp_o) $(PxCudaContextManager_checked_cc_o) $(PxCudaContextManager_checked_c_o) $(PxCudaContextManager_checked_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_checked_bin := ./../../../lib/linux32/libPxCudaContextManagerCHECKED.a - -clean_PxCudaContextManager_checked: - @$(ECHO) clean PxCudaContextManager checked - @$(RMDIR) $(PxCudaContextManager_checked_objsdir) - @$(RMDIR) $(PxCudaContextManager_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/checked - -build_PxCudaContextManager_checked: postbuild_PxCudaContextManager_checked -postbuild_PxCudaContextManager_checked: mainbuild_PxCudaContextManager_checked -mainbuild_PxCudaContextManager_checked: prebuild_PxCudaContextManager_checked $(PxCudaContextManager_checked_bin) -prebuild_PxCudaContextManager_checked: - -$(PxCudaContextManager_checked_bin): $(PxCudaContextManager_checked_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxCudaContextManagerCHECKED.a` - @$(AR) rcs $(PxCudaContextManager_checked_bin) $(PxCudaContextManager_checked_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_checked_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_checked_cpp_o): $(PxCudaContextManager_checked_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_checked_DEPDIR).d - -$(PxCudaContextManager_checked_cc_o): $(PxCudaContextManager_checked_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).checked.P; \ - rm -f $(PxCudaContextManager_checked_DEPDIR).d - -$(PxCudaContextManager_checked_c_o): $(PxCudaContextManager_checked_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_checked_DEPDIR).d - -PxCudaContextManager_profile_hpaths := -PxCudaContextManager_profile_hpaths += ./../../../include -PxCudaContextManager_profile_hpaths += ./../../foundation/include -PxCudaContextManager_profile_hpaths += ./../../task/include -PxCudaContextManager_profile_hpaths += ./../../cudamanager/include -PxCudaContextManager_profile_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_profile_lpaths := -PxCudaContextManager_profile_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_profile_defines += NDEBUG -PxCudaContextManager_profile_defines += PX_PROFILE=1 -PxCudaContextManager_profile_libraries := -PxCudaContextManager_profile_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_profile_common_cflags += -MMD -PxCudaContextManager_profile_common_cflags += $(addprefix -D, $(PxCudaContextManager_profile_defines)) -PxCudaContextManager_profile_common_cflags += $(addprefix -I, $(PxCudaContextManager_profile_hpaths)) -PxCudaContextManager_profile_common_cflags += -m32 -PxCudaContextManager_profile_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_profile_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_profile_common_cflags += -O3 -fno-strict-aliasing -PxCudaContextManager_profile_cflags := $(PxCudaContextManager_profile_common_cflags) -PxCudaContextManager_profile_cppflags := $(PxCudaContextManager_profile_common_cflags) -PxCudaContextManager_profile_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_profile_lflags += $(addprefix -L, $(PxCudaContextManager_profile_lpaths)) -PxCudaContextManager_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_profile_libraries)) -Wl,--end-group -PxCudaContextManager_profile_lflags += -lrt -PxCudaContextManager_profile_lflags += -m32 -PxCudaContextManager_profile_objsdir = $(OBJS_DIR)/PxCudaContextManager_profile -PxCudaContextManager_profile_cpp_o = $(addprefix $(PxCudaContextManager_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_profile_cc_o = $(addprefix $(PxCudaContextManager_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_profile_c_o = $(addprefix $(PxCudaContextManager_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_profile_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_profile_obj = $(PxCudaContextManager_profile_cpp_o) $(PxCudaContextManager_profile_cc_o) $(PxCudaContextManager_profile_c_o) $(PxCudaContextManager_profile_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_profile_bin := ./../../../lib/linux32/libPxCudaContextManagerPROFILE.a - -clean_PxCudaContextManager_profile: - @$(ECHO) clean PxCudaContextManager profile - @$(RMDIR) $(PxCudaContextManager_profile_objsdir) - @$(RMDIR) $(PxCudaContextManager_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/profile - -build_PxCudaContextManager_profile: postbuild_PxCudaContextManager_profile -postbuild_PxCudaContextManager_profile: mainbuild_PxCudaContextManager_profile -mainbuild_PxCudaContextManager_profile: prebuild_PxCudaContextManager_profile $(PxCudaContextManager_profile_bin) -prebuild_PxCudaContextManager_profile: - -$(PxCudaContextManager_profile_bin): $(PxCudaContextManager_profile_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxCudaContextManagerPROFILE.a` - @$(AR) rcs $(PxCudaContextManager_profile_bin) $(PxCudaContextManager_profile_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_profile_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_profile_cpp_o): $(PxCudaContextManager_profile_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_profile_DEPDIR).d - -$(PxCudaContextManager_profile_cc_o): $(PxCudaContextManager_profile_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).profile.P; \ - rm -f $(PxCudaContextManager_profile_DEPDIR).d - -$(PxCudaContextManager_profile_c_o): $(PxCudaContextManager_profile_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_profile_DEPDIR).d - -PxCudaContextManager_release_hpaths := -PxCudaContextManager_release_hpaths += ./../../../include -PxCudaContextManager_release_hpaths += ./../../foundation/include -PxCudaContextManager_release_hpaths += ./../../task/include -PxCudaContextManager_release_hpaths += ./../../cudamanager/include -PxCudaContextManager_release_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_release_lpaths := -PxCudaContextManager_release_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_release_defines += NDEBUG -PxCudaContextManager_release_libraries := -PxCudaContextManager_release_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_release_common_cflags += -MMD -PxCudaContextManager_release_common_cflags += $(addprefix -D, $(PxCudaContextManager_release_defines)) -PxCudaContextManager_release_common_cflags += $(addprefix -I, $(PxCudaContextManager_release_hpaths)) -PxCudaContextManager_release_common_cflags += -m32 -PxCudaContextManager_release_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_release_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_release_common_cflags += -O3 -fno-strict-aliasing -PxCudaContextManager_release_cflags := $(PxCudaContextManager_release_common_cflags) -PxCudaContextManager_release_cppflags := $(PxCudaContextManager_release_common_cflags) -PxCudaContextManager_release_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_release_lflags += $(addprefix -L, $(PxCudaContextManager_release_lpaths)) -PxCudaContextManager_release_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_release_libraries)) -Wl,--end-group -PxCudaContextManager_release_lflags += -lrt -PxCudaContextManager_release_lflags += -m32 -PxCudaContextManager_release_objsdir = $(OBJS_DIR)/PxCudaContextManager_release -PxCudaContextManager_release_cpp_o = $(addprefix $(PxCudaContextManager_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_release_cc_o = $(addprefix $(PxCudaContextManager_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_release_c_o = $(addprefix $(PxCudaContextManager_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_release_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_release_obj = $(PxCudaContextManager_release_cpp_o) $(PxCudaContextManager_release_cc_o) $(PxCudaContextManager_release_c_o) $(PxCudaContextManager_release_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_release_bin := ./../../../lib/linux32/libPxCudaContextManager.a - -clean_PxCudaContextManager_release: - @$(ECHO) clean PxCudaContextManager release - @$(RMDIR) $(PxCudaContextManager_release_objsdir) - @$(RMDIR) $(PxCudaContextManager_release_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/release - -build_PxCudaContextManager_release: postbuild_PxCudaContextManager_release -postbuild_PxCudaContextManager_release: mainbuild_PxCudaContextManager_release -mainbuild_PxCudaContextManager_release: prebuild_PxCudaContextManager_release $(PxCudaContextManager_release_bin) -prebuild_PxCudaContextManager_release: - -$(PxCudaContextManager_release_bin): $(PxCudaContextManager_release_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxCudaContextManager.a` - @$(AR) rcs $(PxCudaContextManager_release_bin) $(PxCudaContextManager_release_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_release_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin/nvcc" -m32 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m32,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_release_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_release_cpp_o): $(PxCudaContextManager_release_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_release_DEPDIR).d - -$(PxCudaContextManager_release_cc_o): $(PxCudaContextManager_release_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).release.P; \ - rm -f $(PxCudaContextManager_release_DEPDIR).d - -$(PxCudaContextManager_release_c_o): $(PxCudaContextManager_release_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_release_DEPDIR).d - -clean_PxCudaContextManager: clean_PxCudaContextManager_debug clean_PxCudaContextManager_checked clean_PxCudaContextManager_profile clean_PxCudaContextManager_release - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux32/Makefile.PxFoundation.mk b/PxShared/src/compiler/linux32/Makefile.PxFoundation.mk deleted file mode 100644 index d309bbf..0000000 --- a/PxShared/src/compiler/linux32/Makefile.PxFoundation.mk +++ /dev/null @@ -1,372 +0,0 @@ -# Makefile generated by XPJ for linux32 --include Makefile.custom -ProjectName = PxFoundation -PxFoundation_cppfiles += ./../../foundation/src/PsAllocator.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsAssert.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsFoundation.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsMathUtils.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsString.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsTempAllocator.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsUtilities.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixAtomic.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixCpu.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixFPU.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixMutex.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixPrintString.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixSList.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixSocket.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixSync.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixThread.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixTime.cpp - -PxFoundation_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_debug_dep = $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_debug_dep = $(PxFoundation_cpp_debug_dep) $(PxFoundation_cc_debug_dep) $(PxFoundation_c_debug_dep) --include $(PxFoundation_debug_dep) -PxFoundation_cpp_release_dep = $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_release_dep = $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_release_dep = $(PxFoundation_cpp_release_dep) $(PxFoundation_cc_release_dep) $(PxFoundation_c_release_dep) --include $(PxFoundation_release_dep) -PxFoundation_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_checked_dep = $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_checked_dep = $(PxFoundation_cpp_checked_dep) $(PxFoundation_cc_checked_dep) $(PxFoundation_c_checked_dep) --include $(PxFoundation_checked_dep) -PxFoundation_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_profile_dep = $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_profile_dep = $(PxFoundation_cpp_profile_dep) $(PxFoundation_cc_profile_dep) $(PxFoundation_c_profile_dep) --include $(PxFoundation_profile_dep) -PxFoundation_debug_hpaths := -PxFoundation_debug_hpaths += ./../../../include -PxFoundation_debug_hpaths += ./../../foundation/include -PxFoundation_debug_hpaths += ./../../foundation/include/unix -PxFoundation_debug_lpaths := -PxFoundation_debug_defines := $(PxFoundation_custom_defines) -PxFoundation_debug_defines += PX_FOUNDATION_DLL=1 -PxFoundation_debug_defines += _DEBUG -PxFoundation_debug_defines += PX_DEBUG=1 -PxFoundation_debug_defines += PX_CHECKED=1 -PxFoundation_debug_libraries := -PxFoundation_debug_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_debug_common_cflags += -MMD -PxFoundation_debug_common_cflags += $(addprefix -D, $(PxFoundation_debug_defines)) -PxFoundation_debug_common_cflags += $(addprefix -I, $(PxFoundation_debug_hpaths)) -PxFoundation_debug_common_cflags += -m32 -PxFoundation_debug_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_debug_common_cflags += -Wno-missing-field-initializers -PxFoundation_debug_common_cflags += -g3 -gdwarf-2 -PxFoundation_debug_cflags := $(PxFoundation_debug_common_cflags) -PxFoundation_debug_cppflags := $(PxFoundation_debug_common_cflags) -PxFoundation_debug_lflags := $(PxFoundation_custom_lflags) -PxFoundation_debug_lflags += $(addprefix -L, $(PxFoundation_debug_lpaths)) -PxFoundation_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_debug_libraries)) -Wl,--end-group -PxFoundation_debug_lflags += -lrt -PxFoundation_debug_lflags += -m32 -PxFoundation_debug_objsdir = $(OBJS_DIR)/PxFoundation_debug -PxFoundation_debug_cpp_o = $(addprefix $(PxFoundation_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_debug_cc_o = $(addprefix $(PxFoundation_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_debug_c_o = $(addprefix $(PxFoundation_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_debug_obj = $(PxFoundation_debug_cpp_o) $(PxFoundation_debug_cc_o) $(PxFoundation_debug_c_o) -PxFoundation_debug_bin := ./../../../bin/linux32/libPxFoundationDEBUG_x86.so - -clean_PxFoundation_debug: - @$(ECHO) clean PxFoundation debug - @$(RMDIR) $(PxFoundation_debug_objsdir) - @$(RMDIR) $(PxFoundation_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/debug - -build_PxFoundation_debug: postbuild_PxFoundation_debug -postbuild_PxFoundation_debug: mainbuild_PxFoundation_debug -mainbuild_PxFoundation_debug: prebuild_PxFoundation_debug $(PxFoundation_debug_bin) -prebuild_PxFoundation_debug: - -$(PxFoundation_debug_bin): $(PxFoundation_debug_obj) - mkdir -p `dirname ./../../../bin/linux32/libPxFoundationDEBUG_x86.so` - $(CXX) -shared $(PxFoundation_debug_obj) $(PxFoundation_debug_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_debug_cpp_o): $(PxFoundation_debug_objsdir)/%.o: - $(ECHO) PxFoundation: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_debug_DEPDIR).d - -$(PxFoundation_debug_cc_o): $(PxFoundation_debug_objsdir)/%.o: - $(ECHO) PxFoundation: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles))))).debug.P; \ - rm -f $(PxFoundation_debug_DEPDIR).d - -$(PxFoundation_debug_c_o): $(PxFoundation_debug_objsdir)/%.o: - $(ECHO) PxFoundation: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_debug_DEPDIR).d - -PxFoundation_release_hpaths := -PxFoundation_release_hpaths += ./../../../include -PxFoundation_release_hpaths += ./../../foundation/include -PxFoundation_release_hpaths += ./../../foundation/include/unix -PxFoundation_release_lpaths := -PxFoundation_release_defines := $(PxFoundation_custom_defines) -PxFoundation_release_defines += PX_FOUNDATION_DLL=1 -PxFoundation_release_defines += NDEBUG -PxFoundation_release_libraries := -PxFoundation_release_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_release_common_cflags += -MMD -PxFoundation_release_common_cflags += $(addprefix -D, $(PxFoundation_release_defines)) -PxFoundation_release_common_cflags += $(addprefix -I, $(PxFoundation_release_hpaths)) -PxFoundation_release_common_cflags += -m32 -PxFoundation_release_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_release_common_cflags += -Wno-missing-field-initializers -PxFoundation_release_common_cflags += -O3 -fno-strict-aliasing -PxFoundation_release_cflags := $(PxFoundation_release_common_cflags) -PxFoundation_release_cppflags := $(PxFoundation_release_common_cflags) -PxFoundation_release_lflags := $(PxFoundation_custom_lflags) -PxFoundation_release_lflags += $(addprefix -L, $(PxFoundation_release_lpaths)) -PxFoundation_release_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_release_libraries)) -Wl,--end-group -PxFoundation_release_lflags += -lrt -PxFoundation_release_lflags += -m32 -PxFoundation_release_objsdir = $(OBJS_DIR)/PxFoundation_release -PxFoundation_release_cpp_o = $(addprefix $(PxFoundation_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_release_cc_o = $(addprefix $(PxFoundation_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_release_c_o = $(addprefix $(PxFoundation_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_release_obj = $(PxFoundation_release_cpp_o) $(PxFoundation_release_cc_o) $(PxFoundation_release_c_o) -PxFoundation_release_bin := ./../../../bin/linux32/libPxFoundation_x86.so - -clean_PxFoundation_release: - @$(ECHO) clean PxFoundation release - @$(RMDIR) $(PxFoundation_release_objsdir) - @$(RMDIR) $(PxFoundation_release_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/release - -build_PxFoundation_release: postbuild_PxFoundation_release -postbuild_PxFoundation_release: mainbuild_PxFoundation_release -mainbuild_PxFoundation_release: prebuild_PxFoundation_release $(PxFoundation_release_bin) -prebuild_PxFoundation_release: - -$(PxFoundation_release_bin): $(PxFoundation_release_obj) - mkdir -p `dirname ./../../../bin/linux32/libPxFoundation_x86.so` - $(CXX) -shared $(PxFoundation_release_obj) $(PxFoundation_release_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_release_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_release_cpp_o): $(PxFoundation_release_objsdir)/%.o: - $(ECHO) PxFoundation: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_release_DEPDIR).d - -$(PxFoundation_release_cc_o): $(PxFoundation_release_objsdir)/%.o: - $(ECHO) PxFoundation: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles))))).release.P; \ - rm -f $(PxFoundation_release_DEPDIR).d - -$(PxFoundation_release_c_o): $(PxFoundation_release_objsdir)/%.o: - $(ECHO) PxFoundation: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_release_DEPDIR).d - -PxFoundation_checked_hpaths := -PxFoundation_checked_hpaths += ./../../../include -PxFoundation_checked_hpaths += ./../../foundation/include -PxFoundation_checked_hpaths += ./../../foundation/include/unix -PxFoundation_checked_lpaths := -PxFoundation_checked_defines := $(PxFoundation_custom_defines) -PxFoundation_checked_defines += PX_FOUNDATION_DLL=1 -PxFoundation_checked_defines += NDEBUG -PxFoundation_checked_defines += PX_CHECKED=1 -PxFoundation_checked_libraries := -PxFoundation_checked_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_checked_common_cflags += -MMD -PxFoundation_checked_common_cflags += $(addprefix -D, $(PxFoundation_checked_defines)) -PxFoundation_checked_common_cflags += $(addprefix -I, $(PxFoundation_checked_hpaths)) -PxFoundation_checked_common_cflags += -m32 -PxFoundation_checked_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_checked_common_cflags += -Wno-missing-field-initializers -PxFoundation_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxFoundation_checked_cflags := $(PxFoundation_checked_common_cflags) -PxFoundation_checked_cppflags := $(PxFoundation_checked_common_cflags) -PxFoundation_checked_lflags := $(PxFoundation_custom_lflags) -PxFoundation_checked_lflags += $(addprefix -L, $(PxFoundation_checked_lpaths)) -PxFoundation_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_checked_libraries)) -Wl,--end-group -PxFoundation_checked_lflags += -lrt -PxFoundation_checked_lflags += -m32 -PxFoundation_checked_objsdir = $(OBJS_DIR)/PxFoundation_checked -PxFoundation_checked_cpp_o = $(addprefix $(PxFoundation_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_checked_cc_o = $(addprefix $(PxFoundation_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_checked_c_o = $(addprefix $(PxFoundation_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_checked_obj = $(PxFoundation_checked_cpp_o) $(PxFoundation_checked_cc_o) $(PxFoundation_checked_c_o) -PxFoundation_checked_bin := ./../../../bin/linux32/libPxFoundationCHECKED_x86.so - -clean_PxFoundation_checked: - @$(ECHO) clean PxFoundation checked - @$(RMDIR) $(PxFoundation_checked_objsdir) - @$(RMDIR) $(PxFoundation_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/checked - -build_PxFoundation_checked: postbuild_PxFoundation_checked -postbuild_PxFoundation_checked: mainbuild_PxFoundation_checked -mainbuild_PxFoundation_checked: prebuild_PxFoundation_checked $(PxFoundation_checked_bin) -prebuild_PxFoundation_checked: - -$(PxFoundation_checked_bin): $(PxFoundation_checked_obj) - mkdir -p `dirname ./../../../bin/linux32/libPxFoundationCHECKED_x86.so` - $(CXX) -shared $(PxFoundation_checked_obj) $(PxFoundation_checked_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_checked_cpp_o): $(PxFoundation_checked_objsdir)/%.o: - $(ECHO) PxFoundation: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_checked_DEPDIR).d - -$(PxFoundation_checked_cc_o): $(PxFoundation_checked_objsdir)/%.o: - $(ECHO) PxFoundation: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles))))).checked.P; \ - rm -f $(PxFoundation_checked_DEPDIR).d - -$(PxFoundation_checked_c_o): $(PxFoundation_checked_objsdir)/%.o: - $(ECHO) PxFoundation: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_checked_DEPDIR).d - -PxFoundation_profile_hpaths := -PxFoundation_profile_hpaths += ./../../../include -PxFoundation_profile_hpaths += ./../../foundation/include -PxFoundation_profile_hpaths += ./../../foundation/include/unix -PxFoundation_profile_lpaths := -PxFoundation_profile_defines := $(PxFoundation_custom_defines) -PxFoundation_profile_defines += PX_FOUNDATION_DLL=1 -PxFoundation_profile_defines += NDEBUG -PxFoundation_profile_defines += PX_PROFILE=1 -PxFoundation_profile_libraries := -PxFoundation_profile_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_profile_common_cflags += -MMD -PxFoundation_profile_common_cflags += $(addprefix -D, $(PxFoundation_profile_defines)) -PxFoundation_profile_common_cflags += $(addprefix -I, $(PxFoundation_profile_hpaths)) -PxFoundation_profile_common_cflags += -m32 -PxFoundation_profile_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_profile_common_cflags += -Wno-missing-field-initializers -PxFoundation_profile_common_cflags += -O3 -fno-strict-aliasing -PxFoundation_profile_cflags := $(PxFoundation_profile_common_cflags) -PxFoundation_profile_cppflags := $(PxFoundation_profile_common_cflags) -PxFoundation_profile_lflags := $(PxFoundation_custom_lflags) -PxFoundation_profile_lflags += $(addprefix -L, $(PxFoundation_profile_lpaths)) -PxFoundation_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_profile_libraries)) -Wl,--end-group -PxFoundation_profile_lflags += -lrt -PxFoundation_profile_lflags += -m32 -PxFoundation_profile_objsdir = $(OBJS_DIR)/PxFoundation_profile -PxFoundation_profile_cpp_o = $(addprefix $(PxFoundation_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_profile_cc_o = $(addprefix $(PxFoundation_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_profile_c_o = $(addprefix $(PxFoundation_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_profile_obj = $(PxFoundation_profile_cpp_o) $(PxFoundation_profile_cc_o) $(PxFoundation_profile_c_o) -PxFoundation_profile_bin := ./../../../bin/linux32/libPxFoundationPROFILE_x86.so - -clean_PxFoundation_profile: - @$(ECHO) clean PxFoundation profile - @$(RMDIR) $(PxFoundation_profile_objsdir) - @$(RMDIR) $(PxFoundation_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/profile - -build_PxFoundation_profile: postbuild_PxFoundation_profile -postbuild_PxFoundation_profile: mainbuild_PxFoundation_profile -mainbuild_PxFoundation_profile: prebuild_PxFoundation_profile $(PxFoundation_profile_bin) -prebuild_PxFoundation_profile: - -$(PxFoundation_profile_bin): $(PxFoundation_profile_obj) - mkdir -p `dirname ./../../../bin/linux32/libPxFoundationPROFILE_x86.so` - $(CXX) -shared $(PxFoundation_profile_obj) $(PxFoundation_profile_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_profile_cpp_o): $(PxFoundation_profile_objsdir)/%.o: - $(ECHO) PxFoundation: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_profile_DEPDIR).d - -$(PxFoundation_profile_cc_o): $(PxFoundation_profile_objsdir)/%.o: - $(ECHO) PxFoundation: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles))))).profile.P; \ - rm -f $(PxFoundation_profile_DEPDIR).d - -$(PxFoundation_profile_c_o): $(PxFoundation_profile_objsdir)/%.o: - $(ECHO) PxFoundation: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_profile_DEPDIR).d - -clean_PxFoundation: clean_PxFoundation_debug clean_PxFoundation_release clean_PxFoundation_checked clean_PxFoundation_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux32/Makefile.PxPvdSDK.mk b/PxShared/src/compiler/linux32/Makefile.PxPvdSDK.mk deleted file mode 100644 index 06b184f..0000000 --- a/PxShared/src/compiler/linux32/Makefile.PxPvdSDK.mk +++ /dev/null @@ -1,386 +0,0 @@ -# Makefile generated by XPJ for linux32 --include Makefile.custom -ProjectName = PxPvdSDK -PxPvdSDK_cppfiles += ./../../pvd/src/PxProfileEventImpl.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvd.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdDataStream.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdDefaultFileTransport.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdDefaultSocketTransport.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdImpl.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdMemClient.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdObjectModelMetaData.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdObjectRegistrar.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdProfileZoneClient.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdUserRenderer.cpp - -PxPvdSDK_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_debug_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_debug_dep = $(PxPvdSDK_cpp_debug_dep) $(PxPvdSDK_cc_debug_dep) $(PxPvdSDK_c_debug_dep) --include $(PxPvdSDK_debug_dep) -PxPvdSDK_cpp_release_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_release_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_release_dep = $(PxPvdSDK_cpp_release_dep) $(PxPvdSDK_cc_release_dep) $(PxPvdSDK_c_release_dep) --include $(PxPvdSDK_release_dep) -PxPvdSDK_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_checked_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_checked_dep = $(PxPvdSDK_cpp_checked_dep) $(PxPvdSDK_cc_checked_dep) $(PxPvdSDK_c_checked_dep) --include $(PxPvdSDK_checked_dep) -PxPvdSDK_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_profile_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_profile_dep = $(PxPvdSDK_cpp_profile_dep) $(PxPvdSDK_cc_profile_dep) $(PxPvdSDK_c_profile_dep) --include $(PxPvdSDK_profile_dep) -PxPvdSDK_debug_hpaths := -PxPvdSDK_debug_hpaths += ./../../../include -PxPvdSDK_debug_hpaths += ./../../pvd/include -PxPvdSDK_debug_hpaths += ./../../foundation/include -PxPvdSDK_debug_hpaths += ./../../filebuf/include -PxPvdSDK_debug_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_debug_lpaths := -PxPvdSDK_debug_lpaths += ./../../../bin/linux32 -PxPvdSDK_debug_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_debug_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_debug_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_debug_defines += _DEBUG -PxPvdSDK_debug_defines += PX_DEBUG=1 -PxPvdSDK_debug_defines += PX_CHECKED=1 -PxPvdSDK_debug_libraries := -PxPvdSDK_debug_libraries += PxFoundationDEBUG_x86 -PxPvdSDK_debug_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_debug_common_cflags += -MMD -PxPvdSDK_debug_common_cflags += $(addprefix -D, $(PxPvdSDK_debug_defines)) -PxPvdSDK_debug_common_cflags += $(addprefix -I, $(PxPvdSDK_debug_hpaths)) -PxPvdSDK_debug_common_cflags += -m32 -PxPvdSDK_debug_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_debug_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_debug_common_cflags += -g3 -gdwarf-2 -PxPvdSDK_debug_cflags := $(PxPvdSDK_debug_common_cflags) -PxPvdSDK_debug_cppflags := $(PxPvdSDK_debug_common_cflags) -PxPvdSDK_debug_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_debug_lflags += $(addprefix -L, $(PxPvdSDK_debug_lpaths)) -PxPvdSDK_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_debug_libraries)) -Wl,--end-group -PxPvdSDK_debug_lflags += -lrt -PxPvdSDK_debug_lflags += -m32 -PxPvdSDK_debug_objsdir = $(OBJS_DIR)/PxPvdSDK_debug -PxPvdSDK_debug_cpp_o = $(addprefix $(PxPvdSDK_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_debug_cc_o = $(addprefix $(PxPvdSDK_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_debug_c_o = $(addprefix $(PxPvdSDK_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_debug_obj = $(PxPvdSDK_debug_cpp_o) $(PxPvdSDK_debug_cc_o) $(PxPvdSDK_debug_c_o) -PxPvdSDK_debug_bin := ./../../../bin/linux32/libPxPvdSDKDEBUG_x86.so - -clean_PxPvdSDK_debug: - @$(ECHO) clean PxPvdSDK debug - @$(RMDIR) $(PxPvdSDK_debug_objsdir) - @$(RMDIR) $(PxPvdSDK_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/debug - -build_PxPvdSDK_debug: postbuild_PxPvdSDK_debug -postbuild_PxPvdSDK_debug: mainbuild_PxPvdSDK_debug -mainbuild_PxPvdSDK_debug: prebuild_PxPvdSDK_debug $(PxPvdSDK_debug_bin) -prebuild_PxPvdSDK_debug: - -$(PxPvdSDK_debug_bin): $(PxPvdSDK_debug_obj) build_PxFoundation_debug - mkdir -p `dirname ./../../../bin/linux32/libPxPvdSDKDEBUG_x86.so` - $(CXX) -shared $(PxPvdSDK_debug_obj) $(PxPvdSDK_debug_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_debug_cpp_o): $(PxPvdSDK_debug_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_debug_DEPDIR).d - -$(PxPvdSDK_debug_cc_o): $(PxPvdSDK_debug_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).debug.P; \ - rm -f $(PxPvdSDK_debug_DEPDIR).d - -$(PxPvdSDK_debug_c_o): $(PxPvdSDK_debug_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_debug_DEPDIR).d - -PxPvdSDK_release_hpaths := -PxPvdSDK_release_hpaths += ./../../../include -PxPvdSDK_release_hpaths += ./../../pvd/include -PxPvdSDK_release_hpaths += ./../../foundation/include -PxPvdSDK_release_hpaths += ./../../filebuf/include -PxPvdSDK_release_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_release_lpaths := -PxPvdSDK_release_lpaths += ./../../../bin/linux32 -PxPvdSDK_release_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_release_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_release_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_release_defines += NDEBUG -PxPvdSDK_release_libraries := -PxPvdSDK_release_libraries += PxFoundation_x86 -PxPvdSDK_release_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_release_common_cflags += -MMD -PxPvdSDK_release_common_cflags += $(addprefix -D, $(PxPvdSDK_release_defines)) -PxPvdSDK_release_common_cflags += $(addprefix -I, $(PxPvdSDK_release_hpaths)) -PxPvdSDK_release_common_cflags += -m32 -PxPvdSDK_release_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_release_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_release_common_cflags += -O3 -fno-strict-aliasing -PxPvdSDK_release_cflags := $(PxPvdSDK_release_common_cflags) -PxPvdSDK_release_cppflags := $(PxPvdSDK_release_common_cflags) -PxPvdSDK_release_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_release_lflags += $(addprefix -L, $(PxPvdSDK_release_lpaths)) -PxPvdSDK_release_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_release_libraries)) -Wl,--end-group -PxPvdSDK_release_lflags += -lrt -PxPvdSDK_release_lflags += -m32 -PxPvdSDK_release_objsdir = $(OBJS_DIR)/PxPvdSDK_release -PxPvdSDK_release_cpp_o = $(addprefix $(PxPvdSDK_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_release_cc_o = $(addprefix $(PxPvdSDK_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_release_c_o = $(addprefix $(PxPvdSDK_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_release_obj = $(PxPvdSDK_release_cpp_o) $(PxPvdSDK_release_cc_o) $(PxPvdSDK_release_c_o) -PxPvdSDK_release_bin := ./../../../bin/linux32/libPxPvdSDK_x86.so - -clean_PxPvdSDK_release: - @$(ECHO) clean PxPvdSDK release - @$(RMDIR) $(PxPvdSDK_release_objsdir) - @$(RMDIR) $(PxPvdSDK_release_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/release - -build_PxPvdSDK_release: postbuild_PxPvdSDK_release -postbuild_PxPvdSDK_release: mainbuild_PxPvdSDK_release -mainbuild_PxPvdSDK_release: prebuild_PxPvdSDK_release $(PxPvdSDK_release_bin) -prebuild_PxPvdSDK_release: - -$(PxPvdSDK_release_bin): $(PxPvdSDK_release_obj) build_PxFoundation_release - mkdir -p `dirname ./../../../bin/linux32/libPxPvdSDK_x86.so` - $(CXX) -shared $(PxPvdSDK_release_obj) $(PxPvdSDK_release_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_release_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_release_cpp_o): $(PxPvdSDK_release_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_release_DEPDIR).d - -$(PxPvdSDK_release_cc_o): $(PxPvdSDK_release_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).release.P; \ - rm -f $(PxPvdSDK_release_DEPDIR).d - -$(PxPvdSDK_release_c_o): $(PxPvdSDK_release_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_release_DEPDIR).d - -PxPvdSDK_checked_hpaths := -PxPvdSDK_checked_hpaths += ./../../../include -PxPvdSDK_checked_hpaths += ./../../pvd/include -PxPvdSDK_checked_hpaths += ./../../foundation/include -PxPvdSDK_checked_hpaths += ./../../filebuf/include -PxPvdSDK_checked_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_checked_lpaths := -PxPvdSDK_checked_lpaths += ./../../../bin/linux32 -PxPvdSDK_checked_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_checked_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_checked_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_checked_defines += NDEBUG -PxPvdSDK_checked_defines += PX_CHECKED=1 -PxPvdSDK_checked_libraries := -PxPvdSDK_checked_libraries += PxFoundationCHECKED_x86 -PxPvdSDK_checked_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_checked_common_cflags += -MMD -PxPvdSDK_checked_common_cflags += $(addprefix -D, $(PxPvdSDK_checked_defines)) -PxPvdSDK_checked_common_cflags += $(addprefix -I, $(PxPvdSDK_checked_hpaths)) -PxPvdSDK_checked_common_cflags += -m32 -PxPvdSDK_checked_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_checked_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxPvdSDK_checked_cflags := $(PxPvdSDK_checked_common_cflags) -PxPvdSDK_checked_cppflags := $(PxPvdSDK_checked_common_cflags) -PxPvdSDK_checked_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_checked_lflags += $(addprefix -L, $(PxPvdSDK_checked_lpaths)) -PxPvdSDK_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_checked_libraries)) -Wl,--end-group -PxPvdSDK_checked_lflags += -lrt -PxPvdSDK_checked_lflags += -m32 -PxPvdSDK_checked_objsdir = $(OBJS_DIR)/PxPvdSDK_checked -PxPvdSDK_checked_cpp_o = $(addprefix $(PxPvdSDK_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_checked_cc_o = $(addprefix $(PxPvdSDK_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_checked_c_o = $(addprefix $(PxPvdSDK_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_checked_obj = $(PxPvdSDK_checked_cpp_o) $(PxPvdSDK_checked_cc_o) $(PxPvdSDK_checked_c_o) -PxPvdSDK_checked_bin := ./../../../bin/linux32/libPxPvdSDKCHECKED_x86.so - -clean_PxPvdSDK_checked: - @$(ECHO) clean PxPvdSDK checked - @$(RMDIR) $(PxPvdSDK_checked_objsdir) - @$(RMDIR) $(PxPvdSDK_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/checked - -build_PxPvdSDK_checked: postbuild_PxPvdSDK_checked -postbuild_PxPvdSDK_checked: mainbuild_PxPvdSDK_checked -mainbuild_PxPvdSDK_checked: prebuild_PxPvdSDK_checked $(PxPvdSDK_checked_bin) -prebuild_PxPvdSDK_checked: - -$(PxPvdSDK_checked_bin): $(PxPvdSDK_checked_obj) build_PxFoundation_checked - mkdir -p `dirname ./../../../bin/linux32/libPxPvdSDKCHECKED_x86.so` - $(CXX) -shared $(PxPvdSDK_checked_obj) $(PxPvdSDK_checked_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_checked_cpp_o): $(PxPvdSDK_checked_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_checked_DEPDIR).d - -$(PxPvdSDK_checked_cc_o): $(PxPvdSDK_checked_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).checked.P; \ - rm -f $(PxPvdSDK_checked_DEPDIR).d - -$(PxPvdSDK_checked_c_o): $(PxPvdSDK_checked_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_checked_DEPDIR).d - -PxPvdSDK_profile_hpaths := -PxPvdSDK_profile_hpaths += ./../../../include -PxPvdSDK_profile_hpaths += ./../../pvd/include -PxPvdSDK_profile_hpaths += ./../../foundation/include -PxPvdSDK_profile_hpaths += ./../../filebuf/include -PxPvdSDK_profile_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_profile_lpaths := -PxPvdSDK_profile_lpaths += ./../../../bin/linux32 -PxPvdSDK_profile_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_profile_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_profile_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_profile_defines += NDEBUG -PxPvdSDK_profile_defines += PX_PROFILE=1 -PxPvdSDK_profile_libraries := -PxPvdSDK_profile_libraries += PxFoundationPROFILE_x86 -PxPvdSDK_profile_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_profile_common_cflags += -MMD -PxPvdSDK_profile_common_cflags += $(addprefix -D, $(PxPvdSDK_profile_defines)) -PxPvdSDK_profile_common_cflags += $(addprefix -I, $(PxPvdSDK_profile_hpaths)) -PxPvdSDK_profile_common_cflags += -m32 -PxPvdSDK_profile_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_profile_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_profile_common_cflags += -O3 -fno-strict-aliasing -PxPvdSDK_profile_cflags := $(PxPvdSDK_profile_common_cflags) -PxPvdSDK_profile_cppflags := $(PxPvdSDK_profile_common_cflags) -PxPvdSDK_profile_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_profile_lflags += $(addprefix -L, $(PxPvdSDK_profile_lpaths)) -PxPvdSDK_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_profile_libraries)) -Wl,--end-group -PxPvdSDK_profile_lflags += -lrt -PxPvdSDK_profile_lflags += -m32 -PxPvdSDK_profile_objsdir = $(OBJS_DIR)/PxPvdSDK_profile -PxPvdSDK_profile_cpp_o = $(addprefix $(PxPvdSDK_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_profile_cc_o = $(addprefix $(PxPvdSDK_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_profile_c_o = $(addprefix $(PxPvdSDK_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_profile_obj = $(PxPvdSDK_profile_cpp_o) $(PxPvdSDK_profile_cc_o) $(PxPvdSDK_profile_c_o) -PxPvdSDK_profile_bin := ./../../../bin/linux32/libPxPvdSDKPROFILE_x86.so - -clean_PxPvdSDK_profile: - @$(ECHO) clean PxPvdSDK profile - @$(RMDIR) $(PxPvdSDK_profile_objsdir) - @$(RMDIR) $(PxPvdSDK_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/profile - -build_PxPvdSDK_profile: postbuild_PxPvdSDK_profile -postbuild_PxPvdSDK_profile: mainbuild_PxPvdSDK_profile -mainbuild_PxPvdSDK_profile: prebuild_PxPvdSDK_profile $(PxPvdSDK_profile_bin) -prebuild_PxPvdSDK_profile: - -$(PxPvdSDK_profile_bin): $(PxPvdSDK_profile_obj) build_PxFoundation_profile - mkdir -p `dirname ./../../../bin/linux32/libPxPvdSDKPROFILE_x86.so` - $(CXX) -shared $(PxPvdSDK_profile_obj) $(PxPvdSDK_profile_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_profile_cpp_o): $(PxPvdSDK_profile_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_profile_DEPDIR).d - -$(PxPvdSDK_profile_cc_o): $(PxPvdSDK_profile_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).profile.P; \ - rm -f $(PxPvdSDK_profile_DEPDIR).d - -$(PxPvdSDK_profile_c_o): $(PxPvdSDK_profile_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_profile_DEPDIR).d - -clean_PxPvdSDK: clean_PxPvdSDK_debug clean_PxPvdSDK_release clean_PxPvdSDK_checked clean_PxPvdSDK_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux32/Makefile.PxTask.mk b/PxShared/src/compiler/linux32/Makefile.PxTask.mk deleted file mode 100644 index 4dabdcc..0000000 --- a/PxShared/src/compiler/linux32/Makefile.PxTask.mk +++ /dev/null @@ -1,352 +0,0 @@ -# Makefile generated by XPJ for linux32 --include Makefile.custom -ProjectName = PxTask -PxTask_cppfiles += ./../../task/src/TaskManager.cpp - -PxTask_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxTask_ccfiles))))) -PxTask_c_debug_dep = $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_debug_dep = $(PxTask_cpp_debug_dep) $(PxTask_cc_debug_dep) $(PxTask_c_debug_dep) --include $(PxTask_debug_dep) -PxTask_cpp_release_dep = $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxTask_ccfiles))))) -PxTask_c_release_dep = $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_release_dep = $(PxTask_cpp_release_dep) $(PxTask_cc_release_dep) $(PxTask_c_release_dep) --include $(PxTask_release_dep) -PxTask_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxTask_ccfiles))))) -PxTask_c_checked_dep = $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_checked_dep = $(PxTask_cpp_checked_dep) $(PxTask_cc_checked_dep) $(PxTask_c_checked_dep) --include $(PxTask_checked_dep) -PxTask_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxTask_ccfiles))))) -PxTask_c_profile_dep = $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_profile_dep = $(PxTask_cpp_profile_dep) $(PxTask_cc_profile_dep) $(PxTask_c_profile_dep) --include $(PxTask_profile_dep) -PxTask_debug_hpaths := -PxTask_debug_hpaths += ./../../../include -PxTask_debug_hpaths += ./../../task/include -PxTask_debug_hpaths += ./../../foundation/include -PxTask_debug_lpaths := -PxTask_debug_defines := $(PxTask_custom_defines) -PxTask_debug_defines += _DEBUG -PxTask_debug_defines += PX_DEBUG=1 -PxTask_debug_defines += PX_CHECKED=1 -PxTask_debug_libraries := -PxTask_debug_common_cflags := $(PxTask_custom_cflags) -PxTask_debug_common_cflags += -MMD -PxTask_debug_common_cflags += $(addprefix -D, $(PxTask_debug_defines)) -PxTask_debug_common_cflags += $(addprefix -I, $(PxTask_debug_hpaths)) -PxTask_debug_common_cflags += -m32 -PxTask_debug_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_debug_common_cflags += -Wno-missing-field-initializers -PxTask_debug_common_cflags += -g3 -gdwarf-2 -PxTask_debug_cflags := $(PxTask_debug_common_cflags) -PxTask_debug_cppflags := $(PxTask_debug_common_cflags) -PxTask_debug_lflags := $(PxTask_custom_lflags) -PxTask_debug_lflags += $(addprefix -L, $(PxTask_debug_lpaths)) -PxTask_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_debug_libraries)) -Wl,--end-group -PxTask_debug_lflags += -lrt -PxTask_debug_lflags += -m32 -PxTask_debug_objsdir = $(OBJS_DIR)/PxTask_debug -PxTask_debug_cpp_o = $(addprefix $(PxTask_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_debug_cc_o = $(addprefix $(PxTask_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_debug_c_o = $(addprefix $(PxTask_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_debug_obj = $(PxTask_debug_cpp_o) $(PxTask_debug_cc_o) $(PxTask_debug_c_o) -PxTask_debug_bin := ./../../../lib/linux32/libPxTaskDEBUG.a - -clean_PxTask_debug: - @$(ECHO) clean PxTask debug - @$(RMDIR) $(PxTask_debug_objsdir) - @$(RMDIR) $(PxTask_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/debug - -build_PxTask_debug: postbuild_PxTask_debug -postbuild_PxTask_debug: mainbuild_PxTask_debug -mainbuild_PxTask_debug: prebuild_PxTask_debug $(PxTask_debug_bin) -prebuild_PxTask_debug: - -$(PxTask_debug_bin): $(PxTask_debug_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxTaskDEBUG.a` - @$(AR) rcs $(PxTask_debug_bin) $(PxTask_debug_obj) - $(ECHO) building $@ complete! - -PxTask_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_debug_cpp_o): $(PxTask_debug_objsdir)/%.o: - $(ECHO) PxTask: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_debug_DEPDIR).d - -$(PxTask_debug_cc_o): $(PxTask_debug_objsdir)/%.o: - $(ECHO) PxTask: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles))))).debug.P; \ - rm -f $(PxTask_debug_DEPDIR).d - -$(PxTask_debug_c_o): $(PxTask_debug_objsdir)/%.o: - $(ECHO) PxTask: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_debug_DEPDIR).d - -PxTask_release_hpaths := -PxTask_release_hpaths += ./../../../include -PxTask_release_hpaths += ./../../task/include -PxTask_release_hpaths += ./../../foundation/include -PxTask_release_lpaths := -PxTask_release_defines := $(PxTask_custom_defines) -PxTask_release_defines += NDEBUG -PxTask_release_libraries := -PxTask_release_common_cflags := $(PxTask_custom_cflags) -PxTask_release_common_cflags += -MMD -PxTask_release_common_cflags += $(addprefix -D, $(PxTask_release_defines)) -PxTask_release_common_cflags += $(addprefix -I, $(PxTask_release_hpaths)) -PxTask_release_common_cflags += -m32 -PxTask_release_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_release_common_cflags += -Wno-missing-field-initializers -PxTask_release_common_cflags += -O3 -fno-strict-aliasing -PxTask_release_cflags := $(PxTask_release_common_cflags) -PxTask_release_cppflags := $(PxTask_release_common_cflags) -PxTask_release_lflags := $(PxTask_custom_lflags) -PxTask_release_lflags += $(addprefix -L, $(PxTask_release_lpaths)) -PxTask_release_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_release_libraries)) -Wl,--end-group -PxTask_release_lflags += -lrt -PxTask_release_lflags += -m32 -PxTask_release_objsdir = $(OBJS_DIR)/PxTask_release -PxTask_release_cpp_o = $(addprefix $(PxTask_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_release_cc_o = $(addprefix $(PxTask_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_release_c_o = $(addprefix $(PxTask_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_release_obj = $(PxTask_release_cpp_o) $(PxTask_release_cc_o) $(PxTask_release_c_o) -PxTask_release_bin := ./../../../lib/linux32/libPxTask.a - -clean_PxTask_release: - @$(ECHO) clean PxTask release - @$(RMDIR) $(PxTask_release_objsdir) - @$(RMDIR) $(PxTask_release_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/release - -build_PxTask_release: postbuild_PxTask_release -postbuild_PxTask_release: mainbuild_PxTask_release -mainbuild_PxTask_release: prebuild_PxTask_release $(PxTask_release_bin) -prebuild_PxTask_release: - -$(PxTask_release_bin): $(PxTask_release_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxTask.a` - @$(AR) rcs $(PxTask_release_bin) $(PxTask_release_obj) - $(ECHO) building $@ complete! - -PxTask_release_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_release_cpp_o): $(PxTask_release_objsdir)/%.o: - $(ECHO) PxTask: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_release_DEPDIR).d - -$(PxTask_release_cc_o): $(PxTask_release_objsdir)/%.o: - $(ECHO) PxTask: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles))))).release.P; \ - rm -f $(PxTask_release_DEPDIR).d - -$(PxTask_release_c_o): $(PxTask_release_objsdir)/%.o: - $(ECHO) PxTask: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_release_DEPDIR).d - -PxTask_checked_hpaths := -PxTask_checked_hpaths += ./../../../include -PxTask_checked_hpaths += ./../../task/include -PxTask_checked_hpaths += ./../../foundation/include -PxTask_checked_lpaths := -PxTask_checked_defines := $(PxTask_custom_defines) -PxTask_checked_defines += NDEBUG -PxTask_checked_defines += PX_CHECKED=1 -PxTask_checked_libraries := -PxTask_checked_common_cflags := $(PxTask_custom_cflags) -PxTask_checked_common_cflags += -MMD -PxTask_checked_common_cflags += $(addprefix -D, $(PxTask_checked_defines)) -PxTask_checked_common_cflags += $(addprefix -I, $(PxTask_checked_hpaths)) -PxTask_checked_common_cflags += -m32 -PxTask_checked_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_checked_common_cflags += -Wno-missing-field-initializers -PxTask_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxTask_checked_cflags := $(PxTask_checked_common_cflags) -PxTask_checked_cppflags := $(PxTask_checked_common_cflags) -PxTask_checked_lflags := $(PxTask_custom_lflags) -PxTask_checked_lflags += $(addprefix -L, $(PxTask_checked_lpaths)) -PxTask_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_checked_libraries)) -Wl,--end-group -PxTask_checked_lflags += -lrt -PxTask_checked_lflags += -m32 -PxTask_checked_objsdir = $(OBJS_DIR)/PxTask_checked -PxTask_checked_cpp_o = $(addprefix $(PxTask_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_checked_cc_o = $(addprefix $(PxTask_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_checked_c_o = $(addprefix $(PxTask_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_checked_obj = $(PxTask_checked_cpp_o) $(PxTask_checked_cc_o) $(PxTask_checked_c_o) -PxTask_checked_bin := ./../../../lib/linux32/libPxTaskCHECKED.a - -clean_PxTask_checked: - @$(ECHO) clean PxTask checked - @$(RMDIR) $(PxTask_checked_objsdir) - @$(RMDIR) $(PxTask_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/checked - -build_PxTask_checked: postbuild_PxTask_checked -postbuild_PxTask_checked: mainbuild_PxTask_checked -mainbuild_PxTask_checked: prebuild_PxTask_checked $(PxTask_checked_bin) -prebuild_PxTask_checked: - -$(PxTask_checked_bin): $(PxTask_checked_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxTaskCHECKED.a` - @$(AR) rcs $(PxTask_checked_bin) $(PxTask_checked_obj) - $(ECHO) building $@ complete! - -PxTask_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_checked_cpp_o): $(PxTask_checked_objsdir)/%.o: - $(ECHO) PxTask: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_checked_DEPDIR).d - -$(PxTask_checked_cc_o): $(PxTask_checked_objsdir)/%.o: - $(ECHO) PxTask: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles))))).checked.P; \ - rm -f $(PxTask_checked_DEPDIR).d - -$(PxTask_checked_c_o): $(PxTask_checked_objsdir)/%.o: - $(ECHO) PxTask: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_checked_DEPDIR).d - -PxTask_profile_hpaths := -PxTask_profile_hpaths += ./../../../include -PxTask_profile_hpaths += ./../../task/include -PxTask_profile_hpaths += ./../../foundation/include -PxTask_profile_lpaths := -PxTask_profile_defines := $(PxTask_custom_defines) -PxTask_profile_defines += NDEBUG -PxTask_profile_defines += PX_PROFILE=1 -PxTask_profile_libraries := -PxTask_profile_common_cflags := $(PxTask_custom_cflags) -PxTask_profile_common_cflags += -MMD -PxTask_profile_common_cflags += $(addprefix -D, $(PxTask_profile_defines)) -PxTask_profile_common_cflags += $(addprefix -I, $(PxTask_profile_hpaths)) -PxTask_profile_common_cflags += -m32 -PxTask_profile_common_cflags += -Werror -m32 -fPIC -msse2 -mfpmath=sse -malign-double -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_profile_common_cflags += -Wno-missing-field-initializers -PxTask_profile_common_cflags += -O3 -fno-strict-aliasing -PxTask_profile_cflags := $(PxTask_profile_common_cflags) -PxTask_profile_cppflags := $(PxTask_profile_common_cflags) -PxTask_profile_lflags := $(PxTask_custom_lflags) -PxTask_profile_lflags += $(addprefix -L, $(PxTask_profile_lpaths)) -PxTask_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_profile_libraries)) -Wl,--end-group -PxTask_profile_lflags += -lrt -PxTask_profile_lflags += -m32 -PxTask_profile_objsdir = $(OBJS_DIR)/PxTask_profile -PxTask_profile_cpp_o = $(addprefix $(PxTask_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_profile_cc_o = $(addprefix $(PxTask_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_profile_c_o = $(addprefix $(PxTask_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_profile_obj = $(PxTask_profile_cpp_o) $(PxTask_profile_cc_o) $(PxTask_profile_c_o) -PxTask_profile_bin := ./../../../lib/linux32/libPxTaskPROFILE.a - -clean_PxTask_profile: - @$(ECHO) clean PxTask profile - @$(RMDIR) $(PxTask_profile_objsdir) - @$(RMDIR) $(PxTask_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/profile - -build_PxTask_profile: postbuild_PxTask_profile -postbuild_PxTask_profile: mainbuild_PxTask_profile -mainbuild_PxTask_profile: prebuild_PxTask_profile $(PxTask_profile_bin) -prebuild_PxTask_profile: - -$(PxTask_profile_bin): $(PxTask_profile_obj) - mkdir -p `dirname ./../../../lib/linux32/libPxTaskPROFILE.a` - @$(AR) rcs $(PxTask_profile_bin) $(PxTask_profile_obj) - $(ECHO) building $@ complete! - -PxTask_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_profile_cpp_o): $(PxTask_profile_objsdir)/%.o: - $(ECHO) PxTask: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_profile_DEPDIR).d - -$(PxTask_profile_cc_o): $(PxTask_profile_objsdir)/%.o: - $(ECHO) PxTask: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles))))).profile.P; \ - rm -f $(PxTask_profile_DEPDIR).d - -$(PxTask_profile_c_o): $(PxTask_profile_objsdir)/%.o: - $(ECHO) PxTask: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_profile_DEPDIR).d - -clean_PxTask: clean_PxTask_debug clean_PxTask_release clean_PxTask_checked clean_PxTask_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux64/Makefile b/PxShared/src/compiler/linux64/Makefile deleted file mode 100644 index fa9ad43..0000000 --- a/PxShared/src/compiler/linux64/Makefile +++ /dev/null @@ -1,209 +0,0 @@ -#!/usr/bin/make -# Makefile generated by XPJ for linux64 - -DEPSDIR = .deps -#default defines -OBJS_DIR = build -RMDIR = rm -fr -ECHO = echo -CCLD = g++ -CXX = g++ -CC = gcc -RANLIB = ranlib -AR = ar -STRIP = strip -OBJDUMP = objdump -OBJCOPY = objcopy --include Makedefs.linux64.mk - -all: checked debug profile release - -checked: build_PxCudaContextManager_checked - -debug: build_PxCudaContextManager_debug - -profile: build_PxCudaContextManager_profile - -release: build_PxCudaContextManager_release - -clean: clean_PxCudaContextManager_debug clean_PxCudaContextManager_checked clean_PxCudaContextManager_profile clean_PxCudaContextManager_release - rm -rf $(DEPSDIR) - - -clean_debug: clean_PxCudaContextManager_debug - rm -rf $(DEPSDIR) - - -clean_checked: clean_PxCudaContextManager_checked - rm -rf $(DEPSDIR) - - -clean_profile: clean_PxCudaContextManager_profile - rm -rf $(DEPSDIR) - - -clean_release: clean_PxCudaContextManager_release - rm -rf $(DEPSDIR) - - -include Makefile.PxCudaContextManager.mk - - -# Disable implicit rules to speedup build -.SUFFIXES: -SUFFIXES := -%.out: -%.a: -%.ln: -%.o: -%: %.o -%.c: -%: %.c -%.ln: %.c -%.o: %.c -%.cc: -%: %.cc -%.o: %.cc -%.C: -%: %.C -%.o: %.C -%.cpp: -%: %.cpp -%.o: %.cpp -%.p: -%: %.p -%.o: %.p -%.f: -%: - %.f%.o: %.f -%.F: -%: %.F -%.o: %.F -%.f: %.F -%.r: -%: %.r -%.o: %.r -%.f: %.r -%.y: -%.ln: %.y -%.c: %.y -%.l: -%.ln: %.l -%.c: %.l -%.r: %.l -%.s: -%: %.s -%.o: %.s -%.S: -%: %.S -%.o: %.S -%.s: %.S -%.mod: -%: %.mod -%.o: %.mod -%.sym: -%.def: -%.sym: %.def -%.h: -%.info: -%.dvi: -%.tex: -%.dvi: %.tex -%.texinfo: -%.info: %.texinfo -%.dvi: %.texinfo -%.texi: -%.info: %.texi -%.dvi: %.texi -%.txinfo: -%.info: %.txinfo -%.dvi: %.txinfo -%.w: -%.c: %.w -%.tex: %.w -%.ch: -%.web: -%.p: %.web -%.tex: %.web -%.sh: -%: %.sh -%.elc: -%.el: -(%): % -%.out: % -%.c: %.w %.ch -%.tex: %.w %.ch -%: %,v -%: RCS/%,v -%: RCS/% -%: s.% -%: SCCS/s.% -.web.p: -.l.r: -.dvi: -.F.o: -.l: -.y.ln: -.o: -.y: -.def.sym: -.p.o: -.p: -.txinfo.dvi: -.a: -.l.ln: -.w.c: -.texi.dvi: -.sh: -.cc: -.cc.o: -.def: -.c.o: -.r.o: -.r: -.info: -.elc: -.l.c: -.out: -.C: -.r.f: -.S: -.texinfo.info: -.c: -.w.tex: -.c.ln: -.s.o: -.s: -.texinfo.dvi: -.el: -.texinfo: -.y.c: -.web.tex: -.texi.info: -.DEFAULT: -.h: -.tex.dvi: -.cpp.o: -.cpp: -.C.o: -.ln: -.texi: -.txinfo: -.tex: -.txinfo.info: -.ch: -.S.s: -.mod: -.mod.o: -.F.f: -.w: -.S.o: -.F: -.web: -.sym: -.f: -.f.o: -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux64/Makefile.PsFastXml.mk b/PxShared/src/compiler/linux64/Makefile.PsFastXml.mk deleted file mode 100644 index ae3d9da..0000000 --- a/PxShared/src/compiler/linux64/Makefile.PsFastXml.mk +++ /dev/null @@ -1,356 +0,0 @@ -# Makefile generated by XPJ for linux64 --include Makefile.custom -ProjectName = PsFastXml -PsFastXml_cppfiles += ./../../fastxml/src/PsFastXml.cpp - -PsFastXml_cpp_debug_dep = $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_debug_dep = $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_debug_dep = $(PsFastXml_cpp_debug_dep) $(PsFastXml_cc_debug_dep) $(PsFastXml_c_debug_dep) --include $(PsFastXml_debug_dep) -PsFastXml_cpp_release_dep = $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_release_dep = $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_release_dep = $(PsFastXml_cpp_release_dep) $(PsFastXml_cc_release_dep) $(PsFastXml_c_release_dep) --include $(PsFastXml_release_dep) -PsFastXml_cpp_checked_dep = $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_checked_dep = $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_checked_dep = $(PsFastXml_cpp_checked_dep) $(PsFastXml_cc_checked_dep) $(PsFastXml_c_checked_dep) --include $(PsFastXml_checked_dep) -PsFastXml_cpp_profile_dep = $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PsFastXml_cppfiles))))) -PsFastXml_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PsFastXml_ccfiles))))) -PsFastXml_c_profile_dep = $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PsFastXml_cfiles))))) -PsFastXml_profile_dep = $(PsFastXml_cpp_profile_dep) $(PsFastXml_cc_profile_dep) $(PsFastXml_c_profile_dep) --include $(PsFastXml_profile_dep) -PsFastXml_debug_hpaths := -PsFastXml_debug_hpaths += ./../../../include -PsFastXml_debug_hpaths += ./../../foundation/include -PsFastXml_debug_hpaths += ./../../fastxml/include -PsFastXml_debug_lpaths := -PsFastXml_debug_defines := $(PsFastXml_custom_defines) -PsFastXml_debug_defines += PX_FOUNDATION_DLL=0 -PsFastXml_debug_defines += _DEBUG -PsFastXml_debug_defines += PX_DEBUG=1 -PsFastXml_debug_defines += PX_CHECKED=1 -PsFastXml_debug_libraries := -PsFastXml_debug_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_debug_common_cflags += -MMD -PsFastXml_debug_common_cflags += $(addprefix -D, $(PsFastXml_debug_defines)) -PsFastXml_debug_common_cflags += $(addprefix -I, $(PsFastXml_debug_hpaths)) -PsFastXml_debug_common_cflags += -m64 -PsFastXml_debug_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_debug_common_cflags += -Wno-missing-field-initializers -PsFastXml_debug_common_cflags += -g3 -gdwarf-2 -PsFastXml_debug_cflags := $(PsFastXml_debug_common_cflags) -PsFastXml_debug_cppflags := $(PsFastXml_debug_common_cflags) -PsFastXml_debug_lflags := $(PsFastXml_custom_lflags) -PsFastXml_debug_lflags += $(addprefix -L, $(PsFastXml_debug_lpaths)) -PsFastXml_debug_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_debug_libraries)) -Wl,--end-group -PsFastXml_debug_lflags += -lrt -PsFastXml_debug_lflags += -m64 -PsFastXml_debug_objsdir = $(OBJS_DIR)/PsFastXml_debug -PsFastXml_debug_cpp_o = $(addprefix $(PsFastXml_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_debug_cc_o = $(addprefix $(PsFastXml_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_debug_c_o = $(addprefix $(PsFastXml_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_debug_obj = $(PsFastXml_debug_cpp_o) $(PsFastXml_debug_cc_o) $(PsFastXml_debug_c_o) -PsFastXml_debug_bin := ./../../../lib/linux64/libPsFastXmlDEBUG.a - -clean_PsFastXml_debug: - @$(ECHO) clean PsFastXml debug - @$(RMDIR) $(PsFastXml_debug_objsdir) - @$(RMDIR) $(PsFastXml_debug_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/debug - -build_PsFastXml_debug: postbuild_PsFastXml_debug -postbuild_PsFastXml_debug: mainbuild_PsFastXml_debug -mainbuild_PsFastXml_debug: prebuild_PsFastXml_debug $(PsFastXml_debug_bin) -prebuild_PsFastXml_debug: - -$(PsFastXml_debug_bin): $(PsFastXml_debug_obj) - mkdir -p `dirname ./../../../lib/linux64/libPsFastXmlDEBUG.a` - @$(AR) rcs $(PsFastXml_debug_bin) $(PsFastXml_debug_obj) - $(ECHO) building $@ complete! - -PsFastXml_debug_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_debug_cpp_o): $(PsFastXml_debug_objsdir)/%.o: - $(ECHO) PsFastXml: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_debug_DEPDIR).d - -$(PsFastXml_debug_cc_o): $(PsFastXml_debug_objsdir)/%.o: - $(ECHO) PsFastXml: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_ccfiles))))).debug.P; \ - rm -f $(PsFastXml_debug_DEPDIR).d - -$(PsFastXml_debug_c_o): $(PsFastXml_debug_objsdir)/%.o: - $(ECHO) PsFastXml: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_debug_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_debug_DEPDIR).d - -PsFastXml_release_hpaths := -PsFastXml_release_hpaths += ./../../../include -PsFastXml_release_hpaths += ./../../foundation/include -PsFastXml_release_hpaths += ./../../fastxml/include -PsFastXml_release_lpaths := -PsFastXml_release_defines := $(PsFastXml_custom_defines) -PsFastXml_release_defines += PX_FOUNDATION_DLL=0 -PsFastXml_release_defines += NDEBUG -PsFastXml_release_libraries := -PsFastXml_release_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_release_common_cflags += -MMD -PsFastXml_release_common_cflags += $(addprefix -D, $(PsFastXml_release_defines)) -PsFastXml_release_common_cflags += $(addprefix -I, $(PsFastXml_release_hpaths)) -PsFastXml_release_common_cflags += -m64 -PsFastXml_release_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_release_common_cflags += -Wno-missing-field-initializers -PsFastXml_release_common_cflags += -O3 -fno-strict-aliasing -PsFastXml_release_cflags := $(PsFastXml_release_common_cflags) -PsFastXml_release_cppflags := $(PsFastXml_release_common_cflags) -PsFastXml_release_lflags := $(PsFastXml_custom_lflags) -PsFastXml_release_lflags += $(addprefix -L, $(PsFastXml_release_lpaths)) -PsFastXml_release_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_release_libraries)) -Wl,--end-group -PsFastXml_release_lflags += -lrt -PsFastXml_release_lflags += -m64 -PsFastXml_release_objsdir = $(OBJS_DIR)/PsFastXml_release -PsFastXml_release_cpp_o = $(addprefix $(PsFastXml_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_release_cc_o = $(addprefix $(PsFastXml_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_release_c_o = $(addprefix $(PsFastXml_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_release_obj = $(PsFastXml_release_cpp_o) $(PsFastXml_release_cc_o) $(PsFastXml_release_c_o) -PsFastXml_release_bin := ./../../../lib/linux64/libPsFastXml.a - -clean_PsFastXml_release: - @$(ECHO) clean PsFastXml release - @$(RMDIR) $(PsFastXml_release_objsdir) - @$(RMDIR) $(PsFastXml_release_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/release - -build_PsFastXml_release: postbuild_PsFastXml_release -postbuild_PsFastXml_release: mainbuild_PsFastXml_release -mainbuild_PsFastXml_release: prebuild_PsFastXml_release $(PsFastXml_release_bin) -prebuild_PsFastXml_release: - -$(PsFastXml_release_bin): $(PsFastXml_release_obj) - mkdir -p `dirname ./../../../lib/linux64/libPsFastXml.a` - @$(AR) rcs $(PsFastXml_release_bin) $(PsFastXml_release_obj) - $(ECHO) building $@ complete! - -PsFastXml_release_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_release_cpp_o): $(PsFastXml_release_objsdir)/%.o: - $(ECHO) PsFastXml: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_release_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_release_DEPDIR).d - -$(PsFastXml_release_cc_o): $(PsFastXml_release_objsdir)/%.o: - $(ECHO) PsFastXml: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_ccfiles))))).release.P; \ - rm -f $(PsFastXml_release_DEPDIR).d - -$(PsFastXml_release_c_o): $(PsFastXml_release_objsdir)/%.o: - $(ECHO) PsFastXml: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_release_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_release_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_release_DEPDIR).d - -PsFastXml_checked_hpaths := -PsFastXml_checked_hpaths += ./../../../include -PsFastXml_checked_hpaths += ./../../foundation/include -PsFastXml_checked_hpaths += ./../../fastxml/include -PsFastXml_checked_lpaths := -PsFastXml_checked_defines := $(PsFastXml_custom_defines) -PsFastXml_checked_defines += PX_FOUNDATION_DLL=0 -PsFastXml_checked_defines += NDEBUG -PsFastXml_checked_defines += PX_CHECKED=1 -PsFastXml_checked_libraries := -PsFastXml_checked_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_checked_common_cflags += -MMD -PsFastXml_checked_common_cflags += $(addprefix -D, $(PsFastXml_checked_defines)) -PsFastXml_checked_common_cflags += $(addprefix -I, $(PsFastXml_checked_hpaths)) -PsFastXml_checked_common_cflags += -m64 -PsFastXml_checked_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_checked_common_cflags += -Wno-missing-field-initializers -PsFastXml_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PsFastXml_checked_cflags := $(PsFastXml_checked_common_cflags) -PsFastXml_checked_cppflags := $(PsFastXml_checked_common_cflags) -PsFastXml_checked_lflags := $(PsFastXml_custom_lflags) -PsFastXml_checked_lflags += $(addprefix -L, $(PsFastXml_checked_lpaths)) -PsFastXml_checked_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_checked_libraries)) -Wl,--end-group -PsFastXml_checked_lflags += -lrt -PsFastXml_checked_lflags += -m64 -PsFastXml_checked_objsdir = $(OBJS_DIR)/PsFastXml_checked -PsFastXml_checked_cpp_o = $(addprefix $(PsFastXml_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_checked_cc_o = $(addprefix $(PsFastXml_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_checked_c_o = $(addprefix $(PsFastXml_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_checked_obj = $(PsFastXml_checked_cpp_o) $(PsFastXml_checked_cc_o) $(PsFastXml_checked_c_o) -PsFastXml_checked_bin := ./../../../lib/linux64/libPsFastXmlCHECKED.a - -clean_PsFastXml_checked: - @$(ECHO) clean PsFastXml checked - @$(RMDIR) $(PsFastXml_checked_objsdir) - @$(RMDIR) $(PsFastXml_checked_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/checked - -build_PsFastXml_checked: postbuild_PsFastXml_checked -postbuild_PsFastXml_checked: mainbuild_PsFastXml_checked -mainbuild_PsFastXml_checked: prebuild_PsFastXml_checked $(PsFastXml_checked_bin) -prebuild_PsFastXml_checked: - -$(PsFastXml_checked_bin): $(PsFastXml_checked_obj) - mkdir -p `dirname ./../../../lib/linux64/libPsFastXmlCHECKED.a` - @$(AR) rcs $(PsFastXml_checked_bin) $(PsFastXml_checked_obj) - $(ECHO) building $@ complete! - -PsFastXml_checked_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_checked_cpp_o): $(PsFastXml_checked_objsdir)/%.o: - $(ECHO) PsFastXml: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_checked_DEPDIR).d - -$(PsFastXml_checked_cc_o): $(PsFastXml_checked_objsdir)/%.o: - $(ECHO) PsFastXml: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_ccfiles))))).checked.P; \ - rm -f $(PsFastXml_checked_DEPDIR).d - -$(PsFastXml_checked_c_o): $(PsFastXml_checked_objsdir)/%.o: - $(ECHO) PsFastXml: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_checked_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_checked_DEPDIR).d - -PsFastXml_profile_hpaths := -PsFastXml_profile_hpaths += ./../../../include -PsFastXml_profile_hpaths += ./../../foundation/include -PsFastXml_profile_hpaths += ./../../fastxml/include -PsFastXml_profile_lpaths := -PsFastXml_profile_defines := $(PsFastXml_custom_defines) -PsFastXml_profile_defines += PX_FOUNDATION_DLL=0 -PsFastXml_profile_defines += NDEBUG -PsFastXml_profile_defines += PX_PROFILE=1 -PsFastXml_profile_libraries := -PsFastXml_profile_common_cflags := $(PsFastXml_custom_cflags) -PsFastXml_profile_common_cflags += -MMD -PsFastXml_profile_common_cflags += $(addprefix -D, $(PsFastXml_profile_defines)) -PsFastXml_profile_common_cflags += $(addprefix -I, $(PsFastXml_profile_hpaths)) -PsFastXml_profile_common_cflags += -m64 -PsFastXml_profile_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PsFastXml_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PsFastXml_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PsFastXml_profile_common_cflags += -Wno-missing-field-initializers -PsFastXml_profile_common_cflags += -O3 -fno-strict-aliasing -PsFastXml_profile_cflags := $(PsFastXml_profile_common_cflags) -PsFastXml_profile_cppflags := $(PsFastXml_profile_common_cflags) -PsFastXml_profile_lflags := $(PsFastXml_custom_lflags) -PsFastXml_profile_lflags += $(addprefix -L, $(PsFastXml_profile_lpaths)) -PsFastXml_profile_lflags += -Wl,--start-group $(addprefix -l, $(PsFastXml_profile_libraries)) -Wl,--end-group -PsFastXml_profile_lflags += -lrt -PsFastXml_profile_lflags += -m64 -PsFastXml_profile_objsdir = $(OBJS_DIR)/PsFastXml_profile -PsFastXml_profile_cpp_o = $(addprefix $(PsFastXml_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PsFastXml_cppfiles))))) -PsFastXml_profile_cc_o = $(addprefix $(PsFastXml_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PsFastXml_ccfiles))))) -PsFastXml_profile_c_o = $(addprefix $(PsFastXml_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PsFastXml_cfiles))))) -PsFastXml_profile_obj = $(PsFastXml_profile_cpp_o) $(PsFastXml_profile_cc_o) $(PsFastXml_profile_c_o) -PsFastXml_profile_bin := ./../../../lib/linux64/libPsFastXmlPROFILE.a - -clean_PsFastXml_profile: - @$(ECHO) clean PsFastXml profile - @$(RMDIR) $(PsFastXml_profile_objsdir) - @$(RMDIR) $(PsFastXml_profile_bin) - @$(RMDIR) $(DEPSDIR)/PsFastXml/profile - -build_PsFastXml_profile: postbuild_PsFastXml_profile -postbuild_PsFastXml_profile: mainbuild_PsFastXml_profile -mainbuild_PsFastXml_profile: prebuild_PsFastXml_profile $(PsFastXml_profile_bin) -prebuild_PsFastXml_profile: - -$(PsFastXml_profile_bin): $(PsFastXml_profile_obj) - mkdir -p `dirname ./../../../lib/linux64/libPsFastXmlPROFILE.a` - @$(AR) rcs $(PsFastXml_profile_bin) $(PsFastXml_profile_obj) - $(ECHO) building $@ complete! - -PsFastXml_profile_DEPDIR = $(dir $(@))/$(*F) -$(PsFastXml_profile_cpp_o): $(PsFastXml_profile_objsdir)/%.o: - $(ECHO) PsFastXml: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles)))))) - cp $(PsFastXml_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cppfiles))))).P; \ - rm -f $(PsFastXml_profile_DEPDIR).d - -$(PsFastXml_profile_cc_o): $(PsFastXml_profile_objsdir)/%.o: - $(ECHO) PsFastXml: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PsFastXml_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles)))))) - cp $(PsFastXml_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_ccfiles))))).profile.P; \ - rm -f $(PsFastXml_profile_DEPDIR).d - -$(PsFastXml_profile_c_o): $(PsFastXml_profile_objsdir)/%.o: - $(ECHO) PsFastXml: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PsFastXml_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles)))))) - cp $(PsFastXml_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PsFastXml_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PsFastXml/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PsFastXml_profile_objsdir),, $@))), $(PsFastXml_cfiles))))).P; \ - rm -f $(PsFastXml_profile_DEPDIR).d - -clean_PsFastXml: clean_PsFastXml_debug clean_PsFastXml_release clean_PsFastXml_checked clean_PsFastXml_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux64/Makefile.PxCudaContextManager.mk b/PxShared/src/compiler/linux64/Makefile.PxCudaContextManager.mk deleted file mode 100644 index 6cf7540..0000000 --- a/PxShared/src/compiler/linux64/Makefile.PxCudaContextManager.mk +++ /dev/null @@ -1,391 +0,0 @@ -# Makefile generated by XPJ for linux64 --include Makefile.custom -ProjectName = PxCudaContextManager -PxCudaContextManager_cppfiles += ./../../cudamanager/src/BlockingWait.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/CudaContextManager.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/CudaKernelWrangler.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/CudaMemoryManager.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/GpuDispatcher.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/HeapManagerRef.cpp -PxCudaContextManager_cppfiles += ./../../cudamanager/src/PhysXDeviceSettings.cpp -PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu += ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_debug_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_debug_dep = $(PxCudaContextManager_cpp_debug_dep) $(PxCudaContextManager_cc_debug_dep) $(PxCudaContextManager_c_debug_dep) --include $(PxCudaContextManager_debug_dep) -PxCudaContextManager_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_checked_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_checked_dep = $(PxCudaContextManager_cpp_checked_dep) $(PxCudaContextManager_cc_checked_dep) $(PxCudaContextManager_c_checked_dep) --include $(PxCudaContextManager_checked_dep) -PxCudaContextManager_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_profile_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_profile_dep = $(PxCudaContextManager_cpp_profile_dep) $(PxCudaContextManager_cc_profile_dep) $(PxCudaContextManager_c_profile_dep) --include $(PxCudaContextManager_profile_dep) -PxCudaContextManager_cpp_release_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_c_release_dep = $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_release_dep = $(PxCudaContextManager_cpp_release_dep) $(PxCudaContextManager_cc_release_dep) $(PxCudaContextManager_c_release_dep) --include $(PxCudaContextManager_release_dep) -PxCudaContextManager_debug_hpaths := -PxCudaContextManager_debug_hpaths += ./../../../include -PxCudaContextManager_debug_hpaths += ./../../foundation/include -PxCudaContextManager_debug_hpaths += ./../../task/include -PxCudaContextManager_debug_hpaths += ./../../cudamanager/include -PxCudaContextManager_debug_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_debug_lpaths := -PxCudaContextManager_debug_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_debug_defines += _DEBUG -PxCudaContextManager_debug_defines += PX_DEBUG=1 -PxCudaContextManager_debug_defines += PX_CHECKED=1 -PxCudaContextManager_debug_libraries := -PxCudaContextManager_debug_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_debug_common_cflags += -MMD -PxCudaContextManager_debug_common_cflags += $(addprefix -D, $(PxCudaContextManager_debug_defines)) -PxCudaContextManager_debug_common_cflags += $(addprefix -I, $(PxCudaContextManager_debug_hpaths)) -PxCudaContextManager_debug_common_cflags += -m64 -PxCudaContextManager_debug_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_debug_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_debug_common_cflags += -g3 -gdwarf-2 -PxCudaContextManager_debug_cflags := $(PxCudaContextManager_debug_common_cflags) -PxCudaContextManager_debug_cppflags := $(PxCudaContextManager_debug_common_cflags) -PxCudaContextManager_debug_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_debug_lflags += $(addprefix -L, $(PxCudaContextManager_debug_lpaths)) -PxCudaContextManager_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_debug_libraries)) -Wl,--end-group -PxCudaContextManager_debug_lflags += -lrt -PxCudaContextManager_debug_lflags += -m64 -PxCudaContextManager_debug_objsdir = $(OBJS_DIR)/PxCudaContextManager_debug -PxCudaContextManager_debug_cpp_o = $(addprefix $(PxCudaContextManager_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_debug_cc_o = $(addprefix $(PxCudaContextManager_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_debug_c_o = $(addprefix $(PxCudaContextManager_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_debug_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_debug_obj = $(PxCudaContextManager_debug_cpp_o) $(PxCudaContextManager_debug_cc_o) $(PxCudaContextManager_debug_c_o) $(PxCudaContextManager_debug_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_debug_bin := ./../../../lib/linux64/libPxCudaContextManagerDEBUG.a - -clean_PxCudaContextManager_debug: - @$(ECHO) clean PxCudaContextManager debug - @$(RMDIR) $(PxCudaContextManager_debug_objsdir) - @$(RMDIR) $(PxCudaContextManager_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/debug - -build_PxCudaContextManager_debug: postbuild_PxCudaContextManager_debug -postbuild_PxCudaContextManager_debug: mainbuild_PxCudaContextManager_debug -mainbuild_PxCudaContextManager_debug: prebuild_PxCudaContextManager_debug $(PxCudaContextManager_debug_bin) -prebuild_PxCudaContextManager_debug: - -$(PxCudaContextManager_debug_bin): $(PxCudaContextManager_debug_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxCudaContextManagerDEBUG.a` - @$(AR) rcs $(PxCudaContextManager_debug_bin) $(PxCudaContextManager_debug_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_debug_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -D_DEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -D_DEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_debug/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_debug_cpp_o): $(PxCudaContextManager_debug_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_debug_DEPDIR).d - -$(PxCudaContextManager_debug_cc_o): $(PxCudaContextManager_debug_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).debug.P; \ - rm -f $(PxCudaContextManager_debug_DEPDIR).d - -$(PxCudaContextManager_debug_c_o): $(PxCudaContextManager_debug_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_debug_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_debug_DEPDIR).d - -PxCudaContextManager_checked_hpaths := -PxCudaContextManager_checked_hpaths += ./../../../include -PxCudaContextManager_checked_hpaths += ./../../foundation/include -PxCudaContextManager_checked_hpaths += ./../../task/include -PxCudaContextManager_checked_hpaths += ./../../cudamanager/include -PxCudaContextManager_checked_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_checked_lpaths := -PxCudaContextManager_checked_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_checked_defines += NDEBUG -PxCudaContextManager_checked_defines += PX_CHECKED=1 -PxCudaContextManager_checked_libraries := -PxCudaContextManager_checked_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_checked_common_cflags += -MMD -PxCudaContextManager_checked_common_cflags += $(addprefix -D, $(PxCudaContextManager_checked_defines)) -PxCudaContextManager_checked_common_cflags += $(addprefix -I, $(PxCudaContextManager_checked_hpaths)) -PxCudaContextManager_checked_common_cflags += -m64 -PxCudaContextManager_checked_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_checked_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxCudaContextManager_checked_cflags := $(PxCudaContextManager_checked_common_cflags) -PxCudaContextManager_checked_cppflags := $(PxCudaContextManager_checked_common_cflags) -PxCudaContextManager_checked_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_checked_lflags += $(addprefix -L, $(PxCudaContextManager_checked_lpaths)) -PxCudaContextManager_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_checked_libraries)) -Wl,--end-group -PxCudaContextManager_checked_lflags += -lrt -PxCudaContextManager_checked_lflags += -m64 -PxCudaContextManager_checked_objsdir = $(OBJS_DIR)/PxCudaContextManager_checked -PxCudaContextManager_checked_cpp_o = $(addprefix $(PxCudaContextManager_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_checked_cc_o = $(addprefix $(PxCudaContextManager_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_checked_c_o = $(addprefix $(PxCudaContextManager_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_checked_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_checked_obj = $(PxCudaContextManager_checked_cpp_o) $(PxCudaContextManager_checked_cc_o) $(PxCudaContextManager_checked_c_o) $(PxCudaContextManager_checked_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_checked_bin := ./../../../lib/linux64/libPxCudaContextManagerCHECKED.a - -clean_PxCudaContextManager_checked: - @$(ECHO) clean PxCudaContextManager checked - @$(RMDIR) $(PxCudaContextManager_checked_objsdir) - @$(RMDIR) $(PxCudaContextManager_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/checked - -build_PxCudaContextManager_checked: postbuild_PxCudaContextManager_checked -postbuild_PxCudaContextManager_checked: mainbuild_PxCudaContextManager_checked -mainbuild_PxCudaContextManager_checked: prebuild_PxCudaContextManager_checked $(PxCudaContextManager_checked_bin) -prebuild_PxCudaContextManager_checked: - -$(PxCudaContextManager_checked_bin): $(PxCudaContextManager_checked_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxCudaContextManagerCHECKED.a` - @$(AR) rcs $(PxCudaContextManager_checked_bin) $(PxCudaContextManager_checked_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_checked_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_checked/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_checked_cpp_o): $(PxCudaContextManager_checked_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_checked_DEPDIR).d - -$(PxCudaContextManager_checked_cc_o): $(PxCudaContextManager_checked_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).checked.P; \ - rm -f $(PxCudaContextManager_checked_DEPDIR).d - -$(PxCudaContextManager_checked_c_o): $(PxCudaContextManager_checked_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_checked_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_checked_DEPDIR).d - -PxCudaContextManager_profile_hpaths := -PxCudaContextManager_profile_hpaths += ./../../../include -PxCudaContextManager_profile_hpaths += ./../../foundation/include -PxCudaContextManager_profile_hpaths += ./../../task/include -PxCudaContextManager_profile_hpaths += ./../../cudamanager/include -PxCudaContextManager_profile_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_profile_lpaths := -PxCudaContextManager_profile_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_profile_defines += NDEBUG -PxCudaContextManager_profile_defines += PX_PROFILE=1 -PxCudaContextManager_profile_libraries := -PxCudaContextManager_profile_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_profile_common_cflags += -MMD -PxCudaContextManager_profile_common_cflags += $(addprefix -D, $(PxCudaContextManager_profile_defines)) -PxCudaContextManager_profile_common_cflags += $(addprefix -I, $(PxCudaContextManager_profile_hpaths)) -PxCudaContextManager_profile_common_cflags += -m64 -PxCudaContextManager_profile_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_profile_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_profile_common_cflags += -O3 -fno-strict-aliasing -PxCudaContextManager_profile_cflags := $(PxCudaContextManager_profile_common_cflags) -PxCudaContextManager_profile_cppflags := $(PxCudaContextManager_profile_common_cflags) -PxCudaContextManager_profile_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_profile_lflags += $(addprefix -L, $(PxCudaContextManager_profile_lpaths)) -PxCudaContextManager_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_profile_libraries)) -Wl,--end-group -PxCudaContextManager_profile_lflags += -lrt -PxCudaContextManager_profile_lflags += -m64 -PxCudaContextManager_profile_objsdir = $(OBJS_DIR)/PxCudaContextManager_profile -PxCudaContextManager_profile_cpp_o = $(addprefix $(PxCudaContextManager_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_profile_cc_o = $(addprefix $(PxCudaContextManager_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_profile_c_o = $(addprefix $(PxCudaContextManager_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_profile_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_profile_obj = $(PxCudaContextManager_profile_cpp_o) $(PxCudaContextManager_profile_cc_o) $(PxCudaContextManager_profile_c_o) $(PxCudaContextManager_profile_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_profile_bin := ./../../../lib/linux64/libPxCudaContextManagerPROFILE.a - -clean_PxCudaContextManager_profile: - @$(ECHO) clean PxCudaContextManager profile - @$(RMDIR) $(PxCudaContextManager_profile_objsdir) - @$(RMDIR) $(PxCudaContextManager_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/profile - -build_PxCudaContextManager_profile: postbuild_PxCudaContextManager_profile -postbuild_PxCudaContextManager_profile: mainbuild_PxCudaContextManager_profile -mainbuild_PxCudaContextManager_profile: prebuild_PxCudaContextManager_profile $(PxCudaContextManager_profile_bin) -prebuild_PxCudaContextManager_profile: - -$(PxCudaContextManager_profile_bin): $(PxCudaContextManager_profile_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxCudaContextManagerPROFILE.a` - @$(AR) rcs $(PxCudaContextManager_profile_bin) $(PxCudaContextManager_profile_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_profile_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_profile/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_profile_cpp_o): $(PxCudaContextManager_profile_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_profile_DEPDIR).d - -$(PxCudaContextManager_profile_cc_o): $(PxCudaContextManager_profile_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).profile.P; \ - rm -f $(PxCudaContextManager_profile_DEPDIR).d - -$(PxCudaContextManager_profile_c_o): $(PxCudaContextManager_profile_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_profile_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_profile_DEPDIR).d - -PxCudaContextManager_release_hpaths := -PxCudaContextManager_release_hpaths += ./../../../include -PxCudaContextManager_release_hpaths += ./../../foundation/include -PxCudaContextManager_release_hpaths += ./../../task/include -PxCudaContextManager_release_hpaths += ./../../cudamanager/include -PxCudaContextManager_release_hpaths += ./../../../../../../externals/CUDA/6.5.19-linux/include -PxCudaContextManager_release_lpaths := -PxCudaContextManager_release_defines := $(PxCudaContextManager_custom_defines) -PxCudaContextManager_release_defines += NDEBUG -PxCudaContextManager_release_libraries := -PxCudaContextManager_release_common_cflags := $(PxCudaContextManager_custom_cflags) -PxCudaContextManager_release_common_cflags += -MMD -PxCudaContextManager_release_common_cflags += $(addprefix -D, $(PxCudaContextManager_release_defines)) -PxCudaContextManager_release_common_cflags += $(addprefix -I, $(PxCudaContextManager_release_hpaths)) -PxCudaContextManager_release_common_cflags += -m64 -PxCudaContextManager_release_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxCudaContextManager_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxCudaContextManager_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxCudaContextManager_release_common_cflags += -Wno-missing-field-initializers -PxCudaContextManager_release_common_cflags += -O3 -fno-strict-aliasing -PxCudaContextManager_release_cflags := $(PxCudaContextManager_release_common_cflags) -PxCudaContextManager_release_cppflags := $(PxCudaContextManager_release_common_cflags) -PxCudaContextManager_release_lflags := $(PxCudaContextManager_custom_lflags) -PxCudaContextManager_release_lflags += $(addprefix -L, $(PxCudaContextManager_release_lpaths)) -PxCudaContextManager_release_lflags += -Wl,--start-group $(addprefix -l, $(PxCudaContextManager_release_libraries)) -Wl,--end-group -PxCudaContextManager_release_lflags += -lrt -PxCudaContextManager_release_lflags += -m64 -PxCudaContextManager_release_objsdir = $(OBJS_DIR)/PxCudaContextManager_release -PxCudaContextManager_release_cpp_o = $(addprefix $(PxCudaContextManager_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxCudaContextManager_cppfiles))))) -PxCudaContextManager_release_cc_o = $(addprefix $(PxCudaContextManager_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxCudaContextManager_ccfiles))))) -PxCudaContextManager_release_c_o = $(addprefix $(PxCudaContextManager_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxCudaContextManager_cfiles))))) -PxCudaContextManager_release_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o += $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o -PxCudaContextManager_release_obj = $(PxCudaContextManager_release_cpp_o) $(PxCudaContextManager_release_cc_o) $(PxCudaContextManager_release_c_o) $(PxCudaContextManager_release_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o) -PxCudaContextManager_release_bin := ./../../../lib/linux64/libPxCudaContextManager.a - -clean_PxCudaContextManager_release: - @$(ECHO) clean PxCudaContextManager release - @$(RMDIR) $(PxCudaContextManager_release_objsdir) - @$(RMDIR) $(PxCudaContextManager_release_bin) - @$(RMDIR) $(DEPSDIR)/PxCudaContextManager/release - -build_PxCudaContextManager_release: postbuild_PxCudaContextManager_release -postbuild_PxCudaContextManager_release: mainbuild_PxCudaContextManager_release -mainbuild_PxCudaContextManager_release: prebuild_PxCudaContextManager_release $(PxCudaContextManager_release_bin) -prebuild_PxCudaContextManager_release: - -$(PxCudaContextManager_release_bin): $(PxCudaContextManager_release_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxCudaContextManager.a` - @$(AR) rcs $(PxCudaContextManager_release_bin) $(PxCudaContextManager_release_obj) - $(ECHO) building $@ complete! - -$(PxCudaContextManager_release_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu_o): $(PxCudaContextManager_CUDA_src_cudamanager_src_CUDA_UtilKernels_cu) - @mkdir -p `dirname $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o` - $(ECHO) "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - "E:/nx0/sw/physx/externals/CUDA/6.5.19-linux/bin64/nvcc" -m64 -lineinfo -use_fast_math -ftz=true -prec-div=false -prec-sqrt=false -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=sm_50 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_60,code=compute_60 -DNDEBUG --compiler-options=-Wall,-O3,-fPIC,-msse2,-mfpmath=sse,-malign-double,-m64,-fvisibility=hidden -IE:/nx0/sw/physx/PxShared/1.0/trunk/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/foundation/include -IE:/nx0/sw/physx/PxShared/1.0/trunk/src/cudamanager/include --compile -o $(OBJS_DIR)/PxCudaContextManager_release/CUDA_src/cudamanager/src/CUDAUtilKernels.o ./../../cudamanager/src/CUDA/UtilKernels.cu - -PxCudaContextManager_release_DEPDIR = $(dir $(@))/$(*F) -$(PxCudaContextManager_release_cpp_o): $(PxCudaContextManager_release_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles)))))) - cp $(PxCudaContextManager_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cppfiles))))).P; \ - rm -f $(PxCudaContextManager_release_DEPDIR).d - -$(PxCudaContextManager_release_cc_o): $(PxCudaContextManager_release_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxCudaContextManager_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles)))))) - cp $(PxCudaContextManager_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_ccfiles))))).release.P; \ - rm -f $(PxCudaContextManager_release_DEPDIR).d - -$(PxCudaContextManager_release_c_o): $(PxCudaContextManager_release_objsdir)/%.o: - $(ECHO) PxCudaContextManager: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxCudaContextManager_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles)))))) - cp $(PxCudaContextManager_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxCudaContextManager_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxCudaContextManager/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxCudaContextManager_release_objsdir),, $@))), $(PxCudaContextManager_cfiles))))).P; \ - rm -f $(PxCudaContextManager_release_DEPDIR).d - -clean_PxCudaContextManager: clean_PxCudaContextManager_debug clean_PxCudaContextManager_checked clean_PxCudaContextManager_profile clean_PxCudaContextManager_release - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux64/Makefile.PxFoundation.mk b/PxShared/src/compiler/linux64/Makefile.PxFoundation.mk deleted file mode 100644 index eefcbb3..0000000 --- a/PxShared/src/compiler/linux64/Makefile.PxFoundation.mk +++ /dev/null @@ -1,372 +0,0 @@ -# Makefile generated by XPJ for linux64 --include Makefile.custom -ProjectName = PxFoundation -PxFoundation_cppfiles += ./../../foundation/src/PsAllocator.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsAssert.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsFoundation.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsMathUtils.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsString.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsTempAllocator.cpp -PxFoundation_cppfiles += ./../../foundation/src/PsUtilities.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixAtomic.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixCpu.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixFPU.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixMutex.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixPrintString.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixSList.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixSocket.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixSync.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixThread.cpp -PxFoundation_cppfiles += ./../../foundation/src/unix/PsUnixTime.cpp - -PxFoundation_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_debug_dep = $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_debug_dep = $(PxFoundation_cpp_debug_dep) $(PxFoundation_cc_debug_dep) $(PxFoundation_c_debug_dep) --include $(PxFoundation_debug_dep) -PxFoundation_cpp_release_dep = $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_release_dep = $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_release_dep = $(PxFoundation_cpp_release_dep) $(PxFoundation_cc_release_dep) $(PxFoundation_c_release_dep) --include $(PxFoundation_release_dep) -PxFoundation_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_checked_dep = $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_checked_dep = $(PxFoundation_cpp_checked_dep) $(PxFoundation_cc_checked_dep) $(PxFoundation_c_checked_dep) --include $(PxFoundation_checked_dep) -PxFoundation_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxFoundation_cppfiles))))) -PxFoundation_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxFoundation_ccfiles))))) -PxFoundation_c_profile_dep = $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxFoundation_cfiles))))) -PxFoundation_profile_dep = $(PxFoundation_cpp_profile_dep) $(PxFoundation_cc_profile_dep) $(PxFoundation_c_profile_dep) --include $(PxFoundation_profile_dep) -PxFoundation_debug_hpaths := -PxFoundation_debug_hpaths += ./../../../include -PxFoundation_debug_hpaths += ./../../foundation/include -PxFoundation_debug_hpaths += ./../../foundation/include/unix -PxFoundation_debug_lpaths := -PxFoundation_debug_defines := $(PxFoundation_custom_defines) -PxFoundation_debug_defines += PX_FOUNDATION_DLL=1 -PxFoundation_debug_defines += _DEBUG -PxFoundation_debug_defines += PX_DEBUG=1 -PxFoundation_debug_defines += PX_CHECKED=1 -PxFoundation_debug_libraries := -PxFoundation_debug_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_debug_common_cflags += -MMD -PxFoundation_debug_common_cflags += $(addprefix -D, $(PxFoundation_debug_defines)) -PxFoundation_debug_common_cflags += $(addprefix -I, $(PxFoundation_debug_hpaths)) -PxFoundation_debug_common_cflags += -m64 -PxFoundation_debug_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_debug_common_cflags += -Wno-missing-field-initializers -PxFoundation_debug_common_cflags += -g3 -gdwarf-2 -PxFoundation_debug_cflags := $(PxFoundation_debug_common_cflags) -PxFoundation_debug_cppflags := $(PxFoundation_debug_common_cflags) -PxFoundation_debug_lflags := $(PxFoundation_custom_lflags) -PxFoundation_debug_lflags += $(addprefix -L, $(PxFoundation_debug_lpaths)) -PxFoundation_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_debug_libraries)) -Wl,--end-group -PxFoundation_debug_lflags += -lrt -PxFoundation_debug_lflags += -m64 -PxFoundation_debug_objsdir = $(OBJS_DIR)/PxFoundation_debug -PxFoundation_debug_cpp_o = $(addprefix $(PxFoundation_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_debug_cc_o = $(addprefix $(PxFoundation_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_debug_c_o = $(addprefix $(PxFoundation_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_debug_obj = $(PxFoundation_debug_cpp_o) $(PxFoundation_debug_cc_o) $(PxFoundation_debug_c_o) -PxFoundation_debug_bin := ./../../../bin/linux64/libPxFoundationDEBUG_x64.so - -clean_PxFoundation_debug: - @$(ECHO) clean PxFoundation debug - @$(RMDIR) $(PxFoundation_debug_objsdir) - @$(RMDIR) $(PxFoundation_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/debug - -build_PxFoundation_debug: postbuild_PxFoundation_debug -postbuild_PxFoundation_debug: mainbuild_PxFoundation_debug -mainbuild_PxFoundation_debug: prebuild_PxFoundation_debug $(PxFoundation_debug_bin) -prebuild_PxFoundation_debug: - -$(PxFoundation_debug_bin): $(PxFoundation_debug_obj) - mkdir -p `dirname ./../../../bin/linux64/libPxFoundationDEBUG_x64.so` - $(CXX) -shared $(PxFoundation_debug_obj) $(PxFoundation_debug_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_debug_cpp_o): $(PxFoundation_debug_objsdir)/%.o: - $(ECHO) PxFoundation: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_debug_DEPDIR).d - -$(PxFoundation_debug_cc_o): $(PxFoundation_debug_objsdir)/%.o: - $(ECHO) PxFoundation: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_ccfiles))))).debug.P; \ - rm -f $(PxFoundation_debug_DEPDIR).d - -$(PxFoundation_debug_c_o): $(PxFoundation_debug_objsdir)/%.o: - $(ECHO) PxFoundation: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_debug_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_debug_DEPDIR).d - -PxFoundation_release_hpaths := -PxFoundation_release_hpaths += ./../../../include -PxFoundation_release_hpaths += ./../../foundation/include -PxFoundation_release_hpaths += ./../../foundation/include/unix -PxFoundation_release_lpaths := -PxFoundation_release_defines := $(PxFoundation_custom_defines) -PxFoundation_release_defines += PX_FOUNDATION_DLL=1 -PxFoundation_release_defines += NDEBUG -PxFoundation_release_libraries := -PxFoundation_release_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_release_common_cflags += -MMD -PxFoundation_release_common_cflags += $(addprefix -D, $(PxFoundation_release_defines)) -PxFoundation_release_common_cflags += $(addprefix -I, $(PxFoundation_release_hpaths)) -PxFoundation_release_common_cflags += -m64 -PxFoundation_release_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_release_common_cflags += -Wno-missing-field-initializers -PxFoundation_release_common_cflags += -O3 -fno-strict-aliasing -PxFoundation_release_cflags := $(PxFoundation_release_common_cflags) -PxFoundation_release_cppflags := $(PxFoundation_release_common_cflags) -PxFoundation_release_lflags := $(PxFoundation_custom_lflags) -PxFoundation_release_lflags += $(addprefix -L, $(PxFoundation_release_lpaths)) -PxFoundation_release_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_release_libraries)) -Wl,--end-group -PxFoundation_release_lflags += -lrt -PxFoundation_release_lflags += -m64 -PxFoundation_release_objsdir = $(OBJS_DIR)/PxFoundation_release -PxFoundation_release_cpp_o = $(addprefix $(PxFoundation_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_release_cc_o = $(addprefix $(PxFoundation_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_release_c_o = $(addprefix $(PxFoundation_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_release_obj = $(PxFoundation_release_cpp_o) $(PxFoundation_release_cc_o) $(PxFoundation_release_c_o) -PxFoundation_release_bin := ./../../../bin/linux64/libPxFoundation_x64.so - -clean_PxFoundation_release: - @$(ECHO) clean PxFoundation release - @$(RMDIR) $(PxFoundation_release_objsdir) - @$(RMDIR) $(PxFoundation_release_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/release - -build_PxFoundation_release: postbuild_PxFoundation_release -postbuild_PxFoundation_release: mainbuild_PxFoundation_release -mainbuild_PxFoundation_release: prebuild_PxFoundation_release $(PxFoundation_release_bin) -prebuild_PxFoundation_release: - -$(PxFoundation_release_bin): $(PxFoundation_release_obj) - mkdir -p `dirname ./../../../bin/linux64/libPxFoundation_x64.so` - $(CXX) -shared $(PxFoundation_release_obj) $(PxFoundation_release_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_release_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_release_cpp_o): $(PxFoundation_release_objsdir)/%.o: - $(ECHO) PxFoundation: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_release_DEPDIR).d - -$(PxFoundation_release_cc_o): $(PxFoundation_release_objsdir)/%.o: - $(ECHO) PxFoundation: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_ccfiles))))).release.P; \ - rm -f $(PxFoundation_release_DEPDIR).d - -$(PxFoundation_release_c_o): $(PxFoundation_release_objsdir)/%.o: - $(ECHO) PxFoundation: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_release_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_release_DEPDIR).d - -PxFoundation_checked_hpaths := -PxFoundation_checked_hpaths += ./../../../include -PxFoundation_checked_hpaths += ./../../foundation/include -PxFoundation_checked_hpaths += ./../../foundation/include/unix -PxFoundation_checked_lpaths := -PxFoundation_checked_defines := $(PxFoundation_custom_defines) -PxFoundation_checked_defines += PX_FOUNDATION_DLL=1 -PxFoundation_checked_defines += NDEBUG -PxFoundation_checked_defines += PX_CHECKED=1 -PxFoundation_checked_libraries := -PxFoundation_checked_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_checked_common_cflags += -MMD -PxFoundation_checked_common_cflags += $(addprefix -D, $(PxFoundation_checked_defines)) -PxFoundation_checked_common_cflags += $(addprefix -I, $(PxFoundation_checked_hpaths)) -PxFoundation_checked_common_cflags += -m64 -PxFoundation_checked_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_checked_common_cflags += -Wno-missing-field-initializers -PxFoundation_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxFoundation_checked_cflags := $(PxFoundation_checked_common_cflags) -PxFoundation_checked_cppflags := $(PxFoundation_checked_common_cflags) -PxFoundation_checked_lflags := $(PxFoundation_custom_lflags) -PxFoundation_checked_lflags += $(addprefix -L, $(PxFoundation_checked_lpaths)) -PxFoundation_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_checked_libraries)) -Wl,--end-group -PxFoundation_checked_lflags += -lrt -PxFoundation_checked_lflags += -m64 -PxFoundation_checked_objsdir = $(OBJS_DIR)/PxFoundation_checked -PxFoundation_checked_cpp_o = $(addprefix $(PxFoundation_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_checked_cc_o = $(addprefix $(PxFoundation_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_checked_c_o = $(addprefix $(PxFoundation_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_checked_obj = $(PxFoundation_checked_cpp_o) $(PxFoundation_checked_cc_o) $(PxFoundation_checked_c_o) -PxFoundation_checked_bin := ./../../../bin/linux64/libPxFoundationCHECKED_x64.so - -clean_PxFoundation_checked: - @$(ECHO) clean PxFoundation checked - @$(RMDIR) $(PxFoundation_checked_objsdir) - @$(RMDIR) $(PxFoundation_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/checked - -build_PxFoundation_checked: postbuild_PxFoundation_checked -postbuild_PxFoundation_checked: mainbuild_PxFoundation_checked -mainbuild_PxFoundation_checked: prebuild_PxFoundation_checked $(PxFoundation_checked_bin) -prebuild_PxFoundation_checked: - -$(PxFoundation_checked_bin): $(PxFoundation_checked_obj) - mkdir -p `dirname ./../../../bin/linux64/libPxFoundationCHECKED_x64.so` - $(CXX) -shared $(PxFoundation_checked_obj) $(PxFoundation_checked_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_checked_cpp_o): $(PxFoundation_checked_objsdir)/%.o: - $(ECHO) PxFoundation: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_checked_DEPDIR).d - -$(PxFoundation_checked_cc_o): $(PxFoundation_checked_objsdir)/%.o: - $(ECHO) PxFoundation: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_ccfiles))))).checked.P; \ - rm -f $(PxFoundation_checked_DEPDIR).d - -$(PxFoundation_checked_c_o): $(PxFoundation_checked_objsdir)/%.o: - $(ECHO) PxFoundation: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_checked_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_checked_DEPDIR).d - -PxFoundation_profile_hpaths := -PxFoundation_profile_hpaths += ./../../../include -PxFoundation_profile_hpaths += ./../../foundation/include -PxFoundation_profile_hpaths += ./../../foundation/include/unix -PxFoundation_profile_lpaths := -PxFoundation_profile_defines := $(PxFoundation_custom_defines) -PxFoundation_profile_defines += PX_FOUNDATION_DLL=1 -PxFoundation_profile_defines += NDEBUG -PxFoundation_profile_defines += PX_PROFILE=1 -PxFoundation_profile_libraries := -PxFoundation_profile_common_cflags := $(PxFoundation_custom_cflags) -PxFoundation_profile_common_cflags += -MMD -PxFoundation_profile_common_cflags += $(addprefix -D, $(PxFoundation_profile_defines)) -PxFoundation_profile_common_cflags += $(addprefix -I, $(PxFoundation_profile_hpaths)) -PxFoundation_profile_common_cflags += -m64 -PxFoundation_profile_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxFoundation_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxFoundation_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxFoundation_profile_common_cflags += -Wno-missing-field-initializers -PxFoundation_profile_common_cflags += -O3 -fno-strict-aliasing -PxFoundation_profile_cflags := $(PxFoundation_profile_common_cflags) -PxFoundation_profile_cppflags := $(PxFoundation_profile_common_cflags) -PxFoundation_profile_lflags := $(PxFoundation_custom_lflags) -PxFoundation_profile_lflags += $(addprefix -L, $(PxFoundation_profile_lpaths)) -PxFoundation_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxFoundation_profile_libraries)) -Wl,--end-group -PxFoundation_profile_lflags += -lrt -PxFoundation_profile_lflags += -m64 -PxFoundation_profile_objsdir = $(OBJS_DIR)/PxFoundation_profile -PxFoundation_profile_cpp_o = $(addprefix $(PxFoundation_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxFoundation_cppfiles))))) -PxFoundation_profile_cc_o = $(addprefix $(PxFoundation_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxFoundation_ccfiles))))) -PxFoundation_profile_c_o = $(addprefix $(PxFoundation_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxFoundation_cfiles))))) -PxFoundation_profile_obj = $(PxFoundation_profile_cpp_o) $(PxFoundation_profile_cc_o) $(PxFoundation_profile_c_o) -PxFoundation_profile_bin := ./../../../bin/linux64/libPxFoundationPROFILE_x64.so - -clean_PxFoundation_profile: - @$(ECHO) clean PxFoundation profile - @$(RMDIR) $(PxFoundation_profile_objsdir) - @$(RMDIR) $(PxFoundation_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxFoundation/profile - -build_PxFoundation_profile: postbuild_PxFoundation_profile -postbuild_PxFoundation_profile: mainbuild_PxFoundation_profile -mainbuild_PxFoundation_profile: prebuild_PxFoundation_profile $(PxFoundation_profile_bin) -prebuild_PxFoundation_profile: - -$(PxFoundation_profile_bin): $(PxFoundation_profile_obj) - mkdir -p `dirname ./../../../bin/linux64/libPxFoundationPROFILE_x64.so` - $(CXX) -shared $(PxFoundation_profile_obj) $(PxFoundation_profile_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxFoundation_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxFoundation_profile_cpp_o): $(PxFoundation_profile_objsdir)/%.o: - $(ECHO) PxFoundation: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles)))))) - cp $(PxFoundation_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cppfiles))))).P; \ - rm -f $(PxFoundation_profile_DEPDIR).d - -$(PxFoundation_profile_cc_o): $(PxFoundation_profile_objsdir)/%.o: - $(ECHO) PxFoundation: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxFoundation_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles)))))) - cp $(PxFoundation_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_ccfiles))))).profile.P; \ - rm -f $(PxFoundation_profile_DEPDIR).d - -$(PxFoundation_profile_c_o): $(PxFoundation_profile_objsdir)/%.o: - $(ECHO) PxFoundation: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxFoundation_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles)))))) - cp $(PxFoundation_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxFoundation_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxFoundation/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxFoundation_profile_objsdir),, $@))), $(PxFoundation_cfiles))))).P; \ - rm -f $(PxFoundation_profile_DEPDIR).d - -clean_PxFoundation: clean_PxFoundation_debug clean_PxFoundation_release clean_PxFoundation_checked clean_PxFoundation_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux64/Makefile.PxPvdSDK.mk b/PxShared/src/compiler/linux64/Makefile.PxPvdSDK.mk deleted file mode 100644 index 75bf7d3..0000000 --- a/PxShared/src/compiler/linux64/Makefile.PxPvdSDK.mk +++ /dev/null @@ -1,386 +0,0 @@ -# Makefile generated by XPJ for linux64 --include Makefile.custom -ProjectName = PxPvdSDK -PxPvdSDK_cppfiles += ./../../pvd/src/PxProfileEventImpl.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvd.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdDataStream.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdDefaultFileTransport.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdDefaultSocketTransport.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdImpl.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdMemClient.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdObjectModelMetaData.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdObjectRegistrar.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdProfileZoneClient.cpp -PxPvdSDK_cppfiles += ./../../pvd/src/PxPvdUserRenderer.cpp - -PxPvdSDK_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_debug_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_debug_dep = $(PxPvdSDK_cpp_debug_dep) $(PxPvdSDK_cc_debug_dep) $(PxPvdSDK_c_debug_dep) --include $(PxPvdSDK_debug_dep) -PxPvdSDK_cpp_release_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_release_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_release_dep = $(PxPvdSDK_cpp_release_dep) $(PxPvdSDK_cc_release_dep) $(PxPvdSDK_c_release_dep) --include $(PxPvdSDK_release_dep) -PxPvdSDK_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_checked_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_checked_dep = $(PxPvdSDK_cpp_checked_dep) $(PxPvdSDK_cc_checked_dep) $(PxPvdSDK_c_checked_dep) --include $(PxPvdSDK_checked_dep) -PxPvdSDK_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_c_profile_dep = $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxPvdSDK_cfiles))))) -PxPvdSDK_profile_dep = $(PxPvdSDK_cpp_profile_dep) $(PxPvdSDK_cc_profile_dep) $(PxPvdSDK_c_profile_dep) --include $(PxPvdSDK_profile_dep) -PxPvdSDK_debug_hpaths := -PxPvdSDK_debug_hpaths += ./../../../include -PxPvdSDK_debug_hpaths += ./../../pvd/include -PxPvdSDK_debug_hpaths += ./../../foundation/include -PxPvdSDK_debug_hpaths += ./../../filebuf/include -PxPvdSDK_debug_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_debug_lpaths := -PxPvdSDK_debug_lpaths += ./../../../bin/linux64 -PxPvdSDK_debug_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_debug_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_debug_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_debug_defines += _DEBUG -PxPvdSDK_debug_defines += PX_DEBUG=1 -PxPvdSDK_debug_defines += PX_CHECKED=1 -PxPvdSDK_debug_libraries := -PxPvdSDK_debug_libraries += PxFoundationDEBUG_x64 -PxPvdSDK_debug_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_debug_common_cflags += -MMD -PxPvdSDK_debug_common_cflags += $(addprefix -D, $(PxPvdSDK_debug_defines)) -PxPvdSDK_debug_common_cflags += $(addprefix -I, $(PxPvdSDK_debug_hpaths)) -PxPvdSDK_debug_common_cflags += -m64 -PxPvdSDK_debug_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_debug_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_debug_common_cflags += -g3 -gdwarf-2 -PxPvdSDK_debug_cflags := $(PxPvdSDK_debug_common_cflags) -PxPvdSDK_debug_cppflags := $(PxPvdSDK_debug_common_cflags) -PxPvdSDK_debug_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_debug_lflags += $(addprefix -L, $(PxPvdSDK_debug_lpaths)) -PxPvdSDK_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_debug_libraries)) -Wl,--end-group -PxPvdSDK_debug_lflags += -lrt -PxPvdSDK_debug_lflags += -m64 -PxPvdSDK_debug_objsdir = $(OBJS_DIR)/PxPvdSDK_debug -PxPvdSDK_debug_cpp_o = $(addprefix $(PxPvdSDK_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_debug_cc_o = $(addprefix $(PxPvdSDK_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_debug_c_o = $(addprefix $(PxPvdSDK_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_debug_obj = $(PxPvdSDK_debug_cpp_o) $(PxPvdSDK_debug_cc_o) $(PxPvdSDK_debug_c_o) -PxPvdSDK_debug_bin := ./../../../bin/linux64/libPxPvdSDKDEBUG_x64.so - -clean_PxPvdSDK_debug: - @$(ECHO) clean PxPvdSDK debug - @$(RMDIR) $(PxPvdSDK_debug_objsdir) - @$(RMDIR) $(PxPvdSDK_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/debug - -build_PxPvdSDK_debug: postbuild_PxPvdSDK_debug -postbuild_PxPvdSDK_debug: mainbuild_PxPvdSDK_debug -mainbuild_PxPvdSDK_debug: prebuild_PxPvdSDK_debug $(PxPvdSDK_debug_bin) -prebuild_PxPvdSDK_debug: - -$(PxPvdSDK_debug_bin): $(PxPvdSDK_debug_obj) build_PxFoundation_debug - mkdir -p `dirname ./../../../bin/linux64/libPxPvdSDKDEBUG_x64.so` - $(CXX) -shared $(PxPvdSDK_debug_obj) $(PxPvdSDK_debug_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_debug_cpp_o): $(PxPvdSDK_debug_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_debug_DEPDIR).d - -$(PxPvdSDK_debug_cc_o): $(PxPvdSDK_debug_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).debug.P; \ - rm -f $(PxPvdSDK_debug_DEPDIR).d - -$(PxPvdSDK_debug_c_o): $(PxPvdSDK_debug_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_debug_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_debug_DEPDIR).d - -PxPvdSDK_release_hpaths := -PxPvdSDK_release_hpaths += ./../../../include -PxPvdSDK_release_hpaths += ./../../pvd/include -PxPvdSDK_release_hpaths += ./../../foundation/include -PxPvdSDK_release_hpaths += ./../../filebuf/include -PxPvdSDK_release_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_release_lpaths := -PxPvdSDK_release_lpaths += ./../../../bin/linux64 -PxPvdSDK_release_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_release_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_release_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_release_defines += NDEBUG -PxPvdSDK_release_libraries := -PxPvdSDK_release_libraries += PxFoundation_x64 -PxPvdSDK_release_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_release_common_cflags += -MMD -PxPvdSDK_release_common_cflags += $(addprefix -D, $(PxPvdSDK_release_defines)) -PxPvdSDK_release_common_cflags += $(addprefix -I, $(PxPvdSDK_release_hpaths)) -PxPvdSDK_release_common_cflags += -m64 -PxPvdSDK_release_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_release_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_release_common_cflags += -O3 -fno-strict-aliasing -PxPvdSDK_release_cflags := $(PxPvdSDK_release_common_cflags) -PxPvdSDK_release_cppflags := $(PxPvdSDK_release_common_cflags) -PxPvdSDK_release_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_release_lflags += $(addprefix -L, $(PxPvdSDK_release_lpaths)) -PxPvdSDK_release_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_release_libraries)) -Wl,--end-group -PxPvdSDK_release_lflags += -lrt -PxPvdSDK_release_lflags += -m64 -PxPvdSDK_release_objsdir = $(OBJS_DIR)/PxPvdSDK_release -PxPvdSDK_release_cpp_o = $(addprefix $(PxPvdSDK_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_release_cc_o = $(addprefix $(PxPvdSDK_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_release_c_o = $(addprefix $(PxPvdSDK_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_release_obj = $(PxPvdSDK_release_cpp_o) $(PxPvdSDK_release_cc_o) $(PxPvdSDK_release_c_o) -PxPvdSDK_release_bin := ./../../../bin/linux64/libPxPvdSDK_x64.so - -clean_PxPvdSDK_release: - @$(ECHO) clean PxPvdSDK release - @$(RMDIR) $(PxPvdSDK_release_objsdir) - @$(RMDIR) $(PxPvdSDK_release_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/release - -build_PxPvdSDK_release: postbuild_PxPvdSDK_release -postbuild_PxPvdSDK_release: mainbuild_PxPvdSDK_release -mainbuild_PxPvdSDK_release: prebuild_PxPvdSDK_release $(PxPvdSDK_release_bin) -prebuild_PxPvdSDK_release: - -$(PxPvdSDK_release_bin): $(PxPvdSDK_release_obj) build_PxFoundation_release - mkdir -p `dirname ./../../../bin/linux64/libPxPvdSDK_x64.so` - $(CXX) -shared $(PxPvdSDK_release_obj) $(PxPvdSDK_release_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_release_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_release_cpp_o): $(PxPvdSDK_release_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_release_DEPDIR).d - -$(PxPvdSDK_release_cc_o): $(PxPvdSDK_release_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).release.P; \ - rm -f $(PxPvdSDK_release_DEPDIR).d - -$(PxPvdSDK_release_c_o): $(PxPvdSDK_release_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_release_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_release_DEPDIR).d - -PxPvdSDK_checked_hpaths := -PxPvdSDK_checked_hpaths += ./../../../include -PxPvdSDK_checked_hpaths += ./../../pvd/include -PxPvdSDK_checked_hpaths += ./../../foundation/include -PxPvdSDK_checked_hpaths += ./../../filebuf/include -PxPvdSDK_checked_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_checked_lpaths := -PxPvdSDK_checked_lpaths += ./../../../bin/linux64 -PxPvdSDK_checked_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_checked_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_checked_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_checked_defines += NDEBUG -PxPvdSDK_checked_defines += PX_CHECKED=1 -PxPvdSDK_checked_libraries := -PxPvdSDK_checked_libraries += PxFoundationCHECKED_x64 -PxPvdSDK_checked_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_checked_common_cflags += -MMD -PxPvdSDK_checked_common_cflags += $(addprefix -D, $(PxPvdSDK_checked_defines)) -PxPvdSDK_checked_common_cflags += $(addprefix -I, $(PxPvdSDK_checked_hpaths)) -PxPvdSDK_checked_common_cflags += -m64 -PxPvdSDK_checked_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_checked_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxPvdSDK_checked_cflags := $(PxPvdSDK_checked_common_cflags) -PxPvdSDK_checked_cppflags := $(PxPvdSDK_checked_common_cflags) -PxPvdSDK_checked_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_checked_lflags += $(addprefix -L, $(PxPvdSDK_checked_lpaths)) -PxPvdSDK_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_checked_libraries)) -Wl,--end-group -PxPvdSDK_checked_lflags += -lrt -PxPvdSDK_checked_lflags += -m64 -PxPvdSDK_checked_objsdir = $(OBJS_DIR)/PxPvdSDK_checked -PxPvdSDK_checked_cpp_o = $(addprefix $(PxPvdSDK_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_checked_cc_o = $(addprefix $(PxPvdSDK_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_checked_c_o = $(addprefix $(PxPvdSDK_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_checked_obj = $(PxPvdSDK_checked_cpp_o) $(PxPvdSDK_checked_cc_o) $(PxPvdSDK_checked_c_o) -PxPvdSDK_checked_bin := ./../../../bin/linux64/libPxPvdSDKCHECKED_x64.so - -clean_PxPvdSDK_checked: - @$(ECHO) clean PxPvdSDK checked - @$(RMDIR) $(PxPvdSDK_checked_objsdir) - @$(RMDIR) $(PxPvdSDK_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/checked - -build_PxPvdSDK_checked: postbuild_PxPvdSDK_checked -postbuild_PxPvdSDK_checked: mainbuild_PxPvdSDK_checked -mainbuild_PxPvdSDK_checked: prebuild_PxPvdSDK_checked $(PxPvdSDK_checked_bin) -prebuild_PxPvdSDK_checked: - -$(PxPvdSDK_checked_bin): $(PxPvdSDK_checked_obj) build_PxFoundation_checked - mkdir -p `dirname ./../../../bin/linux64/libPxPvdSDKCHECKED_x64.so` - $(CXX) -shared $(PxPvdSDK_checked_obj) $(PxPvdSDK_checked_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_checked_cpp_o): $(PxPvdSDK_checked_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_checked_DEPDIR).d - -$(PxPvdSDK_checked_cc_o): $(PxPvdSDK_checked_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).checked.P; \ - rm -f $(PxPvdSDK_checked_DEPDIR).d - -$(PxPvdSDK_checked_c_o): $(PxPvdSDK_checked_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_checked_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_checked_DEPDIR).d - -PxPvdSDK_profile_hpaths := -PxPvdSDK_profile_hpaths += ./../../../include -PxPvdSDK_profile_hpaths += ./../../pvd/include -PxPvdSDK_profile_hpaths += ./../../foundation/include -PxPvdSDK_profile_hpaths += ./../../filebuf/include -PxPvdSDK_profile_hpaths += ./../../../../../../externals/nvToolsExt/1/include -PxPvdSDK_profile_lpaths := -PxPvdSDK_profile_lpaths += ./../../../bin/linux64 -PxPvdSDK_profile_defines := $(PxPvdSDK_custom_defines) -PxPvdSDK_profile_defines += PX_PVDSDK_DLL=1 -PxPvdSDK_profile_defines += PX_FOUNDATION_DLL=1 -PxPvdSDK_profile_defines += NDEBUG -PxPvdSDK_profile_defines += PX_PROFILE=1 -PxPvdSDK_profile_libraries := -PxPvdSDK_profile_libraries += PxFoundationPROFILE_x64 -PxPvdSDK_profile_common_cflags := $(PxPvdSDK_custom_cflags) -PxPvdSDK_profile_common_cflags += -MMD -PxPvdSDK_profile_common_cflags += $(addprefix -D, $(PxPvdSDK_profile_defines)) -PxPvdSDK_profile_common_cflags += $(addprefix -I, $(PxPvdSDK_profile_hpaths)) -PxPvdSDK_profile_common_cflags += -m64 -PxPvdSDK_profile_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxPvdSDK_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxPvdSDK_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxPvdSDK_profile_common_cflags += -Wno-missing-field-initializers -PxPvdSDK_profile_common_cflags += -O3 -fno-strict-aliasing -PxPvdSDK_profile_cflags := $(PxPvdSDK_profile_common_cflags) -PxPvdSDK_profile_cppflags := $(PxPvdSDK_profile_common_cflags) -PxPvdSDK_profile_lflags := $(PxPvdSDK_custom_lflags) -PxPvdSDK_profile_lflags += $(addprefix -L, $(PxPvdSDK_profile_lpaths)) -PxPvdSDK_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxPvdSDK_profile_libraries)) -Wl,--end-group -PxPvdSDK_profile_lflags += -lrt -PxPvdSDK_profile_lflags += -m64 -PxPvdSDK_profile_objsdir = $(OBJS_DIR)/PxPvdSDK_profile -PxPvdSDK_profile_cpp_o = $(addprefix $(PxPvdSDK_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxPvdSDK_cppfiles))))) -PxPvdSDK_profile_cc_o = $(addprefix $(PxPvdSDK_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxPvdSDK_ccfiles))))) -PxPvdSDK_profile_c_o = $(addprefix $(PxPvdSDK_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxPvdSDK_cfiles))))) -PxPvdSDK_profile_obj = $(PxPvdSDK_profile_cpp_o) $(PxPvdSDK_profile_cc_o) $(PxPvdSDK_profile_c_o) -PxPvdSDK_profile_bin := ./../../../bin/linux64/libPxPvdSDKPROFILE_x64.so - -clean_PxPvdSDK_profile: - @$(ECHO) clean PxPvdSDK profile - @$(RMDIR) $(PxPvdSDK_profile_objsdir) - @$(RMDIR) $(PxPvdSDK_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxPvdSDK/profile - -build_PxPvdSDK_profile: postbuild_PxPvdSDK_profile -postbuild_PxPvdSDK_profile: mainbuild_PxPvdSDK_profile -mainbuild_PxPvdSDK_profile: prebuild_PxPvdSDK_profile $(PxPvdSDK_profile_bin) -prebuild_PxPvdSDK_profile: - -$(PxPvdSDK_profile_bin): $(PxPvdSDK_profile_obj) build_PxFoundation_profile - mkdir -p `dirname ./../../../bin/linux64/libPxPvdSDKPROFILE_x64.so` - $(CXX) -shared $(PxPvdSDK_profile_obj) $(PxPvdSDK_profile_lflags) -lc -o $@ - $(ECHO) building $@ complete! - -PxPvdSDK_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxPvdSDK_profile_cpp_o): $(PxPvdSDK_profile_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles)))))) - cp $(PxPvdSDK_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cppfiles))))).P; \ - rm -f $(PxPvdSDK_profile_DEPDIR).d - -$(PxPvdSDK_profile_cc_o): $(PxPvdSDK_profile_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxPvdSDK_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles)))))) - cp $(PxPvdSDK_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_ccfiles))))).profile.P; \ - rm -f $(PxPvdSDK_profile_DEPDIR).d - -$(PxPvdSDK_profile_c_o): $(PxPvdSDK_profile_objsdir)/%.o: - $(ECHO) PxPvdSDK: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxPvdSDK_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles)))))) - cp $(PxPvdSDK_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxPvdSDK_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxPvdSDK/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxPvdSDK_profile_objsdir),, $@))), $(PxPvdSDK_cfiles))))).P; \ - rm -f $(PxPvdSDK_profile_DEPDIR).d - -clean_PxPvdSDK: clean_PxPvdSDK_debug clean_PxPvdSDK_release clean_PxPvdSDK_checked clean_PxPvdSDK_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/linux64/Makefile.PxTask.mk b/PxShared/src/compiler/linux64/Makefile.PxTask.mk deleted file mode 100644 index ab35d83..0000000 --- a/PxShared/src/compiler/linux64/Makefile.PxTask.mk +++ /dev/null @@ -1,352 +0,0 @@ -# Makefile generated by XPJ for linux64 --include Makefile.custom -ProjectName = PxTask -PxTask_cppfiles += ./../../task/src/TaskManager.cpp - -PxTask_cpp_debug_dep = $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_debug_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.debug.P, $(PxTask_ccfiles))))) -PxTask_c_debug_dep = $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_debug_dep = $(PxTask_cpp_debug_dep) $(PxTask_cc_debug_dep) $(PxTask_c_debug_dep) --include $(PxTask_debug_dep) -PxTask_cpp_release_dep = $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_release_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.release.P, $(PxTask_ccfiles))))) -PxTask_c_release_dep = $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_release_dep = $(PxTask_cpp_release_dep) $(PxTask_cc_release_dep) $(PxTask_c_release_dep) --include $(PxTask_release_dep) -PxTask_cpp_checked_dep = $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_checked_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.checked.P, $(PxTask_ccfiles))))) -PxTask_c_checked_dep = $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_checked_dep = $(PxTask_cpp_checked_dep) $(PxTask_cc_checked_dep) $(PxTask_c_checked_dep) --include $(PxTask_checked_dep) -PxTask_cpp_profile_dep = $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.P, $(PxTask_cppfiles))))) -PxTask_cc_profile_dep = $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.profile.P, $(PxTask_ccfiles))))) -PxTask_c_profile_dep = $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.P, $(PxTask_cfiles))))) -PxTask_profile_dep = $(PxTask_cpp_profile_dep) $(PxTask_cc_profile_dep) $(PxTask_c_profile_dep) --include $(PxTask_profile_dep) -PxTask_debug_hpaths := -PxTask_debug_hpaths += ./../../../include -PxTask_debug_hpaths += ./../../task/include -PxTask_debug_hpaths += ./../../foundation/include -PxTask_debug_lpaths := -PxTask_debug_defines := $(PxTask_custom_defines) -PxTask_debug_defines += _DEBUG -PxTask_debug_defines += PX_DEBUG=1 -PxTask_debug_defines += PX_CHECKED=1 -PxTask_debug_libraries := -PxTask_debug_common_cflags := $(PxTask_custom_cflags) -PxTask_debug_common_cflags += -MMD -PxTask_debug_common_cflags += $(addprefix -D, $(PxTask_debug_defines)) -PxTask_debug_common_cflags += $(addprefix -I, $(PxTask_debug_hpaths)) -PxTask_debug_common_cflags += -m64 -PxTask_debug_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_debug_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_debug_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_debug_common_cflags += -Wno-missing-field-initializers -PxTask_debug_common_cflags += -g3 -gdwarf-2 -PxTask_debug_cflags := $(PxTask_debug_common_cflags) -PxTask_debug_cppflags := $(PxTask_debug_common_cflags) -PxTask_debug_lflags := $(PxTask_custom_lflags) -PxTask_debug_lflags += $(addprefix -L, $(PxTask_debug_lpaths)) -PxTask_debug_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_debug_libraries)) -Wl,--end-group -PxTask_debug_lflags += -lrt -PxTask_debug_lflags += -m64 -PxTask_debug_objsdir = $(OBJS_DIR)/PxTask_debug -PxTask_debug_cpp_o = $(addprefix $(PxTask_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_debug_cc_o = $(addprefix $(PxTask_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_debug_c_o = $(addprefix $(PxTask_debug_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_debug_obj = $(PxTask_debug_cpp_o) $(PxTask_debug_cc_o) $(PxTask_debug_c_o) -PxTask_debug_bin := ./../../../lib/linux64/libPxTaskDEBUG.a - -clean_PxTask_debug: - @$(ECHO) clean PxTask debug - @$(RMDIR) $(PxTask_debug_objsdir) - @$(RMDIR) $(PxTask_debug_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/debug - -build_PxTask_debug: postbuild_PxTask_debug -postbuild_PxTask_debug: mainbuild_PxTask_debug -mainbuild_PxTask_debug: prebuild_PxTask_debug $(PxTask_debug_bin) -prebuild_PxTask_debug: - -$(PxTask_debug_bin): $(PxTask_debug_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxTaskDEBUG.a` - @$(AR) rcs $(PxTask_debug_bin) $(PxTask_debug_obj) - $(ECHO) building $@ complete! - -PxTask_debug_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_debug_cpp_o): $(PxTask_debug_objsdir)/%.o: - $(ECHO) PxTask: compiling debug $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_debug_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_debug_DEPDIR).d - -$(PxTask_debug_cc_o): $(PxTask_debug_objsdir)/%.o: - $(ECHO) PxTask: compiling debug $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_debug_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_debug_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles))))).debug.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_ccfiles))))).debug.P; \ - rm -f $(PxTask_debug_DEPDIR).d - -$(PxTask_debug_c_o): $(PxTask_debug_objsdir)/%.o: - $(ECHO) PxTask: compiling debug $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_debug_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_debug_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_debug_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/debug/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_debug_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_debug_DEPDIR).d - -PxTask_release_hpaths := -PxTask_release_hpaths += ./../../../include -PxTask_release_hpaths += ./../../task/include -PxTask_release_hpaths += ./../../foundation/include -PxTask_release_lpaths := -PxTask_release_defines := $(PxTask_custom_defines) -PxTask_release_defines += NDEBUG -PxTask_release_libraries := -PxTask_release_common_cflags := $(PxTask_custom_cflags) -PxTask_release_common_cflags += -MMD -PxTask_release_common_cflags += $(addprefix -D, $(PxTask_release_defines)) -PxTask_release_common_cflags += $(addprefix -I, $(PxTask_release_hpaths)) -PxTask_release_common_cflags += -m64 -PxTask_release_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_release_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_release_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_release_common_cflags += -Wno-missing-field-initializers -PxTask_release_common_cflags += -O3 -fno-strict-aliasing -PxTask_release_cflags := $(PxTask_release_common_cflags) -PxTask_release_cppflags := $(PxTask_release_common_cflags) -PxTask_release_lflags := $(PxTask_custom_lflags) -PxTask_release_lflags += $(addprefix -L, $(PxTask_release_lpaths)) -PxTask_release_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_release_libraries)) -Wl,--end-group -PxTask_release_lflags += -lrt -PxTask_release_lflags += -m64 -PxTask_release_objsdir = $(OBJS_DIR)/PxTask_release -PxTask_release_cpp_o = $(addprefix $(PxTask_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_release_cc_o = $(addprefix $(PxTask_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_release_c_o = $(addprefix $(PxTask_release_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_release_obj = $(PxTask_release_cpp_o) $(PxTask_release_cc_o) $(PxTask_release_c_o) -PxTask_release_bin := ./../../../lib/linux64/libPxTask.a - -clean_PxTask_release: - @$(ECHO) clean PxTask release - @$(RMDIR) $(PxTask_release_objsdir) - @$(RMDIR) $(PxTask_release_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/release - -build_PxTask_release: postbuild_PxTask_release -postbuild_PxTask_release: mainbuild_PxTask_release -mainbuild_PxTask_release: prebuild_PxTask_release $(PxTask_release_bin) -prebuild_PxTask_release: - -$(PxTask_release_bin): $(PxTask_release_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxTask.a` - @$(AR) rcs $(PxTask_release_bin) $(PxTask_release_obj) - $(ECHO) building $@ complete! - -PxTask_release_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_release_cpp_o): $(PxTask_release_objsdir)/%.o: - $(ECHO) PxTask: compiling release $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_release_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_release_DEPDIR).d - -$(PxTask_release_cc_o): $(PxTask_release_objsdir)/%.o: - $(ECHO) PxTask: compiling release $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_release_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_release_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles))))).release.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_ccfiles))))).release.P; \ - rm -f $(PxTask_release_DEPDIR).d - -$(PxTask_release_c_o): $(PxTask_release_objsdir)/%.o: - $(ECHO) PxTask: compiling release $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_release_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_release_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_release_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/release/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_release_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_release_DEPDIR).d - -PxTask_checked_hpaths := -PxTask_checked_hpaths += ./../../../include -PxTask_checked_hpaths += ./../../task/include -PxTask_checked_hpaths += ./../../foundation/include -PxTask_checked_lpaths := -PxTask_checked_defines := $(PxTask_custom_defines) -PxTask_checked_defines += NDEBUG -PxTask_checked_defines += PX_CHECKED=1 -PxTask_checked_libraries := -PxTask_checked_common_cflags := $(PxTask_custom_cflags) -PxTask_checked_common_cflags += -MMD -PxTask_checked_common_cflags += $(addprefix -D, $(PxTask_checked_defines)) -PxTask_checked_common_cflags += $(addprefix -I, $(PxTask_checked_hpaths)) -PxTask_checked_common_cflags += -m64 -PxTask_checked_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_checked_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_checked_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_checked_common_cflags += -Wno-missing-field-initializers -PxTask_checked_common_cflags += -g3 -gdwarf-2 -O3 -fno-strict-aliasing -PxTask_checked_cflags := $(PxTask_checked_common_cflags) -PxTask_checked_cppflags := $(PxTask_checked_common_cflags) -PxTask_checked_lflags := $(PxTask_custom_lflags) -PxTask_checked_lflags += $(addprefix -L, $(PxTask_checked_lpaths)) -PxTask_checked_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_checked_libraries)) -Wl,--end-group -PxTask_checked_lflags += -lrt -PxTask_checked_lflags += -m64 -PxTask_checked_objsdir = $(OBJS_DIR)/PxTask_checked -PxTask_checked_cpp_o = $(addprefix $(PxTask_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_checked_cc_o = $(addprefix $(PxTask_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_checked_c_o = $(addprefix $(PxTask_checked_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_checked_obj = $(PxTask_checked_cpp_o) $(PxTask_checked_cc_o) $(PxTask_checked_c_o) -PxTask_checked_bin := ./../../../lib/linux64/libPxTaskCHECKED.a - -clean_PxTask_checked: - @$(ECHO) clean PxTask checked - @$(RMDIR) $(PxTask_checked_objsdir) - @$(RMDIR) $(PxTask_checked_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/checked - -build_PxTask_checked: postbuild_PxTask_checked -postbuild_PxTask_checked: mainbuild_PxTask_checked -mainbuild_PxTask_checked: prebuild_PxTask_checked $(PxTask_checked_bin) -prebuild_PxTask_checked: - -$(PxTask_checked_bin): $(PxTask_checked_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxTaskCHECKED.a` - @$(AR) rcs $(PxTask_checked_bin) $(PxTask_checked_obj) - $(ECHO) building $@ complete! - -PxTask_checked_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_checked_cpp_o): $(PxTask_checked_objsdir)/%.o: - $(ECHO) PxTask: compiling checked $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_checked_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_checked_DEPDIR).d - -$(PxTask_checked_cc_o): $(PxTask_checked_objsdir)/%.o: - $(ECHO) PxTask: compiling checked $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_checked_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_checked_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles))))).checked.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_ccfiles))))).checked.P; \ - rm -f $(PxTask_checked_DEPDIR).d - -$(PxTask_checked_c_o): $(PxTask_checked_objsdir)/%.o: - $(ECHO) PxTask: compiling checked $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_checked_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_checked_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_checked_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/checked/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_checked_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_checked_DEPDIR).d - -PxTask_profile_hpaths := -PxTask_profile_hpaths += ./../../../include -PxTask_profile_hpaths += ./../../task/include -PxTask_profile_hpaths += ./../../foundation/include -PxTask_profile_lpaths := -PxTask_profile_defines := $(PxTask_custom_defines) -PxTask_profile_defines += NDEBUG -PxTask_profile_defines += PX_PROFILE=1 -PxTask_profile_libraries := -PxTask_profile_common_cflags := $(PxTask_custom_cflags) -PxTask_profile_common_cflags += -MMD -PxTask_profile_common_cflags += $(addprefix -D, $(PxTask_profile_defines)) -PxTask_profile_common_cflags += $(addprefix -I, $(PxTask_profile_hpaths)) -PxTask_profile_common_cflags += -m64 -PxTask_profile_common_cflags += -Werror -m64 -fPIC -msse2 -mfpmath=sse -fno-exceptions -fno-rtti -fvisibility=hidden -fvisibility-inlines-hidden -PxTask_profile_common_cflags += -Wall -Wextra -Wstrict-aliasing=2 -fdiagnostics-show-option -PxTask_profile_common_cflags += -Wno-invalid-offsetof -Wno-uninitialized -Wno-implicit-fallthrough -PxTask_profile_common_cflags += -Wno-missing-field-initializers -PxTask_profile_common_cflags += -O3 -fno-strict-aliasing -PxTask_profile_cflags := $(PxTask_profile_common_cflags) -PxTask_profile_cppflags := $(PxTask_profile_common_cflags) -PxTask_profile_lflags := $(PxTask_custom_lflags) -PxTask_profile_lflags += $(addprefix -L, $(PxTask_profile_lpaths)) -PxTask_profile_lflags += -Wl,--start-group $(addprefix -l, $(PxTask_profile_libraries)) -Wl,--end-group -PxTask_profile_lflags += -lrt -PxTask_profile_lflags += -m64 -PxTask_profile_objsdir = $(OBJS_DIR)/PxTask_profile -PxTask_profile_cpp_o = $(addprefix $(PxTask_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cpp, %.cpp.o, $(PxTask_cppfiles))))) -PxTask_profile_cc_o = $(addprefix $(PxTask_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.cc, %.cc.o, $(PxTask_ccfiles))))) -PxTask_profile_c_o = $(addprefix $(PxTask_profile_objsdir)/, $(subst ./, , $(subst ../, , $(patsubst %.c, %.c.o, $(PxTask_cfiles))))) -PxTask_profile_obj = $(PxTask_profile_cpp_o) $(PxTask_profile_cc_o) $(PxTask_profile_c_o) -PxTask_profile_bin := ./../../../lib/linux64/libPxTaskPROFILE.a - -clean_PxTask_profile: - @$(ECHO) clean PxTask profile - @$(RMDIR) $(PxTask_profile_objsdir) - @$(RMDIR) $(PxTask_profile_bin) - @$(RMDIR) $(DEPSDIR)/PxTask/profile - -build_PxTask_profile: postbuild_PxTask_profile -postbuild_PxTask_profile: mainbuild_PxTask_profile -mainbuild_PxTask_profile: prebuild_PxTask_profile $(PxTask_profile_bin) -prebuild_PxTask_profile: - -$(PxTask_profile_bin): $(PxTask_profile_obj) - mkdir -p `dirname ./../../../lib/linux64/libPxTaskPROFILE.a` - @$(AR) rcs $(PxTask_profile_bin) $(PxTask_profile_obj) - $(ECHO) building $@ complete! - -PxTask_profile_DEPDIR = $(dir $(@))/$(*F) -$(PxTask_profile_cpp_o): $(PxTask_profile_objsdir)/%.o: - $(ECHO) PxTask: compiling profile $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_profile_cppflags) -c $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles)))))) - cp $(PxTask_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cpp.o,.cpp, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cppfiles))))).P; \ - rm -f $(PxTask_profile_DEPDIR).d - -$(PxTask_profile_cc_o): $(PxTask_profile_objsdir)/%.o: - $(ECHO) PxTask: compiling profile $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles))... - mkdir -p $(dir $(@)) - $(CXX) $(PxTask_profile_cppflags) -c $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles)) -o $@ - mkdir -p $(dir $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles)))))) - cp $(PxTask_profile_DEPDIR).d $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles))))).profile.P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .cc.o,.cc, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_ccfiles))))).profile.P; \ - rm -f $(PxTask_profile_DEPDIR).d - -$(PxTask_profile_c_o): $(PxTask_profile_objsdir)/%.o: - $(ECHO) PxTask: compiling profile $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles))... - mkdir -p $(dir $(@)) - $(CC) $(PxTask_profile_cflags) -c $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles)) -o $@ - @mkdir -p $(dir $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles)))))) - cp $(PxTask_profile_DEPDIR).d $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $(PxTask_profile_DEPDIR).d >> $(addprefix $(DEPSDIR)/PxTask/profile/, $(subst ./, , $(subst ../, , $(filter %$(strip $(subst .c.o,.c, $(subst $(PxTask_profile_objsdir),, $@))), $(PxTask_cfiles))))).P; \ - rm -f $(PxTask_profile_DEPDIR).d - -clean_PxTask: clean_PxTask_debug clean_PxTask_release clean_PxTask_checked clean_PxTask_profile - rm -rf $(DEPSDIR) - -export VERBOSE -ifndef VERBOSE -.SILENT: -endif diff --git a/PxShared/src/compiler/resource_x64/PxFoundation.rc b/PxShared/src/compiler/resource_x64/PxFoundation.rc Binary files differdeleted file mode 100644 index dfcfde2..0000000 --- a/PxShared/src/compiler/resource_x64/PxFoundation.rc +++ /dev/null diff --git a/PxShared/src/compiler/resource_x64/PxPvdSDK.rc b/PxShared/src/compiler/resource_x64/PxPvdSDK.rc Binary files differdeleted file mode 100644 index 37308cf..0000000 --- a/PxShared/src/compiler/resource_x64/PxPvdSDK.rc +++ /dev/null diff --git a/PxShared/src/compiler/resource_x64/resource.h b/PxShared/src/compiler/resource_x64/resource.h deleted file mode 100644 index b421bea..0000000 --- a/PxShared/src/compiler/resource_x64/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PxFoundation.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PxShared/src/compiler/resource_x86/PxFoundation.rc b/PxShared/src/compiler/resource_x86/PxFoundation.rc Binary files differdeleted file mode 100644 index 8b1085d..0000000 --- a/PxShared/src/compiler/resource_x86/PxFoundation.rc +++ /dev/null diff --git a/PxShared/src/compiler/resource_x86/PxPvdSDK.rc b/PxShared/src/compiler/resource_x86/PxPvdSDK.rc Binary files differdeleted file mode 100644 index 90636c2..0000000 --- a/PxShared/src/compiler/resource_x86/PxPvdSDK.rc +++ /dev/null diff --git a/PxShared/src/compiler/resource_x86/resource.h b/PxShared/src/compiler/resource_x86/resource.h deleted file mode 100644 index b421bea..0000000 --- a/PxShared/src/compiler/resource_x86/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by PxFoundation.rc -// - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 101 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1000 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/PxShared/src/cudamanager/include/CudaContextManager.h b/PxShared/src/cudamanager/include/CudaContextManager.h deleted file mode 100644 index 3d68f82..0000000 --- a/PxShared/src/cudamanager/include/CudaContextManager.h +++ /dev/null @@ -1,51 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_CUDACONTEXTMANAGER_H -#define PXCUDACONTEXTMANAGER_CUDACONTEXTMANAGER_H - -#include "task/PxTaskDefine.h" - -#if PX_SUPPORT_GPU_PHYSX - -namespace physx -{ - -class PxCudaContextManager; -class PxCudaContextManagerDesc; -class PxErrorCallback; - -/** -Creates cuda context manager for PhysX and APEX. -*/ -PxCudaContextManager* createCudaContextManager(const PxCudaContextManagerDesc& desc, PxErrorCallback& errorCallback); - -} - -#endif - -#endif // PXCUDACONTEXTMANAGER_CUDACONTEXTMANAGER_H diff --git a/PxShared/src/cudamanager/include/CudaKernelWrangler.h b/PxShared/src/cudamanager/include/CudaKernelWrangler.h deleted file mode 100644 index 36a2cc8..0000000 --- a/PxShared/src/cudamanager/include/CudaKernelWrangler.h +++ /dev/null @@ -1,331 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef __CUDA_KERNEL_WRANGLER__ -#define __CUDA_KERNEL_WRANGLER__ - -// Make this header is safe for inclusion in headers that are shared with device code. -#if !defined(__CUDACC__) - -#include "task/PxTaskDefine.h" -#include "task/PxGpuDispatcher.h" - -#include "PsUserAllocated.h" -#include "PsArray.h" - -#include <cuda.h> - -namespace physx -{ - -class KernelWrangler : public shdfnd::UserAllocated -{ - PX_NOCOPY(KernelWrangler) -public: - KernelWrangler(PxGpuDispatcher& gd, PxErrorCallback& errorCallback, const char** funcNames, uint16_t numFuncs); - ~KernelWrangler(); - - CUfunction getCuFunction(uint16_t funcIndex) const - { - return mCuFunctions[ funcIndex ]; - } - - CUmodule getCuModule(uint16_t funcIndex) const - { - uint16_t modIndex = mCuFuncModIndex[ funcIndex ]; - return mCuModules[ modIndex ]; - } - - static void const* const* getImages(); - static int getNumImages(); - - bool hadError() const { return mError; } - -protected: - bool mError; - shdfnd::Array<CUfunction> mCuFunctions; - shdfnd::Array<uint16_t> mCuFuncModIndex; - shdfnd::Array<CUmodule> mCuModules; - PxGpuDispatcher& mGpuDispatcher; - PxErrorCallback& mErrorCallback; -}; - -/* SJB - These were "borrowed" from an Ignacio Llamas email to devtech-compute. - * If we feel this is too clumsy, we can steal the boost based bits from APEX - */ - -class ExplicitCudaFlush -{ -public: - ExplicitCudaFlush(int cudaFlushCount) : mCudaFlushCount(cudaFlushCount), mDefaultCudaFlushCount(mCudaFlushCount) {} - ~ExplicitCudaFlush() {} - - void setCudaFlushCount(int value) { mCudaFlushCount = mDefaultCudaFlushCount = value; } - unsigned int getCudaFlushCount() const { return (unsigned int)mCudaFlushCount; } - void resetCudaFlushCount() { mCudaFlushCount = mDefaultCudaFlushCount; } - - void decrementFlushCount() - { - if (mCudaFlushCount == 0) return; - - if (--mCudaFlushCount == 0) - { - CUresult ret = cuStreamQuery(0); // flushes current push buffer - PX_UNUSED(ret); - PX_ASSERT(ret == CUDA_SUCCESS || ret == CUDA_ERROR_NOT_READY); - - // For current implementation, disable resetting of cuda flush count - // reset cuda flush count - // mCudaFlushCount = mDefaultCudaFlushCount; - } - } - -private: - int mCudaFlushCount; - int mDefaultCudaFlushCount; -}; - -} - -template <typename T0> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0) -{ - void* kernelParams[] = - { - &v0, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1) -{ - void* kernelParams[] = - { - &v0, &v1, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11, typename T12> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, &v12, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11, typename T12, typename T13> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, - T13 v13) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, &v12, &v13, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, - T13 v13, T14 v14) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, &v12, &v13, &v14, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, - T13 v13, T14 v14, T15 v15) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, &v12, &v13, &v14, &v15, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, - T13 v13, T14 v14, T15 v15, T16 v16) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, &v12, &v13, &v14, &v15, &v16, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -template <typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, - typename T8, typename T9, typename T10, typename T11, typename T12, typename T13, typename T14, typename T15, - typename T16, typename T17> -PX_NOINLINE CUresult launchKernel(CUfunction func, unsigned int numBlocks, unsigned int numThreads, unsigned int sharedMem, CUstream stream, - T0 v0, T1 v1, T2 v2, T3 v3, T4 v4, T5 v5, T6 v6, T7 v7, T8 v8, T9 v9, T10 v10, T11 v11, T12 v12, - T13 v13, T14 v14, T15 v15, T16 v16, T17 v17) -{ - void* kernelParams[] = - { - &v0, &v1, &v2, &v3, &v4, &v5, &v6, &v7, &v8, &v9, &v10, &v11, &v12, &v13, &v14, &v15, &v16, &v17, - }; - return cuLaunchKernel(func, numBlocks, 1, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); -} - -#endif - -#endif diff --git a/PxShared/src/cudamanager/include/GpuDispatcher.h b/PxShared/src/cudamanager/include/GpuDispatcher.h deleted file mode 100644 index 10c412f..0000000 --- a/PxShared/src/cudamanager/include/GpuDispatcher.h +++ /dev/null @@ -1,332 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXTASK_GPUDISPATCHER_H -#define PXTASK_GPUDISPATCHER_H - -#include "task/PxTask.h" -#include "task/PxTaskDefine.h" -#include "task/PxGpuTask.h" -#include "task/PxTaskManager.h" -#include "task/PxGpuDispatcher.h" -#include "foundation/PxProfiler.h" - -#include "PsUserAllocated.h" -#include "PsThread.h" -#include "PsAtomic.h" -#include "PsMutex.h" -#include "PsSync.h" -#include "PsArray.h" - -#include <cuda.h> - -namespace physx { - -typedef uint16_t EventID; - -void releaseGpuDispatcher(PxGpuDispatcher&); - -class KernelWrangler; -class BlockingWaitThread; -class FanoutTask; -class LaunchTask; -class BlockTask; -class PxGpuWorkerThread; - -class GpuDispatcherImpl : public PxGpuDispatcher, public shdfnd::UserAllocated -{ -public: - GpuDispatcherImpl(PxErrorCallback& errorCallback, PxCudaContextManager& ctx); - virtual ~GpuDispatcherImpl(); - - void start(); - void startSimulation(); - void startGroup(); - void submitTask(PxTask& task); - void finishGroup(); - void addCompletionPrereq(PxBaseTask& task); - bool failureDetected() const; - void forceFailureMode(); - void stopSimulation(); - void launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream); - - PxBaseTask& getPreLaunchTask(); - void addPreLaunchDependent(PxBaseTask& dependent); - - PxBaseTask& getPostLaunchTask(); - void addPostLaunchDependent(PxBaseTask& dependent); - - PxCudaContextManager* getCudaContextManager(); - - PxGpuWorkerThread* mDispatcher; - BlockingWaitThread* mBlockingThread; - LaunchTask* mLaunchTask; // predecessor of tasks launching kernels - BlockTask* mBlockTask; // continuation of tasks launching kernels - FanoutTask* mSyncTask; // predecessor of tasks waiting for cuda context synchronize -}; - -class JobQueue -{ - PX_NOCOPY(JobQueue) -public: - JobQueue() : taskarray(PX_DEBUG_EXP("PxTask*")) {} - void push(PxTask* t) - { - access.lock(); - taskarray.pushBack(t); - access.unlock(); - } - PxTask* popBack() - { - access.lock(); - PxTask* t = NULL; - if (taskarray.size()) - { - t = taskarray.popBack(); - } - access.unlock(); - return t; - } - uint32_t size() - { - return taskarray.size(); - } - bool empty() - { - return taskarray.size() == 0; - } - -private: - shdfnd::Array<PxTask*> taskarray; - shdfnd::Mutex access; -}; - -class EventPool -{ - PX_NOCOPY(EventPool) -public: - EventPool(uint32_t inflags) : flags(inflags), evarray(PX_DEBUG_EXP("CUevent")) {} - void add(CUevent ev) - { - access.lock(); - evarray.pushBack(ev); - access.unlock(); - } - CUevent get() - { - access.lock(); - CUevent ev; - if (evarray.size()) - { - ev = evarray.popBack(); - } - else - { - cuEventCreate(&ev, flags); - } - access.unlock(); - return ev; - } - bool empty() const - { - return evarray.size() == 0; - } - void clear() - { - access.lock(); - for (uint32_t i = 0; i < evarray.size(); i++) - { - cuEventDestroy(evarray[i]); - } - access.unlock(); - } - -private: - uint32_t flags; - shdfnd::Array<CUevent> evarray; - shdfnd::Mutex access; -}; - -class StreamCache -{ -public: - StreamCache() : sarray(PX_DEBUG_EXP("CUstream")), freeIndices(PX_DEBUG_EXP("freeIndices")) - { - } - CUstream get(uint32_t s) - { - PX_ASSERT(s); - return sarray[ s - 1 ]; - } - void push(uint32_t s) - { - freeIndices.pushBack(s); - } - uint32_t popBack() - { - if (freeIndices.size()) - { - return freeIndices.popBack(); - } - else - { - CUstream s; - cuStreamCreate(&s, 0); - sarray.pushBack(s); - return sarray.size(); - } - } - void reset() - { - freeIndices.resize(sarray.size()); - for (uint32_t i = 0 ; i < sarray.size() ; i++) - { - freeIndices[i] = i + 1; - } - } - bool empty() - { - return freeIndices.size() == 0; - } - -private: - shdfnd::Array<CUstream> sarray; - shdfnd::Array<uint32_t> freeIndices; -}; - -class KernelBar -{ -public: - KernelBar() - { - reset(); - } - void reset() - { - start = 0xffffffff; - stop = 0; - } - - uint32_t start; - uint32_t stop; -}; - -const int SIZE_COMPLETION_RING = 1024; - -struct CudaBatch -{ - CUevent blockingEvent; - CUstream blockingStream; // sync on stream instead of event if lsb is zero (faster) - PxBaseTask* continuationTask; -}; - -struct ReadyTask -{ - PxGpuTask* task; - uint32_t iteration; -}; - -class PxGpuWorkerThread : public shdfnd::Thread -{ - PX_NOCOPY(PxGpuWorkerThread) -public: - PxGpuWorkerThread(); - ~PxGpuWorkerThread(); - - void setCudaContext(PxCudaContextManager& ctx); - - /* API to TaskManager */ - void startSimulation(); - void stopSimulation(); - - /* API to GPU tasks */ - void addCompletionPrereq(PxBaseTask& task); - - /* PxGpuTask execution thread */ - void execute(); - void pollSubmitted(shdfnd::Array<ReadyTask> *ready); - void processActiveTasks(); - void flushBatch(CUevent endEvent, CUstream, PxBaseTask* task); - void launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream); - - /* Blocking wait thread */ - void blockingWaitFunc(); - - StreamCache mCachedStreams; - shdfnd::Array<PxBaseTask*> mCompletionTasks; - JobQueue mSubmittedTaskList; - volatile int mActiveGroups; - shdfnd::Sync mInputReady; - shdfnd::Sync mRecordEventQueued; - PxCudaContextManager* mCtxMgr; - bool mNewTasksSubmitted; - bool mFailureDetected; - - bool mUsingConcurrentStreams; - - CudaBatch mCompletionRing[ SIZE_COMPLETION_RING ]; - volatile int mCompletionRingPush; - volatile int mCompletionRingPop; - - EventPool mCachedBlockingEvents; - EventPool mCachedNonBlockingEvents; - - volatile int mCountActiveScenes; - - uint32_t* mSmStartTimes; - uint32_t mSmClockFreq; - - shdfnd::Array<ReadyTask> mReady[ PxGpuTaskHint::NUM_GPU_TASK_HINTS ]; - - KernelWrangler* mUtilKernelWrapper; - - CUevent mStartEvent; - - shdfnd::Mutex mMutex; -}; - -class BlockingWaitThread : public shdfnd::Thread -{ -public: - BlockingWaitThread(PxGpuWorkerThread& worker) : mWorker(worker) {} - ~BlockingWaitThread() {} - - void execute(); - -protected: - PxGpuWorkerThread& mWorker; - -private: - BlockingWaitThread& operator=(const BlockingWaitThread&); -}; - -#define GD_CHECK_CALL(call) { CUresult ret = call; \ - if( CUDA_SUCCESS != ret ) { mFailureDetected=true; PX_ASSERT(!ret); } } - -} - -#endif // PXTASK_GPUDISPATCHER_H diff --git a/PxShared/src/cudamanager/include/PhysXDeviceSettings.h b/PxShared/src/cudamanager/include/PhysXDeviceSettings.h deleted file mode 100644 index 5358915..0000000 --- a/PxShared/src/cudamanager/include/PhysXDeviceSettings.h +++ /dev/null @@ -1,56 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_PHYSXDEVICESETTINGS_H -#define PXCUDACONTEXTMANAGER_PHYSXDEVICESETTINGS_H - -#include "task/PxTaskDefine.h" - -#if PX_SUPPORT_GPU_PHYSX - -namespace physx -{ - class PxErrorCallback; - - /** - Helper functions to expose control panel functionality - */ - class PhysXDeviceSettings - { - private: - PhysXDeviceSettings() {} - - public: - static int getSuggestedCudaDeviceOrdinal(PxErrorCallback& errc); - static int isUsingDedicatedGPU(); - static bool isSLIEnabled(void* graphicsDevice); - }; -} - -#endif - -#endif // PXCUDACONTEXTMANAGER_PHYSXDEVICESETTINGS_H diff --git a/PxShared/src/cudamanager/src/BlockingWait.cpp b/PxShared/src/cudamanager/src/BlockingWait.cpp deleted file mode 100644 index 8a2cc44..0000000 --- a/PxShared/src/cudamanager/src/BlockingWait.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "task/PxTaskDefine.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "task/PxTask.h" -#include "task/PxGpuTask.h" -#include "cudamanager/PxCudaContextManager.h" - -#include "PsString.h" - -#if PX_SUPPORT_PXTASK_PROFILING -#include "foundation/PxFoundation.h" -#include "foundation/PxProfiler.h" -#endif - -#include "GpuDispatcher.h" - -using namespace physx; - -/* Blocking thread / GPU Profiling Event Code */ - -void PxGpuWorkerThread::blockingWaitFunc() -{ - mCtxMgr->acquireContext(); - - while (mCompletionRingPop != mCompletionRingPush) - { - CudaBatch& b = mCompletionRing[ mCompletionRingPop ]; - PxBaseTask* t = b.continuationTask; - - if (!b.blockingEvent) - { - PX_ASSERT(b.continuationTask != 0); - - /* No blocking necessary, just allow continuation task to run */ - } - else if (!mFailureDetected) - { -#if PX_SUPPORT_PXTASK_PROFILING - PX_PROFILE_ZONE("GpuDispatcher.BlockingWaitEvent", 0); -#endif - if (1 & ~intptr_t(b.blockingStream)) - { - GD_CHECK_CALL(cuStreamSynchronize(b.blockingStream)); - } - else - { - GD_CHECK_CALL(cuEventSynchronize(b.blockingEvent)); - } - } - - if (b.blockingEvent) - { - mCachedBlockingEvents.add(b.blockingEvent); - } - if (t) - { - t->removeReference(); - } - mCompletionRingPop = (mCompletionRingPop + 1) % SIZE_COMPLETION_RING; - } - - mCtxMgr->releaseContext(); -} - - -/* Blocking wait thread - - All this thread does is block waiting for CUDA Record Events to - be signaled. - */ - -void BlockingWaitThread::execute() -{ - setName("GpuDispatcher.BlockingWait"); - bool running = true; - while (running) - { - mWorker.mRecordEventQueued.wait(); - if (quitIsSignalled()) - { - running = false; - } - - mWorker.mRecordEventQueued.reset(); - mWorker.blockingWaitFunc(); - } - quit(); -} - -#endif - diff --git a/PxShared/src/cudamanager/src/CUDA/UtilKernels.cu b/PxShared/src/cudamanager/src/CUDA/UtilKernels.cu deleted file mode 100644 index 3c73364..0000000 --- a/PxShared/src/cudamanager/src/CUDA/UtilKernels.cu +++ /dev/null @@ -1,164 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "cudamanager/PxGpuCopyDesc.h" -#include "foundation/PxSimpleTypes.h" - -#include <cuda.h> - -using namespace physx; - -extern "C" __host__ void initUtilKernels() {} - -extern "C" __global__ -void Saturate( ) -{ - // NOP -} - -__device__ -void performCopy( const physx::PxGpuCopyDesc& desc, uint32_t totalBlocks ) -{ - if( desc.type == physx::PxGpuCopyDesc::DeviceMemset32 ) - { - uint32_t *dest = (uint32_t*) desc.dest; - uint32_t wordCount = desc.bytes >> 2; - size_t word = blockIdx.x * blockDim.x + threadIdx.x; - size_t stride = blockDim.x * totalBlocks; - for( ; word < wordCount ; word += stride ) - dest[ word ] = desc.source; - return; - } - - /* The idea here is to maximize throughput with minimal register and thread counts */ - /* Manually unrolled 4 times, the compiler refuses to do it for me */ - - if( (desc.source & 0x7) != 0 || (desc.dest & 0x7) != 0 || (desc.bytes & 0x7) != 0) - { - /* Input is word aligned */ - - uint32_t *dest = (uint32_t*) desc.dest; - uint32_t *source = (uint32_t*) desc.source; - uint32_t wordCount = desc.bytes >> 2; - size_t word = blockIdx.x * blockDim.x + threadIdx.x; - size_t stride = blockDim.x * totalBlocks; - while( word < wordCount ) - { - uint32_t a0, a1, a2, a3, a4, a5; - a0 = source[ word ]; - if( word + stride < wordCount ) - a1 = source[ word + stride ]; - if( word + stride*2 < wordCount ) - a2 = source[ word + stride*2 ]; - if( word + stride*3 < wordCount ) - a3 = source[ word + stride*3 ]; - if( word + stride*4 < wordCount ) - a4 = source[ word + stride*4 ]; - if( word + stride*5 < wordCount ) - a5 = source[ word + stride*5 ]; - - dest[ word ] = a0; - if( word + stride < wordCount ) - dest[ word + stride ] = a1; - if( word + stride*2 < wordCount ) - dest[ word + stride*2 ] = a2; - if( word + stride*3 < wordCount ) - dest[ word + stride*3 ] = a3; - if( word + stride*4 < wordCount ) - dest[ word + stride*4 ] = a4; - if( word + stride*5 < wordCount ) - dest[ word + stride*5 ] = a5; - - word += stride*6; - } - } - else - { - /* Input is DWord aligned */ - - uint2 *dest = (uint2*) desc.dest; - uint2 *source = (uint2*) desc.source; - uint32_t dwordCount = desc.bytes >> 3; - size_t word = blockIdx.x * blockDim.x + threadIdx.x; - size_t stride = blockDim.x * totalBlocks; - while( word < dwordCount ) - { - uint2 a0, a1, a2, a3, a4, a5; - a0 = source[ word ]; - if( word + stride < dwordCount ) - a1 = source[ word + stride ]; - if( word + stride*2 < dwordCount ) - a2 = source[ word + stride*2 ]; - if( word + stride*3 < dwordCount ) - a3 = source[ word + stride*3 ]; - if( word + stride*4 < dwordCount ) - a4 = source[ word + stride*4 ]; - if( word + stride*5 < dwordCount ) - a5 = source[ word + stride*5 ]; - - dest[ word ] = a0; - if( word + stride < dwordCount ) - dest[ word + stride ] = a1; - if( word + stride*2 < dwordCount ) - dest[ word + stride*2 ] = a2; - if( word + stride*3 < dwordCount ) - dest[ word + stride*3 ] = a3; - if( word + stride*4 < dwordCount ) - dest[ word + stride*4 ] = a4; - if( word + stride*5 < dwordCount ) - dest[ word + stride*5 ] = a5; - - word += stride*6; - } - } - - __threadfence_system(); -} - -extern "C" __global__ -void MemCopyAsync( physx::PxGpuCopyDesc desc ) -{ - performCopy( desc, gridDim.x ); -} - - -extern "C" __global__ -void MemCopyBatchedAsync( physx::PxGpuCopyDesc *desc ) -{ - __shared__ physx::PxGpuCopyDesc sdesc; - - if( threadIdx.x < sizeof(physx::PxGpuCopyDesc) / sizeof(uint32_t) ) - { - uint32_t *dest = (uint32_t*)&sdesc; - uint32_t *source = (uint32_t*)(desc + blockIdx.y); - dest[ threadIdx.x ] = source[ threadIdx.x ]; - __threadfence_block(); - } - __syncthreads(); - - performCopy( sdesc, gridDim.x ); -} diff --git a/PxShared/src/cudamanager/src/CudaContextManager.cpp b/PxShared/src/cudamanager/src/CudaContextManager.cpp deleted file mode 100644 index e05911e..0000000 --- a/PxShared/src/cudamanager/src/CudaContextManager.cpp +++ /dev/null @@ -1,823 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "foundation/PxAssert.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxMath.h" -#include "foundation/PxPreprocessor.h" - -#include "cudamanager/PxCudaContextManager.h" -#include "task/PxGpuDispatcher.h" - -#include "CudaMemoryManager.h" -#include "GpuDispatcher.h" -#include "PhysXDeviceSettings.h" - -#include "PsMutex.h" -#include "PsThread.h" -#include "PsUserAllocated.h" -#include "PsString.h" - -#include <cuda.h> - -#if PX_WIN32 || PX_WIN64 - -#ifdef PX_SECURE_LOAD_LIBRARY -#include "nvSecureLoadLibrary.h" -#endif - -#pragma warning (push) -#pragma warning (disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' -#include <windows.h> -#pragma warning (pop) - -class IDirect3DDevice9; -class IDirect3DResource9; -class IDirect3DVertexBuffer9; -#include <cudad3d9.h> - -class IDXGIAdapter; -class ID3D10Device; -class ID3D10Resource; -#include <cudad3d10.h> - -struct ID3D11Device; -struct ID3D11Resource; -#include <cudad3d11.h> - -#endif // PX_WINDOWS_FAMILY - -#if PX_LINUX -#include <dlfcn.h> -static void* GetProcAddress(void* handle, const char* name) { return dlsym(handle, name); } -#endif - -#include <GL/gl.h> -#include <cudaGL.h> -#include <assert.h> - -#include "foundation/PxErrors.h" -#include "foundation/PxErrorCallback.h" - -#define CU_INIT_UUID -#include "CudaNode3DLowLatencyInterface.h" - -#define ENABLE_DEVICE_INFO_BRINGUP 0 - -namespace physx -{ - -#if PX_VC -#pragma warning(disable: 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required' -#endif - -#define MIN_SM_MAJOR_VERSION 2 -#define MIN_SM_MINOR_VERSION 0 - -class CudaCtxMgr : public PxCudaContextManager, public shdfnd::UserAllocated -{ -public: - CudaCtxMgr(const PxCudaContextManagerDesc& desc, PxErrorCallback& errorCallback); - ~CudaCtxMgr(); - - bool safeDelayImport(PxErrorCallback& errorCallback); - void acquireContext(); - void releaseContext(); - - /* All these methods can be called without acquiring the context */ - - PxCudaMemoryManager* getMemoryManager(); - PxGpuDispatcher* getGpuDispatcher(); - - bool contextIsValid() const; - bool supportsArchSM10() const; // G80 - bool supportsArchSM11() const; // G92 - bool supportsArchSM12() const; - bool supportsArchSM13() const; // GT200 - bool supportsArchSM20() const; // GF100 - bool supportsArchSM30() const; // GK100 - bool supportsArchSM35() const; // GK110 - bool supportsArchSM50() const; // GM100 - bool supportsArchSM52() const; // GM200 - bool supportsArchSM60() const; // GP100 - bool isIntegrated() const; // true if GPU is integrated (MCP) part - bool canMapHostMemory() const; // true if GPU map host memory to GPU - int getDriverVersion() const; - size_t getDeviceTotalMemBytes() const; - int getMultiprocessorCount() const; - int getSharedMemPerBlock() const; - int getSharedMemPerMultiprocessor() const; - unsigned int getMaxThreadsPerBlock() const; - unsigned int getClockRate() const; - - const char* getDeviceName() const; - CUdevice getDevice() const; - const CUdevprop* getDeviceProperties() const; - - PxCudaInteropMode::Enum getInteropMode() const; - - void setUsingConcurrentStreams(bool); - bool getUsingConcurrentStreams() const; - - bool registerResourceInCudaD3D(CUgraphicsResource& resource, void* resourcePointer, PxCudaInteropRegisterFlags flags); - bool registerResourceInCudaGL(CUgraphicsResource& resource, uint32_t buffer, PxCudaInteropRegisterFlags flags); - bool unregisterResourceInCuda(CUgraphicsResource resource); - - /* - \brief Determine if the user has configured a dedicated PhysX GPU in the NV Control Panel - \returns 1 if there is a dedicated PhysX GPU - \returns 0 if there is NOT a dedicated PhysX GPU - \returns -1 if the routine is not implemented - */ - int usingDedicatedGPU() const; - - void release(); - - CUcontext getContext() { return mCtx; } - -private: - - int mSceneCount; - bool mIsValid; - bool mOwnContext; - CUdevice mDevHandle; - CUcontext mCtx; - CudaMemMgr* mMemMgr; - - GpuDispatcherImpl* mDispatcher; - CUetblPhysXInterface* m_physXInterface; - - /* Cached device attributes, so threads can query w/o context */ - int mComputeCapMajor; - int mComputeCapMinor; - int mIsIntegrated; - int mCanMapHost; - int mDriverVersion; - size_t mTotalMemBytes; - int mMultiprocessorCount; - int mMaxThreadsPerBlock; - char mDeviceName[128]; - int mSharedMemPerBlock; - int mSharedMemPerMultiprocessor; - int mClockRate; - PxCudaInteropMode::Enum mInteropMode; - bool mUsingConcurrentStreams; - -#if PX_DEBUG - static uint32_t mManagerRefCount; - static uint32_t mContextRefCountTls; -#endif -}; - -#if PX_DEBUG -uint32_t CudaCtxMgr::mManagerRefCount = 0; -uint32_t CudaCtxMgr::mContextRefCountTls = 0; -#endif - -bool CudaCtxMgr::contextIsValid() const -{ - return mIsValid; -} -bool CudaCtxMgr::supportsArchSM10() const -{ - return mIsValid; -} -bool CudaCtxMgr::supportsArchSM11() const -{ - return mIsValid && (mComputeCapMinor >= 1 || mComputeCapMajor > 1); -} -bool CudaCtxMgr::supportsArchSM12() const -{ - return mIsValid && (mComputeCapMinor >= 2 || mComputeCapMajor > 1); -} -bool CudaCtxMgr::supportsArchSM13() const -{ - return mIsValid && (mComputeCapMinor >= 3 || mComputeCapMajor > 1); -} -bool CudaCtxMgr::supportsArchSM20() const -{ - return mIsValid && mComputeCapMajor >= 2; -} -bool CudaCtxMgr::supportsArchSM30() const -{ - return mIsValid && mComputeCapMajor >= 3; -} -bool CudaCtxMgr::supportsArchSM35() const -{ - return mIsValid && ((mComputeCapMajor > 3) || (mComputeCapMajor == 3 && mComputeCapMinor >= 5)); -} -bool CudaCtxMgr::supportsArchSM50() const -{ - return mIsValid && mComputeCapMajor >= 5; -} -bool CudaCtxMgr::supportsArchSM52() const -{ - return mIsValid && ((mComputeCapMajor > 5) || (mComputeCapMajor == 5 && mComputeCapMinor >= 2)); -} -bool CudaCtxMgr::supportsArchSM60() const -{ - return mIsValid && mComputeCapMajor >= 6; -} - -bool CudaCtxMgr::isIntegrated() const -{ - return mIsValid && mIsIntegrated; -} -bool CudaCtxMgr::canMapHostMemory() const -{ - return mIsValid && mCanMapHost; -} -int CudaCtxMgr::getDriverVersion() const -{ - return mDriverVersion; -} -size_t CudaCtxMgr::getDeviceTotalMemBytes() const -{ - return mTotalMemBytes; -} -int CudaCtxMgr::getMultiprocessorCount() const -{ - return mMultiprocessorCount; -} -int CudaCtxMgr::getSharedMemPerBlock() const -{ - return mSharedMemPerBlock; -} -int CudaCtxMgr::getSharedMemPerMultiprocessor() const -{ - return mSharedMemPerMultiprocessor; -} -unsigned int CudaCtxMgr::getMaxThreadsPerBlock() const -{ - return (unsigned int)mMaxThreadsPerBlock; -} -unsigned int CudaCtxMgr::getClockRate() const -{ - return (unsigned int)mClockRate; -} - -const char* CudaCtxMgr::getDeviceName() const -{ - if (mIsValid) - { - return mDeviceName; - } - else - { - return "Invalid"; - } -} - -CUdevice CudaCtxMgr::getDevice() const -{ - if (mIsValid) - { - return mDevHandle; - } - else - { - return -1; - } -} - -PxCudaInteropMode::Enum CudaCtxMgr::getInteropMode() const -{ - return mInteropMode; -} - -void CudaCtxMgr::setUsingConcurrentStreams(bool value) -{ - mUsingConcurrentStreams = value; -} - -bool CudaCtxMgr::getUsingConcurrentStreams() const -{ - return mUsingConcurrentStreams; -} - -PxCudaMemoryManager* CudaCtxMgr::getMemoryManager() -{ - if (mIsValid) - { - return mMemMgr; - } - else - { - return NULL; - } -} - -PxGpuDispatcher* CudaCtxMgr::getGpuDispatcher() -{ - if (mIsValid) - { - return mDispatcher; - } - else - { - return NULL; - } -} - -int CudaCtxMgr::usingDedicatedGPU() const -{ - if (PxCudaInteropMode::NO_INTEROP == getInteropMode()) - { - return PhysXDeviceSettings::isUsingDedicatedGPU(); - } - else - { - return 0; // not a dedicated GPU - } -} - -#define CUT_SAFE_CALL(call) { CUresult ret = call; \ - if( CUDA_SUCCESS != ret ) { PX_ASSERT(0); } } - -/* If a context is not provided, an ordinal must be given */ -CudaCtxMgr::CudaCtxMgr(const PxCudaContextManagerDesc& desc, PxErrorCallback& errorCallback) - : mSceneCount(0) - , mOwnContext(false) - , mMemMgr(0) - , mDispatcher(0) - , m_physXInterface(0) - , mInteropMode(desc.interopMode) - , mUsingConcurrentStreams(true) -{ - CUresult status; - mIsValid = false; - mDeviceName[0] = 0; - - if (safeDelayImport(errorCallback) == false) - { - // The table where this info is found is here: https://wiki.nvidia.com/nvcompute/index.php/NVCompute#CUDA_Planning - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "NVIDIA Release 331 graphics driver and above is required for GPU acceleration.", __FILE__, __LINE__); - return; - } - - if (desc.ctx == 0) - { - int flags = CU_CTX_LMEM_RESIZE_TO_MAX | CU_CTX_SCHED_BLOCKING_SYNC | CU_CTX_MAP_HOST; - class FoundationErrorReporter : public PxErrorCallback - { - public: - FoundationErrorReporter(PxErrorCallback& ec) - : errorCallback(&ec) - { - } - - virtual void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) - { - errorCallback->reportError( code, message, file, line); - } - - PxErrorCallback* errorCallback; - } foundationErrorReporter(errorCallback); - - int devOrdinal = PhysXDeviceSettings::getSuggestedCudaDeviceOrdinal(foundationErrorReporter); - if (devOrdinal < 0) - { - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "No PhysX capable GPU suggested.", __FILE__, __LINE__); - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "If you have a PhysX capable GPU, verify that PhysX is not set to CPU in the NVIDIA Control Panel.", __FILE__, __LINE__); - return; - } - - status = cuInit(0); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuInit failed", __FILE__, __LINE__); - return; - } - - // Try to create the context on Node3DLowLatency. - // If that does not work, try to create the cuda context using cuCtxCreatePhysX, - // since we must be on a driver that does not support cuCtxCreateOnNode3DLowLatency. - cuGetExportTable((const void**)&m_physXInterface, (const CUuuid*)&CU_ETID_PhysXInterface); - - // if using a dedicated GPU or SLI we disable D3D interop (which is not supported over multiple GPUs) - // this ensures the users control panel setting is always respected - bool sliEnabled = false; - if (mInteropMode != PxCudaInteropMode::NO_INTEROP && desc.graphicsDevice != NULL) - { - sliEnabled = PhysXDeviceSettings::isSLIEnabled(desc.graphicsDevice) == 1 ? true : false; - } - - if (PhysXDeviceSettings::isUsingDedicatedGPU() == 1 || sliEnabled) - { - if (mInteropMode == PxCudaInteropMode::D3D10_INTEROP || - mInteropMode == PxCudaInteropMode::D3D11_INTEROP) - { - mInteropMode = PxCudaInteropMode::NO_INTEROP; - if (sliEnabled) - { - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "D3D/CUDA interop cannot be used in tandem with SLI, disabling interop. Query PxCudaContextManager::getInteropMode() for interop status.", - __FILE__,__LINE__); - } - } - } - - if (mInteropMode == PxCudaInteropMode::NO_INTEROP) - { - status = cuDeviceGet(&mDevHandle, devOrdinal); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuDeviceGet failed",__FILE__,__LINE__); - return; - } - - if (m_physXInterface) - status = m_physXInterface->cuCtxCreateOnNode3DLowLatency(&mCtx, (unsigned int)flags, mDevHandle); - else - status = cuCtxCreate(&mCtx, (unsigned int)flags, mDevHandle); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuCtxCreate failed",__FILE__,__LINE__); - return; - } - mOwnContext = true; - } - else if (mInteropMode == PxCudaInteropMode::OGL_INTEROP) - { - status = cuDeviceGet(&mDevHandle, devOrdinal); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuDeviceGet failed",__FILE__,__LINE__); - return; - } - - status = cuGLCtxCreate(&mCtx, (unsigned int)flags, mDevHandle); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuCtxGLCreate failed",__FILE__,__LINE__); - return; - } - - status = cuGLInit(); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuGLInit failed",__FILE__,__LINE__); - return; - } - mOwnContext = true; - } -#if PX_WIN32 || PX_WIN64 - else if (mInteropMode == PxCudaInteropMode::D3D10_INTEROP) - { - status = cuD3D10CtxCreate(&mCtx, &mDevHandle, (unsigned int)flags, - reinterpret_cast<ID3D10Device*>(desc.graphicsDevice)); - - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuD3D10CtxCreate failed",__FILE__,__LINE__); - return; - } - mOwnContext = true; - } - else if (mInteropMode == PxCudaInteropMode::D3D11_INTEROP) - { - status = cuD3D11CtxCreate(&mCtx, &mDevHandle, (unsigned int)flags, - reinterpret_cast<ID3D11Device*>(desc.graphicsDevice)); - - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuD3D11CtxCreate failed",__FILE__,__LINE__); - return; - } - mOwnContext = true; - } -#endif //PX_WIN32 || PX_WIN64 - else - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "Requested interop type is not supported!",__FILE__,__LINE__); - return; - } - } - else - { - mCtx = *desc.ctx; - status = cuCtxGetDevice(&mDevHandle); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuCtxGetDevice failed",__FILE__,__LINE__); - return; - } - } - - // Verify we can at least allocate a CUDA event from this context - CUevent testEvent; - if (CUDA_SUCCESS == cuEventCreate(&testEvent, 0)) - { - cuEventDestroy(testEvent); - } - else - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "CUDA context validation failed",__FILE__,__LINE__); - return; - } - - status = cuDeviceGetName(mDeviceName, sizeof(mDeviceName), mDevHandle); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuDeviceGetName failed",__FILE__,__LINE__); - return; - } - - cuDeviceGetAttribute(&mSharedMemPerBlock, CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_BLOCK, mDevHandle); - cuDeviceGetAttribute(&mSharedMemPerMultiprocessor, CU_DEVICE_ATTRIBUTE_MAX_SHARED_MEMORY_PER_MULTIPROCESSOR, mDevHandle); - cuDeviceGetAttribute(&mClockRate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, mDevHandle); - cuDeviceGetAttribute(&mComputeCapMajor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR, mDevHandle); - cuDeviceGetAttribute(&mComputeCapMinor, CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR, mDevHandle); - cuDeviceGetAttribute(&mIsIntegrated, CU_DEVICE_ATTRIBUTE_INTEGRATED, mDevHandle); - cuDeviceGetAttribute(&mCanMapHost, CU_DEVICE_ATTRIBUTE_CAN_MAP_HOST_MEMORY, mDevHandle); - cuDeviceGetAttribute(&mMultiprocessorCount, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT, mDevHandle); - cuDeviceGetAttribute(&mMaxThreadsPerBlock, CU_DEVICE_ATTRIBUTE_MAX_THREADS_PER_BLOCK, mDevHandle); - - status = cuDeviceTotalMem((size_t*)&mTotalMemBytes, mDevHandle); - if (CUDA_SUCCESS != status) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "cuDeviceTotalMem failed",__FILE__,__LINE__); - return; - } - - // minimum compute capability is MIN_SM_MAJOR_VERSION.MIN_SM_MINOR_VERSION - if ((mComputeCapMajor < MIN_SM_MAJOR_VERSION) || - (mComputeCapMajor == MIN_SM_MAJOR_VERSION && mComputeCapMinor < MIN_SM_MINOR_VERSION)) - { - char buffer[256]; - physx::shdfnd::snprintf(buffer, 256, "Minimum GPU compute capability %d.%d is required", MIN_SM_MAJOR_VERSION, MIN_SM_MINOR_VERSION); - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING,buffer,__FILE__,__LINE__); - return; - } - - mMemMgr = PX_NEW(CudaMemMgr)(*this, errorCallback); - if (mMemMgr == NULL) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "CudaMemMgr failed: Unable to allocate heaps",__FILE__,__LINE__); - return; - } - - bool succ = true; - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - PxCudaBufferType type(PxCudaBufferMemorySpace::Enum(i), PxCudaBufferFlags::F_READ_WRITE); - succ &= mMemMgr->setBaseSize(type, desc.memoryBaseSize[i]); - succ &= mMemMgr->setPageSize(type, desc.memoryPageSize[i]); - succ &= mMemMgr->setMaxMemorySize(type, desc.maxMemorySize[i]); - PX_ASSERT(succ); - if (!succ) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "CudaMemMgr failed: Invalid memory parameter",__FILE__,__LINE__); - return; - } - } - -#if PX_DEBUG - if(!mManagerRefCount++) - mContextRefCountTls = shdfnd::TlsAlloc(); - if(!shdfnd::TlsGet(mContextRefCountTls)) - CUT_SAFE_CALL(cuCtxSetCurrent(0)); -#endif - - mIsValid = true; - mDispatcher = PX_NEW(GpuDispatcherImpl)(errorCallback, *this); - if (!mDispatcher || mDispatcher->failureDetected()) - { - errorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "Failed to create functional GPU dispatcher",__FILE__,__LINE__); - mIsValid = false; - return; - } - - mDispatcher->start(); - -#if ENABLE_DEVICE_INFO_BRINGUP - // Device info (Enable for Amodel and Emulator testing) - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Device Name: %s", mDeviceName); - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Shared Memory Per Block: %d", mSharedMemPerBlock); - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Shared Memory Per Multiprocessor: %d", mSharedMemPerMultiprocessor); - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Number of SM: %d", mMultiprocessorCount); - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Max Threads Per Block: %d", mMaxThreadsPerBlock); -#endif -} - -/* Some driver version mismatches can cause delay import crashes. Load NVCUDA.dll - * manually, verify its version number, then allow delay importing to bind all the - * APIs. - */ -bool CudaCtxMgr::safeDelayImport(PxErrorCallback& errorCallback) -{ -#if PX_WIN32 || PX_WIN64 -#ifdef PX_SECURE_LOAD_LIBRARY - HMODULE hCudaDriver = nvLoadSystemLibrary("nvcuda.dll"); -#else - HMODULE hCudaDriver = LoadLibrary("nvcuda.dll"); -#endif -#elif PX_LINUX - void* hCudaDriver = dlopen("libcuda.so", RTLD_NOW); -#endif - if (!hCudaDriver) - { - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "nvcuda.dll not found or could not be loaded.", __FILE__, __LINE__); - return false; - } - - typedef CUresult(CUDAAPI * pfnCuDriverGetVersion_t)(int*); - pfnCuDriverGetVersion_t pfnCuDriverGetVersion = (pfnCuDriverGetVersion_t) GetProcAddress(hCudaDriver, "cuDriverGetVersion"); - if (!pfnCuDriverGetVersion) - { - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "cuDriverGetVersion missing in nvcuda.dll.", __FILE__, __LINE__); - return false; - } - - CUresult status = pfnCuDriverGetVersion(&mDriverVersion); - if (status != CUDA_SUCCESS) - { - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Retrieving CUDA driver version failed.", __FILE__, __LINE__); - return false; - } - - /* Let's require a driver version >= to the version we compile against - * Currently, CUDA_VERSION is 6000 or 6.0, but APEX still uses CUDA 5.0 so we can't assert on 6.0 yet. - */ - PX_COMPILE_TIME_ASSERT(5000 <= CUDA_VERSION); - - if (mDriverVersion < CUDA_VERSION) - { - char buffer[256]; - physx::shdfnd::snprintf(buffer, 256, "CUDA driver version is %u, expected at least %u.", mDriverVersion, CUDA_VERSION); - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, buffer, __FILE__,__LINE__); - return false; - } - - /* Now trigger delay import and API binding */ - status = cuDriverGetVersion(&mDriverVersion); - if (status != CUDA_SUCCESS) - { - errorCallback.reportError(PxErrorCode::eDEBUG_INFO, "Failed to bind CUDA API.", __FILE__, __LINE__); - return false; - } - - /* Not strictly necessary, but good practice */ -#if PX_WIN32 | PX_WIN64 - FreeLibrary(hCudaDriver); -#elif PX_LINUX - dlclose(hCudaDriver); -#endif - - - return true; -} - -void CudaCtxMgr::release() -{ - delete this; -} - -CudaCtxMgr::~CudaCtxMgr() -{ - if (mDispatcher) - { - releaseGpuDispatcher(*mDispatcher); - } - if (mMemMgr) - { - delete mMemMgr; - } - if (mOwnContext) - { - CUT_SAFE_CALL(cuCtxDestroy(mCtx)); - } - -#if PX_DEBUG - if(!--mManagerRefCount) - shdfnd::TlsFree(mContextRefCountTls); -#endif -} - -bool CudaCtxMgr::registerResourceInCudaGL(CUgraphicsResource& resource, uint32_t buffer, PxCudaInteropRegisterFlags flags) -{ - CUresult ret = CUDA_ERROR_UNKNOWN; - - acquireContext(); - - PX_ASSERT(mInteropMode == PxCudaInteropMode::OGL_INTEROP); - - ret = cuGraphicsGLRegisterBuffer(&resource, (GLuint) buffer, uint32_t(flags)); - - releaseContext(); - - return ret == CUDA_SUCCESS; -} - -bool CudaCtxMgr::registerResourceInCudaD3D(CUgraphicsResource& resource, void* resourcePointer, PxCudaInteropRegisterFlags flags) -{ - CUresult ret = CUDA_ERROR_UNKNOWN; -#if PX_WINDOWS_FAMILY - acquireContext(); - - switch (mInteropMode) - { - case PxCudaInteropMode::D3D10_INTEROP: - ret = cuGraphicsD3D10RegisterResource(&resource, (ID3D10Resource*)resourcePointer, uint32_t(flags)); - break; - case PxCudaInteropMode::D3D11_INTEROP: - ret = cuGraphicsD3D11RegisterResource(&resource, (ID3D11Resource*)resourcePointer, uint32_t(flags)); - break; - case PxCudaInteropMode::NO_INTEROP: - case PxCudaInteropMode::OGL_INTEROP: - case PxCudaInteropMode::COUNT: - default: - PX_ALWAYS_ASSERT_MESSAGE("unexpected state in registerResourceInCuda3D"); - } - - releaseContext(); -#else - PX_UNUSED(resource); - PX_UNUSED(resourcePointer); - PX_UNUSED(flags); -#endif //PX_WINDOWS_FAMILY - return ret == CUDA_SUCCESS; -} - -bool CudaCtxMgr::unregisterResourceInCuda(CUgraphicsResource resource) -{ - CUresult ret = CUDA_ERROR_UNKNOWN; - - acquireContext(); - - ret = cuGraphicsUnregisterResource(resource); - - releaseContext(); - - return ret == CUDA_SUCCESS; -} - -void CudaCtxMgr::acquireContext() -{ - CUcontext ctx = 0; - CUT_SAFE_CALL(cuCtxGetCurrent(&ctx)); - - if (ctx != mCtx) - { -#if PX_DEBUG - PX_ASSERT(!shdfnd::TlsGet(mContextRefCountTls)); -#endif - CUT_SAFE_CALL(cuCtxSetCurrent(mCtx)); - } - -#if PX_DEBUG - char* refCount = (char*)shdfnd::TlsGet(mContextRefCountTls); - shdfnd::TlsSet(mContextRefCountTls, ++refCount); -#endif -} - -void CudaCtxMgr::releaseContext() -{ -#if PX_DEBUG - char* refCount = (char*)shdfnd::TlsGet(mContextRefCountTls); - shdfnd::TlsSet(mContextRefCountTls, --refCount); - // see DE8475 - if(!refCount) - CUT_SAFE_CALL(cuCtxSetCurrent(0)); -#endif -} - -#if PX_SUPPORT_GPU_PHYSX -extern "C" void initUtilKernels(); - -PxCudaContextManager* createCudaContextManager(const PxCudaContextManagerDesc& desc, PxErrorCallback& errorCallback) -{ - //this call is needed to force UtilKernels linkage in case someone links PxCudaContextManager as Static Library! - initUtilKernels(); - - return PX_NEW(CudaCtxMgr)(desc, errorCallback); -} - -#endif - -} // end physx namespace - - diff --git a/PxShared/src/cudamanager/src/CudaKernelWrangler.cpp b/PxShared/src/cudamanager/src/CudaKernelWrangler.cpp deleted file mode 100644 index 7579d63..0000000 --- a/PxShared/src/cudamanager/src/CudaKernelWrangler.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "task/PxGpuDispatcher.h" -#include "cudamanager/PxCudaContextManager.h" - -#include "foundation/PxAssert.h" -#include "foundation/PxErrorCallback.h" - -#include "PsString.h" - -#include "CudaKernelWrangler.h" - -#include <cuda.h> -#include <texture_types.h> - -/** - * Workaround hacks for using nvcc --compiler output object files - * without linking with CUDART. We must implement our own versions - * of these functions that the object files are hard-coded to call into. - */ - -#define CUT_SAFE_CALL(call) { CUresult ret = call; if( CUDA_SUCCESS != ret ) { PX_ASSERT(!ret); } } - -#define MAX_MODULES 64 // Max number of .cu files you will build -static void* gModuleTable[ MAX_MODULES ]; -static int gNumModules = 0; - -#define MAX_FUNCTIONS 256 // Max number of kernel of entry points -typedef struct -{ - int moduleIndex; - const char* functionName; -} cuFuncDesc; -static cuFuncDesc gFunctionTable[ MAX_FUNCTIONS ]; -static int gNumFunctions = 0; - -using namespace physx::shdfnd; -using namespace physx; - -KernelWrangler::KernelWrangler(PxGpuDispatcher& gd, PxErrorCallback& errorCallback, const char** funcNames, uint16_t numFuncs) - : mError(false) - , mCuFunctions(PX_DEBUG_EXP("CuFunctions")) - , mCuModules(PX_DEBUG_EXP("CuModules")) - , mGpuDispatcher(gd) - , mErrorCallback(errorCallback) -{ - PxScopedCudaLock _lock_(*gd.getCudaContextManager()); - - /* Formally load the CUDA modules, get CUmodule handles */ - mCuModules.resize((uint32_t)gNumModules); - for (int i = 0 ; i < gNumModules ; ++i) - { - CUresult ret = cuModuleLoadDataEx(&mCuModules[(uint32_t)i], gModuleTable[i], 0, NULL, NULL); - if (ret != CUDA_SUCCESS && ret != CUDA_ERROR_NO_BINARY_FOR_GPU) - { - mErrorCallback.reportError(PxErrorCode::eINTERNAL_ERROR, "Failed to load CUDA module data.", __FILE__, __LINE__); - mError = true; - return; - } - } - - /* matchup funcNames to CUDA modules, get CUfunction handles */ - mCuFunctions.resize(numFuncs); - mCuFuncModIndex.resize(numFuncs); - for (uint32_t i = 0 ; i < numFuncs ; ++i) - { - for (int j = 0; ; ++j) - { - if(j == gNumFunctions) - { - char buffer[256]; - physx::shdfnd::snprintf(buffer, 256, "Could not find registered CUDA function '%s'.", funcNames[i]); - mErrorCallback.reportError(PxErrorCode::eINTERNAL_ERROR, buffer, __FILE__, __LINE__); - mError = true; - return; - } - - if (!physx::shdfnd::strcmp(gFunctionTable[j].functionName, funcNames[i])) - { - mCuFuncModIndex[i] = (uint16_t)gFunctionTable[j].moduleIndex; - CUresult ret = cuModuleGetFunction(&mCuFunctions[i], mCuModules[mCuFuncModIndex[i]], funcNames[i]); - if (ret != CUDA_SUCCESS) - { - char buffer[256]; - physx::shdfnd::snprintf(buffer, 256, "Could not find CUDA module containing function '%s'.", funcNames[i]); - mErrorCallback.reportError(PxErrorCode::eINTERNAL_ERROR, buffer, __FILE__, __LINE__); - mError = true; - return; - } - break; - } - } - } -} - -KernelWrangler::~KernelWrangler() -{ - if (mCuModules.size()) - { - PxScopedCudaLock _lock_(*mGpuDispatcher.getCudaContextManager()); - - for (uint32_t i = 0 ; i < mCuModules.size() ; i++) - if(mCuModules[i]) - CUT_SAFE_CALL(cuModuleUnload(mCuModules[i])); - } -} - -void const* const* KernelWrangler::getImages() -{ - return gModuleTable; -} - -int KernelWrangler::getNumImages() -{ - return gNumModules; -} - -/* - * These calls are all made _before_ main() during static initialization - * of this DLL. - */ - -#include <driver_types.h> - -#if PX_WINDOWS_FAMILY -#define CUDARTAPI __stdcall -#endif - -struct uint3; -struct dim3; - -extern "C" -void** CUDARTAPI __cudaRegisterFatBinary(void* fatBin) -{ - //HACK to get real fatbin in CUDA 4.0 - struct CUIfatbinStruct - { - int magic; - int version; - void *fatbinArray; - char *fatbinFile; - }; - const CUIfatbinStruct *fatbinStruct = (const CUIfatbinStruct *)fatBin; - if (fatbinStruct->magic == 0x466243B1) - { - fatBin = fatbinStruct->fatbinArray; - } - - if (gNumModules < MAX_MODULES) - { - gModuleTable[ gNumModules ] = fatBin; - return (void**)(size_t) gNumModules++; - } - return NULL; -} - -extern "C" -void CUDARTAPI __cudaUnregisterFatBinary(void** fatCubinHandle) -{ - gModuleTable[(int)(size_t) fatCubinHandle ] = 0; -} - -extern "C" -void CUDARTAPI __cudaRegisterTexture(void**, const struct textureReference*, const void**, const char*, int, int, int) -{ -} - -extern "C" void CUDARTAPI __cudaRegisterVar(void**, char*, char*, const char*, int, int, int, int) -{ -} - - -extern "C" void CUDARTAPI __cudaRegisterShared(void**, void**) -{ -} - -extern "C" -void CUDARTAPI __cudaRegisterFunction(void** fatCubinHandle, const char*, - char*, const char* deviceName, int, uint3*, uint3*, dim3*, dim3*, int*) -{ - if (gNumFunctions < MAX_FUNCTIONS) - { - // We need this association of function to module in order to find textures and globals - gFunctionTable[ gNumFunctions ].moduleIndex = (int)(size_t) fatCubinHandle; - gFunctionTable[ gNumFunctions ].functionName = deviceName; - gNumFunctions++; - } -} - -/* These functions are implemented just to resolve link dependencies */ - -extern "C" -cudaError_t CUDARTAPI cudaLaunch(const char* entry) -{ - PX_UNUSED(entry); - return cudaSuccess; -} - -extern "C" -cudaError_t CUDARTAPI cudaSetupArgument(const void*, size_t, size_t) -{ - return cudaSuccess; -} - -extern "C" -struct cudaChannelFormatDesc CUDARTAPI cudaCreateChannelDesc( - int x, int y, int z, int w, enum cudaChannelFormatKind f) -{ - struct cudaChannelFormatDesc desc; - desc.x = x; - desc.y = y; - desc.z = z; - desc.w = w; - desc.f = f; - return desc; -} - diff --git a/PxShared/src/cudamanager/src/CudaMemoryManager.cpp b/PxShared/src/cudamanager/src/CudaMemoryManager.cpp deleted file mode 100644 index b1c6f94..0000000 --- a/PxShared/src/cudamanager/src/CudaMemoryManager.cpp +++ /dev/null @@ -1,649 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "cudamanager/PxCudaContextManager.h" -#include "foundation/PxMath.h" -#include "foundation/PxMemory.h" - -#include "CudaMemoryManager.h" -#include "HeapManagerRef.h" - -#include <cuda.h> - -#define DEVICE_BASE_SIZE (0) -#define DEVICE_PAGE_SIZE ( 2 * 1024*1024) -#define PINNED_BASE_SIZE (0) -#define PINNED_PAGE_SIZE ( 2 * 1024*1024) -#define WC_BASE_SIZE (0) -#define WC_PAGE_SIZE ( 2 * 1024*1024) -#define MIN_BLOCK_SIZE 2048 - - -#define CMM_DELETE_SINGLE(x) { if(x) delete x; } -#define CMM_DELETE_ARRAY(x) { if(x) delete [] x; } - -using namespace physx; - -CudaMemMgr::CudaMemMgr(PxCudaContextManager& mgr, physx::PxErrorCallback& errorCallback) - : mErrorCallback(errorCallback) - , mBufferPool("mBufferPool", 1024) - , mInitialized(false) - , mMgr(mgr) - , mDebugDisableAllocs(false) -{ - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - mHeap[i] = NULL; - mMemoryAllocator[i] = NULL; - mMemoryMaxSize[i] = size_t(-1); - } - - mMemoryBaseSize[PxCudaBufferMemorySpace::T_GPU] = DEVICE_BASE_SIZE; - mMemoryBaseSize[PxCudaBufferMemorySpace::T_PINNED_HOST] = PINNED_BASE_SIZE; - mMemoryBaseSize[PxCudaBufferMemorySpace::T_WRITE_COMBINED] = WC_BASE_SIZE; - mMemoryBaseSize[PxCudaBufferMemorySpace::T_HOST] = 0; - - mMemoryPageSize[PxCudaBufferMemorySpace::T_GPU] = DEVICE_PAGE_SIZE; - mMemoryPageSize[PxCudaBufferMemorySpace::T_PINNED_HOST] = PINNED_PAGE_SIZE; - mMemoryPageSize[PxCudaBufferMemorySpace::T_WRITE_COMBINED] = WC_PAGE_SIZE; - mMemoryPageSize[PxCudaBufferMemorySpace::T_HOST] = PINNED_PAGE_SIZE; -} - - -CudaMemMgr::~CudaMemMgr() -{ - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - CMM_DELETE_SINGLE(mHeap[i]); - CMM_DELETE_SINGLE(mMemoryAllocator[i]); - } -} - - -PX_INLINE bool CudaMemMgr::initialize() -{ - if (mInitialized) - { - return true; - } - - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - mHeap[i] = PX_NEW(HeapManagerRef)(mErrorCallback, false); - PX_ASSERT(mHeap[i]); - } - - mMemoryAllocator[PxCudaBufferMemorySpace::T_GPU] = PX_NEW(DeviceMemAllocator)(mMgr, mMemoryMaxSize[PxCudaBufferMemorySpace::T_GPU]); - mMemoryAllocator[PxCudaBufferMemorySpace::T_PINNED_HOST] = PX_NEW(PinnedMemAllocator)(mMgr, mMemoryMaxSize[PxCudaBufferMemorySpace::T_PINNED_HOST]); - mMemoryAllocator[PxCudaBufferMemorySpace::T_WRITE_COMBINED] = PX_NEW(WriteCombinedMemAllocator)(mMgr, mMemoryMaxSize[PxCudaBufferMemorySpace::T_WRITE_COMBINED]); - mMemoryAllocator[PxCudaBufferMemorySpace::T_HOST] = PX_NEW(HostMemAllocator)(mMemoryMaxSize[PxCudaBufferMemorySpace::T_HOST]); - - bool succ = true; - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - succ &= mHeap[i]->init(mMemoryAllocator[i], mMemoryBaseSize[i], mMemoryPageSize[i], MIN_BLOCK_SIZE); - PX_ASSERT(succ); - } - - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - succ &= mHeap[i] && mMemoryAllocator[i]; - } - - if (!succ) - { - for (uint32_t i = 0; i < PxCudaBufferMemorySpace::COUNT; i++) - { - CMM_DELETE_SINGLE(mHeap[i]); - CMM_DELETE_SINGLE(mMemoryAllocator[i]); - } - mInitialized = false; - } - - return mInitialized = succ;; -} - - -bool CudaMemMgr::setPageSize(const PxCudaBufferType& type, size_t size) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (!mInitialized) - { - mMemoryPageSize[type.memorySpace] = PxMax(mMemoryPageSize[type.memorySpace], size); - return true; - } - else - { - bool ret = mHeap[type.memorySpace]->setPageSize(size); - mMemoryPageSize[type.memorySpace] = ret ? size : mMemoryPageSize[type.memorySpace]; - return ret; - } -} - - -bool CudaMemMgr::setBaseSize(const PxCudaBufferType& type, size_t size) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (mInitialized || (((size - 1)&size) != 0)) - { - return false; - } - else - { - mMemoryBaseSize[type.memorySpace] = PxMax(mMemoryBaseSize[type.memorySpace], size); - return true; - } -} - - -size_t CudaMemMgr::getBaseSize(const PxCudaBufferType& type) -{ - return mMemoryBaseSize[type.memorySpace]; -} - - -size_t CudaMemMgr::getPageSize(const PxCudaBufferType& type) -{ - return mMemoryPageSize[type.memorySpace]; -} - - -bool CudaMemMgr::setMaxMemorySize(const PxCudaBufferType& type, size_t size) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (mInitialized) - { - switch (type.memorySpace) - { - case PxCudaBufferMemorySpace::T_GPU: - static_cast<DeviceMemAllocator*>(mMemoryAllocator[type.memorySpace])->setMaxSize(size); - return true; - break; - case PxCudaBufferMemorySpace::T_PINNED_HOST: - static_cast<PinnedMemAllocator*>(mMemoryAllocator[type.memorySpace])->setMaxSize(size); - return true; - break; - case PxCudaBufferMemorySpace::T_HOST: - static_cast<HostMemAllocator*>(mMemoryAllocator[type.memorySpace])->setMaxSize(size); - return true; - break; - case PxCudaBufferMemorySpace::T_WRITE_COMBINED: - static_cast<WriteCombinedMemAllocator*>(mMemoryAllocator[type.memorySpace])->setMaxSize(size); - return true; - break; - case PxCudaBufferMemorySpace::COUNT: - default: - PX_ASSERT(!"unknown memory type"); - break; - } - } - else - { - mMemoryMaxSize[type.memorySpace] = PxMax(mMemoryMaxSize[type.memorySpace], size); - return true; - } - - return false; -} - -size_t CudaMemMgr::getMaxMemorySize(const PxCudaBufferType& type) -{ - if (mInitialized) - { - switch (type.memorySpace) - { - case PxCudaBufferMemorySpace::T_GPU: - return static_cast<DeviceMemAllocator*>(mMemoryAllocator[type.memorySpace])->getMaxSize(); - break; - case PxCudaBufferMemorySpace::T_PINNED_HOST: - return static_cast<PinnedMemAllocator*>(mMemoryAllocator[type.memorySpace])->getMaxSize(); - break; - case PxCudaBufferMemorySpace::T_HOST: - return static_cast<HostMemAllocator*>(mMemoryAllocator[type.memorySpace])->getMaxSize(); - break; - case PxCudaBufferMemorySpace::T_WRITE_COMBINED: - return static_cast<WriteCombinedMemAllocator*>(mMemoryAllocator[type.memorySpace])->getMaxSize(); - break; - case PxCudaBufferMemorySpace::COUNT: - default: - PX_ASSERT(!"unknown memory type"); - break; - } - } - return 0; -} - -bool CudaMemMgr::reserve(const PxCudaBufferType& type, size_t size) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (!mInitialized) - { - if (!initialize()) - { - return false; - } - } - - return mHeap[type.memorySpace]->reserve(size); -} - - -PxCudaBuffer* CudaMemMgr::alloc(const PxCudaBufferType& type, size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - PxCudaBufferPtr addr = alloc(type.memorySpace, size, PX_ALLOC_INFO_PARAMS_INPUT()); - - shdfnd::Mutex::ScopedLock lock(mMutex); - CudaBuffer* buffer = NULL; - if (addr) - { - buffer = mBufferPool.construct(type); - if (buffer) - { - buffer->init(addr, size, *this, PX_ALLOC_INFO_PARAMS_INPUT()); - } - } - return buffer; -} - -PxCudaBufferPtr CudaMemMgr::alloc(PxCudaBufferMemorySpace::Enum memorySpace, size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (!mInitialized) - { - if (!initialize()) - { - return 0; - } - } - - if (mDebugDisableAllocs) - { - return 0; - } - - return reinterpret_cast<PxCudaBufferPtr>(mHeap[memorySpace]->alloc(size, PX_ALLOC_INFO_PARAMS_INPUT())); -} - -bool CudaMemMgr::free(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (!mInitialized) - { - return false; - } - - if (addr) - { - return mHeap[memorySpace]->free((void*)(addr)); - } - else - { - return false; - } -} - -bool CudaMemMgr::realloc(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr, size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (!mInitialized) - { - return false; - } - - if (!size) - { - return false; - } - - if (mDebugDisableAllocs) - { - return NULL; - } - - bool ret = false; - if (addr) - { - ret = mHeap[memorySpace]->realloc((void*)(addr), size, PX_ALLOC_INFO_PARAMS_INPUT()); - } - - return ret; -} - -void CudaMemMgr::getStats(const PxCudaBufferType& type, PxCudaMemoryManagerStats& outStats) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (!mInitialized) - { - return; - } - - ApexHeapStats hpStats; - mHeap[type.memorySpace]->getStats(hpStats, HeapStatsFlags::F_BASIC_STATS | HeapStatsFlags::F_ALLOC_ID_STATS); - - outStats.heapSize = hpStats.heapSize; - outStats.totalAllocated = hpStats.totalAllocated; - outStats.maxAllocated = hpStats.maxAllocated; - PxMemCopy(outStats.allocIdStats, hpStats.allocIdStats, sizeof(PxAllocIdStats)*PxAllocId::NUM_IDS); -} - - -bool CudaMemMgr::free(CudaBuffer& buffer) -{ - PxCudaBufferMemorySpace::Enum memSpace = buffer.getTypeFast().memorySpace; - PxCudaBufferPtr addr = buffer.getPtrFast(); - - { - shdfnd::Mutex::ScopedLock lock(mMutex); - mBufferPool.destroy(&buffer); - } - - return free(memSpace, addr); -} - - -bool CudaMemMgr::realloc(CudaBuffer& buffer, size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - return realloc(buffer.getTypeFast().memorySpace, buffer.getPtrFast(), size, PX_ALLOC_INFO_PARAMS_INPUT()); -} - -PxCudaBufferPtr CudaMemMgr::getMappedPinnedPtr(PxCudaBufferPtr hostPtr) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - void* base = mHeap[PxCudaBufferMemorySpace::T_PINNED_HOST]->findBaseAddress((void*)hostPtr); - if (base) - { - size_t offset = ((PinnedMemAllocator*)mMemoryAllocator[PxCudaBufferMemorySpace::T_PINNED_HOST])->getMappedPinnedOffset(base); - return hostPtr + offset; - } - return 0; -} - -bool CudaBuffer::free() -{ - return mMemManager->free(*this); -} - - -bool CudaBuffer::realloc(size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - return mMemManager->realloc(*this, size, PX_ALLOC_INFO_PARAMS_INPUT()); -} - - -DeviceMemAllocator::DeviceMemAllocator(PxCudaContextManager& mgr, size_t maxSize) - : mMgr(mgr) - , mMaxSize(maxSize) - , mAllocSize(0) -{} - - -DeviceMemAllocator::~DeviceMemAllocator() -{ - PX_ASSERT(mAllocSize == 0); -} - - -void* DeviceMemAllocator::alloc(const size_t size) -{ - if (mAllocSize + size > mMaxSize) - { - return NULL; - } - else - { - PxScopedCudaLock lock(mMgr); - CUdeviceptr dPtr; - CUresult result = cuMemAlloc(&dPtr, uint32_t(size)); - - if (result == CUDA_SUCCESS) - { - mAllocSize += size; - return (void*)(size_t)(dPtr); - } - else - { - PX_ASSERT_WITH_MESSAGE(0, "Failed to allocate device memory."); - return NULL; - } - } -} - - -void DeviceMemAllocator::free(void* addr, const size_t size) -{ - PxScopedCudaLock lock(mMgr); - PX_ASSERT(mAllocSize >= size); - CUresult result = cuMemFree((CUdeviceptr)(size_t)(addr)); - PX_UNUSED(result); - PX_ASSERT(result == CUDA_SUCCESS); - mAllocSize -= size; -} - - -PinnedMemAllocator::PinnedMemAllocator(PxCudaContextManager& mgr, size_t maxSize) - : mMgr(mgr) - , mMaxSize(maxSize) - , mAllocSize(0) -{ -} - - -PinnedMemAllocator::~PinnedMemAllocator() -{ - PX_ASSERT(mAllocSize == 0); -} - - -void* PinnedMemAllocator::alloc(const size_t size) -{ - if (mAllocSize + size > mMaxSize) - { - return NULL; - } - else - { - PxScopedCudaLock lock(mMgr); - void* hPtr; - unsigned int flags = 0; - - if (mMgr.canMapHostMemory()) - { - flags |= CU_MEMHOSTALLOC_DEVICEMAP; - } - CUresult result = cuMemHostAlloc(&hPtr, uint32_t(size), flags); - - if (result == CUDA_SUCCESS) - { - if (hPtr) - { - mAllocSize += size; - } - - if (mMgr.canMapHostMemory()) - { - CUdeviceptr dptr = 0; - cuMemHostGetDevicePointer(&dptr, hPtr, 0); - mMappedPinnedPtrs.insert(hPtr, size_t(dptr)); - } - - return hPtr; - } - else - { - PX_ASSERT_WITH_MESSAGE(0, "Failed to allocate pinned memory."); - return NULL; - } - } -} - - -void PinnedMemAllocator::free(void* addr, const size_t size) -{ - PxScopedCudaLock lock(mMgr); - PX_ASSERT(mAllocSize >= size); - - if (mMgr.canMapHostMemory()) - { - PX_ASSERT(mMappedPinnedPtrs.find(addr)); - mMappedPinnedPtrs.erase(addr); - } - - CUresult result = cuMemFreeHost(addr); - PX_UNUSED(result); - PX_ASSERT(result == CUDA_SUCCESS); - mAllocSize -= size; -} - - -WriteCombinedMemAllocator::WriteCombinedMemAllocator(PxCudaContextManager& mgr, size_t maxSize) - : mMgr(mgr) - , mMaxSize(maxSize) - , mAllocSize(0) -{ - mWcMemSupport = mMgr.getDriverVersion() >= 2020 ? WcMem::SUPPORTED : WcMem::NOT_SUPPORTED; -} - - -WriteCombinedMemAllocator::~WriteCombinedMemAllocator() -{ - PX_ASSERT(mAllocSize == 0); -} - - -bool WriteCombinedMemAllocator::isWcMemSupported() -{ - if (mWcMemSupport == WcMem::SUPPORTED) - { - return true; - } - else - { - PX_ASSERT(mWcMemSupport == WcMem::NOT_SUPPORTED); - return false; - } -} - - -void* WriteCombinedMemAllocator::alloc(const size_t size) -{ - if (mAllocSize + size > mMaxSize) - { - return NULL; - } - else - { - PxScopedCudaLock lock(mMgr); - void* hPtr = NULL; - - unsigned int flags = CU_MEMHOSTALLOC_WRITECOMBINED; - - if (mMgr.canMapHostMemory()) - { - flags |= CU_MEMHOSTALLOC_DEVICEMAP; - } - - bool success = isWcMemSupported() && (cuMemHostAlloc(&hPtr, size, flags) == CUDA_SUCCESS); - if (success) - { - if (hPtr) - { - mAllocSize += size; - } - - return hPtr; - } - else - { - PX_ASSERT_WITH_MESSAGE(0, "Failed to allocate write combined memory."); - return NULL; - } - } -} - - -void WriteCombinedMemAllocator::free(void* addr, const size_t size) -{ - PxScopedCudaLock lock(mMgr); - PX_ASSERT(mAllocSize >= size); - CUresult result = cuMemFreeHost(addr); - PX_ASSERT(result == CUDA_SUCCESS); - PX_UNUSED(result); - mAllocSize -= size; -} - - -HostMemAllocator::HostMemAllocator(size_t maxSize) - : mMaxSize(maxSize) - , mAllocSize(0) -{ -} - - -HostMemAllocator::~HostMemAllocator() -{ - PX_ASSERT(mAllocSize == 0); -} - - -void* HostMemAllocator::alloc(const size_t size) -{ - if (mAllocSize + size > mMaxSize) - { - return NULL; - } - else - { - void* ret = PX_ALLOC(size, "host memory"); - if (ret) - { - mAllocSize += size; - return ret; - } - else - { - PX_ASSERT_WITH_MESSAGE(0, "Failed to allocate host memory."); - return NULL; - } - } -} - - -void HostMemAllocator::free(void* addr, const size_t size) -{ - PX_ASSERT(mAllocSize >= size); - PX_FREE(addr); - mAllocSize -= size; -} - diff --git a/PxShared/src/cudamanager/src/CudaMemoryManager.h b/PxShared/src/cudamanager/src/CudaMemoryManager.h deleted file mode 100644 index 071b4ab..0000000 --- a/PxShared/src/cudamanager/src/CudaMemoryManager.h +++ /dev/null @@ -1,297 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_CUDAMEMORYMANAGER_H -#define PXCUDACONTEXTMANAGER_CUDAMEMORYMANAGER_H - -#include "task/PxTaskDefine.h" -#include "HeapManagerInterface.h" - -#include "PsPool.h" -#include "PsMutex.h" -#include "PsUserAllocated.h" -#include "PsHashMap.h" - -namespace physx -{ - -class CudaBuffer; -class HeapManagerInterface; -class CudaMemMgr; -class PxCudaContextManager; - -class CudaBuffer: public PxCudaBuffer -{ -public: - PX_INLINE CudaBuffer(const PxCudaBufferType& type) - : mType(type) - {} - -// Ni Interface - bool free(); - bool realloc(size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - const PxCudaBufferType& getType() const - { - return getTypeFast(); - } - PxCudaBufferPtr getPtr() const - { - return getPtrFast(); - } - size_t getSize() const - { - return getSizeFast(); - } - PxCudaMemoryManager* getCudaMemoryManager() const - { - return getCudaMemoryManagerFast(); - } -// - PX_INLINE const PxCudaBufferType& getTypeFast() const - { - return mType; - } - PX_INLINE PxCudaBufferPtr getPtrFast() const - { - return mPtr; - } - PX_INLINE void setPtr(PxCudaBufferPtr val) - { - mPtr = val; - } - PX_INLINE size_t getSizeFast() const - { - return mSize; - } - PX_INLINE void setSize(size_t val) - { - mSize = val; - } - PX_INLINE PxCudaMemoryManager* getCudaMemoryManagerFast() const - { - return reinterpret_cast<PxCudaMemoryManager*>(mMemManager); - } - PX_INLINE void init(PxCudaBufferPtr ptr, size_t size, CudaMemMgr& manager, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) - { - mPtr = ptr; - mSize = size; - mMemManager = &manager; - mAllocInfo = PxAllocInfo(PX_ALLOC_INFO_PARAMS_INPUT()); - } - - void operator=(const CudaBuffer& in) - { - const_cast<PxCudaBufferType&>(mType) = in.mType; - mPtr = in.mPtr; - mSize = in.mSize; - mMemManager = in.mMemManager; - } - -private: - const PxCudaBufferType mType; - PxCudaBufferPtr mPtr; - size_t mSize; - CudaMemMgr* mMemManager; - PxAllocInfo mAllocInfo; -}; - - -class CudaMemMgr: public PxCudaMemoryManager, public shdfnd::UserAllocated -{ - PX_NOCOPY(CudaMemMgr) -public: - CudaMemMgr(PxCudaContextManager& mMgr, physx::PxErrorCallback& errorCallback); - virtual ~CudaMemMgr(); - - PxCudaBuffer* alloc(const PxCudaBufferType& type, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - PxCudaBufferPtr alloc(PxCudaBufferMemorySpace::Enum memorySpace, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - bool free(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr); - bool realloc(PxCudaBufferMemorySpace::Enum memorySpace, PxCudaBufferPtr addr, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - void getStats(const PxCudaBufferType& type, PxCudaMemoryManagerStats& outStats); - bool reserve(const PxCudaBufferType& type, size_t size); - bool setPageSize(const PxCudaBufferType& type, size_t size); - bool setMaxMemorySize(const PxCudaBufferType& type, size_t size); - size_t getBaseSize(const PxCudaBufferType& type); - size_t getPageSize(const PxCudaBufferType& type); - size_t getMaxMemorySize(const PxCudaBufferType& type); - void debugDisableAllocs() - { - mDebugDisableAllocs = true; - } - PxCudaBufferPtr getMappedPinnedPtr(PxCudaBufferPtr hostPtr); - - // internals - bool free(CudaBuffer& buffer); - bool realloc(CudaBuffer& buffer, size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - bool setBaseSize(const PxCudaBufferType& type, size_t size); - -private: - PX_INLINE bool initialize(); - physx::PxErrorCallback& mErrorCallback; - HeapManagerInterface* mHeap[PxCudaBufferMemorySpace::COUNT]; - HeapManagerInterface::Allocator* mMemoryAllocator[PxCudaBufferMemorySpace::COUNT]; - size_t mMemoryBaseSize[PxCudaBufferMemorySpace::COUNT]; - size_t mMemoryPageSize[PxCudaBufferMemorySpace::COUNT]; - size_t mMemoryMaxSize[PxCudaBufferMemorySpace::COUNT]; - shdfnd::Pool<CudaBuffer> mBufferPool; - bool mInitialized; - PxCudaContextManager& mMgr; - shdfnd::Mutex mMutex; - bool mDebugDisableAllocs; -}; - -// TODO, give MemoryAllocator prefix or namespace -class DeviceMemAllocator: public HeapManagerInterface::Allocator, public shdfnd::UserAllocated -{ - PX_NOCOPY(DeviceMemAllocator) -public: - DeviceMemAllocator(PxCudaContextManager& mgr, size_t maxSize); - virtual ~DeviceMemAllocator(); - - virtual void* alloc(const size_t size); - virtual void free(void* addr, const size_t size); - - void setMaxSize(size_t maxSize) - { - mMaxSize = maxSize; - } - size_t getMaxSize() - { - return mMaxSize; - } - -private: - PxCudaContextManager& mMgr; - size_t mMaxSize; - size_t mAllocSize; -}; - - -class PinnedMemAllocator: public HeapManagerInterface::Allocator, public shdfnd::UserAllocated -{ - PX_NOCOPY(PinnedMemAllocator) -public: - PinnedMemAllocator(PxCudaContextManager& mMgr, size_t maxSize); - virtual ~PinnedMemAllocator(); - - virtual void* alloc(const size_t size); - virtual void free(void* addr, const size_t size); - - void setMaxSize(size_t maxSize) - { - mMaxSize = maxSize; - } - size_t getMaxSize() - { - return mMaxSize; - } - - size_t getMappedPinnedOffset(void* base) - { - - PX_ASSERT(base); - const shdfnd::HashMap<void*, size_t>::Entry* entry = mMappedPinnedPtrs.find(base); - PX_ASSERT(entry); - return entry->second - size_t(base); - } - -private: - PxCudaContextManager& mMgr; - size_t mMaxSize; - size_t mAllocSize; - shdfnd::HashMap<void*, size_t> mMappedPinnedPtrs; -}; - - -class HostMemAllocator: public HeapManagerInterface::Allocator, public shdfnd::UserAllocated -{ - PX_NOCOPY(HostMemAllocator) -public: - HostMemAllocator(size_t maxSize); - virtual ~HostMemAllocator(); - - virtual void* alloc(const size_t size); - virtual void free(void* addr, const size_t size); - - void setMaxSize(size_t maxSize) - { - mMaxSize = maxSize; - } - size_t getMaxSize() - { - return mMaxSize; - } - -private: - size_t mMaxSize; - size_t mAllocSize; -}; - - -class WriteCombinedMemAllocator: public HeapManagerInterface::Allocator, public shdfnd::UserAllocated -{ - PX_NOCOPY(WriteCombinedMemAllocator) -public: - WriteCombinedMemAllocator(PxCudaContextManager& mgr, size_t maxSize); - virtual ~WriteCombinedMemAllocator(); - - virtual void* alloc(const size_t size); - virtual void free(void* addr, const size_t size); - - void setMaxSize(size_t maxSize) - { - mMaxSize = maxSize; - } - size_t getMaxSize() - { - return mMaxSize; - } - -private: - struct WcMem - { - enum Enum - { - NOT_CHECKED, - SUPPORTED, - NOT_SUPPORTED - }; - }; - - bool isWcMemSupported(); - -private: - int mCudaOrdinal; - PxCudaContextManager& mMgr; - WcMem::Enum mWcMemSupport; - size_t mMaxSize; - size_t mAllocSize; -}; - -} // end physx namespace - -#endif // PXCUDACONTEXTMANAGER_CUDAMEMORYMANAGER_H diff --git a/PxShared/src/cudamanager/src/CudaNode3DLowLatencyInterface.h b/PxShared/src/cudamanager/src/CudaNode3DLowLatencyInterface.h deleted file mode 100644 index f20d87a..0000000 --- a/PxShared/src/cudamanager/src/CudaNode3DLowLatencyInterface.h +++ /dev/null @@ -1,128 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXCUDACONTEXTMANAGER_CUDANODE3DLOWLATENCYINTERFACE_H -#define PXCUDACONTEXTMANAGER_CUDANODE3DLOWLATENCYINTERFACE_H - -#include <cuda.h> - -namespace physx -{ -// Utility macros for defining and using UUID values for use with -// the CUDA driver. -// -// CU_INIT_UUID must be #defined in exactly one translation unit -// per linkage unit (i.e. one .c or .cpp file per binary). This -// allows multiple .c and .cpp files to include headers that define -// UUIDs using CU_DEFINE_UUID: The translation unit that #defines -// CU_INIT_UUID will define and initialize the UUIDs, and all other -// translation units will link to that definition. - -// Define helper macro: CU_INIT_EXTERN_CONST -// In C, global consts have external linkage by default. In C++, -// global consts have internal linkage by default, and require the -// "extern" storage class specifier to have external linkage. C++ -// allows using "extern" with initializers, but it is illegal in C. -// Thus, there is no common syntax for C and C++ to declare and -// initialize global constants with external linkage. This macro -// helps reduce duplication of other macros by factoring out the -// C/C++ discrepancy. -#ifdef __cplusplus -#define CU_INIT_EXTERN_CONST extern const -#else -#define CU_INIT_EXTERN_CONST const -#endif - -// Define macro CU_DEFINE_UUID. The parameters are the commonly -// used "int-short-short-char[8]" style, which can be generated by -// Microsoft's guidgen.exe tool, Visual Studio's "Create GUID" -// option in the Tools menu (select style #2), and many web-based -// UUID generator tools. Here's an example of what "Create GUID" -// style #2 generates: -// -// DEFINE_GUID( <<name>>, -// 0x2446054, 0xbb8e, 0x4b2f, 0x8b, 0xfc, 0xa4, 0xfe, 0x44, 0x9, 0x8f, 0xb8); -// -// So to use one of these with CUDA, just change the macro to -// CU_DEFINE_UUID and choose a symbol name. For example: -// -// CU_DEFINE_UUID( MyUuid, -// 0x2446054, 0xbb8e, 0x4b2f, 0x8b, 0xfc, 0xa4, 0xfe, 0x44, 0x9, 0x8f, 0xb8); -// -#if defined(CU_INIT_UUID) -#define CU_CHAR(x) (char)(unsigned char)((x) & 0xff) -// Define the symbol as exportable to other translation units, and -// initialize the value. Inner set of parens is necessary because -// "bytes" array needs parens within the struct initializer, which -// also needs parens. -#define CU_DEFINE_UUID(name, a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - CU_INIT_EXTERN_CONST CUuuid name = \ - { \ - { \ - CU_CHAR(a), CU_CHAR((a) >> 8), CU_CHAR((a) >> 16), CU_CHAR((a) >> 24), \ - CU_CHAR(b), CU_CHAR((b) >> 8), \ - CU_CHAR(c), CU_CHAR((c) >> 8), \ - CU_CHAR(d0), \ - CU_CHAR(d1), \ - CU_CHAR(d2), \ - CU_CHAR(d3), \ - CU_CHAR(d4), \ - CU_CHAR(d5), \ - CU_CHAR(d6), \ - CU_CHAR(d7) \ - } \ - } -#else -// Declare the symbol to be imported from another translation unit. -#define CU_DEFINE_UUID(name, a, b, c, d0, d1, d2, d3, d4, d5, d6, d7) \ - extern const CUuuid name -#endif - -//------------------------------------------------------------------ -// Cuda Private API Interfaces for PhysX -//------------------------------------------------------------------ - -// This provides backdoor interfaces used by PhysX -CU_DEFINE_UUID(CU_ETID_PhysXInterface, 0x8c0ba50c, 0x0410, 0x9a92, 0x89, 0xa7, 0xd0, 0xdf, 0x10, 0xe7, 0x72, 0x86); - -typedef struct CUetblPhysXInterface_st -{ - /* Size of this structure */ - size_t size; - - /* Create a new CUDA context on Node3dLowLatency. - * - will usually it will just call cuCtxCreateOnNode3DLowLatency. - */ - CUresult (CUDAAPI *cuCtxCreateOnNode3DLowLatency)( - CUcontext *pctx, - unsigned int flags, - CUdevice dev); - -} CUetblPhysXInterface; -} - -#endif // PXCUDACONTEXTMANAGER_CUDANODE3DLOWLATENCYINTERFACE_H diff --git a/PxShared/src/cudamanager/src/GpuDispatcher.cpp b/PxShared/src/cudamanager/src/GpuDispatcher.cpp deleted file mode 100644 index 432a0cd..0000000 --- a/PxShared/src/cudamanager/src/GpuDispatcher.cpp +++ /dev/null @@ -1,928 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "task/PxTaskDefine.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "task/PxGpuDispatcher.h" -#include "task/PxCpuDispatcher.h" -#include "cudamanager/PxCudaContextManager.h" -#include "cudamanager/PxGpuCopyDesc.h" - -#include "CudaKernelWrangler.h" -#include "GpuDispatcher.h" - -#if PX_SUPPORT_PXTASK_PROFILING -#include "foundation/PxProfiler.h" -#endif - -#include "PsArray.h" -#include "PsSync.h" -#include "PsInlineArray.h" -#include "PsUserAllocated.h" -#include "PsAtomic.h" - -#if PX_VC -#pragma warning(disable: 4062) //enumerator 'identifier' in switch of enum 'enumeration' is not handled -#endif - -using namespace physx; - -// hack to run CUDA calls in a single thread -// used to capture CUDA APIC traces -// #define SINGLE_CUDA_THREAD 1 - -/* Kernels in UtilsKernels.cu */ -const char* UtilKernelNames[] = -{ - "Saturate", - "MemCopyAsync", - "MemCopyBatchedAsync", -}; -enum -{ - KERNEL_SATURATE, - KERNEL_MEMCOPY, - KERNEL_MEMCOPY_BATCHED -}; - -/* ==================== LaunchTask =========================== */ - -/** -\brief A task that maintains a list of dependent tasks. - -This task maintains a list of dependent tasks that have their reference counts -reduced on completion of the task. - -The refcount is incremented every time a dependent task is added. -*/ -class physx::FanoutTask : public PxBaseTask, public shdfnd::UserAllocated -{ - PX_NOCOPY(FanoutTask) -public: - FanoutTask(const char* name) : mRefCount(0), mName(name), mNotifySubmission(false) {} - - virtual void run() {} - virtual const char* getName(void) const { return mName; } - - virtual void removeReference() - { - shdfnd::Mutex::ScopedLock lock(mMutex); - if (!shdfnd::atomicDecrement(&mRefCount)) - { - // prevents access to mReferencesToRemove until release - shdfnd::atomicIncrement(&mRefCount); - mNotifySubmission = false; - PX_ASSERT(mReferencesToRemove.empty()); - // save continuation and dependents - for (uint32_t i = 0; i < mDependents.size(); i++) - mReferencesToRemove.pushBack(mDependents[i]); - mDependents.clear(); - mTm->getCpuDispatcher()->submitTask(*this); - } - } - - /** - \brief Increases reference count - */ - virtual void addReference() - { - shdfnd::Mutex::ScopedLock lock(mMutex); - shdfnd::atomicIncrement(&mRefCount); - mNotifySubmission = true; - } - - /** - \brief Return the ref-count for this task - */ - PX_INLINE int32_t getReference() const - { - return mRefCount; - } - - /** - Adds a dependent task. It also sets the task manager querying it from the dependent task. - The refcount is incremented every time a dependent task is added. - */ - void addDependent(PxBaseTask& dependent) - { - shdfnd::Mutex::ScopedLock lock(mMutex); - shdfnd::atomicIncrement(&mRefCount); - mTm = dependent.getTaskManager(); - mDependents.pushBack(&dependent); - dependent.addReference(); - mNotifySubmission = true; - } - - /** - Reduces reference counts of the continuation task and the dependent tasks, also - clearing the copy of continuation and dependents task list. - */ - virtual void release() - { - shdfnd::InlineArray<PxBaseTask*, 10> referencesToRemove; - - { - shdfnd::Mutex::ScopedLock lock(mMutex); - - const uint32_t contCount = mReferencesToRemove.size(); - referencesToRemove.reserve(contCount); - for (uint32_t i=0; i < contCount; ++i) - referencesToRemove.pushBack(mReferencesToRemove[i]); - - mReferencesToRemove.clear(); - // allow access to mReferencesToRemove again - if (mNotifySubmission) - { - removeReference(); - } - else - { - physx::shdfnd::atomicDecrement(&mRefCount); - } - - // the scoped lock needs to get freed before the continuation tasks get (potentially) submitted because - // those continuation tasks might trigger events that delete this task and corrupt the memory of the - // mutex (for example, assume this task is a member of the scene then the submitted tasks cause the simulation - // to finish and then the scene gets released which in turn will delete this task. When this task then finally - // continues the heap memory will be corrupted. - } - - for (uint32_t i=0; i < referencesToRemove.size(); ++i) - referencesToRemove[i]->removeReference(); - } - -private: - friend class LaunchTask; - - volatile int32_t mRefCount; - const char* mName; - shdfnd::InlineArray<PxBaseTask*, 4> mDependents; - shdfnd::InlineArray<PxBaseTask*, 4> mReferencesToRemove; - bool mNotifySubmission; - shdfnd::Mutex mMutex; // guarding mDependents and mNotifySubmission -}; - -class physx::LaunchTask : public physx::FanoutTask -{ -public: - LaunchTask() : FanoutTask("GpuDispatcher.launch"), mIsBatchStarted(false) - { - } - - virtual void run() - { - if (mReferencesToRemove.size() >= 1) - mIsBatchStarted = true; - } - - bool mIsBatchStarted; -}; - -class physx::BlockTask : public PxLightCpuTask, public shdfnd::UserAllocated -{ - PX_NOCOPY(BlockTask) -public: - BlockTask(PxGpuWorkerThread* dispatcher, physx::LaunchTask* launchTask) - : mDispatcher(dispatcher), mLaunchTask(launchTask), mSyncTask(NULL) - {} - - virtual const char* getName(void) const - { - return "GpuDispatcher.block"; - } - - virtual void removeReference() - { - shdfnd::Mutex::ScopedLock lock(mMutex); - if (!physx::shdfnd::atomicDecrement(&mRefCount)) - { - // prevents access to mSyncTask until release - physx::shdfnd::atomicIncrement(&mRefCount); - PX_ASSERT(!mSyncTask); - shdfnd::swap(mSyncTask, mCont); - mTm->getCpuDispatcher()->submitTask(*this); - } - } - - virtual void run() - { - if (mLaunchTask->mIsBatchStarted) - { - mDispatcher->mCtxMgr->acquireContext(); - CUevent stopEv = mDispatcher->mCachedBlockingEvents.get(); - CUstream stream = (CUstream)0; - mSyncTask->addReference(); - mDispatcher->flushBatch(stopEv, stream, mSyncTask); - mDispatcher->mCtxMgr->releaseContext(); - mLaunchTask->mIsBatchStarted = false; - } - } - - virtual void setContinuation(PxBaseTask* continuation) - { - // this function is called multiple times, skip after first call - shdfnd::Mutex::ScopedLock lock(mMutex); - physx::shdfnd::atomicIncrement(&mRefCount); - if (!mCont) - { - mCont = continuation; - mTm = mCont->getTaskManager(); - mCont->addReference(); - } - } - - virtual void release() - { - shdfnd::Mutex::ScopedLock lock(mMutex); - mSyncTask->removeReference(); - mSyncTask = NULL; - // allow access to mSyncTask again - if (mCont) - { - removeReference(); - } - else - { - physx::shdfnd::atomicDecrement(&mRefCount); - } - } - - PxGpuWorkerThread* mDispatcher; - physx::LaunchTask* mLaunchTask; - PxBaseTask* mSyncTask; - shdfnd::Mutex mMutex; // guarding mCont -}; - -/* ==================== API functions =========================== */ - -void physx::releaseGpuDispatcher(PxGpuDispatcher& gd) -{ - GpuDispatcherImpl* impl = (GpuDispatcherImpl*) &gd; - delete impl; -} - -PxCudaContextManager* GpuDispatcherImpl::getCudaContextManager() -{ - return mDispatcher->mCtxMgr; -} - -GpuDispatcherImpl::GpuDispatcherImpl(PxErrorCallback& errorCallback, PxCudaContextManager& ctx) : - mDispatcher(NULL), - mBlockingThread(NULL), - mLaunchTask(NULL), - mBlockTask(NULL), - mSyncTask(NULL) -{ - mDispatcher = PX_NEW(PxGpuWorkerThread); - if (!mDispatcher) - { - forceFailureMode(); - return; - } - - mDispatcher->setCudaContext(ctx); - - mDispatcher->mUtilKernelWrapper = PX_NEW(KernelWrangler)(*this, errorCallback, UtilKernelNames, sizeof(UtilKernelNames) / sizeof(char*)); - if (!mDispatcher->mUtilKernelWrapper || mDispatcher->mUtilKernelWrapper->hadError()) - { - forceFailureMode(); - return; - } - - mLaunchTask = PX_NEW(LaunchTask); - mBlockTask = PX_NEW(BlockTask)(mDispatcher, mLaunchTask); - mSyncTask = PX_NEW(FanoutTask)("GpuDispatcher.sync"); -} - -GpuDispatcherImpl::~GpuDispatcherImpl() -{ - if (mBlockingThread) - { - mBlockingThread->signalQuit(); - PX_ASSERT(mDispatcher); - mDispatcher->mRecordEventQueued.set(); - mBlockingThread->waitForQuit(); - delete mBlockingThread; - } - - if (mDispatcher) - { - mDispatcher->signalQuit(); - mDispatcher->mInputReady.set(); - mDispatcher->waitForQuit(); - delete mDispatcher; - } - - if (mLaunchTask) - PX_DELETE(mLaunchTask); - - if (mBlockTask) - PX_DELETE(mBlockTask); - - if (mSyncTask) - PX_DELETE(mSyncTask); -} - -void GpuDispatcherImpl::start() -{ -#ifndef SINGLE_CUDA_THREAD - mDispatcher->start(shdfnd::Thread::getDefaultStackSize()); -#else - mDispatcher->execute(); -#endif - - mBlockingThread = PX_NEW(BlockingWaitThread)(*mDispatcher); -#ifndef SINGLE_CUDA_THREAD - mBlockingThread->start(shdfnd::Thread::getDefaultStackSize()); -#endif -} - -void GpuDispatcherImpl::startSimulation() -{ - mDispatcher->startSimulation(); -} - -void GpuDispatcherImpl::stopSimulation() -{ - mDispatcher->stopSimulation(); -} - -void GpuDispatcherImpl::startGroup() -{ - shdfnd::atomicIncrement(&mDispatcher->mActiveGroups); -} - -void GpuDispatcherImpl::submitTask(PxTask& task) -{ - mDispatcher->mSubmittedTaskList.push(&task); -} - -void GpuDispatcherImpl::finishGroup() -{ - if (!shdfnd::atomicDecrement(&mDispatcher->mActiveGroups)) - { -#ifdef SINGLE_CUDA_THREAD - mDispatcher->mCtxMgr->acquireContext(); - mDispatcher->processActiveTasks(); - mDispatcher->mCtxMgr->releaseContext(); - mDispatcher->blockingWaitFunc(); -#endif - mDispatcher->mInputReady.set(); - } -} - -void GpuDispatcherImpl::addCompletionPrereq(PxBaseTask& task) -{ - mDispatcher->addCompletionPrereq(task); -} - -bool GpuDispatcherImpl::failureDetected() const -{ - return mDispatcher->mFailureDetected; -} - -void GpuDispatcherImpl::forceFailureMode() -{ - mDispatcher->mFailureDetected = true; -} - -void GpuDispatcherImpl::launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream) -{ - mDispatcher->launchCopyKernel(desc, count, stream); -} - -PxBaseTask& GpuDispatcherImpl::getPreLaunchTask() -{ - PX_ASSERT(mLaunchTask); - return *mLaunchTask; -} - -void GpuDispatcherImpl::addPreLaunchDependent(PxBaseTask& dependent) -{ - PX_ASSERT(mLaunchTask); - mLaunchTask->addDependent(dependent); -} - -PxBaseTask& GpuDispatcherImpl::getPostLaunchTask() -{ - PX_ASSERT(mBlockTask); - return *mBlockTask; -} - -void GpuDispatcherImpl::addPostLaunchDependent(PxBaseTask& dependent) -{ - PX_ASSERT(mSyncTask && mBlockTask); - mSyncTask->addDependent(dependent); - mBlockTask->setContinuation(mSyncTask); - mSyncTask->removeReference(); -} - -/* ==================== Worker Thread =========================== */ - -PxGpuWorkerThread::PxGpuWorkerThread() - : mActiveGroups(0) - , mCtxMgr(NULL) - , mFailureDetected(false) - , mCompletionRingPush(0) - , mCompletionRingPop(0) - , mCachedBlockingEvents(CU_EVENT_BLOCKING_SYNC) - , mCachedNonBlockingEvents(0) - , mCountActiveScenes(0) - , mSmStartTimes(0) - , mUtilKernelWrapper(0) -{ -} - -void PxGpuWorkerThread::setCudaContext(PxCudaContextManager& ctx) -{ - mCtxMgr = &ctx; -} - -PxGpuWorkerThread::~PxGpuWorkerThread() -{ - mCtxMgr->acquireContext(); - mCachedBlockingEvents.clear(); - mCachedNonBlockingEvents.clear(); - mCachedStreams.reset(); - while (!mCachedStreams.empty()) - { - GD_CHECK_CALL(cuStreamDestroy(mCachedStreams.get(mCachedStreams.popBack()))); - } - mCtxMgr->releaseContext(); - - if (mSmStartTimes) - { - PX_FREE(mSmStartTimes); - } - if (mUtilKernelWrapper) - { - // will acquire the context for itself - PX_DELETE(mUtilKernelWrapper); - } -} - - -/* A TaskManager is informing us that its simulation is being stepped */ -void PxGpuWorkerThread::startSimulation() -{ - mUsingConcurrentStreams = mCtxMgr->getUsingConcurrentStreams(); - - shdfnd::atomicIncrement(&mCountActiveScenes); -} - - -/* A TaskManager is informing us that its simulation has ended */ -void PxGpuWorkerThread::stopSimulation() -{ - if (shdfnd::atomicDecrement(&mCountActiveScenes) == 0) - mCachedStreams.reset(); -} - - -/* PxGpuDispatcher worker thread main loop */ -void PxGpuWorkerThread::execute() -{ - setName("GpuDispatcher.Worker"); - -#ifndef SINGLE_CUDA_THREAD - bool running = true; - while (running) - { - mInputReady.wait(); - - if (quitIsSignalled()) - { - break; - } - - if (!mSubmittedTaskList.empty()) - { - mCtxMgr->acquireContext(); - processActiveTasks(); - mCtxMgr->releaseContext(); - } - } - - quit(); -#endif -} - -/* Expected to be called by a GPU task, or a function called by a GPU - * task. The context is important because I think it does not require - * any locking since only one GPU task's launchInstance() function will - * be running at a time, per GpuDispatcherImpl (per CUDA context). - */ -void PxGpuWorkerThread::addCompletionPrereq(PxBaseTask& task) -{ - if(mFailureDetected) - return; - -#if PX_SUPPORT_PXTASK_PROFILING - PX_PROFILE_ZONE("GpuDispatcher.AddCompletionEvent", task.getContextId()); -#endif - task.addReference(); - mCompletionTasks.pushBack(&task); -} - -namespace -{ - template <typename T0> - PX_NOINLINE CUresult launchKernelGrid(CUfunction func, unsigned int gridWidth, unsigned int gridHeight, unsigned int numThreads, unsigned int sharedMem, CUstream stream, T0 v0) - { - void* kernelParams[] = - { - &v0, - }; - return cuLaunchKernel(func, gridWidth, gridHeight, 1, numThreads, 1, 1, sharedMem, stream, kernelParams, NULL); - } -} - -void PxGpuWorkerThread::launchCopyKernel(PxGpuCopyDesc* desc, uint32_t count, CUstream stream) -{ - if (!mCtxMgr->canMapHostMemory()) - { - for (uint32_t i = 0 ; i < count ; i++) - { - PX_ASSERT(desc->isValid()); - switch (desc->type) - { - case PxGpuCopyDesc::DeviceMemset32: - GD_CHECK_CALL(cuMemsetD32Async(desc->dest, (uint32_t) desc->source, desc->bytes >> 2, stream)); - break; - case PxGpuCopyDesc::DeviceToDevice: - GD_CHECK_CALL(cuMemcpyDtoDAsync(desc->dest, desc->source, desc->bytes, stream)); - break; - case PxGpuCopyDesc::DeviceToHost: - GD_CHECK_CALL(cuMemcpyDtoHAsync((void*) desc->dest, desc->source, desc->bytes, stream)); - break; - case PxGpuCopyDesc::HostToDevice: - GD_CHECK_CALL(cuMemcpyHtoDAsync(desc->dest, (void*) desc->source, desc->bytes, stream)); - break; - } - - desc++; - } - } - else if (count == 1) - { - CUfunction func = mUtilKernelWrapper->getCuFunction(KERNEL_MEMCOPY); - uint32_t smCount = (uint32_t)mCtxMgr->getMultiprocessorCount(); - - PX_ASSERT(desc->isValid()); - - CUdeviceptr dptr; - switch (desc->type) - { - case PxGpuCopyDesc::DeviceToHost: - dptr = mCtxMgr->getMemoryManager()->getMappedPinnedPtr(PxCudaBufferPtr(desc->dest)); - desc->dest = dptr; - break; - case PxGpuCopyDesc::HostToDevice: - dptr = mCtxMgr->getMemoryManager()->getMappedPinnedPtr(PxCudaBufferPtr(desc->source)); - desc->source = dptr; - break; - case PxGpuCopyDesc::DeviceMemset32: - case PxGpuCopyDesc::DeviceToDevice: - //do nothing, cases are here for GCCs warning system - break; - } - - uint32_t numThreads; - if (mCtxMgr->supportsArchSM20()) - { - numThreads = 256; - } - else - { - numThreads = 128; - } - uint32_t blocks = uint32_t(desc->bytes / (numThreads * 4 * 6)); - if (blocks == 0) - { - blocks = 1; - } - if (blocks > smCount) - { - blocks = smCount; - } - - GD_CHECK_CALL( - launchKernel(func, blocks, numThreads, 0, stream, *desc) - ); - } - else - { - CUfunction func = mUtilKernelWrapper->getCuFunction(KERNEL_MEMCOPY_BATCHED); - CUdeviceptr dptr; - - for (uint32_t i = 0 ; i < count ; i++) - { - PX_ASSERT(desc[i].isValid()); - - switch (desc[i].type) - { - case PxGpuCopyDesc::DeviceToHost: - dptr = mCtxMgr->getMemoryManager()->getMappedPinnedPtr(PxCudaBufferPtr(desc[i].dest)); - desc[i].dest = dptr; - break; - case PxGpuCopyDesc::HostToDevice: - dptr = mCtxMgr->getMemoryManager()->getMappedPinnedPtr(PxCudaBufferPtr(desc[i].source)); - desc[i].source = dptr; - break; - case PxGpuCopyDesc::DeviceMemset32: - case PxGpuCopyDesc::DeviceToDevice: - //do nothing, cases are here for GCCs warning system - break; - } - } - - uint32_t numThreads, numBlocksX; - if (mCtxMgr->supportsArchSM20()) - { - numThreads = 256; - numBlocksX = 1; - } - else - { - numThreads = 128; - numBlocksX = 2; - } - - dptr = mCtxMgr->getMemoryManager()->getMappedPinnedPtr(PxCudaBufferPtr(desc)); - - GD_CHECK_CALL( - launchKernelGrid(func, numBlocksX, count, numThreads, 0, stream, - dptr) - ); - } -} - -void PxGpuWorkerThread::flushBatch(CUevent endEvent, CUstream syncStream, PxBaseTask* task) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (mFailureDetected) - { - return; - } - - if (endEvent && (1 & intptr_t(syncStream))) - { - // blocking record event on stream 0, flushes current push buffer - GD_CHECK_CALL(cuEventRecord(endEvent, 0)); - } else { - CUresult ret = cuStreamQuery(0); // flushes current push buffer - PX_ASSERT(ret == CUDA_SUCCESS || ret == CUDA_ERROR_NOT_READY); - PX_UNUSED(ret); - } - - int next = (mCompletionRingPush + 1) % SIZE_COMPLETION_RING; - while (next == mCompletionRingPop) - { - // lordy, I hope we never get here. - PX_ALWAYS_ASSERT(); - mCtxMgr->releaseContext(); - sleep(1); - mCtxMgr->acquireContext(); - } - - CudaBatch& b = mCompletionRing[ mCompletionRingPush ]; - b.blockingEvent = endEvent; - b.blockingStream = syncStream; - b.continuationTask = task; - - mCompletionRingPush = next; - mRecordEventQueued.set(); -} - -// Take any submitted tasks into its appropriate read list -void PxGpuWorkerThread::pollSubmitted(shdfnd::Array<ReadyTask>* ready) -{ - mInputReady.reset(); - PxGpuTask* gt; - while ((gt = (PxGpuTask*) mSubmittedTaskList.popBack()) != 0) - { - PxGpuTaskHint::Enum type = gt->getTaskHint(); - ReadyTask* r = &ready[ type ].insert(); - r->task = gt; - r->iteration = 0; - if (mUsingConcurrentStreams && gt->mStreamIndex == 0) - { - gt->mStreamIndex = mCachedStreams.popBack(); - } - } -} - -void PxGpuWorkerThread::processActiveTasks() -{ -#if PX_SUPPORT_PXTASK_PROFILING - PX_PROFILE_ZONE("GpuDispatcher.ProcessTasksEvent", 0); // PT: TODO: fix invalid context -#endif - - if (mFailureDetected) - { - while (!mSubmittedTaskList.empty()) - { - mInputReady.reset(); - mSubmittedTaskList.popBack()->release(); - } - return; - } - - for (uint32_t i = 0; i < PxGpuTaskHint::NUM_GPU_TASK_HINTS; i++) - { - mReady[i].clear(); - } - - //OutputDebugString("batch beginning\n"); - - const CUevent nonBlockEv = mCachedNonBlockingEvents.get(); - bool workToFlush = false; - bool tasksRemain = false; - PxGpuTaskHint::Enum curMode = PxGpuTaskHint::HostToDevice; - - pollSubmitted(mReady); - - do - { - // cycle current run mode when necessary - if (mReady[ curMode ].size() == 0) - { - if (curMode == PxGpuTaskHint::HostToDevice) - { - curMode = PxGpuTaskHint::Kernel; - } - else if (curMode == PxGpuTaskHint::Kernel) - { - curMode = PxGpuTaskHint::DeviceToHost; - } - else - { - curMode = PxGpuTaskHint::HostToDevice; - } - } - - uint32_t singleStream = mReady[curMode].empty() ? 0 : mReady[curMode].front().task->mStreamIndex; - - while (mReady[ curMode ].size()) - { - bool needwfi = false; - for (uint32_t i = 0 ; i < mReady[ curMode ].size() ; i++) - { - ReadyTask& r = mReady[ curMode ][ i ]; - - if (r.task->mPreSyncRequired) - { - // If mPreSyncRequired is set *before* the task is run, it implies - // a WFI must be inserted before this task issues any work. Multiple - // ready tasks may have this flag, so to avoid inserting multiple WFI - // requests, we skip marked tasks in this pass and note a WFI is needed. - needwfi = true; - r.task->mPreSyncRequired = false; - } - else - { - const CUstream s = (r.task->mStreamIndex > 0) ? mCachedStreams.get(r.task->mStreamIndex) : 0; - - bool active; - { -#if PX_PROFILE -#if PX_SUPPORT_PXTASK_PROFILING - PX_PROFILE_ZONE(r.task->getName(), r.task->getContextId()); -#endif -#endif - active = r.task->launchInstance(s, int(r.iteration++)); - } - if(singleStream != r.task->mStreamIndex) - singleStream = 0; - - // If the launchInstance() call reported a non-recoverable error, gracefully - // release all scheduled tasks - if (mFailureDetected) - { - // Release all ready tasks - for (uint32_t h = 0; h < PxGpuTaskHint::NUM_GPU_TASK_HINTS; h++) - { - for (uint32_t j = 0 ; j < mReady[ h ].size() ; j++) - { - mReady[ h ][ j ].task->release(); - } - mReady[ h ].clear(); - } - - // Release all submitted tasks, until idle - while (!mSubmittedTaskList.empty()) - { - mInputReady.reset(); - mSubmittedTaskList.popBack()->release(); - } - return; - } - - workToFlush = true; - if (r.task->mPreSyncRequired) - { - // This task has asked for a sync point, meaning it has launched a copy - // or a kernel that must be completed before any later tasks are allowed - // to start. Insert a WFI and clear the needwfi flag - GD_CHECK_CALL(cuEventRecord(nonBlockEv, 0)); - needwfi = false; - r.task->mPreSyncRequired = false; - } - - if (!active) - { - r.task->release(); - mReady[ curMode ].replaceWithLast(i); - pollSubmitted(mReady); - i -= 1; - } - } - } - - if (needwfi) - { - GD_CHECK_CALL(cuEventRecord(nonBlockEv, 0)); - } - } - - /* We have completed one of the three phases */ - - tasksRemain = false; - for (int e = (int) PxGpuTaskHint::HostToDevice ; e != (int) PxGpuTaskHint::NUM_GPU_TASK_HINTS ; e++) - { - tasksRemain |= (mReady[ e ].size() != 0); - } - - if (!mCompletionTasks.empty()) - { - workToFlush = true; - } - - if (workToFlush && (tasksRemain == false || curMode == PxGpuTaskHint::DeviceToHost)) - { - //OutputDebugString("batch ending\n"); - - while (mCompletionTasks.size()) - { - PxBaseTask* t = mCompletionTasks.popBack(); - if (workToFlush) - { - CUevent stopEv = mCachedBlockingEvents.get(); - CUstream stream = singleStream ? mCachedStreams.get(singleStream) : (CUstream)1; - flushBatch(stopEv, stream, t); - workToFlush = false; - } - else - { - flushBatch(0, 0, t); - } - } - if (workToFlush) - { - /* Getting here is probably an indication of a bug in your task graph, - * but it is possible to get this warning if you have CPU tasks that - * can delay GpuTasks. So, consider this warning "training wheels" and - * disable it if you know your graph is correct. - */ - // SJB - Disabling this warning, APEX does this every frame because - // of how BasicIOS and IOFX interact. - //shdfnd::getFoundation().error(PX_WARN, - // "CUDA work generated without a completion dependency!"); - CUevent stopEv = mCachedBlockingEvents.get(); - flushBatch(stopEv, (CUstream)1, NULL); - } - } - } - while (tasksRemain); - - mCachedNonBlockingEvents.add(nonBlockEv); -} - -#endif diff --git a/PxShared/src/cudamanager/src/HeapManagerInterface.h b/PxShared/src/cudamanager/src/HeapManagerInterface.h deleted file mode 100644 index 7fe7f2e..0000000 --- a/PxShared/src/cudamanager/src/HeapManagerInterface.h +++ /dev/null @@ -1,156 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -//----------------------------------------------------------------------------// -// HeapManagerInterface.h -//----------------------------------------------------------------------------// - -#ifndef PXCUDACONTEXTMANAGER_HEAPMANAGERINTERFACE_H -#define PXCUDACONTEXTMANAGER_HEAPMANAGERINTERFACE_H - -#include "task/PxTaskDefine.h" -#include "foundation/PxSimpleTypes.h" -#include "cudamanager/PxCudaMemoryManager.h" - -#include <string.h> - -namespace physx -{ -struct HeapStatsFlags -{ - enum Enum - { - F_BASIC_STATS = 1 << 0, - F_INTERNAL_FRAGMENTATION = 1 << 1, - F_BIGGEST_FREE_BLOCK = 1 << 2, - F_HISTOGRAM = 1 << 3, - F_ALLOC_ID_STATS = 1 << 4, - F_ALL = 0xFFFFFFFF, - }; -}; - -#define BITSPERWORD sizeof(size_t)*8 - -class ApexHeapStats -{ -public: - ApexHeapStats(): - heapSize(0), - totalAllocated(0), - maxAllocated(0), - internalFragmentation(0), - maxInternalFragmentation(0), - biggestFreeBlock(0), - numEntries(0) - {} - - PX_INLINE void reset() - { - memset(this, 0, sizeof(ApexHeapStats)); - } - - // F_BASIC_STATS - size_t heapSize; - size_t totalAllocated; - size_t maxAllocated; - - // F_INTERNAL_FRAGMENTATION - size_t internalFragmentation; - size_t maxInternalFragmentation; - - // F_BIGGEST_FREE_BLOCK - size_t biggestFreeBlock; - - // F_HISTOGRAM - size_t freeBuddyHistogram[BITSPERWORD]; - size_t allocatedBuddyHistogram[BITSPERWORD]; - size_t numEntries; - - // F_ALLOC_ID_STATS - PxAllocIdStats allocIdStats[PxAllocId::NUM_IDS]; -}; - - -class HeapManagerInterface -{ -public: - // simple allocator interface over which the heap manager does its base allocation and allocates further pages - class Allocator - { - public: - virtual ~Allocator() {}; - - virtual void* alloc(const size_t size) = 0; - virtual void free(void* addr, const size_t size) = 0; - }; - - virtual ~HeapManagerInterface() {}; - - // INTERFACE METHODS - // init the HeapManager by passing it a block of memory and the smallest size of a memory block. - // returns true if init was successful - virtual bool init(Allocator* memAllocator, const size_t baseSize, const size_t pageSize, const size_t minBlockSize, const size_t maxIntFrag = size_t(-1)) = 0; - - // Changes the page size. The size of allocations over the supplied Allocator are a multiple of the pageSize. - // returns true if the page size was valid. (!0, >minBlockSize, pow2) - virtual bool setPageSize(size_t pageSize) = 0; - - // returns the address of an allocated block for the requested size. - // returns a NULL ptr if alloc failed. - virtual void* alloc(const size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - // returns true if the block at the given address could be resized to size - // returns false if this failed. Manual free and alloc is still possible but needs a memcopy. - virtual bool realloc(void* addr, const size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)) = 0; - - // frees a given block. - // returns true if the operation was successful - virtual bool free(void* addr) = 0; - - // deallocates all empty pages - virtual void freeEmptyPages() = 0; - - // ensures that there there is free memory of at least the requested size - // returns true if the operation was successful. Free memory was already big enough or new pages were allocated successfully. - virtual bool reserve(size_t size) = 0; - - // returns stats into a ApexHeapStats object, stats can be selected with HeapManagerStatsFlags. - // returns true if the operation was successful - virtual bool getStats(ApexHeapStats& stats, const uint32_t flags) = 0; - - // discretisize memory into an array such that it can be visualized - // returns true if the operation was successful - virtual bool visualizeMemory(uint8_t* array, const size_t size) = 0; - - // returns the base address of the page containing the memory block at addr. - // returns NULL if addr doesn't correspond to a page - virtual void* findBaseAddress(void* addr) = 0; -}; - -} // end physx namespace - -#endif // PXCUDACONTEXTMANAGER_HEAPMANAGERINTERFACE_H diff --git a/PxShared/src/cudamanager/src/HeapManagerLinkedList.h b/PxShared/src/cudamanager/src/HeapManagerLinkedList.h deleted file mode 100644 index 45a359d..0000000 --- a/PxShared/src/cudamanager/src/HeapManagerLinkedList.h +++ /dev/null @@ -1,204 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -//----------------------------------------------------------------------------// -// HeapManagerLinkedList.h -//----------------------------------------------------------------------------// - -#ifndef PXCUDACONTEXTMANAGER_HEAPMANAGERLINKEDLIST_H -#define PXCUDACONTEXTMANAGER_HEAPMANAGERLINKEDLIST_H - -#include "foundation/PxAssert.h" - -namespace physx -{ - -template <typename T> -class LinkedList -{ -public: - - PX_INLINE LinkedList() - : mHead(NULL) - , mNumElements(0) - { - } - - PX_INLINE void insert(T*& elt) - { - if (mHead) - { - elt->next = mHead->next; - } - mHead = elt; - mNumElements++; - } - - PX_INLINE void insertSorted(T*& elt) - { - if (!mHead) - { - mHead = elt; - mHead->next = NULL; - } - else if (!mHead->next || (mHead->addr > elt->addr)) - { - if (mHead->addr > elt->addr) - { - elt->next = mHead; - mHead = elt; - } - else - { - mHead->next = elt; - elt->next = NULL; - } - } - else - { - T* cur = mHead; - while (cur->next && (elt->addr > cur->next->addr)) - { - cur = cur->next; - } - elt->next = cur->next; - cur->next = elt; - } - mNumElements++; - } - - PX_INLINE T* pop() - { - if (mHead) - { - T* ret = mHead; - mHead = mHead->next; - mNumElements--; - return ret; - } - return NULL; - } - - PX_INLINE bool remove(const T* elt) - { - PX_ASSERT(elt); - if (mHead && mHead == elt) - { - mHead = mHead->next; - mNumElements--; - return true; - } - else - { - T* cur = mHead; - while (cur && cur->next != elt) - { - PX_ASSERT(cur->addr < elt->addr); // assert for sorted list property. - cur = cur->next; - } - if (cur && elt) - { - cur->next = elt->next; - mNumElements--; - return true; - } - } - return false; - } - - PX_INLINE T* find(const size_t addr) - { - T* cur = mHead; - while (cur && cur->addr < addr) - { - cur = cur->next; - } - - return cur && (cur->addr == addr) ? cur : NULL; - } - - PX_INLINE T* findAndPop(const size_t addr) - { - if (mHead == NULL) - { - return NULL; - } - - if (mHead->addr == addr) - { - return pop(); - } - - T* cur = mHead; - T* last = mHead; - while (cur) - { - if (cur->addr == addr) - { - last->next = cur->next; - mNumElements--; - return cur; - } - else if (cur->addr > addr) - { - return NULL; // because list is sorted. - } - else - { - last = cur; - cur = cur->next; - } - } - return NULL; - } - - PX_INLINE size_t getSize() - { - return mNumElements; - } - PX_INLINE T* getHead() - { - return mHead; - } - - // hacky - PX_INLINE void setSize(size_t s) - { - mNumElements = s; - } - PX_INLINE void setHead(T* h) - { - mHead = h; - } -private: - T* mHead; - size_t mNumElements; -}; - -} // end physx namespace - -#endif // PXCUDACONTEXTMANAGER_HEAPMANAGERLINKEDLIST_H diff --git a/PxShared/src/cudamanager/src/HeapManagerRef.cpp b/PxShared/src/cudamanager/src/HeapManagerRef.cpp deleted file mode 100644 index bf3847f..0000000 --- a/PxShared/src/cudamanager/src/HeapManagerRef.cpp +++ /dev/null @@ -1,1380 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "CudaMemoryManager.h" -#include "HeapManagerRef.h" - -#include "PsSort.h" -#include "PsArray.h" -#include "PsAllocator.h" -#include "PsString.h" - -#include "foundation/PxMath.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxMemory.h" - - -#if DUMP_HEAP_USAGE_TO_FILE -#include "PsWindowsInclude.h" -#endif - -using namespace physx::shdfnd; -using namespace physx; - - -#define CMM_DELETE_SINGLE(x) { if(x) delete x; x = NULL; } -#define CMM_DELETE_ARRAY(x) { if(x) delete [] x; x = NULL; } - -HeapManagerRef::HeapManagerRef(physx::PxErrorCallback& errorCallback, bool enableMutex) - : mHeaps(PX_DEBUG_EXP("HeapManagerRef:mHeaps")) - , mBuddyPool("mBuddyPool", 1024) - , mPageSize(0) - , mMinBlockSize(0) - , mMaxIntFrag(size_t(-1)) - , mNewEmptyPage(false) - , mMemAllocator(NULL) - , mGlobalAllocMem(0) - , mGlobalMaxAllocMem(0) - , mGlobalInternalFragmentation(0) - , mGlobalMaxInternalFragmentation(0) - , mErrorCallback(errorCallback) - -{ - PX_UNUSED(enableMutex); // SJB: heap alloc of shdfnd::Mutex not working for me -} - -HeapManagerRef::~HeapManagerRef() -{ - for (uint32_t i = 0; i < mHeaps.size(); i++) - { - if (mMemAllocator && mHeaps[i].baseAddr) - { - mMemAllocator->free(reinterpret_cast<void*>(mHeaps[i].baseAddr), mHeaps[i].heap->getTotalMemorySize()); - } - CMM_DELETE_SINGLE(mHeaps[i].heap); - } -#if DUMP_HEAP_USAGE_TO_FILE - fclose(mLogFile); -#endif -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// INTERFACE METHODS -bool HeapManagerRef::init(Allocator* memAllocator, const size_t baseSize, const size_t pageSize, const size_t minBlockSize, const size_t maxIntFrag) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - // init Heap and do some basic checks. - - // init only once - if (mHeaps.size()) - { - return false; - } - - if (baseSize && (minBlockSize > baseSize)) - { - return false; - } - - if (minBlockSize > pageSize) - { - return false; - } - - if (baseSize && (baseSize % minBlockSize)) - { - return false; - } - - uint8_t minBlockSizeLog2; - if (minBlockSize != findNextPow2(minBlockSizeLog2, minBlockSize, 0, BITSPERWORD)) - { - return false; - } - - if (pageSize != findNextPow2(pageSize, minBlockSizeLog2, BITSPERWORD)) - { - return false; - } - - if (!memAllocator) - { - return false; - } - - mMemAllocator = memAllocator; - mPageSize = pageSize; - mMinBlockSize = minBlockSize; - mMaxIntFrag = maxIntFrag; - - memset(&mGlobalAllocIdStats, 0, sizeof(PxAllocIdStats)*PxAllocId::NUM_IDS); - -#if DUMP_HEAP_USAGE_TO_FILE - char fileName[1024]; - sprintf_s(fileName, 1024, "HeapLog_%p.txt", this); - fopen_s(&mLogFile, fileName, "w"); - fprintf(mLogFile, "HeapSize: %d, BlockSize: %d Addr: 0x0\n", baseSize, minBlockSize); - QueryPerformanceCounter((LARGE_INTEGER*)&m_qpc); - QueryPerformanceFrequency((LARGE_INTEGER*)&m_qpf); -#endif - - // init heap - if (baseSize) - { - return allocateNewHeap(baseSize, true) != NULL; - } - else - { - return true; - } -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool HeapManagerRef::setPageSize(size_t pageSize) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - if (pageSize == 0) - { - return false; - } - - if (mMinBlockSize > pageSize) - { - return false; - } - - if (pageSize != findNextPow2(pageSize, 0, BITSPERWORD)) - { - return false; - } - - mPageSize = pageSize; - return true; -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void* HeapManagerRef::alloc(const size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - -#if DUMP_HEAP_USAGE_TO_FILE - unsigned __int64 qpc; - QueryPerformanceCounter((LARGE_INTEGER*)&qpc); - float dtime = (float)((double)(qpc - m_qpc) / (double)m_qpf); - fprintf(mLogFile, "alloc t: %f s: %d", dtime, size); -#endif - - void* ret = NULL; - // try to allocate it in one of the heaps/pages - for (uint32_t i = 0; !ret && i < mHeaps.size(); i++) - { - ret = mHeaps[i].heap->alloc(size, PX_ALLOC_INFO_PARAMS_INPUT()); - } - - // create a new page - if (!ret) - { - Heap* heap = allocateNewPages(size); - if (heap) - { - ret = heap->alloc(size, PX_ALLOC_INFO_PARAMS_INPUT()); - } - } - -#if DUMP_HEAP_USAGE_TO_FILE - fprintf(mLogFile, " a: 0x%p\n", ret); -#endif - - return ret; -} - -//(10/20/2009 feodorb) TODO: decide whether we move the binary search -//somewhere away from here. Stands here for std::lower_bound replacement -template<typename T> -static uint32_t findUpperBound(const physx::shdfnd::Array<T>& refArray, const T& refValue) -{ - uint32_t start = 0, end = refArray.size(); - while (end - start > 0) - { - uint32_t midPoint = start + ((end - start) >> 1); - - if (!(refValue < refArray[midPoint])) - { - start = midPoint + 1; - } - else - { - end = midPoint; - } - } - return start; -} - -Heap* HeapManagerRef::findHeap(void* addr) const -{ - HeapManagerPage searchPage; - searchPage.baseAddr = reinterpret_cast<size_t>(addr); - - uint32_t upperBound = findUpperBound(mHeaps, searchPage); - PX_ASSERT(upperBound == 0 || - (searchPage.baseAddr >= mHeaps[upperBound - 1].baseAddr && - searchPage.baseAddr < mHeaps[upperBound - 1].baseAddr + mHeaps[upperBound - 1].heap->getTotalMemorySize()) - ); - - return (upperBound > 0) ? mHeaps[upperBound - 1].heap : 0; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool HeapManagerRef::realloc(void* addr, const size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - -#if DUMP_HEAP_USAGE_TO_FILE - unsigned __int64 qpc; - QueryPerformanceCounter((LARGE_INTEGER*)&qpc); - float dtime = (float)((double)(qpc - m_qpc) / (double)m_qpf); - fprintf(mLogFile, "realloc t: %f s: %d, a: 0x%p\n", dtime, size, addr); -#endif - - Heap* heap = findHeap(addr); - - if (heap != 0) - { - bool ret = heap->realloc(addr, size, PX_ALLOC_INFO_PARAMS_INPUT()); - if (ret && size > 0 && mNewEmptyPage) - { - shrinkMemory(); - } - return ret; - } - return false; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool HeapManagerRef::free(void* addr) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - -#if DUMP_HEAP_USAGE_TO_FILE - unsigned __int64 qpc; - QueryPerformanceCounter((LARGE_INTEGER*)&qpc); - float dtime = (float)((double)(qpc - m_qpc) / (double)m_qpf); - fprintf(mLogFile, "free t: %f a: 0x%p\n", dtime, addr); -#endif - - if (addr == NULL) - { - return false; - } - - Heap* heap = findHeap(addr); - if (heap != 0) - { - bool ret = heap->free(addr); - if (ret && mNewEmptyPage) - { - shrinkMemory(); - } - return ret; - } - return false; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -static void addStats(ApexHeapStats& dst, const ApexHeapStats& src, uint32_t flags) -{ - if (flags & HeapStatsFlags::F_BASIC_STATS) - { - dst.heapSize += src.heapSize; - } - if (flags & HeapStatsFlags::F_BIGGEST_FREE_BLOCK) - { - dst.biggestFreeBlock = PxMax(dst.biggestFreeBlock, src.biggestFreeBlock); - } - if (flags & HeapStatsFlags::F_HISTOGRAM) - { - dst.numEntries = PxMax(dst.numEntries, src.numEntries); - for (uint32_t i = 0; i < BITSPERWORD; i++) - { - dst.freeBuddyHistogram[i] += src.freeBuddyHistogram[i]; - dst.allocatedBuddyHistogram[i] += src.allocatedBuddyHistogram[i]; - } - } -} - -PX_INLINE void HeapManagerRef::addToStats(PxAllocId::Enum id, const size_t size, const size_t fragmentation) -{ - PxAllocIdStats& idStats = mGlobalAllocIdStats[id]; - idStats.elements++; - idStats.size += size; - idStats.maxElements = PxMax(idStats.maxElements, idStats.elements); - idStats.maxSize = PxMax(idStats.maxSize, idStats.size); - mGlobalAllocMem += size; - mGlobalMaxAllocMem = PxMax(mGlobalMaxAllocMem, mGlobalAllocMem); - mGlobalInternalFragmentation += fragmentation; - mGlobalMaxInternalFragmentation = PxMax(mGlobalMaxInternalFragmentation, mGlobalInternalFragmentation); -} - - -PX_INLINE void HeapManagerRef::removeFromStats(PxAllocId::Enum id, const size_t size, const size_t fragmentation) -{ - PxAllocIdStats& idStats = mGlobalAllocIdStats[id]; - PX_ASSERT(idStats.elements); - PX_ASSERT(idStats.size >= size); - - idStats.elements--; - idStats.size -= size; - mGlobalAllocMem -= size; - mGlobalInternalFragmentation -= fragmentation; -} - -PX_INLINE void HeapManagerRef::incStats(PxAllocId::Enum id, const size_t change, const size_t fragmentation) -{ - PxAllocIdStats& idStats = mGlobalAllocIdStats[id]; - idStats.size += change; - idStats.maxSize = PxMax(idStats.maxSize, idStats.size); - mGlobalAllocMem += change; - mGlobalMaxAllocMem = PxMax(mGlobalMaxAllocMem, mGlobalAllocMem); - mGlobalInternalFragmentation += fragmentation; - mGlobalMaxInternalFragmentation = PxMax(mGlobalMaxInternalFragmentation, mGlobalInternalFragmentation); -} - -PX_INLINE void HeapManagerRef::decStats(PxAllocId::Enum id, const size_t change, const size_t fragmentation) -{ - PxAllocIdStats& idStats = mGlobalAllocIdStats[id]; - PX_ASSERT(idStats.size >= change); - idStats.size -= change; - mGlobalAllocMem += change; - mGlobalInternalFragmentation += fragmentation; -} - -bool HeapManagerRef::getStats(ApexHeapStats& stats, const uint32_t flags) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - ApexHeapStats tmpStats; - stats.reset(); - for (uint32_t i = 0; i < mHeaps.size(); i++) - { - mHeaps[i].heap->getStats(tmpStats, flags); - addStats(stats, tmpStats, flags); - } - if (flags & HeapStatsFlags::F_BASIC_STATS) - { - stats.totalAllocated = mGlobalAllocMem; - stats.maxAllocated = mGlobalMaxAllocMem; - - } - if (flags & HeapStatsFlags::F_INTERNAL_FRAGMENTATION) - { - stats.internalFragmentation = mGlobalInternalFragmentation; - stats.maxInternalFragmentation = mGlobalMaxInternalFragmentation; - } - if (flags & HeapStatsFlags::F_ALLOC_ID_STATS) - { - // stats per allocation ID - PxMemCopy(stats.allocIdStats, mGlobalAllocIdStats, sizeof(PxAllocIdStats)*PxAllocId::NUM_IDS); - } - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool HeapManagerRef::visualizeMemory(uint8_t* array, const size_t arraySize) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - ApexHeapStats tmpStats; - getStats(tmpStats, HeapStatsFlags::F_BASIC_STATS); - float scale = float(arraySize) / float(tmpStats.heapSize); - uint8_t* start = array; - for (uint32_t i = 0; i < mHeaps.size(); i++) - { - size_t heapSize = mHeaps[i].heap->getTotalMemorySize(); - size_t numVis = size_t(float(heapSize) * scale); - PX_ASSERT(start + numVis <= array + arraySize); - mHeaps[i].heap->visualizeMemory(start, numVis); - start += numVis; - } - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void* HeapManagerRef::findBaseAddress(void* addr) -{ - Heap* heap = findHeap(addr); - if (heap) - { - return heap->getBaseAddress(); - } - return NULL; -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -Heap* HeapManagerRef::allocateNewHeap(size_t heapSize, bool isPersistent) -{ - if (!mMemAllocator) - { - return NULL; - } - - void* newPage = mMemAllocator->alloc(heapSize); - if (newPage) - { - HeapManagerPage page; - page.baseAddr = reinterpret_cast<size_t>(newPage); - page.heap = PX_NEW(Heap)(*this, mErrorCallback); - page.isPersistent = isPersistent; - if (page.heap && page.heap->init(page.baseAddr, heapSize, mMinBlockSize, mMaxIntFrag)) - { - mHeaps.pushBack(page); - shdfnd::sort(mHeaps.begin(), (uint32_t) mHeaps.size()); - return page.heap; - } - else - { - mMemAllocator->free(newPage, page.heap->getTotalMemorySize()); - CMM_DELETE_SINGLE(page.heap); - } - } - return NULL; -} - -Heap* HeapManagerRef::allocateNewPages(size_t requestedSize) -{ - uint8_t pageSizeLog2; - uint8_t minBlockSizeLog2; - findNextPow2(minBlockSizeLog2, mMinBlockSize, 0, BITSPERWORD); - findNextPow2(pageSizeLog2, mPageSize, minBlockSizeLog2, BITSPERWORD); - const size_t allocSize = findNextPow2(requestedSize, pageSizeLog2, BITSPERWORD); - return allocateNewHeap(allocSize); -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void HeapManagerRef::removeDeletedHeapsFromList(uint32_t numDeletes) -{ - // remove pages from list, keeping it sorted. - if (numDeletes) - { - const uint32_t numEntries = (uint32_t) mHeaps.size(); - - //seek - uint32_t w = 0; - while (w < (numEntries) && mHeaps[w].heap != NULL) - { - w++; - } - - // remove holes - uint32_t r = w + 1; - while (r < numEntries) - { - if (mHeaps[r].heap == NULL) - { - r++; - } - else - { - mHeaps[w++] = mHeaps[r++]; - } - } - - mHeaps.resize(numEntries - numDeletes); - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void HeapManagerRef::resetHeap(HeapManagerPage& page) -{ - PX_ASSERT(page.heap->getAllocatedMemorySize() == 0); - Heap* newHeap = PX_NEW(Heap)(*this, mErrorCallback); - if (newHeap) - { - if (newHeap->init(page.baseAddr, page.heap->getTotalMemorySize(), mMinBlockSize, mMaxIntFrag)) - { - CMM_DELETE_SINGLE(page.heap); - page.heap = newHeap; - } - else - { - CMM_DELETE_SINGLE(newHeap); - } - } -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void HeapManagerRef::freeEmptyPages() -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - // release heaps - uint32_t numDeletes = 0; - const uint32_t numEntries = (uint32_t) mHeaps.size(); - for (uint32_t i = 0; i < numEntries; i++) - { - HeapManagerPage& page = mHeaps[i]; - PX_ASSERT(page.heap); - if (page.isPersistent) - { - // for persistent pages: reset without release. - if (page.heap->getAllocatedMemorySize() == 0) - { - resetHeap(page); - } - } - else if (page.heap->getAllocatedMemorySize() == 0) - { - mMemAllocator->free(reinterpret_cast<void*>(page.baseAddr), page.heap->getTotalMemorySize()); - CMM_DELETE_SINGLE(page.heap); - numDeletes++; - } - } - - if (numDeletes) - { - removeDeletedHeapsFromList(numDeletes); - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void HeapManagerRef::shrinkMemory() -{ - mNewEmptyPage = false; - - // collect stats - size_t totalAllocated = 0; - size_t totalPageSize = 0; - const uint32_t numEntries = (uint32_t) mHeaps.size(); - for (uint32_t i = 0; i < numEntries; i++) - { - HeapManagerPage& page = mHeaps[i]; - totalAllocated += page.heap->getAllocatedMemorySize(); - totalPageSize += page.heap->getTotalMemorySize(); - PX_ASSERT(totalAllocated <= totalPageSize); - } - - // shrink memory if free non-persistent space is half or more of the allocated pages. - // releasing from the back of address sorted list, other strategies like LRU, best fit are also possible. - if (totalPageSize) - { - float allocScale = float(totalAllocated) / float(totalPageSize); - if (allocScale <= 0.5f) - { - size_t sizeToRelease = totalAllocated ? (totalPageSize - totalAllocated) >> 1 : totalPageSize; - uint32_t numDeletes = 0; - for (uint32_t i = 0; i < numEntries; i++) - { - HeapManagerPage& page = mHeaps[numEntries - i - 1]; - PX_ASSERT(page.heap); - if (page.heap->getAllocatedMemorySize() == 0) - { - if (!page.isPersistent && page.heap->getTotalMemorySize() <= sizeToRelease) - { - mMemAllocator->free(reinterpret_cast<void*>(page.baseAddr), page.heap->getTotalMemorySize()); - sizeToRelease -= page.heap->getTotalMemorySize(); - CMM_DELETE_SINGLE(page.heap); - numDeletes++; - } - else - { - resetHeap(page); - } - } - } - - if (numDeletes) - { - removeDeletedHeapsFromList(numDeletes); - } - } - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool HeapManagerRef::reserve(size_t size) -{ - shdfnd::Mutex::ScopedLock lock(mMutex); - - size_t freeSize = 0; - for (uint32_t i = 0; i < mHeaps.size(); i++) - { - freeSize += mHeaps[i].heap->getTotalMemorySize() - mHeaps[i].heap->getAllocatedMemorySize(); - } - - if (freeSize < size) - { - return allocateNewPages(size - freeSize) != NULL; - } - else - { - return true; - } -} - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -PX_INLINE size_t HeapManagerRef::findNextPow2(const size_t val, const uint8_t min, const uint8_t max) -{ - size_t ret = val; - for (uint8_t i = min; i <= max; i++) - { - ret = size_t(1) << i; - if (ret >= val) - { - break; - } - } - return ret; -} - - -PX_INLINE size_t HeapManagerRef::findNextPow2(uint8_t& pow, const size_t val, const uint8_t min, const uint8_t max) -{ - size_t ret = val; - for (pow = min; pow <= max; pow++) - { - ret = size_t(1) << pow; - if (ret >= val) - { - break; - } - } - return ret; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void BuddyList::clear() -{ - Buddy* cur = pop(); - while (cur) - { - heap->getBuddyPool().destroy(cur); - cur = pop(); - } -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -Heap::~Heap() -{ - for (uint32_t i = 0; i <= mMaxLevel; i++) - { - mFreeBuddiesAtLevel[i].clear(); - } - CMM_DELETE_ARRAY(mFreeBuddiesAtLevel); - - for (Buddy* buddy = mAllocatedBuddies.getHead(); buddy != NULL; buddy = buddy->next) - { - void* address = reinterpret_cast<void*>((buddy->addr << mMinBlockLog2) + mBaseAddr); -#if KEEP_DEBUG_INFO - char buffer[256]; - physx::shdfnd::snprintf(buffer, 256, "Memory leak!\naddress %p file %s, line %d, name %s", address, buddy->file, buddy->line, buddy->allocName); - mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, buffer, __FILE__, __LINE__); -#else - char buffer[256]; - physx::shdfnd::snprintf(buffer, 256, "Memory leak at address %p", address); - mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, buffer, __FILE__, __LINE__); -#endif - } - - //clear it anyway - mAllocatedBuddies.clear(); -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::init(size_t baseAddr, const size_t baseSize, const size_t minBlockSize, const size_t maxIntFrag) -{ - if (minBlockSize != HeapManagerRef::findNextPow2(mMinBlockLog2, minBlockSize, 0, BITSPERWORD)) - { - return false; - } - - if ((maxIntFrag != size_t(-1)) && (maxIntFrag != HeapManagerRef::findNextPow2(maxIntFrag, 0, BITSPERWORD))) - { - return false; - } - - mMaxIntFrag = maxIntFrag; - - mMinBlockSize = minBlockSize; - mTotalSize = baseSize; - mBaseAddr = baseAddr; - - if (mBaseAddr == 0) - { - return false; - } - - size_t numBlocks = baseSize >> mMinBlockLog2; - // allow only memory blocks which have a power of 2 in size. and numblocks must be at least 1. - if (numBlocks != HeapManagerRef::findNextPow2(mMaxLevel, numBlocks, 0, sizeof(size_t) * 4)) - { - return false; - } - - mFreeBuddiesAtLevel = PX_NEW(BuddyList)[(unsigned int)(mMaxLevel + 1)]; - if (!mFreeBuddiesAtLevel) - { - return false; - } - - // init size of buddy arrays - for (uint32_t i = 0; i <= mMaxLevel; i++) - { - mFreeBuddiesAtLevel[i].buddySize = size_t(1) << i; - mFreeBuddiesAtLevel[i].heap = this; - } - mAllocatedBuddies.heap = this; - - Buddy* b = mManager.getBuddyPool().construct(); - if (!b) - { - CMM_DELETE_ARRAY(mFreeBuddiesAtLevel); - return false; - } - b->level = mMaxLevel; - - // add buddy to its array - mFreeBuddiesAtLevel[mMaxLevel].insert(b); - - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void* Heap::alloc(const size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - /* - compute needed buddysize -> level - if(mFreeBuddiesAtLevel[level].array.size() > 0) - { - ret = array.popBack() - allocList.pushBack(ret) - return ret.adr+basePtr; - } - else - { - if(nonemptylist at higher levels) - ret = recursive split - else if(nonemptylist at lower levels ) - ret = recursive merge - else - ret = NULL; // heap full or to fragmented - } - */ - - PX_UNUSED(allocId); - PX_UNUSED(allocName); - PX_UNUSED(line); - PX_UNUSED(file); - - if (size == 0 || size > mTotalSize) - { - return NULL; - } - - PX_ASSERT(allocId < PxAllocId::NUM_IDS); - //PX_ASSERT(allocId != PxAllocId::UNASSIGNED); // enable to track unassigned memory - - // compute needed buddysize -> level - uint8_t level = 0; - HeapManagerRef::findNextPow2(level, size, mMinBlockLog2, BITSPERWORD); - level = uint8_t(level - mMinBlockLog2); - - Buddy* ret = NULL; - if (mFreeBuddiesAtLevel[level].getSize() > 0) - { - ret = mFreeBuddiesAtLevel[level].pop(); - } - else - { - // prefer splitting - if (level != mMaxLevel) - { - ret = findBySplitting(level); - } - // else try merging - if (!ret && level != 0) - { - ret = findByMerging(level); - } - } - - if (ret) - { - ret->occupiedSize = size; - size_t addr = ret->addr; - ret->allocId = uint16_t(allocId); -#if KEEP_DEBUG_INFO - ret->file = file; - ret->line = (uint32_t)line; - ret->allocName = allocName; -#endif - - size_t allocSize; - if (mMaxIntFrag != size_t(-1)) - { - allocSize = reduceIntFragment(*ret, mMaxIntFrag); // ret can be changed in here, that's why we store the address - } - else - { - allocSize = size_t(1) << (level + mMinBlockLog2); - mAllocatedBuddies.insertSorted(ret); - } - mAllocMem += allocSize; - mInternalFragmentation += allocSize - size; - mMaxAllocMem = PxMax(mAllocMem, mMaxAllocMem); - mMaxInternalFragmentation = PxMax(mInternalFragmentation, mMaxInternalFragmentation); - mManager.addToStats(allocId, allocSize, allocSize - size); - - PX_ASSERT(sanityTest()); - return reinterpret_cast<void*>((addr << mMinBlockLog2) + mBaseAddr); - } - else - { - PX_ASSERT(sanityTest()); - return NULL; - } -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::realloc(void* addr, const size_t size, PX_ALLOC_INFO_PARAMS_DEF()) -{ - PX_UNUSED(allocId); - PX_UNUSED(allocName); - PX_UNUSED(line); - PX_UNUSED(file); - - if (addr == NULL || size > mTotalSize) - { - return false; - } - - if (size == 0) - { - //realloc to 0 bytes can't keep the pointer as it was. - return false; - //return free(addr); - } - - size_t inernal_addr = reinterpret_cast<size_t>(addr) - mBaseAddr; - inernal_addr >>= mMinBlockLog2; - - // collect all buddies which are associated with this addr - shdfnd::Array<Buddy*, shdfnd::TempAllocator> budyList; - size_t totalAllocated = 0; - size_t buddyAllocated = 0; - Buddy* found = NULL; - do - { - found = mAllocatedBuddies.find(inernal_addr); - if (!found) - { - return false; - } - budyList.pushBack(found); - inernal_addr += size_t(1) << found->level; - totalAllocated += found->occupiedSize; - buddyAllocated += size_t(1) << (found->level + mMinBlockLog2); - } - while (found && !found->isLastBuddy); - - Buddy* cur = budyList.popBack(); - - // increase size - if (totalAllocated < size) - { - size_t leftSpace = (size_t(1) << (cur->level + mMinBlockLog2)) - cur->occupiedSize; - size_t neededSpace = size - totalAllocated; - if (neededSpace <= leftSpace) - { - cur->occupiedSize += neededSpace; -#if KEEP_DEBUG_INFO - cur->file = file; - cur->line = (uint32_t)line; - cur->allocName = allocName; -#endif - - mInternalFragmentation -= neededSpace; - mManager.decStats(PxAllocId::Enum(cur->allocId), 0, neededSpace); - - // replace - mAllocatedBuddies.remove(cur); - mAllocatedBuddies.insertSorted(cur); - PX_ASSERT(sanityTest()); - return true; - } - else - { - return false; -#ifdef UNREACHABLE - // TODO:try merge free buddies until big enough, - // then add buddy and do internal fragmentation reduction. - - // search for free blocks next to this one. - size_t addr = cur->addr + (size_t(1) << cur->level); - if (!mAllocatedBuddies.find(addr)) - { - return false; - } - - // if not found, return null, let user reallocate - PX_ASSERT(sanityTest()); - return false; -#endif - } - } - // reduce size - else - { - // succededly remove buddies until the requested size is reached. - // if internal fragmentation reduction is turned on, then an allocation can consist of multiple buddies. - mInternalFragmentation -= (size_t(1) << (cur->level + mMinBlockLog2)) - cur->occupiedSize; - mManager.decStats(PxAllocId::Enum(cur->allocId), 0, (size_t(1) << (cur->level + mMinBlockLog2)) - cur->occupiedSize); - size_t diff = totalAllocated - size; - while (diff >= cur->occupiedSize) - { - diff -= cur->occupiedSize; - cur->occupiedSize = 0; - bool succ = mAllocatedBuddies.remove(cur); - PX_UNUSED(succ); - PX_ASSERT(succ); - mFreeBuddiesAtLevel[cur->level].insertSorted(cur); - size_t allocSize = size_t(1) << (cur->level + mMinBlockLog2); - mAllocMem -= allocSize; - mManager.decStats(PxAllocId::Enum(cur->allocId), allocSize, 0); - cur = budyList.popBack(); - } - cur->isLastBuddy = true; - cur->occupiedSize -= diff; - -#if KEEP_DEBUG_INFO - cur->file = file; - cur->line =(uint32_t)line; - cur->allocName = allocName; -#endif - - // replace - bool succ = mAllocatedBuddies.remove(cur); - PX_UNUSED(succ); - PX_ASSERT(succ); - mAllocatedBuddies.insertSorted(cur); - mInternalFragmentation += (size_t(1) << (cur->level + mMinBlockLog2)) - cur->occupiedSize; - mManager.incStats(PxAllocId::Enum(cur->allocId), 0, (size_t(1) << (cur->level + mMinBlockLog2)) - cur->occupiedSize); - PX_ASSERT(sanityTest()); - return true; - } -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::free(void* addr) -{ - if (addr == NULL) - { - return false; - } - - size_t internalAddr = reinterpret_cast<size_t>(addr) - mBaseAddr; - internalAddr >>= mMinBlockLog2; - - bool ret = true; - - bool dummy = true; - while (dummy) - { - Buddy* b = mAllocatedBuddies.findAndPop(internalAddr); - - if (!b) - { - return false; - } - - size_t allocSize = size_t(1) << (b->level + mMinBlockLog2); - mAllocMem -= allocSize; - mInternalFragmentation -= allocSize - b->occupiedSize; - mManager.removeFromStats(PxAllocId::Enum(b->allocId), allocSize, allocSize - b->occupiedSize); - b->occupiedSize = 0; - - mFreeBuddiesAtLevel[b->level].insertSorted(b); - - // check if this memory block occupied another buddy - if (b->isLastBuddy) - { - break; - } - else - { - internalAddr += size_t(1) << b->level; - } - } - - if (mAllocMem == 0) - { - mManager.notifyEmptyPage(); - } - - PX_ASSERT(sanityTest()); - return ret; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::getStats(ApexHeapStats& stats, const uint32_t flags) -{ - if (flags & HeapStatsFlags::F_BASIC_STATS) - { - stats.heapSize = mTotalSize; - stats.totalAllocated = mAllocMem; - stats.maxAllocated = mMaxAllocMem; - } - if (flags & HeapStatsFlags::F_INTERNAL_FRAGMENTATION) - { - // internal fragmentation - stats.internalFragmentation = mInternalFragmentation; - stats.maxInternalFragmentation = mMaxInternalFragmentation; - } - if (flags & HeapStatsFlags::F_BIGGEST_FREE_BLOCK) - { - // bigggest free block - stats.biggestFreeBlock = 0; - uint8_t curLevel = mMaxLevel; - do - { - if (mFreeBuddiesAtLevel[curLevel].getSize()) - { - stats.biggestFreeBlock = mFreeBuddiesAtLevel[curLevel].buddySize << mMinBlockLog2; - break; - } - curLevel--; - } - while (curLevel != 0); - } - if (flags & HeapStatsFlags::F_HISTOGRAM) - { - // histograms - for (uint8_t i = 0; i <= mMaxLevel; i++) - { - stats.freeBuddyHistogram[i] = mFreeBuddiesAtLevel[i].getSize(); - stats.allocatedBuddyHistogram[i] = 0; - } - Buddy* b = mAllocatedBuddies.getHead(); - while (b) - { - stats.allocatedBuddyHistogram[b->level]++; - b = b->next; - } - stats.numEntries = size_t(mMaxLevel + 1); - } - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::sanityTest() -{ - size_t sum = 0; - - for (uint8_t i = 0; i <= mMaxLevel; i++) - { - size_t buddiesAtLevel = 0; - for (Buddy* cur = mFreeBuddiesAtLevel[i].getHead(); cur; cur = cur->next) - { - if ((size_t(1) << cur->level != mFreeBuddiesAtLevel[i].buddySize) || - (cur->occupiedSize > size_t(1) << (cur->level + mMinBlockLog2))) - { - return false; - } - sum += mFreeBuddiesAtLevel[i].buddySize << mMinBlockLog2; - buddiesAtLevel++; - } - if (mFreeBuddiesAtLevel[i].getSize() != buddiesAtLevel || - (buddiesAtLevel > (size_t(1) << (mMaxLevel - i)))) - { - return false; - } - } - - size_t numAllocated = 0; - for (Buddy* cur = mAllocatedBuddies.getHead(); cur; cur = cur->next) - { - sum += size_t(1) << (cur->level + mMinBlockLog2); - numAllocated++; - } - - if (numAllocated != mAllocatedBuddies.getSize()) - { - return false; - } - - ptrdiff_t diff = ptrdiff_t(sum - (size_t(1) << (mMaxLevel + mMinBlockLog2))); - if (diff != 0) - { - return false; - } - else - { - return true; - } -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::visualizeMemory(uint8_t* array, const size_t size) -{ - float scale = (float)size / (size_t(1) << mMaxLevel); - - for (size_t i = 0; i < size; i++) - { - array[i] = 0; - } - for (Buddy* cur = mAllocatedBuddies.getHead(); cur; cur = cur->next) - { - size_t start = (size_t)((float)(cur->addr) * scale); - size_t end = (size_t)((float)(cur->addr + (size_t(1) << size_t(cur->level))) * scale); - PX_ASSERT(start <= size); - PX_ASSERT(end <= size); - for (size_t i = start; i < end; i++) - { - PX_ASSERT(i < size); - array[i] = uint8_t(cur->level + 1); - } - } - - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::splitBuddy(Buddy* b) -{ - if (b->level == 0) - { - return false; - } - - b->level--; - size_t newSize = size_t(1) << b->level; - - Buddy* b0 = b; - Buddy* b1 = mManager.getBuddyPool().construct(*b); - PX_ASSERT(b0 && b1); - - b1->addr = b1->addr + newSize; - - mFreeBuddiesAtLevel[b0->level].insertSorted(b0); - mFreeBuddiesAtLevel[b1->level].insertSorted(b1); - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -bool Heap::mergeBuddies(Buddy* b0, Buddy* b1) -{ - if (b0->level != b1->level || b0->level >= mMaxLevel || (b1->addr - b0->addr) != size_t(1) << size_t(b0->level)) - { - return false; - } - - Buddy* b = b0; - b->occupiedSize = 0; - b->isLastBuddy = true; - b->level++; - b->next = NULL; - mFreeBuddiesAtLevel[b->level].insertSorted(b); - - mManager.getBuddyPool().destroy(b1); - return true; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -Buddy* Heap::findBySplitting(uint8_t searchLevel) -{ - Buddy* ret = NULL; - - uint8_t curLevel = searchLevel; - - // walk through array of buddy lists and search for a free buddy which is at level >= searchLevel - for (; !mFreeBuddiesAtLevel[curLevel].getSize() && (curLevel < mMaxLevel); curLevel++) - { - ; - } - - // pop buddy at highest level and split until it has the correct level - ret = mFreeBuddiesAtLevel[curLevel].pop(); - for (; ret && (curLevel != searchLevel) && curLevel > 0; curLevel--) - { - splitBuddy(ret); - ret = mFreeBuddiesAtLevel[curLevel - 1].pop(); - } - return ret; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -Buddy* Heap::findByMerging(uint8_t searchLevel) -{ - /* - while there is no pair to merge on this level, ask lower level to merge - may ask lower level to merge more than 1 pair after each failure - or just merge all pairs of lower levels - */ - if (searchLevel == 0) - { - return NULL; - } - - uint8_t curLevel = uint8_t(searchLevel - 1); - bool dummy = true; - while (dummy) - { - int32_t shift = (mMaxLevel - (1 << (curLevel + 1))); - shift = shift >= 0 ? shift : 0; - size_t numToFind = size_t(1) << shift; - size_t found = findPairAndMerge(mFreeBuddiesAtLevel[curLevel], numToFind); - if (found) - { - if (curLevel == searchLevel - 1) - { - break; - } - curLevel++; - } - else - { - if (curLevel > 0) - { - curLevel--; - } - else - { - return NULL; - } - } - } - return mFreeBuddiesAtLevel[searchLevel].pop(); -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -size_t Heap::findPairAndMerge(BuddyList& list, size_t numToFind) -{ - size_t found = 0; - Buddy* cur = list.getHead(); - Buddy* last = list.getHead(); - size_t diff = list.buddySize; - while ((found != numToFind) && cur && cur->next) - { - // find buddy pair b0 and b1, b0 must be at an even address, and b0 and b1 must be neighbours in address space. - // since the list is sorted, we do only compare neighbours in the list. - if (((cur->addr & (size_t(1) << size_t(cur->level))) == 0) && (cur->next->addr - cur->addr == diff)) - { - Buddy* b0 = cur; - Buddy* b1 = cur->next; - - if (cur == list.getHead()) - { - list.setHead(cur->next->next); - cur = list.getHead(); - last = cur; - } - else - { - cur = cur->next->next; - last->next = cur; - } - list.setSize(list.getSize() - 2); - if (mergeBuddies(b0, b1)) - { - found++; - } - } - else - { - last = cur; - cur = cur->next; - } - } - return found; -} - - -///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -size_t Heap::reduceIntFragment(Buddy& b, size_t threshold) -{ - /* - while internalFragmentation > threshold - cut buddy in the middle - if cut goes through occupied space - left buddy is full, can be pushed to alloc list clear last buddy flag - else - right buddy is free, push it to free list - */ - size_t allocSize = 0; - Buddy* curB = &b; - curB->isLastBuddy = false; - while (curB->level && ((size_t(1) << (curB->level + mMinBlockLog2)) - curB->occupiedSize) > threshold) - { - //split - Buddy* b0 = mManager.getBuddyPool().construct(*curB); - Buddy* b1 = curB; - b0->level--; - b1->level--; - b1->addr += size_t(1) << size_t(b1->level); - if ((size_t(1) << (b0->level + mMinBlockLog2)) < b0->occupiedSize) - { - b0->occupiedSize = size_t(1) << (b0->level + mMinBlockLog2); - b1->occupiedSize -= b0->occupiedSize; - mAllocatedBuddies.insertSorted(b0); - allocSize += size_t(1) << b1->level; - curB = b1; - } - else - { - b1->occupiedSize = 0; - mFreeBuddiesAtLevel[b1->level].insertSorted(b1); - curB = b0; - } - } - curB->isLastBuddy = true; - allocSize += size_t(1) << curB->level; - mAllocatedBuddies.insertSorted(curB); - return (allocSize << mMinBlockLog2); -} - - diff --git a/PxShared/src/cudamanager/src/HeapManagerRef.h b/PxShared/src/cudamanager/src/HeapManagerRef.h deleted file mode 100644 index e6e585e..0000000 --- a/PxShared/src/cudamanager/src/HeapManagerRef.h +++ /dev/null @@ -1,297 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -//----------------------------------------------------------------------------// -// HeapManagerRef.h -//----------------------------------------------------------------------------// - -#ifndef PXCUDACONTEXTMANAGER_HEAPMANAGERREF_H -#define PXCUDACONTEXTMANAGER_HEAPMANAGERREF_H - -#include "task/PxTaskDefine.h" - -#include "HeapManagerInterface.h" -#include "HeapManagerLinkedList.h" -#include "PsPool.h" -#include "PsMutex.h" -#include "PsArray.h" -#include "PsUserAllocated.h" - -#define DUMP_HEAP_USAGE_TO_FILE 0 - -#ifdef _DEBUG -#define KEEP_DEBUG_INFO 1 -#else -#define KEEP_DEBUG_INFO 0 -#endif - -#if DUMP_HEAP_USAGE_TO_FILE -#include "stdio.h" -#endif - -namespace physx -{ - -class Heap; -struct Buddy -{ - PX_INLINE Buddy() - : addr(0) - , next(0) - , occupiedSize(0) - , allocId(PxAllocId::UNASSIGNED) - , isLastBuddy(true) - , level(0) -#if KEEP_DEBUG_INFO - , file(NULL) - , allocName(NULL) - , line(0) -#endif - {} - - PX_INLINE Buddy(Buddy& b) - : addr(b.addr) - , next(b.next) - , occupiedSize(b.occupiedSize) - , allocId(b.allocId) - , isLastBuddy(b.isLastBuddy) - , level(b.level) -#if KEEP_DEBUG_INFO - , file(b.file) - , allocName(b.allocName) - , line(b.line) -#endif - {} - - size_t addr; - Buddy* next; - size_t occupiedSize; - uint16_t allocId; - uint8_t isLastBuddy; - uint8_t level; -#if KEEP_DEBUG_INFO - const char* file; - const char* allocName; - uint32_t line; -#endif -}; - -struct BuddyList: public LinkedList<Buddy>, public shdfnd::UserAllocated -{ - BuddyList() - : buddySize(0) - , heap(NULL) - {} - void clear(); - - size_t buddySize; // = 2^level - Heap* heap; -}; - -struct HeapManagerPage -{ - PX_INLINE bool operator < (const HeapManagerPage& p) const - { - return baseAddr < p.baseAddr; - } - - PX_INLINE bool operator > (const HeapManagerPage& p) const - { - return baseAddr > p.baseAddr; - } - - size_t baseAddr; - Heap* heap; - bool isPersistent; -}; - - -class HeapManagerRef: public HeapManagerInterface, public shdfnd::UserAllocated -{ - PX_NOCOPY(HeapManagerRef) -public: - HeapManagerRef(physx::PxErrorCallback& errorCallback, bool enableMutex = true); - virtual ~HeapManagerRef(); - - // INTERFACE METHODS - virtual bool init(Allocator* memAllocator, const size_t baseSize, const size_t pageSize, const size_t minBlockSize, const size_t maxIntFrag); - virtual bool setPageSize(size_t pageSize); - virtual void* alloc(const size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - virtual bool realloc(void* addr, const size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - virtual bool free(void* addr); - virtual void freeEmptyPages(); - virtual bool reserve(size_t size); - virtual bool getStats(ApexHeapStats& stats, const uint32_t flags); - virtual bool visualizeMemory(uint8_t* array, const size_t size); - virtual void* findBaseAddress(void* addr); - - // INTERNALS - // searches 2^pow >= val, searches pow in [min, max] - static PX_INLINE size_t findNextPow2(const size_t val, const uint8_t min = 0, const uint8_t max = BITSPERWORD); - static PX_INLINE size_t findNextPow2(uint8_t& pow, const size_t val, const uint8_t min = 0, const uint8_t max = BITSPERWORD); - - PX_INLINE void addToStats(PxAllocId::Enum id, const size_t size, const size_t fragmentation); - PX_INLINE void removeFromStats(PxAllocId::Enum id, const size_t size, const size_t fragmentation); - PX_INLINE void incStats(PxAllocId::Enum id, const size_t change, const size_t fragmentation); - PX_INLINE void decStats(PxAllocId::Enum id, const size_t change, const size_t fragmentation); - - PX_INLINE void notifyEmptyPage() - { - mNewEmptyPage = true; - } - PX_INLINE shdfnd::Pool<Buddy>& getBuddyPool() - { - return mBuddyPool; - } - -private: - Heap* allocateNewHeap(size_t heapSize, bool isPersistent = false); - Heap* allocateNewPages(size_t requestedSize); - void resetHeap(HeapManagerPage& page); - void removeDeletedHeapsFromList(uint32_t numDeletes); - void shrinkMemory(); - - Heap* findHeap(void* addr) const; - -private: - // heaps - shdfnd::Array<HeapManagerPage> mHeaps; - shdfnd::Pool<Buddy> mBuddyPool; - size_t mPageSize; - size_t mMinBlockSize; - size_t mMaxIntFrag; - bool mNewEmptyPage; - // lock - shdfnd::Mutex mMutex; - // page allocator - Allocator* mMemAllocator; - // overall stats - size_t mGlobalAllocMem; - size_t mGlobalMaxAllocMem; - size_t mGlobalInternalFragmentation; - size_t mGlobalMaxInternalFragmentation; - // stats per allocation ID - PxAllocIdStats mGlobalAllocIdStats[PxAllocId::NUM_IDS]; - // error callback - physx::PxErrorCallback& mErrorCallback; - -#if DUMP_HEAP_USAGE_TO_FILE - FILE* mLogFile; - unsigned __int64 m_qpc; - unsigned __int64 m_qpf; -#endif -}; - - -class Heap : public shdfnd::UserAllocated -{ -public: - PX_INLINE Heap(HeapManagerRef& manager, physx::PxErrorCallback& errorCallback) - : mManager(manager) - , mErrorCallback(errorCallback) - , mBaseAddr(0) - , mMinBlockSize(0) - , mFreeBuddiesAtLevel(NULL) - , mMaxIntFrag(0) - , mTotalSize(0) - , mMaxLevel(0) - , mMinBlockLog2(0) - , mAllocMem(0) - , mMaxAllocMem(0) - , mInternalFragmentation(0) - , mMaxInternalFragmentation(0) - {} - - PX_INLINE ~Heap(); - - bool init(size_t baseAddr, const size_t baseSize, const size_t minBlockSize, const size_t maxIntFrag); - void* alloc(const size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - bool realloc(void* addr, const size_t size, PX_ALLOC_INFO_PARAMS_DECL(NULL, 0, NULL, UNASSIGNED)); - bool free(void* addr); - bool getStats(ApexHeapStats& stats, const uint32_t flags); - bool visualizeMemory(uint8_t* array, const size_t size); - - PX_INLINE size_t getTotalMemorySize() - { - return mTotalSize; - } - PX_INLINE size_t getAllocatedMemorySize() - { - return mAllocMem; - } - PX_INLINE shdfnd::Pool<Buddy>& getBuddyPool() - { - return mManager.getBuddyPool(); - } - PX_INLINE void* getBaseAddress() - { - return (void*)mBaseAddr; - } - -private: - // split buddy b with size 2^level into two buddies with level 2^(level-1) and append those to the free list. deletes b, assumes that b was removed from the list before. - bool splitBuddy(Buddy* b); - // merge 2 buddies to next bigger one. deletes b0 and b1, assumes that they are already removed from their array. - bool mergeBuddies(Buddy* b0, Buddy* b1); - - // split of right, free children of a buddy if the internal fragmentation of a buddy is bigger than a threshold - // returns the size of all allocated buddies - size_t reduceIntFragment(Buddy& b, size_t threshold); - - // find a Buddy by splitting a Buddy at searchLevel - Buddy* findBySplitting(uint8_t searchLevel); - Buddy* findByMerging(uint8_t searchLevel); - size_t findPairAndMerge(BuddyList& list, size_t numToFind); - - bool sanityTest(); - - void operator=(const Heap&) - { - PX_ASSERT(0); - } - -private: - HeapManagerRef& mManager; - physx::PxErrorCallback& mErrorCallback; - size_t mBaseAddr; - size_t mMinBlockSize; - BuddyList* mFreeBuddiesAtLevel; - BuddyList mAllocatedBuddies; - size_t mMaxIntFrag; - size_t mTotalSize; - uint8_t mMaxLevel; // 2^maxLevel <= memorySize - uint8_t mMinBlockLog2; - - size_t mAllocMem; // fragmented - size_t mMaxAllocMem; - size_t mInternalFragmentation; - size_t mMaxInternalFragmentation; -}; - -} // end physx namespace - -#endif // PXCUDACONTEXTMANAGER_HEAPMANAGERREF_H diff --git a/PxShared/src/cudamanager/src/PhysXDevice.h b/PxShared/src/cudamanager/src/PhysXDevice.h deleted file mode 100644 index b066bdc..0000000 --- a/PxShared/src/cudamanager/src/PhysXDevice.h +++ /dev/null @@ -1,119 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef ___PHYS_X_DEVICE_ -#define ___PHYS_X_DEVICE_ - -#include "foundation/PxPreprocessor.h" - -#if PX_WINDOWS -# pragma warning (push) -# pragma warning (disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' -# include "windows/PsWindowsInclude.h" -# pragma warning (pop) -#endif - -#if PX_WINDOWS - #define PHYSX_DEV_DLL_API extern "C" __declspec(dllexport) - #ifdef _DEBUG - # define PHYSX_DEV_DLL_PRIVATE_API extern "C" __declspec(dllexport) - #else - # define PHYSX_DEV_DLL_PRIVATE_API - #endif -#else - #define PHYSX_DEV_DLL_API - #define PHYSX_DEV_DLL_PRIVATE_API -#endif - -/** typedefs */ -typedef int PHYSX_DEV_STATUS; -typedef unsigned int PhysXDevHandle; - -/** PHYSX_DEV_STATUS values */ -enum -{ - PHYSX_DEV_OK = 0, - PHYSX_DEV_UNKNOWN_ERROR, - PHYSX_DEV_INVALID_HANDLE, - PHYSX_DEV_UNINITIALIZED, - PHYSX_DEV_NV_API_UNAVAILABLE, - PHYSX_DEV_CUDA_UNAVAILABLE, - PHYSX_DEV_CUDA_MEMORY_ALLOC_FAILURE, - PHYSX_DEV_LEGACY_MODE_GPU_HANDLE, - PHYSX_DEV_PHYSX_DEV_UNAVAILABLE, -}; - - -/** - * physxDevInit - * Initialize the PhysX Device information functions. - * Must be called before using any other API functions. - */ -PHYSX_DEV_DLL_API PHYSX_DEV_STATUS physxDevInit(); - -/** - * physxDevClose - * Call this when finished with the PhysX Device API, it - * frees memory that is allocated in physxDevInit - */ -PHYSX_DEV_DLL_API PHYSX_DEV_STATUS physxDevClose(); - -/** - * physxDevGetCudaOrdinal - * Returns the CUDA device ordinal for the given PhysX GPU device - */ -PHYSX_DEV_DLL_API PHYSX_DEV_STATUS physxDevGetCudaOrdinal(int* cudaDevOrdinal, PhysXDevHandle devHandle); -PHYSX_DEV_STATUS physxDevGetCudaOrdinalWrapper(int* cudaDevOrdinal); - -/** - * physxDevGet - * Returns the PhysX GPU device that the PhysX Engine - * will use. If the device is -1, the engine will - * automatically choose which GPU to use. - * - * This function handles the R177/R180 detection first, then decides accordingly - * - * if(180+) - * if(GPU Enabled) ? get NVAPI sel : -1 - * else (177) - * if regkey ? regkey value : -1 (PHYSX_DEV_LEGACY_MODE_GPU_HANDLE returned) - */ -PHYSX_DEV_DLL_API PHYSX_DEV_STATUS physxDevGet(PhysXDevHandle* devHandle); - -/** - * physxDevUsingDedicatedGPU - * Returns whether or not PhysX has a dedicated GPU (set by the user in the NV CPL) - */ -PHYSX_DEV_DLL_API bool physxDevUsingDedicatedGPU(); - -/** - * physxDevSLIEnabled - * Returns whether or not the device pointer specified (D3D device) is in an SLI group - */ -PHYSX_DEV_DLL_API bool physxDevSLIEnabled(void* graphicsDevice); - -#endif diff --git a/PxShared/src/cudamanager/src/PhysXDeviceSettings.cpp b/PxShared/src/cudamanager/src/PhysXDeviceSettings.cpp deleted file mode 100644 index 77896c2..0000000 --- a/PxShared/src/cudamanager/src/PhysXDeviceSettings.cpp +++ /dev/null @@ -1,248 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "task/PxTaskDefine.h" - -#if PX_SUPPORT_GPU_PHYSX - -#include "foundation/PxErrorCallback.h" - -#include "PhysXDeviceSettings.h" -#include "PhysXDevice.h" - -#if PX_VC -#pragma warning(disable: 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required' -#endif - -namespace -{ -#if PX_WIN32 || PX_WIN64 - /** funcs for the dynamic loading of the PhysXDevice.dll file */ - typedef PHYSX_DEV_STATUS __cdecl physxDevInit_t(); - typedef PHYSX_DEV_STATUS __cdecl physxDevClose_t(); - typedef PHYSX_DEV_STATUS __cdecl physxDevGet_t(PhysXDevHandle* devHandle); - typedef PHYSX_DEV_STATUS __cdecl physxDevGetCudaOrdinal_t(int* cudaDevOrdinal, PhysXDevHandle devHandle); - typedef bool __cdecl physxDevUsingDedicatedGPU_t(); - typedef bool __cdecl physxDevSLIEnabled_t(void* graphicsDevice); - - /** globals for cuda functions */ - static physxDevInit_t* physxDevInit_f; - static physxDevClose_t* physxDevClose_f; - static physxDevGetCudaOrdinal_t* physxDevGetCudaOrdinal_f; - static physxDevGet_t* physxDevGet_f; - static physxDevUsingDedicatedGPU_t* physxDevUsingDedicatedGPU_f; - static physxDevSLIEnabled_t* physxDevSLIEnabled_f; - - /** globals */ - static HMODULE gPhysXDevModuleH; - - PHYSX_DEV_STATUS initPhysXDeviceLib() - { - PHYSX_DEV_STATUS status; -#if PX_X86 - gPhysXDevModuleH = LoadLibrary("PhysXDevice.dll"); -#else - gPhysXDevModuleH = LoadLibrary("PhysXDevice64.dll"); -#endif - if (!gPhysXDevModuleH) - { - return PHYSX_DEV_PHYSX_DEV_UNAVAILABLE; - } - - physxDevInit_f = (physxDevInit_t*)GetProcAddress(gPhysXDevModuleH, "physxDevInit"); - physxDevClose_f = (physxDevClose_t*)GetProcAddress(gPhysXDevModuleH, "physxDevClose"); - physxDevGetCudaOrdinal_f = (physxDevGetCudaOrdinal_t*)GetProcAddress(gPhysXDevModuleH, "physxDevGetCudaOrdinal"); - physxDevGet_f = (physxDevGet_t*)GetProcAddress(gPhysXDevModuleH, "physxDevGet"); - physxDevUsingDedicatedGPU_f = (physxDevUsingDedicatedGPU_t*)GetProcAddress(gPhysXDevModuleH, "physxDevUsingDedicatedGPU"); - physxDevSLIEnabled_f = (physxDevSLIEnabled_t*)GetProcAddress(gPhysXDevModuleH, "physxDevSLIEnabled"); - - if (!physxDevInit_f || - !physxDevClose_f || - !physxDevGetCudaOrdinal_f || - !physxDevGet_f) - { - FreeLibrary(gPhysXDevModuleH); - return PHYSX_DEV_CUDA_UNAVAILABLE; - } - - status = physxDevInit_f(); - if (PHYSX_DEV_OK != status) - { - FreeLibrary(gPhysXDevModuleH); - return status; - } - - return PHYSX_DEV_OK; - } -#endif // PX_WIN32 || PX_WIN64 - - PHYSX_DEV_STATUS getCudaOrdinal(int* cudaDevOrdinal) - { -#if PX_WIN32 || PX_WIN64 - PHYSX_DEV_STATUS status; - PhysXDevHandle selectedDev; - - status = initPhysXDeviceLib(); - - if (PHYSX_DEV_OK != status) - { - return status; - } - - status = physxDevGet_f(&selectedDev); - physxDevGetCudaOrdinal_f(cudaDevOrdinal, selectedDev); - - physxDevClose_f(); - FreeLibrary(gPhysXDevModuleH); - - if (status == PHYSX_DEV_LEGACY_MODE_GPU_HANDLE) // R177 installed - { - return PHYSX_DEV_LEGACY_MODE_GPU_HANDLE; - } - else - { - return PHYSX_DEV_OK; - } -#elif PX_LINUX - const char* deviceOrdinalString = ::getenv("PHYSX_GPU_DEVICE"); - if (!deviceOrdinalString) - *cudaDevOrdinal = 0; - else - *cudaDevOrdinal = atoi(deviceOrdinalString); - return PHYSX_DEV_OK; -#endif - } - -} - -namespace physx -{ - - int PhysXDeviceSettings::getSuggestedCudaDeviceOrdinal(physx::PxErrorCallback& errc) - { - int cudaDevOrdinal = -1; - switch (getCudaOrdinal(&cudaDevOrdinal)) - { - case PHYSX_DEV_OK: - break; - - case PHYSX_DEV_UNKNOWN_ERROR: - errc.reportError(PxErrorCode::eDEBUG_WARNING, "unknown error during CUDA device detection\n", __FILE__, __LINE__); - break; - - case PHYSX_DEV_NV_API_UNAVAILABLE: - errc.reportError(PxErrorCode::eDEBUG_WARNING, "NVAPI is not available\n", __FILE__, __LINE__); - break; - - case PHYSX_DEV_CUDA_UNAVAILABLE: - errc.reportError(PxErrorCode::eDEBUG_WARNING, "CUDA is not available\n", __FILE__, __LINE__); - break; - - case PHYSX_DEV_PHYSX_DEV_UNAVAILABLE: -#if PX_X86 - errc.reportError(PxErrorCode::eDEBUG_WARNING, "PhysXDevice.dll is not available\n", __FILE__, __LINE__); -#else - errc.reportError(PxErrorCode::eDEBUG_WARNING, "PhysXDevice64.dll is not available\n", __FILE__, __LINE__); -#endif - break; - - default: - errc.reportError(PxErrorCode::eDEBUG_WARNING, "unknown error during CUDA device detection\n", __FILE__, __LINE__); - break; - } - - return cudaDevOrdinal; - } - - int PhysXDeviceSettings::isUsingDedicatedGPU() - { -#if PX_WIN32 || PX_WIN64 - PHYSX_DEV_STATUS status; - bool dedicated = false; - - status = initPhysXDeviceLib(); - - if (PHYSX_DEV_OK != status) - { - return 0; - } - - if (physxDevUsingDedicatedGPU_f) - { - dedicated = physxDevUsingDedicatedGPU_f(); - physxDevClose_f(); - FreeLibrary(gPhysXDevModuleH); - return(dedicated); - } - else - { - physxDevClose_f(); - FreeLibrary(gPhysXDevModuleH); - return(-1); - } -#elif PX_LINUX - // need some way to set this - return 0; -#endif - } - - bool PhysXDeviceSettings::isSLIEnabled(void* graphicsDevice) - { -#if PX_WIN32 || PX_WIN64 - PHYSX_DEV_STATUS status; - status = initPhysXDeviceLib(); - - if (PHYSX_DEV_OK != status) - { - return false; - } - - if (physxDevSLIEnabled_f) - { - bool enabled = physxDevSLIEnabled_f(graphicsDevice); - physxDevClose_f(); - FreeLibrary(gPhysXDevModuleH); - return enabled; - } - else - { - physxDevClose_f(); - FreeLibrary(gPhysXDevModuleH); - return false; - } -#elif PX_LINUX - // Unimplemented for Linux because we don't need it, not because it's really always false. - PX_UNUSED(graphicsDevice); - return false; -#endif - } - -} // end physx namespace - -#endif // PX_SUPPORT_GPU_PHYSX - - diff --git a/PxShared/src/fastxml/include/PsFastXml.h b/PxShared/src/fastxml/include/PsFastXml.h deleted file mode 100644 index e1f1c69..0000000 --- a/PxShared/src/fastxml/include/PsFastXml.h +++ /dev/null @@ -1,167 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFASTXML_PSFASTXML_H -#define PSFASTXML_PSFASTXML_H - -#include "foundation/PxSimpleTypes.h" // defines basic data types; modify for your platform as needed. -#include "foundation/PxIO.h" -#include "foundation/PxAssert.h" -#include "PsAllocator.h" - -namespace physx -{ -namespace shdfnd -{ - -class FastXml -{ - PX_NOCOPY(FastXml) - - public: - class AttributePairs - { - int argc; - const char** argv; - - public: - AttributePairs() : argc(0), argv(NULL) - { - } - AttributePairs(int c, const char** v) : argc(c), argv(v) - { - } - - PX_INLINE int getNbAttr() const - { - return argc / 2; - } - - const char* getKey(uint32_t index) const - { - PX_ASSERT((index * 2) < uint32_t(argc)); - return argv[index * 2]; - } - - const char* getValue(uint32_t index) const - { - PX_ASSERT((index * 2 + 1) < uint32_t(argc)); - return argv[index * 2 + 1]; - } - - const char* get(const char* attr) const - { - int32_t count = argc / 2; - for(int32_t i = 0; i < count; ++i) - { - const char* key = argv[i * 2], *value = argv[i * 2 + 1]; - if(strcmp(key, attr) == 0) - return value; - } - - return NULL; - } - }; - - /*** - * Callbacks to the user with the contents of the XML file properly digested. - */ - class Callback - { - public: - virtual ~Callback() - { - } - virtual bool processComment(const char* comment) = 0; // encountered a comment in the XML - - // 'element' is the name of the element that is being closed. - // depth is the recursion depth of this element. - // Return true to continue processing the XML file. - // Return false to stop processing the XML file; leaves the read pointer of the stream right after this close - // tag. - // The bool 'isError' indicates whether processing was stopped due to an error, or intentionally canceled early. - virtual bool processClose(const char* element, uint32_t depth, bool& isError) = 0; // process the 'close' - // indicator for a previously - // encountered element - - // return true to continue processing the XML document, false to skip. - virtual bool processElement(const char* elementName, // name of the element - const char* elementData, // element data, null if none - const AttributePairs& attr, // attributes - int32_t lineno) = 0; // line number in the source XML file - - // process the XML declaration header - virtual bool processXmlDeclaration(const AttributePairs&, // attributes - const char* /*elementData*/, int32_t /*lineno*/) - { - return true; - } - - virtual bool processDoctype(const char* /*rootElement*/, // Root element tag - const char* /*type*/, // SYSTEM or PUBLIC - const char* /*fpi*/, // Formal Public Identifier - const char* /*uri*/) // Path to schema file - { - return true; - } - - virtual void* allocate(uint32_t size) - { - return getAllocator().allocate(size, "FastXml", __FILE__, __LINE__); - } - - virtual void deallocate(void* ptr) - { - getAllocator().deallocate(ptr); - } - }; - - virtual bool processXml(PxInputData& buff, bool streamFromMemory = false) = 0; - - virtual const char* getError(int32_t& lineno) = 0; // report the reason for a parsing error, and the line number - // where it occurred. - - FastXml() - { - } - - virtual void release(void) = 0; - - protected: - virtual ~FastXml() - { - } -}; - -FastXml* createFastXml(FastXml::Callback* iface); - -} // shdfnd -} // physx - -#endif // PSFASTXML_PSFASTXML_H diff --git a/PxShared/src/fastxml/src/PsFastXml.cpp b/PxShared/src/fastxml/src/PsFastXml.cpp deleted file mode 100644 index dcb8c37..0000000 --- a/PxShared/src/fastxml/src/PsFastXml.cpp +++ /dev/null @@ -1,833 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxAssert.h" -#include "foundation/PxMemory.h" -#include "Ps.h" -#include "PsFastXml.h" -#include <stdio.h> -#include <string.h> -#include <new> -#include <ctype.h> - -using namespace physx; - -namespace -{ -#define MIN_CLOSE_COUNT 2 -#define DEFAULT_READ_BUFFER_SIZE (16 * 1024) -#define NUM_ENTITY 5 - -struct Entity -{ - const char* str; - unsigned int strLength; - char chr; -}; - -static const Entity entity[NUM_ENTITY] = { - { "<", 4, '<' }, { "&", 5, '&' }, { ">", 4, '>' }, { """, 6, '\"' }, { "'", 6, '\'' } -}; - -class MyFastXml : public physx::shdfnd::FastXml -{ - public: - enum CharType - { - CT_DATA, - CT_EOF, - CT_SOFT, - CT_END_OF_ELEMENT, // either a forward slash or a greater than symbol - CT_END_OF_LINE - }; - - MyFastXml(Callback* c) - { - mStreamFromMemory = true; - mCallback = c; - memset(mTypes, CT_DATA, sizeof(mTypes)); - mTypes[0] = CT_EOF; - mTypes[uint8_t(' ')] = mTypes[uint8_t('\t')] = CT_SOFT; - mTypes[uint8_t('/')] = mTypes[uint8_t('>')] = mTypes[uint8_t('?')] = CT_END_OF_ELEMENT; - mTypes[uint8_t('\n')] = mTypes[uint8_t('\r')] = CT_END_OF_LINE; - mError = 0; - mStackIndex = 0; - mFileBuf = NULL; - mReadBufferEnd = NULL; - mReadBuffer = NULL; - mReadBufferSize = DEFAULT_READ_BUFFER_SIZE; - mOpenCount = 0; - mLastReadLoc = 0; - for(uint32_t i = 0; i < (MAX_STACK + 1); i++) - { - mStack[i] = NULL; - mStackAllocated[i] = false; - } - } - - char* processClose(char c, const char* element, char* scan, int32_t argc, const char** argv, - FastXml::Callback* iface, bool& isError) - { - AttributePairs attr(argc, argv); - isError = true; // by default, if we return null it's due to an error. - if(c == '/' || c == '?') - { - char* slash = const_cast<char*>(static_cast<const char*>(strchr(element, c))); - if(slash) - *slash = 0; - - if(c == '?' && strcmp(element, "xml") == 0) - { - if(!iface->processXmlDeclaration(attr, 0, mLineNo)) - return NULL; - } - else - { - if(!iface->processElement(element, 0, attr, mLineNo)) - { - mError = "User aborted the parsing process"; - return NULL; - } - - pushElement(element); - - const char* close = popElement(); - - if(!iface->processClose(close, mStackIndex, isError)) - { - return NULL; - } - } - - if(!slash) - ++scan; - } - else - { - scan = skipNextData(scan); - char* data = scan; // this is the data portion of the element, only copies memory if we encounter line feeds - char* dest_data = 0; - while(*scan && *scan != '<') - { - if(getCharType(scan) == CT_END_OF_LINE) - { - if(*scan == '\r') - mLineNo++; - dest_data = scan; - *dest_data++ = ' '; // replace the linefeed with a space... - scan = skipNextData(scan); - while(*scan && *scan != '<') - { - if(getCharType(scan) == CT_END_OF_LINE) - { - if(*scan == '\r') - mLineNo++; - *dest_data++ = ' '; // replace the linefeed with a space... - scan = skipNextData(scan); - } - else - { - *dest_data++ = *scan++; - } - } - break; - } - else if('&' == *scan) - { - dest_data = scan; - while(*scan && *scan != '<') - { - if('&' == *scan) - { - if(*(scan + 1) && *(scan + 1) == '#' && *(scan + 2)) - { - if(*(scan + 2) == 'x') - { - // Hexadecimal. - if(!*(scan + 3)) - break; - - char* q = scan + 3; - q = strchr(q, ';'); - - if(!q || !*q) - PX_ASSERT(0); - - --q; - char ch = char(*q > '9' ? (tolower(*q) - 'a' + 10) : *q - '0'); - if(*(--q) != tolower('x')) - ch |= char(*q > '9' ? (tolower(*q) - 'a' + 10) : *q - '0') << 4; - - *dest_data++ = ch; - } - else - { - // Decimal. - if(!*(scan + 2)) - break; - - const char* q = scan + 2; - q = strchr(q, ';'); - - if(!q || !*q) - PX_ASSERT(0); - - --q; - char ch = *q - '0'; - if(*(--q) != '#') - ch |= (*q - '0') * 10; - - *dest_data++ = ch; - } - - char* start = scan; - char* end = strchr(start, ';'); - if(end) - { - *end = 0; - scan = end + 1; - } - - continue; - } - - for(int i = 0; i < NUM_ENTITY; ++i) - { - if(strncmp(entity[i].str, scan, entity[i].strLength) == 0) - { - *dest_data++ = entity[i].chr; - scan += entity[i].strLength; - break; - } - } - } - else - { - *dest_data++ = *scan++; - } - } - break; - } - else - ++scan; - } - - if(*scan == '<') - { - if(scan[1] != '/') - { - PX_ASSERT(mOpenCount > 0); - mOpenCount--; - } - if(dest_data) - { - *dest_data = 0; - } - else - { - *scan = 0; - } - - scan++; // skip it.. - - if(*data == 0) - data = 0; - - if(!iface->processElement(element, data, attr, mLineNo)) - { - mError = "User aborted the parsing process"; - return 0; - } - - pushElement(element); - - // check for the comment use case... - if(scan[0] == '!' && scan[1] == '-' && scan[2] == '-') - { - scan += 3; - while(*scan && *scan == ' ') - ++scan; - - char* comment = scan; - char* comment_end = strstr(scan, "-->"); - if(comment_end) - { - *comment_end = 0; - scan = comment_end + 3; - if(!iface->processComment(comment)) - { - mError = "User aborted the parsing process"; - return 0; - } - } - } - else if(*scan == '/') - { - scan = processClose(scan, iface, isError); - if(scan == NULL) - { - return NULL; - } - } - } - else - { - mError = "Data portion of an element wasn't terminated properly"; - return NULL; - } - } - - if(mOpenCount < MIN_CLOSE_COUNT) - { - scan = readData(scan); - } - - return scan; - } - - char* processClose(char* scan, FastXml::Callback* iface, bool& isError) - { - const char* start = popElement(), *close = start; - if(scan[1] != '>') - { - scan++; - close = scan; - while(*scan && *scan != '>') - scan++; - *scan = 0; - } - - if(0 != strcmp(start, close)) - { - mError = "Open and closing tags do not match"; - return 0; - } - - if(!iface->processClose(close, mStackIndex, isError)) - { - // we need to set the read pointer! - uint32_t offset = uint32_t(mReadBufferEnd - scan) - 1; - uint32_t readLoc = mLastReadLoc - offset; - mFileBuf->seek(readLoc); - return NULL; - } - ++scan; - - return scan; - } - - virtual bool processXml(physx::PxInputData& fileBuf, bool streamFromMemory) - { - releaseMemory(); - mFileBuf = &fileBuf; - mStreamFromMemory = streamFromMemory; - return processXml(mCallback); - } - - // if we have finished processing the data we had pending.. - char* readData(char* scan) - { - for(uint32_t i = 0; i < (mStackIndex + 1); i++) - { - if(!mStackAllocated[i]) - { - const char* text = mStack[i]; - if(text) - { - uint32_t tlen = uint32_t(strlen(text)); - mStack[i] = static_cast<const char*>(mCallback->allocate(tlen + 1)); - PxMemCopy(const_cast<void*>(static_cast<const void*>(mStack[i])), text, tlen + 1); - mStackAllocated[i] = true; - } - } - } - - if(!mStreamFromMemory) - { - if(scan == NULL) - { - uint32_t seekLoc = mFileBuf->tell(); - mReadBufferSize = (mFileBuf->getLength() - seekLoc); - } - else - { - return scan; - } - } - - if(mReadBuffer == NULL) - { - mReadBuffer = static_cast<char*>(mCallback->allocate(mReadBufferSize + 1)); - } - uint32_t offset = 0; - uint32_t readLen = mReadBufferSize; - - if(scan) - { - offset = uint32_t(scan - mReadBuffer); - uint32_t copyLen = mReadBufferSize - offset; - if(copyLen) - { - PX_ASSERT(scan >= mReadBuffer); - memmove(mReadBuffer, scan, copyLen); - mReadBuffer[copyLen] = 0; - readLen = mReadBufferSize - copyLen; - } - offset = copyLen; - } - - uint32_t readCount = mFileBuf->read(&mReadBuffer[offset], readLen); - - while(readCount > 0) - { - - mReadBuffer[readCount + offset] = 0; // end of string terminator... - mReadBufferEnd = &mReadBuffer[readCount + offset]; - - const char* scan_ = &mReadBuffer[offset]; - while(*scan_) - { - if(*scan_ == '<' && scan_[1] != '/') - { - mOpenCount++; - } - scan_++; - } - - if(mOpenCount < MIN_CLOSE_COUNT) - { - uint32_t oldSize = uint32_t(mReadBufferEnd - mReadBuffer); - mReadBufferSize = mReadBufferSize * 2; - char* oldReadBuffer = mReadBuffer; - mReadBuffer = static_cast<char*>(mCallback->allocate(mReadBufferSize + 1)); - PxMemCopy(mReadBuffer, oldReadBuffer, oldSize); - mCallback->deallocate(oldReadBuffer); - offset = oldSize; - uint32_t readSize = mReadBufferSize - oldSize; - readCount = mFileBuf->read(&mReadBuffer[offset], readSize); - if(readCount == 0) - break; - } - else - { - break; - } - } - mLastReadLoc = mFileBuf->tell(); - - return mReadBuffer; - } - - bool processXml(FastXml::Callback* iface) - { - bool ret = true; - - const int MAX_ATTRIBUTE = 2048; // can't imagine having more than 2,048 attributes in a single element right? - - mLineNo = 1; - - char* element, *scan = readData(0); - - while(*scan) - { - - scan = skipNextData(scan); - - if(*scan == 0) - break; - - if(*scan == '<') - { - - if(scan[1] != '/') - { - PX_ASSERT(mOpenCount > 0); - mOpenCount--; - } - scan++; - - if(*scan == '?') // Allow xml declarations - { - scan++; - } - else if(scan[0] == '!' && scan[1] == '-' && scan[2] == '-') - { - scan += 3; - while(*scan && *scan == ' ') - scan++; - char* comment = scan, *comment_end = strstr(scan, "-->"); - if(comment_end) - { - *comment_end = 0; - scan = comment_end + 3; - if(!iface->processComment(comment)) - { - mError = "User aborted the parsing process"; - return false; - } - } - continue; - } - else if(scan[0] == '!') // Allow doctype - { - scan++; - - // DOCTYPE syntax differs from usual XML so we parse it here - - // Read DOCTYPE - const char* tag = "DOCTYPE"; - if(!strstr(scan, tag)) - { - mError = "Invalid DOCTYPE"; - return false; - } - - scan += strlen(tag); - - // Skip whites - while(CT_SOFT == getCharType(scan)) - ++scan; - - // Read rootElement - const char* rootElement = scan; - while(CT_DATA == getCharType(scan)) - ++scan; - - char* endRootElement = scan; - - // TODO: read remaining fields (fpi, uri, etc.) - while(CT_END_OF_ELEMENT != getCharType(scan++)) - ; - - *endRootElement = 0; - - if(!iface->processDoctype(rootElement, 0, 0, 0)) - { - mError = "User aborted the parsing process"; - return false; - } - - continue; // Restart loop - } - } - - if(*scan == '/') - { - bool isError; - scan = processClose(scan, iface, isError); - if(!scan) - { - if(isError) - { - mError = "User aborted the parsing process"; - } - return !isError; - } - } - else - { - if(*scan == '?') - scan++; - element = scan; - int32_t argc = 0; - const char* argv[MAX_ATTRIBUTE]; - bool close; - scan = nextSoftOrClose(scan, close); - if(close) - { - char c = *(scan - 1); - if(c != '?' && c != '/') - { - c = '>'; - } - *scan++ = 0; - bool isError; - scan = processClose(c, element, scan, argc, argv, iface, isError); - if(!scan) - { - if(isError) - { - mError = "User aborted the parsing process"; - } - return !isError; - } - } - else - { - if(*scan == 0) - { - return ret; - } - - *scan = 0; // place a zero byte to indicate the end of the element name... - scan++; - - while(*scan) - { - scan = skipNextData(scan); // advance past any soft seperators (tab or space) - - if(getCharType(scan) == CT_END_OF_ELEMENT) - { - char c = *scan++; - if('?' == c) - { - if('>' != *scan) //?> - { - PX_ASSERT(0); - return false; - } - - scan++; - } - bool isError; - scan = processClose(c, element, scan, argc, argv, iface, isError); - if(!scan) - { - if(isError) - { - mError = "User aborted the parsing process"; - } - return !isError; - } - break; - } - else - { - if(argc >= MAX_ATTRIBUTE) - { - mError = "encountered too many attributes"; - return false; - } - argv[argc] = scan; - scan = nextSep(scan); // scan up to a space, or an equal - if(*scan) - { - if(*scan != '=') - { - *scan = 0; - scan++; - while(*scan && *scan != '=') - scan++; - if(*scan == '=') - scan++; - } - else - { - *scan = 0; - scan++; - } - - if(*scan) // if not eof... - { - scan = skipNextData(scan); - if(*scan == '"') - { - scan++; - argc++; - argv[argc] = scan; - argc++; - while(*scan && *scan != 34) - scan++; - if(*scan == '"') - { - *scan = 0; - scan++; - } - else - { - mError = "Failed to find closing quote for attribute"; - return false; - } - } - else - { - // mError = "Expected quote to begin attribute"; - // return false; - // PH: let's try to have a more graceful fallback - argc--; - while(*scan != '/' && *scan != '>' && *scan != 0) - scan++; - } - } - } // if( *scan ) - } // if ( mTypes[*scan] - } // if( close ) - } // if( *scan == '/' - } // while( *scan ) - } - - if(mStackIndex) - { - mError = "Invalid file format"; - return false; - } - - return ret; - } - - const char* getError(int32_t& lineno) - { - const char* ret = mError; - lineno = mLineNo; - mError = 0; - return ret; - } - - virtual void release(void) - { - Callback* c = mCallback; // get the user allocator interface - MyFastXml* f = this; // cast the this pointer - f->~MyFastXml(); // explicitely invoke the destructor for this class - c->deallocate(f); // now free up the memory associated with it. - } - - private: - virtual ~MyFastXml(void) - { - releaseMemory(); - } - - PX_INLINE void releaseMemory(void) - { - mFileBuf = NULL; - mCallback->deallocate(mReadBuffer); - mReadBuffer = NULL; - mStackIndex = 0; - mReadBufferEnd = NULL; - mOpenCount = 0; - mLastReadLoc = 0; - mError = NULL; - for(uint32_t i = 0; i < (mStackIndex + 1); i++) - { - if(mStackAllocated[i]) - { - mCallback->deallocate(const_cast<void*>(static_cast<const void*>(mStack[i]))); - mStackAllocated[i] = false; - } - mStack[i] = NULL; - } - } - - PX_INLINE CharType getCharType(char* scan) const - { - return mTypes[uint8_t(*scan)]; - } - - PX_INLINE char* nextSoftOrClose(char* scan, bool& close) - { - while(*scan && getCharType(scan) != CT_SOFT && *scan != '>') - scan++; - close = *scan == '>'; - return scan; - } - - PX_INLINE char* nextSep(char* scan) - { - while(*scan && getCharType(scan) != CT_SOFT && *scan != '=') - scan++; - return scan; - } - - PX_INLINE char* skipNextData(char* scan) - { - // while we have data, and we encounter soft seperators or line feeds... - while(*scan && (getCharType(scan) == CT_SOFT || getCharType(scan) == CT_END_OF_LINE)) - { - if(*scan == '\n') - mLineNo++; - scan++; - } - return scan; - } - - void pushElement(const char* element) - { - PX_ASSERT(mStackIndex < uint32_t(MAX_STACK)); - if(mStackIndex < uint32_t(MAX_STACK)) - { - if(mStackAllocated[mStackIndex]) - { - mCallback->deallocate(const_cast<void*>(static_cast<const void*>(mStack[mStackIndex]))); - mStackAllocated[mStackIndex] = false; - } - mStack[mStackIndex++] = element; - } - } - - const char* popElement(void) - { - PX_ASSERT(mStackIndex > 0); - if(mStackAllocated[mStackIndex]) - { - mCallback->deallocate(const_cast<void*>(static_cast<const void*>(mStack[mStackIndex]))); - mStackAllocated[mStackIndex] = false; - } - mStack[mStackIndex] = NULL; - return mStackIndex ? mStack[--mStackIndex] : NULL; - } - - static const int MAX_STACK = 2048; - - CharType mTypes[256]; - - physx::PxInputData* mFileBuf; - - char* mReadBuffer; - char* mReadBufferEnd; - - uint32_t mOpenCount; - uint32_t mReadBufferSize; - uint32_t mLastReadLoc; - - int32_t mLineNo; - const char* mError; - uint32_t mStackIndex; - const char* mStack[MAX_STACK + 1]; - bool mStreamFromMemory; - bool mStackAllocated[MAX_STACK + 1]; - Callback* mCallback; -}; -} - -namespace physx -{ -namespace shdfnd -{ - -FastXml* createFastXml(FastXml::Callback* iface) -{ - MyFastXml* m = static_cast<MyFastXml*>(iface->allocate(sizeof(MyFastXml))); - if(m) - { - new (m) MyFastXml(iface); - } - return static_cast<FastXml*>(m); -} -} -} diff --git a/PxShared/src/filebuf/include/PsAsciiConversion.h b/PxShared/src/filebuf/include/PsAsciiConversion.h deleted file mode 100644 index 7c4fa3a..0000000 --- a/PxShared/src/filebuf/include/PsAsciiConversion.h +++ /dev/null @@ -1,99 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PSFILEBUFFER_PSASCIICONVERSION_H -#define PSFILEBUFFER_PSASCIICONVERSION_H - -/*! -\file -\brief PxAsciiConversion namespace contains string/value helper functions -*/ - -#include "PxMath.h" -#include "PsString.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> -#include <float.h> - -namespace physx -{ -namespace general_string_parsing2 -{ -namespace PxAsc -{ - -const uint32_t PxF32StrLen = 24; -const uint32_t PxF64StrLen = 32; -const uint32_t IntStrLen = 32; - -PX_INLINE bool isWhiteSpace(char c); -PX_INLINE const char * skipNonWhiteSpace(const char *scan); -PX_INLINE const char * skipWhiteSpace(const char *scan); - -////////////////////////// -// str to value functions -////////////////////////// -PX_INLINE bool strToBool(const char *str, const char **endptr); -PX_INLINE int8_t strToI8(const char *str, const char **endptr); -PX_INLINE int16_t strToI16(const char *str, const char **endptr); -PX_INLINE int32_t strToI32(const char *str, const char **endptr); -PX_INLINE int64_t strToI64(const char *str, const char **endptr); -PX_INLINE uint8_t strToU8(const char *str, const char **endptr); -PX_INLINE uint16_t strToU16(const char *str, const char **endptr); -PX_INLINE uint32_t strToU32(const char *str, const char **endptr); -PX_INLINE uint64_t strToU64(const char *str, const char **endptr); -PX_INLINE float strToF32(const char *str, const char **endptr); -PX_INLINE double strToF64(const char *str, const char **endptr); -PX_INLINE void strToF32s(float *v,uint32_t count,const char *str, const char**endptr); - - -////////////////////////// -// value to str functions -////////////////////////// -PX_INLINE const char * valueToStr( bool val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( int8_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( int16_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( int32_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( int64_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( uint8_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( uint16_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( uint32_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( uint64_t val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( float val, char *buf, uint32_t n ); -PX_INLINE const char * valueToStr( double val, char *buf, uint32_t n ); - -#include "PsAsciiConversion.inl" - -} // end of namespace -} // end of namespace -using namespace general_string_parsing2; -} // end of namespace - - -#endif // PSFILEBUFFER_PSASCIICONVERSION_H diff --git a/PxShared/src/filebuf/include/PsAsciiConversion.inl b/PxShared/src/filebuf/include/PsAsciiConversion.inl deleted file mode 100644 index 9e1ba14..0000000 --- a/PxShared/src/filebuf/include/PsAsciiConversion.inl +++ /dev/null @@ -1,566 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -/*! -\file -\brief NvAsciiConversion namespace contains string/value helper functions -*/ - -#include <ctype.h> - -PX_INLINE bool isWhiteSpace(char c) -{ - bool ret = false; - if ( c == 32 || c == 9 || c == 13 || c == 10 || c == ',' ) ret = true; - return ret; -} - -PX_INLINE const char * skipNonWhiteSpace(const char *scan) -{ - while ( !isWhiteSpace(*scan) && *scan) scan++; - if ( *scan == 0 ) scan = NULL; - return scan; -} -PX_INLINE const char * skipWhiteSpace(const char *scan) -{ - while ( isWhiteSpace(*scan) && *scan ) scan++; - if ( *scan == 0 ) scan = NULL; - return scan; -} - -static double strtod_fast(const char * pString) -{ - //--- - // Find the start of the string - const char* pNumberStart = skipWhiteSpace(pString); - - //--- - // Find the end of the string - const char* pNumberEnd = pNumberStart; - - // skip optional sign - if( *pNumberEnd == '-' || *pNumberEnd == '+' ) - ++pNumberEnd; - - // skip optional digits - while( isdigit(*pNumberEnd) ) - ++pNumberEnd; - - // skip optional decimal and digits - if( *pNumberEnd == '.' ) - { - ++pNumberEnd; - - while( isdigit(*pNumberEnd) ) - ++pNumberEnd; - } - - // skip optional exponent - if( *pNumberEnd == 'd' - || *pNumberEnd == 'D' - || *pNumberEnd == 'e' - || *pNumberEnd == 'E' ) - { - ++pNumberEnd; - - if( *pNumberEnd == '-' || *pNumberEnd == '+' ) - ++pNumberEnd; - - while( isdigit(*pNumberEnd) ) - ++pNumberEnd; - } - - //--- - // Process the string - const uint32_t numberLen = (const uint32_t)(pNumberEnd-pNumberStart); - char buffer[32]; - if( numberLen+1 < sizeof(buffer)/sizeof(buffer[0]) ) - { - // copy into buffer and terminate with NUL before calling the - // standard function - memcpy( buffer, pNumberStart, numberLen*sizeof(buffer[0]) ); - buffer[numberLen] = '\0'; - const double result = strtod( buffer, NULL ); - - return result; - } - else - { - // buffer was too small so just call the standard function on the - // source input to get a proper result - return strtod( pString, NULL ); - } -} - -static float strtof_fast(const char* pString) -{ - return (float)strtod_fast(pString); -} - - -////////////////////////// -// str to value functions -////////////////////////// -PX_INLINE bool strToBool(const char *str, const char **endptr) -{ - bool ret = false; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - size_t len = (size_t)(end - begin); - if ( physx::shdfnd::strnicmp(begin,"true", len) == 0 || physx::shdfnd::strnicmp(begin,"1", len) == 0 ) - ret = true; - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE int8_t strToI8(const char *str, const char **endptr) -{ - int8_t ret; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - if( strncmp(begin, "INT8_MIN", (size_t)(end-begin)) == 0) - ret = INT8_MIN; - else if( strncmp(begin, "INT8_MAX", (size_t)(end-begin)) == 0) - ret = INT8_MAX; - else if( strncmp(begin, "PX_MIN_I8", (size_t)(end-begin)) == 0) - ret = INT8_MIN; - else if( strncmp(begin, "PX_MAX_I8", (size_t)(end-begin)) == 0) - ret = INT8_MAX; - else - ret = (int8_t)strtol(begin, 0, 0); //FIXME - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE int16_t strToI16(const char *str, const char **endptr) -{ - int16_t ret; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - if( strncmp(begin, "INT16_MIN", (size_t)(end-begin)) == 0) - ret = INT16_MIN; - else if( strncmp(begin, "INT16_MAX", (size_t)(end-begin)) == 0) - ret = INT16_MAX; - else if( strncmp(begin, "PX_MIN_I16", (size_t)(end-begin)) == 0) - ret = INT16_MIN; - else if( strncmp(begin, "PX_MAX_I16", (size_t)(end-begin)) == 0) - ret = INT16_MAX; - else - ret = (int16_t)strtol(begin, 0, 0); //FIXME - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE int32_t strToI32(const char *str, const char **endptr) -{ - int32_t ret; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - if( strncmp(begin, "INT32_MIN", (size_t)(end-begin)) == 0) - ret = INT32_MIN; - else if( strncmp(begin, "INT32_MAX", (size_t)(end-begin)) == 0) - ret = INT32_MAX; - else if( strncmp(begin, "PX_MIN_I32", (size_t)(end-begin)) == 0) - ret = INT32_MIN; - else if( strncmp(begin, "PX_MAX_I32", (size_t)(end-begin)) == 0) - ret = INT32_MAX; - else - ret = (int32_t)strtol(begin, 0, 0); //FIXME - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE int64_t strToI64(const char *str, const char **endptr) -{ - int64_t ret; - const char *begin = skipWhiteSpace(str); - - //FIXME -#ifdef _WIN32 //NV_WINDOWS, NV_XBOX - ret = (int64_t)_strtoi64(begin,0,10); -#else - ret = (int64_t)strtoll(begin,0,10); -#endif - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE uint8_t strToU8(const char *str, const char **endptr) -{ - uint8_t ret; - const char *begin = skipWhiteSpace(str); - - ret = (uint8_t)strtoul(begin, 0, 0); - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE uint16_t strToU16(const char *str, const char **endptr) -{ - uint16_t ret; - const char *end; - const char *begin = skipWhiteSpace(str); - - end = skipNonWhiteSpace(begin); - if( !end ) - end = begin + strlen(str); - - if( strncmp(begin, "UINT16_MAX", (size_t)(end-begin)) == 0) - ret = UINT16_MAX; - else if( strncmp(begin, "PX_MAX_U16", (size_t)(end-begin)) == 0) - ret = UINT16_MAX; - else - ret = (uint16_t)strtoul(begin,0,0); - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE uint32_t strToU32(const char *str, const char **endptr) -{ - uint32_t ret; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - if( strncmp(begin, "UINT32_MAX", (size_t)(end-begin)) == 0) - ret = UINT32_MAX; - else if( strncmp(begin, "PX_U32_MAX", (size_t)(end-begin)) == 0) - ret = UINT32_MAX; - else - ret = (uint32_t)strtoul(begin,0,0); - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE uint64_t strToU64(const char *str, const char **endptr) -{ - uint64_t ret; - const char *begin; - begin = skipWhiteSpace(str); - - //FIXME -#ifdef _WIN32 //NV_WINDOWS, NV_XBOX - ret = (uint64_t)_strtoui64(begin,0,10); -#else - ret = (uint64_t)strtoull(begin,0,10); -#endif - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -#ifndef DEBUGGING_MISMATCHES -#define DEBUGGING_MISMATCHES 0 -#endif - -PX_INLINE float strToF32(const char *str, const char **endptr) -{ - float ret; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - const uint32_t len = (uint32_t)(end - begin); - - const char F32_MIN[] = "NV_MIN_F32"; - const char F32_MAX[] = "NV_MAX_F32"; - const char PX_F32_MIN[] = "PX_MIN_F32"; - const char PX_F32_MAX[] = "PX_MAX_F32"; - - if( strncmp(begin, PX_F32_MIN, physx::PxMin(len, (uint32_t)(sizeof(PX_F32_MIN) - 1))) == 0) - ret = -PX_MAX_F32; - else if( strncmp(begin, PX_F32_MAX, physx::PxMin(len, (uint32_t)(sizeof(PX_F32_MAX) - 1))) == 0) - ret = PX_MAX_F32; - else if( strncmp(begin, F32_MIN, physx::PxMin(len, (uint32_t)(sizeof(F32_MIN) - 1))) == 0) - ret = -PX_MAX_F32; - else if( strncmp(begin, F32_MAX, physx::PxMin(len, (uint32_t)(sizeof(F32_MAX) - 1))) == 0) - ret = PX_MAX_F32; - else - { - ret = (float)strtof_fast(begin); - } - -#if DEBUGGING_MISMATCHES - float testRet = (float)atof(begin); - if( ret != testRet ) - { - PX_ASSERT(0 && "Inaccurate float string"); - } -#endif - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - - -PX_INLINE double strToF64(const char *str, const char **endptr) -{ - double ret; - const char *begin = skipWhiteSpace(str); - const char *end = skipNonWhiteSpace(begin); - - end = skipNonWhiteSpace(begin); - - if( !end ) - end = begin + strlen(str); - - const uint32_t len = (const uint32_t)(end - begin); - - const char F64_MIN[] = "PX_MIN_F364"; - const char F64_MAX[] = "PX_MAX_F64"; - const char PX_F64_MIN[] = "PX_MIN_F64"; - const char PX_F64_MAX[] = "PX_MAX_F64"; - - if( strncmp(begin, F64_MIN, physx::PxMin(len, (uint32_t)(sizeof(F64_MIN) - 1))) == 0) - ret = -PX_MAX_F64; - else if( strncmp(begin, F64_MAX, physx::PxMin(len, (uint32_t)(sizeof(F64_MAX) - 1))) == 0) - ret = PX_MAX_F64; - else if( strncmp(begin, PX_F64_MIN, physx::PxMin(len, (uint32_t)(sizeof(PX_F64_MIN) - 1))) == 0) - ret = -PX_MAX_F64; - else if( strncmp(begin, PX_F64_MAX, physx::PxMin(len, (uint32_t)(sizeof(PX_F64_MAX) - 1))) == 0) - ret = PX_MAX_F64; - else - ret = (double)strtod_fast(begin); - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); - - return ret; -} - -PX_INLINE void strToF32s(float *v,uint32_t count,const char *str, const char**endptr) -{ - const char *begin = skipWhiteSpace(str); - - if ( *begin == '(' ) begin++; - for (uint32_t i=0; i<count && *begin; i++) - { - v[i] = (float)strToF32(begin, &begin); - } - - if( endptr ) - *endptr = skipNonWhiteSpace(begin); -} - - -////////////////////////// -// value to str functions -////////////////////////// -PX_INLINE const char * valueToStr( bool val, char *buf, uint32_t n ) -{ - physx::shdfnd::snprintf(buf, n,"%s",val ? "true" : "false"); - return buf; -} - -PX_INLINE const char * valueToStr( int8_t val, char *buf, uint32_t n ) -{ - if( val == INT8_MIN ) - physx::shdfnd::snprintf(buf, n,"%s","INT8_MIN" ); - else if( val == INT8_MAX ) - physx::shdfnd::snprintf(buf, n,"%s","INT8_MAX" ); - else - physx::shdfnd::snprintf(buf, n, "%d", val); - return buf; -} - -PX_INLINE const char * valueToStr( int16_t val, char *buf, uint32_t n ) -{ - if( val == INT16_MIN ) - physx::shdfnd::snprintf(buf, n,"%s","INT16_MIN" ); - else if( val == INT16_MAX ) - physx::shdfnd::snprintf(buf, n,"%s","INT16_MAX" ); - else - physx::shdfnd::snprintf(buf, n,"%d",val ); - return buf; -} - -PX_INLINE const char * valueToStr( int32_t val, char *buf, uint32_t n ) -{ - if( val == INT32_MIN ) - physx::shdfnd::snprintf(buf, n,"%s","INT32_MIN" ); - else if( val == INT32_MAX ) - physx::shdfnd::snprintf(buf, n,"%s","INT32_MAX" ); - else - physx::shdfnd::snprintf(buf, n,"%d",val ); - return buf; -} - -PX_INLINE const char * valueToStr( int64_t val, char *buf, uint32_t n ) -{ - physx::shdfnd::snprintf(buf, n,"%lld",val ); - return buf; -} - -PX_INLINE const char * valueToStr( uint8_t val, char *buf, uint32_t n ) -{ - physx::shdfnd::snprintf(buf, n, "%u", val); - return buf; -} - -PX_INLINE const char * valueToStr( uint16_t val, char *buf, uint32_t n ) -{ - if( val == UINT16_MAX ) - physx::shdfnd::snprintf(buf, n,"%s","UINT16_MAX" ); - else - physx::shdfnd::snprintf(buf, n,"%u",val ); - return buf; -} - -PX_INLINE const char * valueToStr( uint32_t val, char *buf, uint32_t n ) -{ - if( val == UINT32_MAX ) - physx::shdfnd::snprintf(buf, n,"%s","UINT32_MAX" ); - else - physx::shdfnd::snprintf(buf, n,"%u",val ); - return buf; -} - -PX_INLINE const char * valueToStr( uint64_t val, char *buf, uint32_t n ) -{ - physx::shdfnd::snprintf(buf, n,"%llu",val ); - return buf; -} - -PX_INLINE const char * valueToStr( float val, char *buf, uint32_t n ) -{ - if( !physx::PxIsFinite(val) ) - { - PX_ASSERT( 0 && "invalid floating point" ); - physx::shdfnd::snprintf(buf, n,"%s","0" ); - } - else if( val == -PX_MAX_F32 ) - physx::shdfnd::snprintf(buf, n,"%s","PX_MIN_F32" ); - else if( val == PX_MAX_F32 ) - physx::shdfnd::snprintf(buf, n,"%s","PX_MAX_F32" ); - else if ( val == 1 ) - physx::shdfnd::strlcpy(buf, n, "1"); - else if ( val == 0 ) - physx::shdfnd::strlcpy(buf, n, "0"); - else if ( val == - 1 ) - physx::shdfnd::strlcpy(buf, n, "-1"); - else - { - physx::shdfnd::snprintf(buf,n,"%.9g", (double)val ); // %g expects double - const char *dot = strchr(buf,'.'); - const char *e = strchr(buf,'e'); - if ( dot && !e ) - { - int32_t len = (int32_t)strlen(buf); - char *foo = &buf[len-1]; - while ( *foo == '0' ) foo--; - if ( *foo == '.' ) - *foo = 0; - else - foo[1] = 0; - } - } - return buf; -} - -PX_INLINE const char * valueToStr( double val, char *buf, uint32_t n ) -{ - if( !physx::PxIsFinite(val) ) - { - PX_ASSERT( 0 && "invalid floating point" ); - physx::shdfnd::snprintf(buf, n,"%s","0" ); - } - else if( val == -PX_MAX_F64 ) - physx::shdfnd::snprintf(buf, n,"%s","PX_MIN_F64" ); - else if( val == PX_MAX_F64 ) - physx::shdfnd::snprintf(buf, n,"%s","PX_MAX_F64" ); - else if ( val == 1 ) - physx::shdfnd::strlcpy(buf, n, "1"); - else if ( val == 0 ) - physx::shdfnd::strlcpy(buf, n, "0"); - else if ( val == - 1 ) - physx::shdfnd::strlcpy(buf, n, "-1"); - else - { - physx::shdfnd::snprintf(buf,n,"%.18g", val ); - const char *dot = strchr(buf,'.'); - const char *e = strchr(buf,'e'); - if ( dot && !e ) - { - int32_t len = (int32_t)strlen(buf); - char *foo = &buf[len-1]; - while ( *foo == '0' ) foo--; - if ( *foo == '.' ) - *foo = 0; - else - foo[1] = 0; - } - } - return buf; -} diff --git a/PxShared/src/filebuf/include/PsFileBuffer.h b/PxShared/src/filebuf/include/PsFileBuffer.h deleted file mode 100644 index d768968..0000000 --- a/PxShared/src/filebuf/include/PsFileBuffer.h +++ /dev/null @@ -1,250 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PSFILEBUFFER_PSFILEBUFFER_H -#define PSFILEBUFFER_PSFILEBUFFER_H - -#include "filebuf/PxFileBuf.h" - -#include "Ps.h" -#include "PsUserAllocated.h" -#include <stdio.h> - -namespace physx -{ -namespace general_PxIOStream2 -{ - using namespace shdfnd; - -//Use this class if you want to use your own allocator -class PxFileBufferBase : public PxFileBuf -{ -public: - PxFileBufferBase(const char *fileName,OpenMode mode) - { - mOpenMode = mode; - mFph = NULL; - mFileLength = 0; - mSeekRead = 0; - mSeekWrite = 0; - mSeekCurrent = 0; - switch ( mode ) - { - case OPEN_READ_ONLY: - mFph = fopen(fileName,"rb"); - break; - case OPEN_WRITE_ONLY: - mFph = fopen(fileName,"wb"); - break; - case OPEN_READ_WRITE_NEW: - mFph = fopen(fileName,"wb+"); - break; - case OPEN_READ_WRITE_EXISTING: - mFph = fopen(fileName,"rb+"); - break; - case OPEN_FILE_NOT_FOUND: - break; - } - if ( mFph ) - { - fseek(mFph,0L,SEEK_END); - mFileLength = static_cast<uint32_t>(ftell(mFph)); - fseek(mFph,0L,SEEK_SET); - } - else - { - mOpenMode = OPEN_FILE_NOT_FOUND; - } - } - - virtual ~PxFileBufferBase() - { - close(); - } - - virtual void close() - { - if( mFph ) - { - fclose(mFph); - mFph = 0; - } - } - - virtual SeekType isSeekable(void) const - { - return mSeekType; - } - - virtual uint32_t read(void* buffer, uint32_t size) - { - uint32_t ret = 0; - if ( mFph ) - { - setSeekRead(); - ret = static_cast<uint32_t>(::fread(buffer,1,size,mFph)); - mSeekRead+=ret; - mSeekCurrent+=ret; - } - return ret; - } - - virtual uint32_t peek(void* buffer, uint32_t size) - { - uint32_t ret = 0; - if ( mFph ) - { - uint32_t loc = tellRead(); - setSeekRead(); - ret = static_cast<uint32_t>(::fread(buffer,1,size,mFph)); - mSeekCurrent+=ret; - seekRead(loc); - } - return ret; - } - - virtual uint32_t write(const void* buffer, uint32_t size) - { - uint32_t ret = 0; - if ( mFph ) - { - setSeekWrite(); - ret = static_cast<uint32_t>(::fwrite(buffer,1,size,mFph)); - mSeekWrite+=ret; - mSeekCurrent+=ret; - if ( mSeekWrite > mFileLength ) - { - mFileLength = mSeekWrite; - } - } - return ret; - } - - virtual uint32_t tellRead(void) const - { - return mSeekRead; - } - - virtual uint32_t tellWrite(void) const - { - return mSeekWrite; - } - - virtual uint32_t seekRead(uint32_t loc) - { - mSeekRead = loc; - if ( mSeekRead > mFileLength ) - { - mSeekRead = mFileLength; - } - return mSeekRead; - } - - virtual uint32_t seekWrite(uint32_t loc) - { - mSeekWrite = loc; - if ( mSeekWrite > mFileLength ) - { - mSeekWrite = mFileLength; - } - return mSeekWrite; - } - - virtual void flush(void) - { - if ( mFph ) - { - ::fflush(mFph); - } - } - - virtual OpenMode getOpenMode(void) const - { - return mOpenMode; - } - - virtual uint32_t getFileLength(void) const - { - return mFileLength; - } - -private: - // Moves the actual file pointer to the current read location - void setSeekRead(void) - { - if ( mSeekRead != mSeekCurrent && mFph ) - { - if ( mSeekRead >= mFileLength ) - { - fseek(mFph,0L,SEEK_END); - } - else - { - fseek(mFph,static_cast<long>(mSeekRead),SEEK_SET); - } - mSeekCurrent = mSeekRead = static_cast<uint32_t>(ftell(mFph)); - } - } - // Moves the actual file pointer to the current write location - void setSeekWrite(void) - { - if ( mSeekWrite != mSeekCurrent && mFph ) - { - if ( mSeekWrite >= mFileLength ) - { - fseek(mFph,0L,SEEK_END); - } - else - { - fseek(mFph,static_cast<long>(mSeekWrite),SEEK_SET); - } - mSeekCurrent = mSeekWrite = static_cast<uint32_t>(ftell(mFph)); - } - } - - - FILE *mFph; - uint32_t mSeekRead; - uint32_t mSeekWrite; - uint32_t mSeekCurrent; - uint32_t mFileLength; - SeekType mSeekType; - OpenMode mOpenMode; -}; - -//Use this class if you want to use PhysX memory allocator -class PsFileBuffer: public PxFileBufferBase, public UserAllocated -{ -public: - PsFileBuffer(const char *fileName,OpenMode mode): PxFileBufferBase(fileName, mode) {} -}; - -} -using namespace general_PxIOStream2; -} - -#endif // PSFILEBUFFER_PSFILEBUFFER_H diff --git a/PxShared/src/filebuf/include/PsIOStream.h b/PxShared/src/filebuf/include/PsIOStream.h deleted file mode 100644 index 07c73f9..0000000 --- a/PxShared/src/filebuf/include/PsIOStream.h +++ /dev/null @@ -1,137 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PSFILEBUFFER_PSIOSTREAM_H -#define PSFILEBUFFER_PSIOSTREAM_H - -/*! -\file -\brief PsIOStream class -*/ -#include "filebuf/PxFileBuf.h" - -#include "Ps.h" -#include "PsString.h" -#include <string.h> -#include <stdlib.h> -#include "PsAsciiConversion.h" - -#define safePrintf physx::shdfnd::snprintf - -PX_PUSH_PACK_DEFAULT - -namespace physx -{ - namespace general_PxIOStream2 - { - -/** -\brief A wrapper class for physx::PxFileBuf that provides both binary and ASCII streaming capabilities -*/ -class PsIOStream -{ - static const uint32_t MAX_STREAM_STRING = 1024; -public: - /** - \param [in] stream the physx::PxFileBuf through which all reads and writes will be performed - \param [in] streamLen the length of the input data stream when de-serializing - */ - PsIOStream(physx::PxFileBuf &stream,uint32_t streamLen) : mBinary(true), mStreamLen(streamLen), mStream(stream) { } - ~PsIOStream(void) { } - - /** - \brief Set the stream to binary or ASCII - - \param [in] state if true, stream is binary, if false, stream is ASCII - - If the stream is binary, stream access is passed straight through to the respecitve - physx::PxFileBuf methods. If the stream is ASCII, all stream reads and writes are converted to - human readable ASCII. - */ - PX_INLINE void setBinary(bool state) { mBinary = state; } - PX_INLINE bool getBinary() { return mBinary; } - - PX_INLINE PsIOStream& operator<<(bool v); - PX_INLINE PsIOStream& operator<<(char c); - PX_INLINE PsIOStream& operator<<(uint8_t v); - PX_INLINE PsIOStream& operator<<(int8_t v); - - PX_INLINE PsIOStream& operator<<(const char *c); - PX_INLINE PsIOStream& operator<<(int64_t v); - PX_INLINE PsIOStream& operator<<(uint64_t v); - PX_INLINE PsIOStream& operator<<(double v); - PX_INLINE PsIOStream& operator<<(float v); - PX_INLINE PsIOStream& operator<<(uint32_t v); - PX_INLINE PsIOStream& operator<<(int32_t v); - PX_INLINE PsIOStream& operator<<(uint16_t v); - PX_INLINE PsIOStream& operator<<(int16_t v); - PX_INLINE PsIOStream& operator<<(const physx::PxVec3 &v); - PX_INLINE PsIOStream& operator<<(const physx::PxQuat &v); - PX_INLINE PsIOStream& operator<<(const physx::PxBounds3 &v); - - PX_INLINE PsIOStream& operator>>(const char *&c); - PX_INLINE PsIOStream& operator>>(bool &v); - PX_INLINE PsIOStream& operator>>(char &c); - PX_INLINE PsIOStream& operator>>(uint8_t &v); - PX_INLINE PsIOStream& operator>>(int8_t &v); - PX_INLINE PsIOStream& operator>>(int64_t &v); - PX_INLINE PsIOStream& operator>>(uint64_t &v); - PX_INLINE PsIOStream& operator>>(double &v); - PX_INLINE PsIOStream& operator>>(float &v); - PX_INLINE PsIOStream& operator>>(uint32_t &v); - PX_INLINE PsIOStream& operator>>(int32_t &v); - PX_INLINE PsIOStream& operator>>(uint16_t &v); - PX_INLINE PsIOStream& operator>>(int16_t &v); - PX_INLINE PsIOStream& operator>>(physx::PxVec3 &v); - PX_INLINE PsIOStream& operator>>(physx::PxQuat &v); - PX_INLINE PsIOStream& operator>>(physx::PxBounds3 &v); - - uint32_t getStreamLen(void) const { return mStreamLen; } - - physx::PxFileBuf& getStream(void) { return mStream; } - - PX_INLINE void storeString(const char *c,bool zeroTerminate=false); - -private: - PsIOStream& operator=( const PsIOStream& ); - - - bool mBinary; // true if we are serializing binary data. Otherwise, everything is assumed converted to ASCII - uint32_t mStreamLen; // the length of the input data stream when de-serializing. - physx::PxFileBuf &mStream; - char mReadString[MAX_STREAM_STRING]; // a temp buffer for streaming strings on input. -}; - -#include "PsIOStream.inl" // inline methods... - - } // end of namespace - using namespace general_PxIOStream2; -} // end of physx namespace - -PX_POP_PACK - -#endif // PSFILEBUFFER_PSIOSTREAM_H diff --git a/PxShared/src/filebuf/include/PsIOStream.inl b/PxShared/src/filebuf/include/PsIOStream.inl deleted file mode 100644 index e821e6a..0000000 --- a/PxShared/src/filebuf/include/PsIOStream.inl +++ /dev/null @@ -1,451 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - - -/* - * Copyright 2009-2011 NVIDIA Corporation. All rights reserved. - * - * NOTICE TO USER: - * - * This source code is subject to NVIDIA ownership rights under U.S. and - * international Copyright laws. Users and possessors of this source code - * are hereby granted a nonexclusive, royalty-free license to use this code - * in individual and commercial software. - * - * NVIDIA MAKES NO REPRESENTATION ABOUT THE SUITABILITY OF THIS SOURCE - * CODE FOR ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR - * IMPLIED WARRANTY OF ANY KIND. NVIDIA DISCLAIMS ALL WARRANTIES WITH - * REGARD TO THIS SOURCE CODE, INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE. - * IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL, - * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS - * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE - * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE - * OR PERFORMANCE OF THIS SOURCE CODE. - * - * U.S. Government End Users. This source code is a "commercial item" as - * that term is defined at 48 C.F.R. 2.101 (OCT 1995), consisting of - * "commercial computer software" and "commercial computer software - * documentation" as such terms are used in 48 C.F.R. 12.212 (SEPT 1995) - * and is provided to the U.S. Government only as a commercial end item. - * Consistent with 48 C.F.R.12.212 and 48 C.F.R. 227.7202-1 through - * 227.7202-4 (JUNE 1995), all U.S. Government End Users acquire the - * source code with only those rights set forth herein. - * - * Any use of this source code in individual and commercial software must - * include, in the user documentation and internal comments to the code, - * the above Disclaimer and U.S. Government End Users Notice. - */ - -/*! -\file -\brief PsIOStream inline implementation -*/ - -PX_INLINE PsIOStream& PsIOStream::operator<<(bool v) -{ - if ( mBinary ) - { - mStream.storeByte((uint8_t)v); - } - else - { - char scratch[6]; - storeString( physx::PxAsc::valueToStr(v, scratch, 6) ); - } - return *this; -} - - -PX_INLINE PsIOStream& PsIOStream::operator<<(char c) -{ - mStream.storeByte((uint8_t)c); - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(uint8_t c) -{ - if ( mBinary ) - { - mStream.storeByte((uint8_t)c); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(c, scratch, physx::PxAsc::IntStrLen) ); - } - - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(int8_t c) -{ - if ( mBinary ) - { - mStream.storeByte((uint8_t)c); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(c, scratch, physx::PxAsc::IntStrLen) ); - } - - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(const char *c) -{ - if ( mBinary ) - { - c = c ? c : ""; // it it is a null pointer, assign it to an empty string. - uint32_t len = (uint32_t)strlen(c); - PX_ASSERT( len < (MAX_STREAM_STRING-1)); - if ( len > (MAX_STREAM_STRING-1) ) - { - len = MAX_STREAM_STRING-1; - } - mStream.storeDword(len); - if ( len ) - mStream.write(c,len); - } - else - { - storeString(c); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(uint64_t v) -{ - if ( mBinary ) - { - mStream.storeDouble( (double) v ); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::IntStrLen) ); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(int64_t v) -{ - if ( mBinary ) - { - mStream.storeDouble( (double) v ); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::IntStrLen) ); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(double v) -{ - if ( mBinary ) - { - mStream.storeDouble( (double) v ); - } - else - { - char scratch[physx::PxAsc::PxF64StrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::PxF64StrLen) ); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(float v) -{ - if ( mBinary ) - { - mStream.storeFloat(v); - } - else - { - char scratch[physx::PxAsc::PxF32StrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::PxF32StrLen) ); - - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(uint32_t v) -{ - if ( mBinary ) - { - mStream.storeDword(v); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::IntStrLen) ); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(int32_t v) -{ - if ( mBinary ) - { - mStream.storeDword( (uint32_t) v ); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::IntStrLen) ); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(uint16_t v) -{ - if ( mBinary ) - { - mStream.storeWord(v); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::IntStrLen) ); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(int16_t v) -{ - if ( mBinary ) - { - mStream.storeWord( (uint16_t) v ); - } - else - { - char scratch[physx::PxAsc::IntStrLen]; - storeString( physx::PxAsc::valueToStr(v, scratch, physx::PxAsc::IntStrLen) ); - } - return *this; -} - - -PX_INLINE PsIOStream& PsIOStream::operator>>(uint32_t &v) -{ - if ( mBinary ) - { - v = mStream.readDword(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(char &v) -{ - if ( mBinary ) - { - v = (char)mStream.readByte(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(uint8_t &v) -{ - if ( mBinary ) - { - v = mStream.readByte(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(int8_t &v) -{ - if ( mBinary ) - { - v = (int8_t)mStream.readByte(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(int64_t &v) -{ - if ( mBinary ) - { - v = mStream.readDword(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(uint64_t &v) -{ - if ( mBinary ) - { - v = (uint64_t)mStream.readDouble(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(double &v) -{ - if ( mBinary ) - { - v = mStream.readDouble(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(float &v) -{ - if ( mBinary ) - { - v = mStream.readFloat(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(int32_t &v) -{ - if ( mBinary ) - { - v = (int32_t)mStream.readDword(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(uint16_t &v) -{ - if ( mBinary ) - { - v = mStream.readWord(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(int16_t &v) -{ - if ( mBinary ) - { - v = (int16_t)mStream.readWord(); - } - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(bool &v) -{ - int8_t iv; - iv = (int8_t)mStream.readByte(); - v = iv ? true : false; - return *this; -} - -#define NX_IOSTREAM_COMMA_SEPARATOR if(!mBinary) *this << ' '; - -PX_INLINE PsIOStream& PsIOStream::operator<<(const physx::PxVec3 &v) -{ - *this << v.x; - NX_IOSTREAM_COMMA_SEPARATOR; - *this << v.y; - NX_IOSTREAM_COMMA_SEPARATOR; - *this << v.z; - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator<<(const physx::PxQuat &v) -{ - *this << v.x; - NX_IOSTREAM_COMMA_SEPARATOR; - *this << v.y; - NX_IOSTREAM_COMMA_SEPARATOR; - *this << v.z; - NX_IOSTREAM_COMMA_SEPARATOR; - *this << v.w; - return *this; -} - - -PX_INLINE PsIOStream& PsIOStream::operator<<(const physx::PxBounds3 &v) -{ - *this << v.minimum; - NX_IOSTREAM_COMMA_SEPARATOR; - *this << v.maximum; - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(physx::PxVec3 &v) -{ - *this >> v.x; - *this >> v.y; - *this >> v.z; - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(physx::PxQuat &v) -{ - *this>>v.x; - *this>>v.y; - *this>>v.z; - *this>>v.w; - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(physx::PxBounds3 &v) -{ - *this >> v.minimum; - *this >> v.maximum; - return *this; -} - -PX_INLINE PsIOStream& PsIOStream::operator>>(const char *&str) -{ - str = NULL; // by default no string streamed... - if ( mBinary ) - { - uint32_t len=0; - *this >> len; - - PX_ASSERT( len < (MAX_STREAM_STRING-1) ); - if ( len < (MAX_STREAM_STRING-1) ) - { - mStream.read(mReadString,len); - mReadString[len] = 0; - str = mReadString; - } - } - return *this; -} - - -PX_INLINE void PsIOStream::storeString(const char *c,bool zeroTerminate) -{ - while ( *c ) - { - mStream.storeByte((uint8_t)*c); - c++; - } - if ( zeroTerminate ) - { - mStream.storeByte(0); - } -} diff --git a/PxShared/src/filebuf/include/PsMemoryBuffer.h b/PxShared/src/filebuf/include/PsMemoryBuffer.h deleted file mode 100644 index 5b59386..0000000 --- a/PxShared/src/filebuf/include/PsMemoryBuffer.h +++ /dev/null @@ -1,449 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PSFILEBUFFER_PSMEMORYBUFFER_H -#define PSFILEBUFFER_PSMEMORYBUFFER_H - -#include "Ps.h" -#include "PsUserAllocated.h" -#include "PsAlignedMalloc.h" -#include "filebuf/PxFileBuf.h" -#include "foundation/PxAssert.h" - -namespace physx -{ -namespace general_PxIOStream2 -{ - using namespace shdfnd; - - const uint32_t BUFFER_SIZE_DEFAULT = 4096; - -//Use this class if you want to use your own allocator -template<class Allocator> -class PxMemoryBufferBase : public PxFileBuf, public Allocator -{ - PX_NOCOPY(PxMemoryBufferBase) - void init(const void *readMem, uint32_t readLen) - { - mAllocator = this; - - mReadBuffer = mReadLoc = static_cast<const uint8_t *>(readMem); - mReadStop = &mReadLoc[readLen]; - - mWriteBuffer = mWriteLoc = mWriteStop = NULL; - mWriteBufferSize = 0; - mDefaultWriteBufferSize = BUFFER_SIZE_DEFAULT; - - mOpenMode = OPEN_READ_ONLY; - mSeekType = SEEKABLE_READ; - } - - void init(uint32_t defaultWriteBufferSize) - { - mAllocator = this; - - mReadBuffer = mReadLoc = mReadStop = NULL; - - mWriteBuffer = mWriteLoc = mWriteStop = NULL; - mWriteBufferSize = 0; - mDefaultWriteBufferSize = defaultWriteBufferSize; - - mOpenMode = OPEN_READ_WRITE_NEW; - mSeekType = SEEKABLE_READWRITE; - } - -public: - PxMemoryBufferBase(const void *readMem,uint32_t readLen) - { - init(readMem, readLen); - } - - PxMemoryBufferBase(const void *readMem,uint32_t readLen, const Allocator &alloc): Allocator(alloc) - { - init(readMem, readLen); - } - - PxMemoryBufferBase(uint32_t defaultWriteBufferSize = BUFFER_SIZE_DEFAULT) - { - init(defaultWriteBufferSize); - } - - PxMemoryBufferBase(uint32_t defaultWriteBufferSize, const Allocator &alloc): Allocator(alloc) - { - init(defaultWriteBufferSize); - } - - virtual ~PxMemoryBufferBase(void) - { - reset(); - } - - void setAllocator(Allocator *allocator) - { - mAllocator = allocator; - } - - void initWriteBuffer(uint32_t size) - { - if ( mWriteBuffer == NULL ) - { - if ( size < mDefaultWriteBufferSize ) size = mDefaultWriteBufferSize; - mWriteBuffer = static_cast<uint8_t *>(mAllocator->allocate(size)); - PX_ASSERT( mWriteBuffer ); - mWriteLoc = mWriteBuffer; - mWriteStop = &mWriteBuffer[size]; - mWriteBufferSize = size; - mReadBuffer = mWriteBuffer; - mReadStop = &mWriteBuffer[size]; - mReadLoc = mWriteBuffer; - } - } - - void reset(void) - { - mAllocator->deallocate(mWriteBuffer); - mWriteBuffer = NULL; - mWriteBufferSize = 0; - mWriteLoc = NULL; - mWriteStop = NULL; - mReadBuffer = NULL; - mReadStop = NULL; - mReadLoc = NULL; - } - - virtual OpenMode getOpenMode(void) const - { - return mOpenMode; - } - - - SeekType isSeekable(void) const - { - return mSeekType; - } - - virtual uint32_t read(void* buffer, uint32_t size) - { - if ( (mReadLoc+size) > mReadStop ) - { - size = uint32_t(mReadStop - mReadLoc); - } - if ( size != 0 ) - { - memmove(buffer,mReadLoc,size); - mReadLoc+=size; - } - return size; - } - - virtual uint32_t peek(void* buffer, uint32_t size) - { - if ( (mReadLoc+size) > mReadStop ) - { - size = uint32_t(mReadStop - mReadLoc); - } - if ( size != 0 ) - { - memmove(buffer,mReadLoc,size); - } - return size; - } - - virtual uint32_t write(const void* buffer, uint32_t size) - { - PX_ASSERT( mOpenMode == OPEN_READ_WRITE_NEW ); - if ( mOpenMode == OPEN_READ_WRITE_NEW ) - { - if ( (mWriteLoc+size) > mWriteStop ) - growWriteBuffer(size); - memmove(mWriteLoc,buffer,size); - mWriteLoc+=size; - mReadStop = mWriteLoc; - } - else - { - size = 0; - } - return size; - } - - PX_INLINE const uint8_t * getReadLoc(void) const { return mReadLoc; } - PX_INLINE void advanceReadLoc(uint32_t len) - { - PX_ASSERT(mReadBuffer); - if ( mReadBuffer ) - { - mReadLoc+=len; - if ( mReadLoc >= mReadStop ) - { - mReadLoc = mReadStop; - } - } - } - - virtual uint32_t tellRead(void) const - { - uint32_t ret=0; - - if ( mReadBuffer ) - { - ret = uint32_t(mReadLoc-mReadBuffer); - } - return ret; - } - - virtual uint32_t tellWrite(void) const - { - return uint32_t(mWriteLoc-mWriteBuffer); - } - - virtual uint32_t seekRead(uint32_t loc) - { - uint32_t ret = 0; - PX_ASSERT(mReadBuffer); - if ( mReadBuffer ) - { - mReadLoc = &mReadBuffer[loc]; - if ( mReadLoc >= mReadStop ) - { - mReadLoc = mReadStop; - } - ret = uint32_t(mReadLoc-mReadBuffer); - } - return ret; - } - - virtual uint32_t seekWrite(uint32_t loc) - { - uint32_t ret = 0; - PX_ASSERT( mOpenMode == OPEN_READ_WRITE_NEW ); - if ( mWriteBuffer ) - { - if ( loc > mWriteBufferSize ) - { - mWriteLoc = mWriteStop; - growWriteBuffer(loc - mWriteBufferSize); - } - mWriteLoc = &mWriteBuffer[loc]; - ret = uint32_t(mWriteLoc-mWriteBuffer); - } - return ret; - } - - virtual void flush(void) - { - - } - - virtual uint32_t getFileLength(void) const - { - uint32_t ret = 0; - if ( mReadBuffer ) - { - ret = uint32_t(mReadStop-mReadBuffer); - } - else if ( mWriteBuffer ) - { - ret = uint32_t(mWriteLoc-mWriteBuffer); - } - return ret; - } - - uint32_t getWriteBufferSize(void) const - { - return uint32_t(mWriteLoc-mWriteBuffer); - } - - void setWriteLoc(uint8_t *writeLoc) - { - PX_ASSERT(writeLoc >= mWriteBuffer && writeLoc < mWriteStop ); - mWriteLoc = writeLoc; - mReadStop = mWriteLoc; - } - - const uint8_t * getWriteBuffer(void) const - { - return mWriteBuffer; - } - - /** - * Attention: if you use aligned allocator you cannot free memory with PX_FREE macros instead use deallocate method from base - */ - uint8_t * getWriteBufferOwnership(uint32_t &dataLen) // return the write buffer, and zero it out, the caller is taking ownership of the memory - { - uint8_t *ret = mWriteBuffer; - dataLen = uint32_t(mWriteLoc-mWriteBuffer); - mWriteBuffer = NULL; - mWriteLoc = NULL; - mWriteStop = NULL; - mWriteBufferSize = 0; - return ret; - } - - - void alignRead(uint32_t a) - { - uint32_t loc = tellRead(); - uint32_t aloc = ((loc+(a-1))/a)*a; - if ( aloc != loc ) - { - seekRead(aloc); - } - } - - void alignWrite(uint32_t a) - { - uint32_t loc = tellWrite(); - uint32_t aloc = ((loc+(a-1))/a)*a; - if ( aloc != loc ) - { - seekWrite(aloc); - } - } - -private: - - - // double the size of the write buffer or at least as large as the 'size' value passed in. - void growWriteBuffer(uint32_t size) - { - if ( mWriteBuffer == NULL ) - { - if ( size < mDefaultWriteBufferSize ) size = mDefaultWriteBufferSize; - initWriteBuffer(size); - } - else - { - uint32_t oldWriteIndex = uint32_t(mWriteLoc - mWriteBuffer); - uint32_t newSize = mWriteBufferSize*2; - uint32_t avail = newSize-oldWriteIndex; - if ( size >= avail ) newSize = newSize+size; - uint8_t *writeBuffer = static_cast<uint8_t *>(mAllocator->allocate(newSize)); - PX_ASSERT( writeBuffer ); - memmove(writeBuffer,mWriteBuffer,mWriteBufferSize); - mAllocator->deallocate(mWriteBuffer); - mWriteBuffer = writeBuffer; - mWriteBufferSize = newSize; - mWriteLoc = &mWriteBuffer[oldWriteIndex]; - mWriteStop = &mWriteBuffer[mWriteBufferSize]; - uint32_t oldReadLoc = uint32_t(mReadLoc-mReadBuffer); - mReadBuffer = mWriteBuffer; - mReadStop = mWriteLoc; - mReadLoc = &mReadBuffer[oldReadLoc]; - } - } - - const uint8_t *mReadBuffer; - const uint8_t *mReadLoc; - const uint8_t *mReadStop; - - uint8_t *mWriteBuffer; - uint8_t *mWriteLoc; - uint8_t *mWriteStop; - - uint32_t mWriteBufferSize; - uint32_t mDefaultWriteBufferSize; - Allocator *mAllocator; - OpenMode mOpenMode; - SeekType mSeekType; - -}; - -class PxMemoryBufferAllocator -{ -public: - PxMemoryBufferAllocator(uint32_t a = 0) : alignment(a) {} - - virtual void * allocate(uint32_t size) - { - switch(alignment) - { - case 0: - return PX_ALLOC(size, PX_DEBUG_EXP("PxMemoryBufferAllocator")); - case 16 : - return physx::AlignedAllocator<16>().allocate(size, __FILE__, __LINE__); - case 32 : - return physx::AlignedAllocator<32>().allocate(size, __FILE__, __LINE__); - case 64 : - return physx::AlignedAllocator<64>().allocate(size, __FILE__, __LINE__); - case 128 : - return physx::AlignedAllocator<128>().allocate(size, __FILE__, __LINE__); - default : - PX_ASSERT(0); - } - return NULL; - } - virtual void deallocate(void *mem) - { - switch(alignment) - { - case 0: - PX_FREE(mem); - break; - case 16 : - physx::AlignedAllocator<16>().deallocate(mem); - break; - case 32 : - physx::AlignedAllocator<32>().deallocate(mem); - break; - case 64 : - physx::AlignedAllocator<64>().deallocate(mem); - break; - case 128 : - physx::AlignedAllocator<128>().deallocate(mem); - break; - default : - PX_ASSERT(0); - } - } - virtual ~PxMemoryBufferAllocator(void) {} -private: - PxMemoryBufferAllocator& operator=(const PxMemoryBufferAllocator&); - - const uint32_t alignment; -}; - -//Use this class if you want to use PhysX memory allocator -class PsMemoryBuffer: public PxMemoryBufferBase<PxMemoryBufferAllocator>, public UserAllocated -{ - PX_NOCOPY(PsMemoryBuffer) - typedef PxMemoryBufferBase<PxMemoryBufferAllocator> BaseClass; - -public: - PsMemoryBuffer(const void *readMem,uint32_t readLen): BaseClass(readMem, readLen) {} - PsMemoryBuffer(const void *readMem,uint32_t readLen, uint32_t alignment): BaseClass(readMem, readLen, PxMemoryBufferAllocator(alignment)) {} - - PsMemoryBuffer(uint32_t defaultWriteBufferSize=BUFFER_SIZE_DEFAULT): BaseClass(defaultWriteBufferSize) {} - PsMemoryBuffer(uint32_t defaultWriteBufferSize,uint32_t alignment): BaseClass(defaultWriteBufferSize, PxMemoryBufferAllocator(alignment)) {} -}; - -} -using namespace general_PxIOStream2; -} - -#endif // PSFILEBUFFER_PSMEMORYBUFFER_H - diff --git a/PxShared/src/foundation/doc/PsFoundation.chm b/PxShared/src/foundation/doc/PsFoundation.chm Binary files differdeleted file mode 100644 index df3c07f..0000000 --- a/PxShared/src/foundation/doc/PsFoundation.chm +++ /dev/null diff --git a/PxShared/src/foundation/doc/Readme.txt b/PxShared/src/foundation/doc/Readme.txt deleted file mode 100644 index 88e1189..0000000 --- a/PxShared/src/foundation/doc/Readme.txt +++ /dev/null @@ -1,18 +0,0 @@ -This is the 'NVIDIA Shared' foundation library. - -This code should not ever appear in any public headers or interfaces. - -This library is primarily a platform abstraction layer. - -It contains code to handle mutexes, atomic operations, etc. - -It also handles some SIMD data types. - -It provides math utility functions. - -It implements a number of common container classes. - -It manages trapping all memory allocations. - -All projects should leverage against this foundation library to -perform these common functions. diff --git a/PxShared/src/foundation/doc/create_docs.cmd b/PxShared/src/foundation/doc/create_docs.cmd deleted file mode 100644 index 4691d7d..0000000 --- a/PxShared/src/foundation/doc/create_docs.cmd +++ /dev/null @@ -1,7 +0,0 @@ -set DOXYGEN_DIR=..\..\..\..\..\..\..\devrel\GameWorks\BuildTools\doxygen-win\bin -set HTMLHELP_DIR=..\..\..\..\..\..\..\devrel\GameWorks\BuildTools\HTMLHelpWorkshop - -%DOXYGEN_DIR%\doxygen.exe docs.doxyfile -cd html -..\%HTMLHELP_DIR%\hhc.exe index.hhp -cd .. diff --git a/PxShared/src/foundation/doc/docs.doxyfile b/PxShared/src/foundation/doc/docs.doxyfile deleted file mode 100644 index 624a44f..0000000 --- a/PxShared/src/foundation/doc/docs.doxyfile +++ /dev/null @@ -1,13 +0,0 @@ -# Doxyfile 1.5.8 - -PROJECT_NAME = "NVIDIA(R) PsFoundation Reference" -#ENABLED_SECTIONS = PHYSICS_SDK_PAGES -WARN_LOGFILE = PsFoundation.err -INPUT = ../include ../include/windows ../src ../src/windows -EXTRACT_ALL = YES -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -GENERATE_HTMLHELP = YES -HTML_OUTPUT = html/ -CHM_FILE = ../PsFoundation.chm -TOC_EXPAND = YES diff --git a/PxShared/src/foundation/include/PsAoS.h b/PxShared/src/foundation/include/PsAoS.h deleted file mode 100644 index 5a7c82d..0000000 --- a/PxShared/src/foundation/include/PsAoS.h +++ /dev/null @@ -1,45 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSAOS_H -#define PSFOUNDATION_PSAOS_H - -#include "foundation/Px.h" - -#if PX_WINDOWS && !PX_NEON -#include "windows/PsWindowsAoS.h" -#elif(PX_UNIX_FAMILY || PX_PS4 || PX_SWITCH) -#include "unix/PsUnixAoS.h" -#elif PX_XBOXONE -#include "XboxOne/PsXboxOneAoS.h" -#else -#error "Platform not supported!" -#endif - -#endif diff --git a/PxShared/src/foundation/include/PsBroadcast.h b/PxShared/src/foundation/include/PsBroadcast.h deleted file mode 100644 index 3eb1cba..0000000 --- a/PxShared/src/foundation/include/PsBroadcast.h +++ /dev/null @@ -1,277 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXBROADCAST_H -#define PXPVDSDK_PXBROADCAST_H - -#include "Ps.h" -#include "PsInlineArray.h" - -#include "foundation/PxSimpleTypes.h" -#include "foundation/PxErrorCallback.h" - -namespace physx -{ -namespace shdfnd -{ - -/** -\brief Abstract listener class that listens to allocation and deallocation events from the - foundation memory system. - -<b>Threading:</b> All methods of this class should be thread safe as it can be called from the user thread -or the physics processing thread(s). -*/ -class AllocationListener -{ - public: - /** - \brief callback when memory is allocated. - \param size Size of the allocation in bytes. - \param typeName Type this data is being allocated for. - \param filename File the allocation came from. - \param line the allocation came from. - \param allocatedMemory memory that will be returned from the allocation. - */ - virtual void onAllocation(size_t size, const char* typeName, const char* filename, int line, - void* allocatedMemory) = 0; - - /** - \brief callback when memory is deallocated. - \param allocatedMemory memory just before allocation. - */ - virtual void onDeallocation(void* allocatedMemory) = 0; - - protected: - virtual ~AllocationListener() - { - } -}; - -/** -\brief Broadcast class implementation, registering listeners. - -<b>Threading:</b> All methods of this class should be thread safe as it can be called from the user thread -or the physics processing thread(s). There is not internal locking -*/ -template <class Listener, class Base> -class Broadcast : public Base -{ - public: - static const uint32_t MAX_NB_LISTENERS = 16; - - /** - \brief The default constructor. - */ - Broadcast() - { - } - - /** - \brief Register new listener. - - \note It is NOT SAFE to register and deregister listeners while allocations may be taking place. - moreover, there is no thread safety to registration/deregistration. - - \param listener Listener to register. - */ - void registerListener(Listener& listener) - { - if(mListeners.size() < MAX_NB_LISTENERS) - mListeners.pushBack(&listener); - } - - /** - \brief Deregister an existing listener. - - \note It is NOT SAFE to register and deregister listeners while allocations may be taking place. - moreover, there is no thread safety to registration/deregistration. - - \param listener Listener to deregister. - */ - void deregisterListener(Listener& listener) - { - mListeners.findAndReplaceWithLast(&listener); - } - - /** - \brief Get number of registered listeners. - - \return Number of listeners. - */ - uint32_t getNbListeners() const - { - return mListeners.size(); - } - - /** - \brief Get an existing listener from given index. - - \param index Index of the listener. - \return Listener on given index. - */ - Listener& getListener(uint32_t index) - { - PX_ASSERT(index <= mListeners.size()); - return *mListeners[index]; - } - - protected: - virtual ~Broadcast() - { - } - - physx::shdfnd::InlineArray<Listener*, MAX_NB_LISTENERS, physx::shdfnd::NonTrackingAllocator> mListeners; -}; - -/** -\brief Abstract base class for an application defined memory allocator that allows an external listener -to audit the memory allocations. -*/ -class BroadcastingAllocator : public Broadcast<AllocationListener, PxAllocatorCallback> -{ - PX_NOCOPY(BroadcastingAllocator) - - public: - /** - \brief The default constructor. - */ - BroadcastingAllocator(PxAllocatorCallback& allocator, PxErrorCallback& error) : mAllocator(allocator), mError(error) - { - mListeners.clear(); - } - - /** - \brief The default constructor. - */ - virtual ~BroadcastingAllocator() - { - mListeners.clear(); - } - - /** - \brief Allocates size bytes of memory, which must be 16-byte aligned. - - This method should never return NULL. If you run out of memory, then - you should terminate the app or take some other appropriate action. - - <b>Threading:</b> This function should be thread safe as it can be called in the context of the user thread - and physics processing thread(s). - - \param size Number of bytes to allocate. - \param typeName Name of the datatype that is being allocated - \param filename The source file which allocated the memory - \param line The source line which allocated the memory - \return The allocated block of memory. - */ - void* allocate(size_t size, const char* typeName, const char* filename, int line) - { - void* mem = mAllocator.allocate(size, typeName, filename, line); - - if(!mem) - { - mError.reportError(PxErrorCode::eABORT, "User allocator returned NULL.", __FILE__, __LINE__); - return NULL; - } - - if((reinterpret_cast<size_t>(mem) & 15)) - { - mError.reportError(PxErrorCode::eABORT, "Allocations must be 16-byte aligned.", __FILE__, __LINE__); - return NULL; - } - - for(uint32_t i = 0; i < mListeners.size(); i++) - mListeners[i]->onAllocation(size, typeName, filename, line, mem); - - return mem; - } - - /** - \brief Frees memory previously allocated by allocate(). - - <b>Threading:</b> This function should be thread safe as it can be called in the context of the user thread - and physics processing thread(s). - - \param ptr Memory to free. - */ - void deallocate(void* ptr) - { - for(uint32_t i = 0; i < mListeners.size(); i++) - { - mListeners[i]->onDeallocation(ptr); - } - mAllocator.deallocate(ptr); - } - - private: - PxAllocatorCallback& mAllocator; - PxErrorCallback& mError; -}; - -/** -\brief Abstract base class for an application defined error callback that allows an external listener -to report errors. -*/ -class BroadcastingErrorCallback : public Broadcast<PxErrorCallback, PxErrorCallback> -{ - PX_NOCOPY(BroadcastingErrorCallback) - public: - /** - \brief The default constructor. - */ - BroadcastingErrorCallback(PxErrorCallback& errorCallback) - { - registerListener(errorCallback); - } - - /** - \brief The default destructor. - */ - virtual ~BroadcastingErrorCallback() - { - mListeners.clear(); - } - - /** - \brief Reports an error code. - \param code Error code, see #PxErrorCode - \param message Message to display. - \param file File error occured in. - \param line Line number error occured on. - */ - void reportError(PxErrorCode::Enum code, const char* message, const char* file, int line) - { - for(uint32_t i = 0; i < mListeners.size(); i++) - mListeners[i]->reportError(code, message, file, line); - } -}; -} -} // namespace physx - -#endif // PXPVDSDK_PXBROADCAST_H diff --git a/PxShared/src/foundation/include/PsCpu.h b/PxShared/src/foundation/include/PsCpu.h deleted file mode 100644 index 2dcc5c1..0000000 --- a/PxShared/src/foundation/include/PsCpu.h +++ /dev/null @@ -1,47 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSCPU_H -#define PSFOUNDATION_PSCPU_H - -#include "Ps.h" - -namespace physx -{ -namespace shdfnd -{ -class Cpu -{ - public: - static uint8_t getCpuId(); -}; -} -} - -#endif // #ifndef PSFOUNDATION_PSCPU_H diff --git a/PxShared/src/foundation/include/PsFoundation.h b/PxShared/src/foundation/include/PsFoundation.h deleted file mode 100644 index 68f2cc7..0000000 --- a/PxShared/src/foundation/include/PsFoundation.h +++ /dev/null @@ -1,216 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PX_FOUNDATION_PSFOUNDATION_H -#define PX_FOUNDATION_PSFOUNDATION_H - -#include "foundation/PxFoundation.h" -#include "foundation/PxErrors.h" -#include "foundation/PxProfiler.h" - -#include "PsBroadcast.h" -#include "PsAllocator.h" -#include "PsTempAllocator.h" -#include "PsMutex.h" -#include "PsHashMap.h" -#include "PsUserAllocated.h" - -#include <stdarg.h> - -namespace physx -{ -namespace shdfnd -{ - -#if PX_VC -#pragma warning(push) -#pragma warning(disable : 4251) // class needs to have dll-interface to be used by clients of class -#endif - -class PX_FOUNDATION_API Foundation : public PxFoundation, public UserAllocated -{ - PX_NOCOPY(Foundation) - - public: - typedef MutexT<Allocator> Mutex; - - typedef HashMap<const NamedAllocator*, const char*, Hash<const NamedAllocator*>, NonTrackingAllocator> AllocNameMap; - typedef Array<TempAllocatorChunk*, Allocator> AllocFreeTable; - - public: - // factory - // note, you MUST eventually call release if createInstance returned true! - static Foundation* createInstance(PxU32 version, PxErrorCallback& errc, PxAllocatorCallback& alloc); - static Foundation& getInstance(); - void release(); - static void incRefCount(); // this call requires a foundation object to exist already - static void decRefCount(); // this call requires a foundation object to exist already - - // Begin Errors - virtual PxErrorCallback& getErrorCallback() - { - return mErrorCallback; - } // Return the user's error callback - PxErrorCallback& getInternalErrorCallback() - { - return mBroadcastingError; - } // Return the broadcasting error callback - - void registerErrorCallback(PxErrorCallback& listener); - void deregisterErrorCallback(PxErrorCallback& listener); - - virtual void setErrorLevel(PxErrorCode::Enum mask) - { - mErrorMask = mask; - } - virtual PxErrorCode::Enum getErrorLevel() const - { - return mErrorMask; - } - - void error(PxErrorCode::Enum, const char* file, int line, const char* messageFmt, ...); // Report errors with the - // broadcasting - void errorImpl(PxErrorCode::Enum, const char* file, int line, const char* messageFmt, va_list); // error callback - static PxU32 getWarnOnceTimestamp(); - - // End errors - - // Begin Allocations - virtual PxAllocatorCallback& getAllocatorCallback() - { - return mAllocatorCallback; - } // Return the user's allocator callback - PxAllocatorCallback& getAllocator() - { - return mBroadcastingAllocator; - } // Return the broadcasting allocator - - void registerAllocationListener(physx::shdfnd::AllocationListener& listener); - void deregisterAllocationListener(physx::shdfnd::AllocationListener& listener); - - virtual bool getReportAllocationNames() const - { - return mReportAllocationNames; - } - virtual void setReportAllocationNames(bool value) - { - mReportAllocationNames = value; - } - - PX_INLINE AllocNameMap& getNamedAllocMap() - { - return mNamedAllocMap; - } - PX_INLINE Mutex& getNamedAllocMutex() - { - return mNamedAllocMutex; - } - - PX_INLINE AllocFreeTable& getTempAllocFreeTable() - { - return mTempAllocFreeTable; - } - PX_INLINE Mutex& getTempAllocMutex() - { - return mTempAllocMutex; - } - // End allocations - - private: - static void destroyInstance(); - - Foundation(PxErrorCallback& errc, PxAllocatorCallback& alloc); - ~Foundation(); - - // init order is tricky here: the mutexes require the allocator, the allocator may require the error stream - PxAllocatorCallback& mAllocatorCallback; - PxErrorCallback& mErrorCallback; - - BroadcastingAllocator mBroadcastingAllocator; - BroadcastingErrorCallback mBroadcastingError; - - bool mReportAllocationNames; - - PxErrorCode::Enum mErrorMask; - Mutex mErrorMutex; - - AllocNameMap mNamedAllocMap; - Mutex mNamedAllocMutex; - - AllocFreeTable mTempAllocFreeTable; - Mutex mTempAllocMutex; - - Mutex mListenerMutex; - - static Foundation* mInstance; - static PxU32 mRefCount; - static PxU32 mWarnOnceTimestap; -}; -#if PX_VC -#pragma warning(pop) -#endif - -PX_INLINE Foundation& getFoundation() -{ - return Foundation::getInstance(); -} - -} // namespace shdfnd -} // namespace physx - -// shortcut macros: -// usage: Foundation::error(PX_WARN, "static friction %f is is lower than dynamic friction %d", sfr, dfr); -#define PX_WARN ::physx::PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__ -#define PX_INFO ::physx::PxErrorCode::eDEBUG_INFO, __FILE__, __LINE__ - -#if PX_DEBUG || PX_CHECKED -#define PX_WARN_ONCE(string) \ - { \ - static PxU32 timestamp = 0; \ - if(timestamp != Ps::getFoundation().getWarnOnceTimestamp()) \ - { \ - timestamp = Ps::getFoundation().getWarnOnceTimestamp(); \ - Ps::getFoundation().error(PX_WARN, string); \ - } \ - \ -} -#define PX_WARN_ONCE_IF(condition, string) \ - { \ - if(condition) \ - { \ - PX_WARN_ONCE(string) \ - } \ - \ -} -#else -#define PX_WARN_ONCE(string) ((void)0) -#define PX_WARN_ONCE_IF(condition, string) ((void)0) -#endif - -#endif diff --git a/PxShared/src/foundation/include/PsHashSet.h b/PxShared/src/foundation/include/PsHashSet.h deleted file mode 100644 index 195f01d..0000000 --- a/PxShared/src/foundation/include/PsHashSet.h +++ /dev/null @@ -1,127 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSHASHSET_H -#define PSFOUNDATION_PSHASHSET_H - -#include "PsHashInternals.h" - -// TODO: make this doxy-format - -// This header defines two hash sets. Hash sets -// * support custom initial table sizes (rounded up internally to power-of-2) -// * support custom static allocator objects -// * auto-resize, based on a load factor (i.e. a 64-entry .75 load factor hash will resize -// when the 49th element is inserted) -// * are based on open hashing -// -// Sets have STL-like copying semantics, and properly initialize and destruct copies of objects -// -// There are two forms of set: coalesced and uncoalesced. Coalesced sets keep the entries in the -// initial segment of an array, so are fast to iterate over; however deletion is approximately -// twice as expensive. -// -// HashSet<T>: -// bool insert(const T& k) amortized O(1) (exponential resize policy) -// bool contains(const T& k) const; O(1) -// bool erase(const T& k); O(1) -// uint32_t size() const; constant -// void reserve(uint32_t size); O(MAX(size, currentOccupancy)) -// void clear(); O(currentOccupancy) (with zero constant for objects without -// destructors) -// Iterator getIterator(); -// -// Use of iterators: -// -// for(HashSet::Iterator iter = test.getIterator(); !iter.done(); ++iter) -// myFunction(*iter); -// -// CoalescedHashSet<T> does not support getIterator, but instead supports -// const Key *getEntries(); -// -// insertion into a set already containing the element fails returning false, as does -// erasure of an element not in the set -// - -namespace physx -{ -namespace shdfnd -{ -template <class Key, class HashFn = Hash<Key>, class Allocator = NonTrackingAllocator> -class HashSet : public internal::HashSetBase<Key, HashFn, Allocator, false> -{ - public: - typedef internal::HashSetBase<Key, HashFn, Allocator, false> HashSetBase; - typedef typename HashSetBase::Iterator Iterator; - - HashSet(uint32_t initialTableSize = 64, float loadFactor = 0.75f) : HashSetBase(initialTableSize, loadFactor) - { - } - HashSet(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) - : HashSetBase(initialTableSize, loadFactor, alloc) - { - } - HashSet(const Allocator& alloc) : HashSetBase(64, 0.75f, alloc) - { - } - Iterator getIterator() - { - return Iterator(HashSetBase::mBase); - } -}; - -template <class Key, class HashFn = Hash<Key>, class Allocator = NonTrackingAllocator> -class CoalescedHashSet : public internal::HashSetBase<Key, HashFn, Allocator, true> -{ - public: - typedef typename internal::HashSetBase<Key, HashFn, Allocator, true> HashSetBase; - - CoalescedHashSet(uint32_t initialTableSize = 64, float loadFactor = 0.75f) - : HashSetBase(initialTableSize, loadFactor) - { - } - - CoalescedHashSet(uint32_t initialTableSize, float loadFactor, const Allocator& alloc) - : HashSetBase(initialTableSize, loadFactor, alloc) - { - } - CoalescedHashSet(const Allocator& alloc) : HashSetBase(64, 0.75f, alloc) - { - } - - const Key* getEntries() const - { - return HashSetBase::mBase.getEntries(); - } -}; - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSHASHSET_H diff --git a/PxShared/src/foundation/include/PsInlineAllocator.h b/PxShared/src/foundation/include/PsInlineAllocator.h deleted file mode 100644 index f87abd6..0000000 --- a/PxShared/src/foundation/include/PsInlineAllocator.h +++ /dev/null @@ -1,91 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSINLINEALLOCATOR_H -#define PSFOUNDATION_PSINLINEALLOCATOR_H - -#include "PsUserAllocated.h" - -namespace physx -{ -namespace shdfnd -{ -// this is used by the array class to allocate some space for a small number -// of objects along with the metadata -template <uint32_t N, typename BaseAllocator> -class InlineAllocator : private BaseAllocator -{ - public: - InlineAllocator(const PxEMPTY v) : BaseAllocator(v) - { - } - - InlineAllocator(const BaseAllocator& alloc = BaseAllocator()) : BaseAllocator(alloc), mBufferUsed(false) - { - } - - InlineAllocator(const InlineAllocator& aloc) : BaseAllocator(aloc), mBufferUsed(false) - { - } - - void* allocate(uint32_t size, const char* filename, int line) - { - if(!mBufferUsed && size <= N) - { - mBufferUsed = true; - return mBuffer; - } - return BaseAllocator::allocate(size, filename, line); - } - - void deallocate(void* ptr) - { - if(ptr == mBuffer) - mBufferUsed = false; - else - BaseAllocator::deallocate(ptr); - } - - PX_FORCE_INLINE uint8_t* getInlineBuffer() - { - return mBuffer; - } - PX_FORCE_INLINE bool isBufferUsed() const - { - return mBufferUsed; - } - - protected: - uint8_t mBuffer[N]; - bool mBufferUsed; -}; -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSINLINEALLOCATOR_H diff --git a/PxShared/src/foundation/include/PsInlineArray.h b/PxShared/src/foundation/include/PsInlineArray.h deleted file mode 100644 index e9ea939..0000000 --- a/PxShared/src/foundation/include/PsInlineArray.h +++ /dev/null @@ -1,68 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSINLINEARRAY_H -#define PSFOUNDATION_PSINLINEARRAY_H - -#include "PsArray.h" -#include "PsInlineAllocator.h" - -namespace physx -{ -namespace shdfnd -{ - -// array that pre-allocates for N elements -template <typename T, uint32_t N, typename Alloc = typename AllocatorTraits<T>::Type> -class InlineArray : public Array<T, InlineAllocator<N * sizeof(T), Alloc> > -{ - typedef InlineAllocator<N * sizeof(T), Alloc> Allocator; - - public: - InlineArray(const PxEMPTY v) : Array<T, Allocator>(v) - { - if(isInlined()) - this->mData = reinterpret_cast<T*>(Array<T, Allocator>::getInlineBuffer()); - } - - PX_INLINE bool isInlined() const - { - return Allocator::isBufferUsed(); - } - - PX_INLINE explicit InlineArray(const Alloc& alloc = Alloc()) : Array<T, Allocator>(alloc) - { - this->mData = this->allocate(N); - this->mCapacity = N; - } -}; -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSINLINEARRAY_H diff --git a/PxShared/src/foundation/include/PsMutex.h b/PxShared/src/foundation/include/PsMutex.h deleted file mode 100644 index 23033d0..0000000 --- a/PxShared/src/foundation/include/PsMutex.h +++ /dev/null @@ -1,330 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSMUTEX_H -#define PSFOUNDATION_PSMUTEX_H - -#include "PsAllocator.h" - -/* - * This <new> inclusion is a best known fix for gcc 4.4.1 error: - * Creating object file for apex/src/PsAllocator.cpp ... - * In file included from apex/include/PsFoundation.h:30, - * from apex/src/PsAllocator.cpp:26: - * apex/include/PsMutex.h: In constructor 'physx::shdfnd::MutexT<Alloc>::MutexT(const Alloc&)': - * apex/include/PsMutex.h:92: error: no matching function for call to 'operator new(unsigned int, - * physx::shdfnd::MutexImpl*&)' - * <built-in>:0: note: candidates are: void* operator new(unsigned int) - */ -#include <new> - -namespace physx -{ -namespace shdfnd -{ -class PX_FOUNDATION_API MutexImpl -{ - public: - /** - The constructor for Mutex creates a mutex. It is initially unlocked. - */ - MutexImpl(); - - /** - The destructor for Mutex deletes the mutex. - */ - ~MutexImpl(); - - /** - Acquire (lock) the mutex. If the mutex is already locked - by another thread, this method blocks until the mutex is - unlocked. - */ - void lock(); - - /** - Acquire (lock) the mutex. If the mutex is already locked - by another thread, this method returns false without blocking. - */ - bool trylock(); - - /** - Release (unlock) the mutex. - */ - void unlock(); - - /** - Size of this class. - */ - static uint32_t getSize(); -}; - -template <typename Alloc = ReflectionAllocator<MutexImpl> > -class MutexT : protected Alloc -{ - PX_NOCOPY(MutexT) - public: - class ScopedLock - { - MutexT<Alloc>& mMutex; - PX_NOCOPY(ScopedLock) - public: - PX_INLINE ScopedLock(MutexT<Alloc>& mutex) : mMutex(mutex) - { - mMutex.lock(); - } - PX_INLINE ~ScopedLock() - { - mMutex.unlock(); - } - }; - - /** - The constructor for Mutex creates a mutex. It is initially unlocked. - */ - MutexT(const Alloc& alloc = Alloc()) : Alloc(alloc) - { - mImpl = reinterpret_cast<MutexImpl*>(Alloc::allocate(MutexImpl::getSize(), __FILE__, __LINE__)); - PX_PLACEMENT_NEW(mImpl, MutexImpl)(); - } - - /** - The destructor for Mutex deletes the mutex. - */ - ~MutexT() - { - mImpl->~MutexImpl(); - Alloc::deallocate(mImpl); - } - - /** - Acquire (lock) the mutex. If the mutex is already locked - by another thread, this method blocks until the mutex is - unlocked. - */ - void lock() const - { - mImpl->lock(); - } - - /** - Acquire (lock) the mutex. If the mutex is already locked - by another thread, this method returns false without blocking, - returns true if lock is successfully acquired - */ - bool trylock() const - { - return mImpl->trylock(); - } - - /** - Release (unlock) the mutex, the calling thread must have - previously called lock() or method will error - */ - void unlock() const - { - mImpl->unlock(); - } - - private: - MutexImpl* mImpl; -}; - -class PX_FOUNDATION_API ReadWriteLock -{ - PX_NOCOPY(ReadWriteLock) - public: - ReadWriteLock(); - ~ReadWriteLock(); - - void lockReader(); - void lockWriter(); - - void unlockReader(); - void unlockWriter(); - - private: - class ReadWriteLockImpl* mImpl; -}; - -class ScopedReadLock -{ - PX_NOCOPY(ScopedReadLock) - public: - PX_INLINE ScopedReadLock(ReadWriteLock& lock) : mLock(lock) - { - mLock.lockReader(); - } - PX_INLINE ~ScopedReadLock() - { - mLock.unlockReader(); - } - - private: - ReadWriteLock& mLock; -}; - -class ScopedWriteLock -{ - PX_NOCOPY(ScopedWriteLock) - public: - PX_INLINE ScopedWriteLock(ReadWriteLock& lock) : mLock(lock) - { - mLock.lockWriter(); - } - PX_INLINE ~ScopedWriteLock() - { - mLock.unlockWriter(); - } - - private: - ReadWriteLock& mLock; -}; - -typedef MutexT<> Mutex; - -/* - * Use this type of lock for mutex behaviour that must operate on SPU and PPU - * On non-PS3 platforms, it is implemented using Mutex - */ -class AtomicLock -{ - Mutex mMutex; - PX_NOCOPY(AtomicLock) - - public: - AtomicLock() - { - } - - bool lock() - { - mMutex.lock(); - return true; - } - - bool trylock() - { - return mMutex.trylock(); - } - - bool unlock() - { - mMutex.unlock(); - return true; - } -}; - -class AtomicLockCopy -{ - AtomicLock* pLock; - - public: - AtomicLockCopy() : pLock(NULL) - { - } - - AtomicLockCopy& operator=(AtomicLock& lock) - { - pLock = &lock; - return *this; - } - - bool lock() - { - return pLock->lock(); - } - - bool trylock() - { - return pLock->trylock(); - } - - bool unlock() - { - return pLock->unlock(); - } -}; - -class AtomicRwLock -{ - ReadWriteLock m_Lock; - PX_NOCOPY(AtomicRwLock) - - public: - AtomicRwLock() - { - } - - void lockReader() - { - m_Lock.lockReader(); - } - void lockWriter() - { - m_Lock.lockWriter(); - } - - bool tryLockReader() - { - // Todo - implement this - m_Lock.lockReader(); - return true; - } - - void unlockReader() - { - m_Lock.unlockReader(); - } - void unlockWriter() - { - m_Lock.unlockWriter(); - } -}; - -class ScopedAtomicLock -{ - PX_INLINE ScopedAtomicLock(AtomicLock& lock) : mLock(lock) - { - mLock.lock(); - } - PX_INLINE ~ScopedAtomicLock() - { - mLock.unlock(); - } - - PX_NOCOPY(ScopedAtomicLock) - private: - AtomicLock& mLock; -}; - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSMUTEX_H diff --git a/PxShared/src/foundation/include/PsPool.h b/PxShared/src/foundation/include/PsPool.h deleted file mode 100644 index 796251a..0000000 --- a/PxShared/src/foundation/include/PsPool.h +++ /dev/null @@ -1,298 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSPOOL_H -#define PSFOUNDATION_PSPOOL_H - -#include "PsArray.h" -#include "PsSort.h" -#include "PsBasicTemplates.h" -#include "PsInlineArray.h" - -namespace physx -{ -namespace shdfnd -{ - -/*! -Simple allocation pool -*/ -template <class T, class Alloc = typename AllocatorTraits<T>::Type> -class PoolBase : public UserAllocated, public Alloc -{ - PX_NOCOPY(PoolBase) - protected: - PoolBase(const Alloc& alloc, uint32_t elementsPerSlab, uint32_t slabSize) - : Alloc(alloc), mSlabs(alloc), mElementsPerSlab(elementsPerSlab), mUsed(0), mSlabSize(slabSize), mFreeElement(0) - { - PX_COMPILE_TIME_ASSERT(sizeof(T) >= sizeof(size_t)); - } - - public: - ~PoolBase() - { - if(mUsed) - disposeElements(); - - for(void** slabIt = mSlabs.begin(), *slabEnd = mSlabs.end(); slabIt != slabEnd; ++slabIt) - Alloc::deallocate(*slabIt); - } - - // Allocate space for single object - PX_INLINE T* allocate() - { - if(mFreeElement == 0) - allocateSlab(); - T* p = reinterpret_cast<T*>(mFreeElement); - mFreeElement = mFreeElement->mNext; - mUsed++; -/** -Mark a specified amount of memory with 0xcd pattern. This is used to check that the meta data -definition for serialized classes is complete in checked builds. -*/ -#if PX_CHECKED - for(uint32_t i = 0; i < sizeof(T); ++i) - reinterpret_cast<uint8_t*>(p)[i] = 0xcd; -#endif - return p; - } - - // Put space for a single element back in the lists - PX_INLINE void deallocate(T* p) - { - if(p) - { - PX_ASSERT(mUsed); - mUsed--; - push(reinterpret_cast<FreeList*>(p)); - } - } - - PX_INLINE T* construct() - { - T* t = allocate(); - return t ? new (t) T() : 0; - } - - template <class A1> - PX_INLINE T* construct(A1& a) - { - T* t = allocate(); - return t ? new (t) T(a) : 0; - } - - template <class A1, class A2> - PX_INLINE T* construct(A1& a, A2& b) - { - T* t = allocate(); - return t ? new (t) T(a, b) : 0; - } - - template <class A1, class A2, class A3> - PX_INLINE T* construct(A1& a, A2& b, A3& c) - { - T* t = allocate(); - return t ? new (t) T(a, b, c) : 0; - } - - template <class A1, class A2, class A3> - PX_INLINE T* construct(A1* a, A2& b, A3& c) - { - T* t = allocate(); - return t ? new (t) T(a, b, c) : 0; - } - - template <class A1, class A2, class A3, class A4> - PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d) - { - T* t = allocate(); - return t ? new (t) T(a, b, c, d) : 0; - } - - template <class A1, class A2, class A3, class A4, class A5> - PX_INLINE T* construct(A1& a, A2& b, A3& c, A4& d, A5& e) - { - T* t = allocate(); - return t ? new (t) T(a, b, c, d, e) : 0; - } - - PX_INLINE void destroy(T* const p) - { - if(p) - { - p->~T(); - deallocate(p); - } - } - - protected: - struct FreeList - { - FreeList* mNext; - }; - - // All the allocated slabs, sorted by pointer - InlineArray<void*, 64, Alloc> mSlabs; - - uint32_t mElementsPerSlab; - uint32_t mUsed; - uint32_t mSlabSize; - - FreeList* mFreeElement; // Head of free-list - - // Helper function to get bitmap of allocated elements - - void push(FreeList* p) - { - p->mNext = mFreeElement; - mFreeElement = p; - } - - // Allocate a slab and segregate it into the freelist - void allocateSlab() - { - T* slab = reinterpret_cast<T*>(Alloc::allocate(mSlabSize, __FILE__, __LINE__)); - - mSlabs.pushBack(slab); - - // Build a chain of nodes for the freelist - T* it = slab + mElementsPerSlab; - while(--it >= slab) - push(reinterpret_cast<FreeList*>(it)); - } - - /* - Cleanup method. Go through all active slabs and call destructor for live objects, - then free their memory - */ - void disposeElements() - { - Array<void*, Alloc> freeNodes(*this); - while(mFreeElement) - { - freeNodes.pushBack(mFreeElement); - mFreeElement = mFreeElement->mNext; - } - Alloc& alloc(*this); - sort(freeNodes.begin(), freeNodes.size(), Less<void*>(), alloc); - sort(mSlabs.begin(), mSlabs.size(), Less<void*>(), alloc); - - typename Array<void*, Alloc>::Iterator slabIt = mSlabs.begin(), slabEnd = mSlabs.end(); - for(typename Array<void*, Alloc>::Iterator freeIt = freeNodes.begin(); slabIt != slabEnd; ++slabIt) - { - for(T* tIt = reinterpret_cast<T*>(*slabIt), *tEnd = tIt + mElementsPerSlab; tIt != tEnd; ++tIt) - { - if(freeIt != freeNodes.end() && *freeIt == tIt) - ++freeIt; - else - tIt->~T(); - } - } - } - - /* - Go through all slabs and call destructor if the slab is empty - */ - void releaseEmptySlabs() - { - Array<void*, Alloc> freeNodes(*this); - Array<void*, Alloc> slabNodes(mSlabs, *this); - while(mFreeElement) - { - freeNodes.pushBack(mFreeElement); - mFreeElement = mFreeElement->mNext; - } - - typename Array<void*, Alloc>::Iterator freeIt = freeNodes.begin(), freeEnd = freeNodes.end(), - lastCheck = freeNodes.end() - mElementsPerSlab; - - if(freeNodes.size() > mElementsPerSlab) - { - Alloc& alloc(*this); - sort(freeNodes.begin(), freeNodes.size(), Less<void*>(), alloc); - sort(slabNodes.begin(), slabNodes.size(), Less<void*>(), alloc); - - mSlabs.clear(); - for(void** slabIt = slabNodes.begin(), *slabEnd = slabNodes.end(); slabIt != slabEnd; ++slabIt) - { - while((freeIt < lastCheck) && (*slabIt > (*freeIt))) - { - push(reinterpret_cast<FreeList*>(*freeIt)); - freeIt++; - } - - if(*slabIt == (*freeIt)) // the slab's first element in freeList - { - const size_t endSlabAddress = size_t(*slabIt) + mSlabSize; - const size_t endFreeAddress = size_t(*(freeIt + mElementsPerSlab - 1)); - if(endFreeAddress + sizeof(T) == endSlabAddress) - { // all slab's element in freeList - Alloc::deallocate(*slabIt); - freeIt += mElementsPerSlab; - continue; - } - } - - mSlabs.pushBack(*slabIt); - } - } - - while(freeIt != freeEnd) - { - push(reinterpret_cast<FreeList*>(*freeIt)); - ++freeIt; - } - } -}; - -// original pool implementation -template <class T, class Alloc = typename AllocatorTraits<T>::Type> -class Pool : public PoolBase<T, Alloc> -{ - public: - Pool(const Alloc& alloc = Alloc(), uint32_t elementsPerSlab = 32) - : PoolBase<T, Alloc>(alloc, elementsPerSlab, elementsPerSlab * sizeof(T)) - { - } -}; - -// allows specification of the slab size instead of the occupancy -template <class T, uint32_t slabSize, class Alloc = typename AllocatorTraits<T>::Type> -class Pool2 : public PoolBase<T, Alloc> -{ - public: - Pool2(const Alloc& alloc = Alloc()) : PoolBase<T, Alloc>(alloc, slabSize / sizeof(T), slabSize) - { - } -}; - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSPOOL_H diff --git a/PxShared/src/foundation/include/PsSList.h b/PxShared/src/foundation/include/PsSList.h deleted file mode 100644 index 961010b..0000000 --- a/PxShared/src/foundation/include/PsSList.h +++ /dev/null @@ -1,140 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSSLIST_H -#define PSFOUNDATION_PSSLIST_H - -#include "foundation/Px.h" -#include "foundation/PxAssert.h" -#include "PsAlignedMalloc.h" - -#if PX_P64_FAMILY -#define PX_SLIST_ALIGNMENT 16 -#else -#define PX_SLIST_ALIGNMENT 8 -#endif - -namespace physx -{ -namespace shdfnd -{ - -#if PX_VC -#pragma warning(push) -#pragma warning(disable : 4324) // Padding was added at the end of a structure because of a __declspec(align) value. -#endif - -#if !PX_GCC_FAMILY -__declspec(align(PX_SLIST_ALIGNMENT)) -#endif - class SListEntry -{ - friend struct SListImpl; - - public: - SListEntry() : mNext(NULL) - { - PX_ASSERT((size_t(this) & (PX_SLIST_ALIGNMENT - 1)) == 0); - } - - // Only use on elements returned by SList::flush() - // because the operation is not atomic. - SListEntry* next() - { - return mNext; - } - - private: - SListEntry* mNext; -} -#if PX_GCC_FAMILY -__attribute__((aligned(PX_SLIST_ALIGNMENT))); -#else -; -#endif - -#if PX_VC -#pragma warning(pop) -#endif - -// template-less implementation -struct PX_FOUNDATION_API SListImpl -{ - SListImpl(); - ~SListImpl(); - void push(SListEntry* entry); - SListEntry* pop(); - SListEntry* flush(); - static uint32_t getSize(); -}; - -template <typename Alloc = ReflectionAllocator<SListImpl> > -class SListT : protected Alloc -{ - public: - SListT(const Alloc& alloc = Alloc()) : Alloc(alloc) - { - mImpl = reinterpret_cast<SListImpl*>(Alloc::allocate(SListImpl::getSize(), __FILE__, __LINE__)); - PX_ASSERT((size_t(mImpl) & (PX_SLIST_ALIGNMENT - 1)) == 0); - PX_PLACEMENT_NEW(mImpl, SListImpl)(); - } - ~SListT() - { - mImpl->~SListImpl(); - Alloc::deallocate(mImpl); - } - - // pushes a new element to the list - void push(SListEntry& entry) - { - mImpl->push(&entry); - } - - // pops an element from the list - SListEntry* pop() - { - return mImpl->pop(); - } - - // removes all items from list, returns pointer to first element - SListEntry* flush() - { - return mImpl->flush(); - } - - private: - SListImpl* mImpl; -}; - -typedef SListT<> SList; - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSSLIST_H diff --git a/PxShared/src/foundation/include/PsSocket.h b/PxShared/src/foundation/include/PsSocket.h deleted file mode 100644 index 0d8bf55..0000000 --- a/PxShared/src/foundation/include/PsSocket.h +++ /dev/null @@ -1,186 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSSOCKET_H -#define PSFOUNDATION_PSSOCKET_H - -#include "PsUserAllocated.h" - -namespace physx -{ -namespace shdfnd -{ -/** -Socket abstraction API -*/ - -class PX_FOUNDATION_API Socket : public UserAllocated -{ - public: - static const uint32_t DEFAULT_BUFFER_SIZE; - - Socket(bool inEnableBuffering = true, bool blocking = true); - - virtual ~Socket(); - - /*! - Opens a network socket for input and/or output - - \param host - Name of the host to connect to. This can be an IP, URL, etc - - \param port - The port to connect to on the remote host - - \param timeout - Timeout in ms until the connection must be established. - - \return - True if the connection was successful, false otherwise - */ - bool connect(const char* host, uint16_t port, uint32_t timeout = 1000); - - /*! - Opens a network socket for input and/or output as a server. Put the connection in listening mode - - \param port - The port on which the socket listens - */ - bool listen(uint16_t port); - - /*! - Accept a connection on a socket that is in listening mode - - \note - This method only supports a single connection client. Additional clients - that connect to the listening port will overwrite the existing socket handle. - - \param block - whether or not the call should block - - \return whether a connection was established - */ - bool accept(bool block); - - /*! - Disconnects an open socket - */ - void disconnect(); - - /*! - Returns whether the socket is currently open (connected) or not. - - \return - True if the socket is connected, false otherwise - */ - bool isConnected() const; - - /*! - Returns the name of the connected host. This is the same as the string - that was supplied to the connect call. - - \return - The name of the connected host - */ - const char* getHost() const; - - /*! - Returns the port of the connected host. This is the same as the port - that was supplied to the connect call. - - \return - The port of the connected host - */ - uint16_t getPort() const; - - /*! - Flushes the output stream. Until the stream is flushed, there is no - guarantee that the written data has actually reached the destination - storage. Flush forces all buffered data to be sent to the output. - - \note flush always blocks. If the socket is in non-blocking mode, this will result - the thread spinning. - - \return - True if the flush was successful, false otherwise - */ - bool flush(); - - /*! - Writes data to the output stream. - - \param data - Pointer to a block of data to write to the stream - - \param length - Amount of data to write, in bytes - - \return - Number of bytes actually written. This could be lower than length if the socket is non-blocking. - */ - - uint32_t write(const uint8_t* data, uint32_t length); - - /*! - Reads data from the output stream. - - \param data - Pointer to a buffer where the read data will be stored. - - \param length - Amount of data to read, in bytes. - - \return - Number of bytes actually read. This could be lower than length if the stream end is - encountered or the socket is non-blocking. - */ - uint32_t read(uint8_t* data, uint32_t length); - - /*! - Sets blocking mode of the socket. - Socket must be connected, otherwise calling this method won't take any effect. - */ - void setBlocking(bool blocking); - - /*! - Returns whether read/write/flush calls to the socket are blocking. - - \return - True if the socket is blocking. - */ - bool isBlocking() const; - - private: - class SocketImpl* mImpl; -}; - -} // namespace shdfnd -} // namespace physx - -#endif // PSFOUNDATION_PSSOCKET_H diff --git a/PxShared/src/foundation/include/PsString.h b/PxShared/src/foundation/include/PsString.h deleted file mode 100644 index 17d25c8..0000000 --- a/PxShared/src/foundation/include/PsString.h +++ /dev/null @@ -1,90 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSSTRING_H -#define PSFOUNDATION_PSSTRING_H - -#include "foundation/PxPreprocessor.h" -#include "foundation/PxSimpleTypes.h" -#include <stdarg.h> - -namespace physx -{ -namespace shdfnd -{ - -// the following functions have C99 semantics. Note that C99 requires for snprintf and vsnprintf: -// * the resulting string is always NULL-terminated regardless of truncation. -// * in the case of truncation the return value is the number of characters that would have been created. - -PX_FOUNDATION_API int32_t sscanf(const char* buffer, const char* format, ...); -PX_FOUNDATION_API int32_t strcmp(const char* str1, const char* str2); -PX_FOUNDATION_API int32_t strncmp(const char* str1, const char* str2, size_t count); -PX_FOUNDATION_API int32_t snprintf(char* dst, size_t dstSize, const char* format, ...); -PX_FOUNDATION_API int32_t vsnprintf(char* dst, size_t dstSize, const char* src, va_list arg); - -// strlcat and strlcpy have BSD semantics: -// * dstSize is always the size of the destination buffer -// * the resulting string is always NULL-terminated regardless of truncation -// * in the case of truncation the return value is the length of the string that would have been created - -PX_FOUNDATION_API size_t strlcat(char* dst, size_t dstSize, const char* src); -PX_FOUNDATION_API size_t strlcpy(char* dst, size_t dstSize, const char* src); - -// case-insensitive string comparison -PX_FOUNDATION_API int32_t stricmp(const char* str1, const char* str2); -PX_FOUNDATION_API int32_t strnicmp(const char* str1, const char* str2, size_t count); - -// in-place string case conversion -PX_FOUNDATION_API void strlwr(char* str); -PX_FOUNDATION_API void strupr(char* str); - -/** -\brief The maximum supported formatted output string length -(number of characters after replacement). - -@see printFormatted() -*/ -static const size_t MAX_PRINTFORMATTED_LENGTH = 1024; - -/** -\brief Prints the formatted data, trying to make sure it's visible to the app programmer - -@see NS_MAX_PRINTFORMATTED_LENGTH -*/ -PX_FOUNDATION_API void printFormatted(const char*, ...); - -/** -\brief Prints the string literally (does not consume % specifier), trying to make sure it's visible to the app -programmer -*/ -PX_FOUNDATION_API void printString(const char*); -} -} -#endif // #ifndef PSFOUNDATION_PSSTRING_H diff --git a/PxShared/src/foundation/include/PsSync.h b/PxShared/src/foundation/include/PsSync.h deleted file mode 100644 index 1fd72f5..0000000 --- a/PxShared/src/foundation/include/PsSync.h +++ /dev/null @@ -1,138 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSSYNC_H -#define PSFOUNDATION_PSSYNC_H - -#include "PsAllocator.h" - -namespace physx -{ -namespace shdfnd -{ -/*! -Implementation notes: -* - Calling set() on an already signaled Sync does not change its state. -* - Calling reset() on an already reset Sync does not change its state. -* - Calling set() on a reset Sync wakes all waiting threads (potential for thread contention). -* - Calling wait() on an already signaled Sync will return true immediately. -* - NOTE: be careful when pulsing an event with set() followed by reset(), because a -* thread that is not waiting on the event will miss the signal. -*/ -class PX_FOUNDATION_API SyncImpl -{ - public: - static const uint32_t waitForever = 0xffffffff; - - SyncImpl(); - - ~SyncImpl(); - - /** Wait on the object for at most the given number of ms. Returns - * true if the object is signaled. Sync::waitForever will block forever - * or until the object is signaled. - */ - - bool wait(uint32_t milliseconds = waitForever); - - /** Signal the synchronization object, waking all threads waiting on it */ - - void set(); - - /** Reset the synchronization object */ - - void reset(); - - /** - Size of this class. - */ - static uint32_t getSize(); -}; - -/*! -Implementation notes: -* - Calling set() on an already signaled Sync does not change its state. -* - Calling reset() on an already reset Sync does not change its state. -* - Calling set() on a reset Sync wakes all waiting threads (potential for thread contention). -* - Calling wait() on an already signaled Sync will return true immediately. -* - NOTE: be careful when pulsing an event with set() followed by reset(), because a -* thread that is not waiting on the event will miss the signal. -*/ -template <typename Alloc = ReflectionAllocator<SyncImpl> > -class SyncT : protected Alloc -{ - public: - static const uint32_t waitForever = SyncImpl::waitForever; - - SyncT(const Alloc& alloc = Alloc()) : Alloc(alloc) - { - mImpl = reinterpret_cast<SyncImpl*>(Alloc::allocate(SyncImpl::getSize(), __FILE__, __LINE__)); - PX_PLACEMENT_NEW(mImpl, SyncImpl)(); - } - - ~SyncT() - { - mImpl->~SyncImpl(); - Alloc::deallocate(mImpl); - } - - /** Wait on the object for at most the given number of ms. Returns - * true if the object is signaled. Sync::waitForever will block forever - * or until the object is signaled. - */ - - bool wait(uint32_t milliseconds = SyncImpl::waitForever) - { - return mImpl->wait(milliseconds); - } - - /** Signal the synchronization object, waking all threads waiting on it */ - - void set() - { - mImpl->set(); - } - - /** Reset the synchronization object */ - - void reset() - { - mImpl->reset(); - } - - private: - class SyncImpl* mImpl; -}; - -typedef SyncT<> Sync; - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSSYNC_H diff --git a/PxShared/src/foundation/include/PsTempAllocator.h b/PxShared/src/foundation/include/PsTempAllocator.h deleted file mode 100644 index 7a063dc..0000000 --- a/PxShared/src/foundation/include/PsTempAllocator.h +++ /dev/null @@ -1,62 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSTEMPALLOCATOR_H -#define PSFOUNDATION_PSTEMPALLOCATOR_H - -#include "PsAllocator.h" - -namespace physx -{ -namespace shdfnd -{ -union TempAllocatorChunk -{ - TempAllocatorChunk() : mNext(0) - { - } - TempAllocatorChunk* mNext; // while chunk is free - uint32_t mIndex; // while chunk is allocated - uint8_t mPad[16]; // 16 byte aligned allocations -}; - -class TempAllocator -{ - public: - PX_FORCE_INLINE TempAllocator(const char* = 0) - { - } - PX_FOUNDATION_API void* allocate(size_t size, const char* file, int line); - PX_FOUNDATION_API void deallocate(void* ptr); -}; - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSTEMPALLOCATOR_H diff --git a/PxShared/src/foundation/include/PsThread.h b/PxShared/src/foundation/include/PsThread.h deleted file mode 100644 index ec9f999..0000000 --- a/PxShared/src/foundation/include/PsThread.h +++ /dev/null @@ -1,382 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSTHREAD_H -#define PSFOUNDATION_PSTHREAD_H - -#include "PsUserAllocated.h" - -// dsequeira: according to existing comment here (David Black would be my guess) -// "This is useful to reduce bus contention on tight spin locks. And it needs -// to be a macro as the xenon compiler often ignores even __forceinline." What's not -// clear is why a pause function needs inlining...? (TODO: check with XBox team) - -// todo: these need to go somewhere else - -#if PX_WINDOWS_FAMILY || PX_XBOXONE -#define PxSpinLockPause() __asm pause -#elif PX_LINUX || PX_ANDROID || PX_PS4 || PX_APPLE_FAMILY || PX_SWITCH -#define PxSpinLockPause() asm("nop") -#else -#error "Platform not supported!" -#endif - -namespace physx -{ -namespace shdfnd -{ -struct ThreadPriority // todo: put in some other header file -{ - enum Enum - { - /** - \brief High priority - */ - eHIGH = 0, - - /** - \brief Above Normal priority - */ - eABOVE_NORMAL = 1, - - /** - \brief Normal/default priority - */ - eNORMAL = 2, - - /** - \brief Below Normal priority - */ - eBELOW_NORMAL = 3, - - /** - \brief Low priority. - */ - eLOW = 4, - eFORCE_DWORD = 0xffFFffFF - }; -}; - -class Runnable -{ - public: - Runnable() - { - } - virtual ~Runnable() - { - } - virtual void execute(void) - { - } -}; - -class PX_FOUNDATION_API ThreadImpl -{ - public: - typedef size_t Id; // space for a pointer or an integer - typedef void* (*ExecuteFn)(void*); - - static uint32_t getDefaultStackSize(); - static Id getId(); - - /** - Construct (but do not start) the thread object. The OS thread object will not be created - until start() is called. Executes in the context - of the spawning thread. - */ - - ThreadImpl(); - - /** - Construct and start the the thread, passing the given arg to the given fn. (pthread style) - */ - - ThreadImpl(ExecuteFn fn, void* arg); - - /** - Deallocate all resources associated with the thread. Should be called in the - context of the spawning thread. - */ - - ~ThreadImpl(); - - /** - Create the OS thread and start it running. Called in the context of the spawning thread. - If an affinity mask has previously been set then it will be applied after the - thread has been created. - */ - - void start(uint32_t stackSize, Runnable* r); - - /** - Violently kill the current thread. Blunt instrument, not recommended since - it can leave all kinds of things unreleased (stack, memory, mutexes...) Should - be called in the context of the spawning thread. - */ - - void kill(); - - /** - Stop the thread. Signals the spawned thread that it should stop, so the - thread should check regularly - */ - - void signalQuit(); - - /** - Wait for a thread to stop. Should be called in the context of the spawning - thread. Returns false if the thread has not been started. - */ - - bool waitForQuit(); - - /** - check whether the thread is signalled to quit. Called in the context of the - spawned thread. - */ - - bool quitIsSignalled(); - - /** - Cleanly shut down this thread. Called in the context of the spawned thread. - */ - void quit(); - - /** - Change the affinity mask for this thread. The mask is a platform - specific value. - - 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. - - On Apple platforms, this function has no effect. - - If the thread has not yet been started then the mask is stored - and applied when the thread is started. - - If the thread has already been started then this method returns the - previous affinity mask on success, otherwise it returns zero. - */ - uint32_t setAffinityMask(uint32_t mask); - - static ThreadPriority::Enum getPriority(Id threadId); - - /** Set thread priority. */ - void setPriority(ThreadPriority::Enum prio); - - /** set the thread's name */ - void setName(const char* name); - - /** Put the current thread to sleep for the given number of milliseconds */ - static void sleep(uint32_t ms); - - /** Yield the current thread's slot on the CPU */ - static void yield(); - - /** Return the number of physical cores (does not include hyper-threaded cores), returns 0 on failure */ - static uint32_t getNbPhysicalCores(); - - /** - Size of this class. - */ - static uint32_t getSize(); -}; - -/** -Thread abstraction API -*/ -template <typename Alloc = ReflectionAllocator<ThreadImpl> > -class ThreadT : protected Alloc, public UserAllocated, public Runnable -{ - public: - typedef ThreadImpl::Id Id; // space for a pointer or an integer - - /** - Construct (but do not start) the thread object. Executes in the context - of the spawning thread - */ - ThreadT(const Alloc& alloc = Alloc()) : Alloc(alloc) - { - mImpl = reinterpret_cast<ThreadImpl*>(Alloc::allocate(ThreadImpl::getSize(), __FILE__, __LINE__)); - PX_PLACEMENT_NEW(mImpl, ThreadImpl)(); - } - - /** - Construct and start the the thread, passing the given arg to the given fn. (pthread style) - */ - ThreadT(ThreadImpl::ExecuteFn fn, void* arg, const Alloc& alloc = Alloc()) : Alloc(alloc) - { - mImpl = reinterpret_cast<ThreadImpl*>(Alloc::allocate(ThreadImpl::getSize(), __FILE__, __LINE__)); - PX_PLACEMENT_NEW(mImpl, ThreadImpl)(fn, arg); - } - - /** - Deallocate all resources associated with the thread. Should be called in the - context of the spawning thread. - */ - virtual ~ThreadT() - { - mImpl->~ThreadImpl(); - Alloc::deallocate(mImpl); - } - - /** - start the thread running. Called in the context of the spawning thread. - */ - - void start(uint32_t stackSize = ThreadImpl::getDefaultStackSize()) - { - mImpl->start(stackSize, this); - } - - /** - Violently kill the current thread. Blunt instrument, not recommended since - it can leave all kinds of things unreleased (stack, memory, mutexes...) Should - be called in the context of the spawning thread. - */ - - void kill() - { - mImpl->kill(); - } - - /** - The virtual execute() method is the user defined function that will - run in the new thread. Called in the context of the spawned thread. - */ - - virtual void execute(void) - { - } - - /** - stop the thread. Signals the spawned thread that it should stop, so the - thread should check regularly - */ - - void signalQuit() - { - mImpl->signalQuit(); - } - - /** - Wait for a thread to stop. Should be called in the context of the spawning - thread. Returns false if the thread has not been started. - */ - - bool waitForQuit() - { - return mImpl->waitForQuit(); - } - - /** - check whether the thread is signalled to quit. Called in the context of the - spawned thread. - */ - - bool quitIsSignalled() - { - return mImpl->quitIsSignalled(); - } - - /** - Cleanly shut down this thread. Called in the context of the spawned thread. - */ - void quit() - { - mImpl->quit(); - } - - uint32_t setAffinityMask(uint32_t mask) - { - return mImpl->setAffinityMask(mask); - } - - static ThreadPriority::Enum getPriority(ThreadImpl::Id threadId) - { - return ThreadImpl::getPriority(threadId); - } - - /** Set thread priority. */ - void setPriority(ThreadPriority::Enum prio) - { - mImpl->setPriority(prio); - } - - /** set the thread's name */ - void setName(const char* name) - { - mImpl->setName(name); - } - - /** Put the current thread to sleep for the given number of milliseconds */ - static void sleep(uint32_t ms) - { - ThreadImpl::sleep(ms); - } - - /** Yield the current thread's slot on the CPU */ - static void yield() - { - ThreadImpl::yield(); - } - - static uint32_t getDefaultStackSize() - { - return ThreadImpl::getDefaultStackSize(); - } - - static ThreadImpl::Id getId() - { - return ThreadImpl::getId(); - } - - static uint32_t getNbPhysicalCores() - { - return ThreadImpl::getNbPhysicalCores(); - } - - private: - class ThreadImpl* mImpl; -}; - -typedef ThreadT<> Thread; - -PX_FOUNDATION_API uint32_t TlsAlloc(); -PX_FOUNDATION_API void TlsFree(uint32_t index); -PX_FOUNDATION_API void* TlsGet(uint32_t index); -PX_FOUNDATION_API uint32_t TlsSet(uint32_t index, void* value); - -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSTHREAD_H diff --git a/PxShared/src/foundation/include/PsTime.h b/PxShared/src/foundation/include/PsTime.h deleted file mode 100644 index b9c7031..0000000 --- a/PxShared/src/foundation/include/PsTime.h +++ /dev/null @@ -1,95 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSTIME_H -#define PSFOUNDATION_PSTIME_H - -#include "Ps.h" - -#if PX_LINUX || PX_ANDROID -#include <time.h> -#endif - -namespace physx -{ -namespace shdfnd -{ - -struct CounterFrequencyToTensOfNanos -{ - uint64_t mNumerator; - uint64_t mDenominator; - CounterFrequencyToTensOfNanos(uint64_t inNum, uint64_t inDenom) : mNumerator(inNum), mDenominator(inDenom) - { - } - - // quite slow. - uint64_t toTensOfNanos(uint64_t inCounter) const - { - return (inCounter * mNumerator) / mDenominator; - } -}; - -class PX_FOUNDATION_API Time -{ - public: - typedef double Second; - static const uint64_t sNumTensOfNanoSecondsInASecond = 100000000; - // This is supposedly guaranteed to not change after system boot - // regardless of processors, speedstep, etc. - static const CounterFrequencyToTensOfNanos& getBootCounterFrequency(); - - static CounterFrequencyToTensOfNanos getCounterFrequency(); - - static uint64_t getCurrentCounterValue(); - - // SLOW!! - // Thar be a 64 bit divide in thar! - static uint64_t getCurrentTimeInTensOfNanoSeconds() - { - uint64_t ticks = getCurrentCounterValue(); - return getBootCounterFrequency().toTensOfNanos(ticks); - } - - Time(); - Second getElapsedSeconds(); - Second peekElapsedSeconds(); - Second getLastTime() const; - - private: -#if PX_LINUX || PX_ANDROID || PX_APPLE_FAMILY || PX_PS4 - Second mLastTime; -#else - int64_t mTickCount; -#endif -}; -} // namespace shdfnd -} // namespace physx - -#endif // #ifndef PSFOUNDATION_PSTIME_H diff --git a/PxShared/src/foundation/include/PsVecMath.h b/PxShared/src/foundation/include/PsVecMath.h deleted file mode 100644 index ffd2de8..0000000 --- a/PxShared/src/foundation/include/PsVecMath.h +++ /dev/null @@ -1,1335 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECMATH_H -#define PSFOUNDATION_PSVECMATH_H - -#include "Ps.h" -#include "PsIntrinsics.h" -#include "foundation/PxVec3.h" -#include "foundation/PxVec4.h" -#include "foundation/PxMat33.h" -#include "foundation/PxUnionCast.h" - -// We can opt to use the scalar version of vectorised functions. -// This can catch type safety issues and might even work out more optimal on pc. -// It will also be useful for benchmarking and testing. -// NEVER submit with vector intrinsics deactivated without good reason. -// AM: deactivating SIMD for debug win64 just so autobuild will also exercise -// non-SIMD path, until a dedicated non-SIMD platform sich as Arm comes online. -// TODO: dima: reference all platforms with SIMD support here, -// all unknown/experimental cases should better default to NO SIMD. - -// enable/disable SIMD -#if !defined(PX_SIMD_DISABLED) -#if PX_INTEL_FAMILY && (!defined(__EMSCRIPTEN__) || defined(__SSE2__)) -#define COMPILE_VECTOR_INTRINSICS 1 -#elif PX_ANDROID&& PX_NEON -#define COMPILE_VECTOR_INTRINSICS 1 -#elif PX_IOS&& PX_NEON -#define COMPILE_VECTOR_INTRINSICS 1 -#elif PX_SWITCH -#define COMPILE_VECTOR_INTRINSICS 1 -#else -#define COMPILE_VECTOR_INTRINSICS 0 -#endif -#else -#define COMPILE_VECTOR_INTRINSICS 0 -#endif - -#if COMPILE_VECTOR_INTRINSICS && PX_INTEL_FAMILY&&(PX_UNIX_FAMILY || PX_PS4) -// only SSE2 compatible platforms should reach this -#if PX_EMSCRIPTEN -#include <emmintrin.h> -#endif -#include <xmmintrin.h> -#endif - -namespace physx -{ -namespace shdfnd -{ -namespace aos -{ - -// Basic AoS types are -// FloatV - 16-byte aligned representation of float. -// Vec3V - 16-byte aligned representation of PxVec3 stored as (x y z 0). -// Vec4V - 16-byte aligned representation of vector of 4 floats stored as (x y z w). -// BoolV - 16-byte aligned representation of vector of 4 bools stored as (x y z w). -// VecU32V - 16-byte aligned representation of 4 unsigned ints stored as (x y z w). -// VecI32V - 16-byte aligned representation of 4 signed ints stored as (x y z w). -// Mat33V - 16-byte aligned representation of any 3x3 matrix. -// Mat34V - 16-byte aligned representation of transformation matrix (rotation in col1,col2,col3 and translation in -// col4). -// Mat44V - 16-byte aligned representation of any 4x4 matrix. - -#if COMPILE_VECTOR_INTRINSICS -#include "PsAoS.h" -#else -#include "PsVecMathAoSScalar.h" -#endif - -////////////////////////////////////////// -// Construct a simd type from a scalar type -////////////////////////////////////////// - -// FloatV -//(f,f,f,f) -PX_FORCE_INLINE FloatV FLoad(const PxF32 f); - -// Vec3V -//(f,f,f,0) -PX_FORCE_INLINE Vec3V V3Load(const PxF32 f); -//(f.x,f.y,f.z,0) -PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f); -//(f.x,f.y,f.z,0), f must be 16-byte aligned -PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f); -//(f.x,f.y,f.z,w_undefined), f must be 16-byte aligned -PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f); -//(f.x,f.y,f.z,0) -PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* f); -//(f.x,f.y,f.z,0), f must be 16-byte aligned -PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* f); - -// Vec4V -//(f,f,f,f) -PX_FORCE_INLINE Vec4V V4Load(const PxF32 f); -//(f[0],f[1],f[2],f[3]) -PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f); -//(f[0],f[1],f[2],f[3]), f must be 16-byte aligned -PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f); -//(x,y,z,w) -PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w); - -// BoolV -//(f,f,f,f) -PX_FORCE_INLINE BoolV BLoad(const bool f); -//(f[0],f[1],f[2],f[3]) -PX_FORCE_INLINE BoolV BLoad(const bool* const f); - -// VecU32V -//(f,f,f,f) -PX_FORCE_INLINE VecU32V U4Load(const PxU32 f); -//(f[0],f[1],f[2],f[3]) -PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* f); -//(f[0],f[1],f[2],f[3]), f must be 16-byte aligned -PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* f); -//((U32)x, (U32)y, (U32)z, (U32)w) -PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w); - -// VecI32V -//(i,i,i,i) -PX_FORCE_INLINE VecI32V I4Load(const PxI32 i); -//(i,i,i,i) -PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i); -//(i,i,i,i) -PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i); - -// QuatV -//(x = v[0], y=v[1], z=v[2], w=v3[3]) and array don't need to aligned -PX_FORCE_INLINE QuatV QuatVLoadU(const PxF32* v); -//(x = v[0], y=v[1], z=v[2], w=v3[3]) and array need to aligned, fast load -PX_FORCE_INLINE QuatV QuatVLoadA(const PxF32* v); -//(x, y, z, w) -PX_FORCE_INLINE QuatV QuatVLoadXYZW(const PxF32 x, const PxF32 y, const PxF32 z, const PxF32 w); - -// not added to public api -Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& v); - -/////////////////////////////////////////////////// -// Construct a simd type from a different simd type -/////////////////////////////////////////////////// - -// Vec3V -//(v.x,v.y,v.z,0) -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v); -//(v.x,v.y,v.z,undefined) - be very careful with w!=0 because many functions require w==0 for correct operation eg V3Dot, V3Length, V3Cross etc etc. -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v); - -// Vec4V -//(f.x,f.y,f.z,f.w) -PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f); -//((PxF32)f.x, (PxF32)f.y, (PxF32)f.z, (PxF32)f.w) -PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a); -//((PxF32)f.x, (PxF32)f.y, (PxF32)f.z, (PxF32)f.w) -PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a); -//(*(reinterpret_cast<PxF32*>(&f.x), (reinterpret_cast<PxF32*>(&f.y), (reinterpret_cast<PxF32*>(&f.z), -//(reinterpret_cast<PxF32*>(&f.w)) -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a); -//(*(reinterpret_cast<PxF32*>(&f.x), (reinterpret_cast<PxF32*>(&f.y), (reinterpret_cast<PxF32*>(&f.z), -//(reinterpret_cast<PxF32*>(&f.w)) -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a); - -// VecU32V -//(*(reinterpret_cast<PxU32*>(&f.x), (reinterpret_cast<PxU32*>(&f.y), (reinterpret_cast<PxU32*>(&f.z), -//(reinterpret_cast<PxU32*>(&f.w)) -PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a); -//(b[0], b[1], b[2], b[3]) -PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg b); - -// VecI32V -//(*(reinterpret_cast<PxI32*>(&f.x), (reinterpret_cast<PxI32*>(&f.y), (reinterpret_cast<PxI32*>(&f.z), -//(reinterpret_cast<PxI32*>(&f.w)) -PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a); -//((I32)a.x, (I32)a.y, (I32)a.z, (I32)a.w) -PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a); -//((I32)b.x, (I32)b.y, (I32)b.z, (I32)b.w) -PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg b); - -/////////////////////////////////////////////////// -// Convert from a simd type back to a scalar type -/////////////////////////////////////////////////// - -// FloatV -// a.x -PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f); - -// Vec3V -//(a.x,a.y,a.z) -PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f); -//(a.x,a.y,a.z) -PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f); - -// Vec4V -PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f); -PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f); - -// BoolV -PX_FORCE_INLINE void BStoreA(const BoolV b, PxU32* f); - -// VecU32V -PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u); - -// VecI32V -PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i); - -////////////////////////////////////////////////////////////////// -// Test that simd types have elements in the floating point range -////////////////////////////////////////////////////////////////// - -// check for each component is valid ie in floating point range -PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a); -// check for each component is valid ie in floating point range -PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a); -// check for each component is valid ie in floating point range -PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a); - -// Check that w-component is zero. -PX_FORCE_INLINE bool isValidVec3V(const Vec3V a); - -////////////////////////////////////////////////////////////////// -// Tests that all elements of two 16-byte types are completely equivalent. -// Use these tests for unit testing and asserts only. -////////////////////////////////////////////////////////////////// - -namespace _VecMathTests -{ -PX_FORCE_INLINE Vec3V getInvalidVec3V(); -PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b); -PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b); -PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b); -PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b); -PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b); -PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b); - -PX_FORCE_INLINE bool allElementsEqualMat33V(const Mat33V& a, const Mat33V& b) -{ - return (allElementsEqualVec3V(a.col0, b.col0) && allElementsEqualVec3V(a.col1, b.col1) && - allElementsEqualVec3V(a.col2, b.col2)); -} -PX_FORCE_INLINE bool allElementsEqualMat34V(const Mat34V& a, const Mat34V& b) -{ - return (allElementsEqualVec3V(a.col0, b.col0) && allElementsEqualVec3V(a.col1, b.col1) && - allElementsEqualVec3V(a.col2, b.col2) && allElementsEqualVec3V(a.col3, b.col3)); -} -PX_FORCE_INLINE bool allElementsEqualMat44V(const Mat44V& a, const Mat44V& b) -{ - return (allElementsEqualVec4V(a.col0, b.col0) && allElementsEqualVec4V(a.col1, b.col1) && - allElementsEqualVec4V(a.col2, b.col2) && allElementsEqualVec4V(a.col3, b.col3)); -} - -PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b); -PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b); -PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b); -PX_FORCE_INLINE bool allElementsNearEqualMat33V(const Mat33V& a, const Mat33V& b) -{ - return (allElementsNearEqualVec3V(a.col0, b.col0) && allElementsNearEqualVec3V(a.col1, b.col1) && - allElementsNearEqualVec3V(a.col2, b.col2)); -} -PX_FORCE_INLINE bool allElementsNearEqualMat34V(const Mat34V& a, const Mat34V& b) -{ - return (allElementsNearEqualVec3V(a.col0, b.col0) && allElementsNearEqualVec3V(a.col1, b.col1) && - allElementsNearEqualVec3V(a.col2, b.col2) && allElementsNearEqualVec3V(a.col3, b.col3)); -} -PX_FORCE_INLINE bool allElementsNearEqualMat44V(const Mat44V& a, const Mat44V& b) -{ - return (allElementsNearEqualVec4V(a.col0, b.col0) && allElementsNearEqualVec4V(a.col1, b.col1) && - allElementsNearEqualVec4V(a.col2, b.col2) && allElementsNearEqualVec4V(a.col3, b.col3)); -} -} - -////////////////////////////////////////////////////////////////// -// Math operations on FloatV -////////////////////////////////////////////////////////////////// - -//(0,0,0,0) -PX_FORCE_INLINE FloatV FZero(); -//(1,1,1,1) -PX_FORCE_INLINE FloatV FOne(); -//(0.5,0.5,0.5,0.5) -PX_FORCE_INLINE FloatV FHalf(); -//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) -PX_FORCE_INLINE FloatV FEps(); -//(PX_MAX_REAL, PX_MAX_REAL, PX_MAX_REAL PX_MAX_REAL) -PX_FORCE_INLINE FloatV FMax(); -//(-PX_MAX_REAL, -PX_MAX_REAL, -PX_MAX_REAL -PX_MAX_REAL) -PX_FORCE_INLINE FloatV FNegMax(); -//(1e-6f, 1e-6f, 1e-6f, 1e-6f) -PX_FORCE_INLINE FloatV FEps6(); -//((PxF32*)&1, (PxF32*)&1, (PxF32*)&1, (PxF32*)&1) - -//-f (per component) -PX_FORCE_INLINE FloatV FNeg(const FloatV f); -// a+b (per component) -PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b); -// a-b (per component) -PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b); -// a*b (per component) -PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b); -// a/b (per component) -PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b); -// a/b (per component) -PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b); -// 1.0f/a -PX_FORCE_INLINE FloatV FRecip(const FloatV a); -// 1.0f/a -PX_FORCE_INLINE FloatV FRecipFast(const FloatV a); -// 1.0f/sqrt(a) -PX_FORCE_INLINE FloatV FRsqrt(const FloatV a); -// 1.0f/sqrt(a) -PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a); -// sqrt(a) -PX_FORCE_INLINE FloatV FSqrt(const FloatV a); -// a*b+c -PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c); -// c-a*b -PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c); -// fabs(a) -PX_FORCE_INLINE FloatV FAbs(const FloatV a); -// c ? a : b (per component) -PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b); -// a>b (per component) -PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b); -// a>=b (per component) -PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b); -// a==b (per component) -PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b); -// Max(a,b) (per component) -PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b); -// Min(a,b) (per component) -PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b); -// Clamp(a,b) (per component) -PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV); - -// a.x>b.x -PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b); -// a.x>=b.x -PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b); -// a.x==b.x -PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b); -// a<min || a>max -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max); -// a>=min && a<=max -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max); -// a<-bounds || a>bounds -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds); -// a>=-bounds && a<=bounds -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds); - -// round float a to the near int -PX_FORCE_INLINE FloatV FRound(const FloatV a); -// calculate the sin of float a -PX_FORCE_INLINE FloatV FSin(const FloatV a); -// calculate the cos of float b -PX_FORCE_INLINE FloatV FCos(const FloatV a); - -////////////////////////////////////////////////////////////////// -// Math operations on Vec3V -////////////////////////////////////////////////////////////////// - -//(f,f,f,f) -PX_FORCE_INLINE Vec3V V3Splat(const FloatV f); - -//(x,y,z) -PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z); - -//(1,0,0,0) -PX_FORCE_INLINE Vec3V V3UnitX(); -//(0,1,0,0) -PX_FORCE_INLINE Vec3V V3UnitY(); -//(0,0,1,0) -PX_FORCE_INLINE Vec3V V3UnitZ(); - -//(f.x,f.x,f.x,f.x) -PX_FORCE_INLINE FloatV V3GetX(const Vec3V f); -//(f.y,f.y,f.y,f.y) -PX_FORCE_INLINE FloatV V3GetY(const Vec3V f); -//(f.z,f.z,f.z,f.z) -PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f); - -//(f,v.y,v.z,v.w) -PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f); -//(v.x,f,v.z,v.w) -PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f); -//(v.x,v.y,f,v.w) -PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f); - -// v.x=f -PX_FORCE_INLINE void V3WriteX(Vec3V& v, const PxF32 f); -// v.y=f -PX_FORCE_INLINE void V3WriteY(Vec3V& v, const PxF32 f); -// v.z=f -PX_FORCE_INLINE void V3WriteZ(Vec3V& v, const PxF32 f); -// v.x=f.x, v.y=f.y, v.z=f.z -PX_FORCE_INLINE void V3WriteXYZ(Vec3V& v, const PxVec3& f); -// return v.x -PX_FORCE_INLINE PxF32 V3ReadX(const Vec3V& v); -// return v.y -PX_FORCE_INLINE PxF32 V3ReadY(const Vec3V& v); -// return v.y -PX_FORCE_INLINE PxF32 V3ReadZ(const Vec3V& v); -// return (v.x,v.y,v.z) -PX_FORCE_INLINE const PxVec3& V3ReadXYZ(const Vec3V& v); - -//(a.x, b.x, c.x) -PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c); -//(a.y, b.y, c.y) -PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c); -//(a.z, b.z, c.z) -PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c); - -//(0,0,0,0) -PX_FORCE_INLINE Vec3V V3Zero(); -//(1,1,1,1) -PX_FORCE_INLINE Vec3V V3One(); -//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) -PX_FORCE_INLINE Vec3V V3Eps(); -//-c (per component) -PX_FORCE_INLINE Vec3V V3Neg(const Vec3V c); -// a+b (per component) -PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b); -// a-b (per component) -PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b); -// a*b (per component) -PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b); -// a*b (per component) -PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b); -// a/b (per component) -PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b); -// a/b (per component) -PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b); -// a/b (per component) -PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b); -// a/b (per component) -PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b); -// 1.0f/a -PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a); -// 1.0f/a -PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a); -// 1.0f/sqrt(a) -PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a); -// 1.0f/sqrt(a) -PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a); -// a*b+c -PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c); -// c-a*b -PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c); -// a*b+c -PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c); -// c-a*b -PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c); -// fabs(a) -PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a); - -// a.b -// Note: a.w and b.w must have value zero -PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b); -// aXb -// Note: a.w and b.w must have value zero -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b); -// |a.a|^1/2 -// Note: a.w must have value zero -PX_FORCE_INLINE FloatV V3Length(const Vec3V a); -// a.a -// Note: a.w must have value zero -PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a); -// a*|a.a|^-1/2 -// Note: a.w must have value zero -PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a); -// a.a>0 ? a*|a.a|^-1/2 : (0,0,0,0) -// Note: a.w must have value zero -PX_FORCE_INLINE FloatV V3Length(const Vec3V a); -// a.a>0 ? a*|a.a|^-1/2 : unsafeReturnValue -// Note: a.w must have value zero -PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue); -// a.x + a.y + a.z -// Note: a.w must have value zero -PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a); - -// c ? a : b (per component) -PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b); -// a>b (per component) -PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b); -// a>=b (per component) -PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b); -// a==b (per component) -PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b); -// Max(a,b) (per component) -PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b); -// Min(a,b) (per component) -PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b); - -// Extract the maximum value from a -// Note: a.w must have value zero -PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a); - -// Extract the minimum value from a -// Note: a.w must have value zero -PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a); - -// Clamp(a,b) (per component) -PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV); - -// Extract the sign for each component -PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a); - -// Test all components. -// (a.x>b.x && a.y>b.y && a.z>b.z) -// Note: a.w and b.w must have value zero -PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b); -// (a.x>=b.x && a.y>=b.y && a.z>=b.z) -// Note: a.w and b.w must have value zero -PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b); -// (a.x==b.x && a.y==b.y && a.z==b.z) -// Note: a.w and b.w must have value zero -PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b); -// a.x<min.x || a.y<min.y || a.z<min.z || a.x>max.x || a.y>max.y || a.z>max.z -// Note: a.w and min.w and max.w must have value zero -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max); -// a.x>=min.x && a.y>=min.y && a.z>=min.z && a.x<=max.x && a.y<=max.y && a.z<=max.z -// Note: a.w and min.w and max.w must have value zero -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max); -// a.x<-bounds.x || a.y<=-bounds.y || a.z<bounds.z || a.x>bounds.x || a.y>bounds.y || a.z>bounds.z -// Note: a.w and bounds.w must have value zero -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds); -// a.x>=-bounds.x && a.y>=-bounds.y && a.z>=-bounds.z && a.x<=bounds.x && a.y<=bounds.y && a.z<=bounds.z -// Note: a.w and bounds.w must have value zero -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds); - -//(floor(a.x + 0.5f), floor(a.y + 0.5f), floor(a.z + 0.5f)) -PX_FORCE_INLINE Vec3V V3Round(const Vec3V a); - -//(sinf(a.x), sinf(a.y), sinf(a.z)) -PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a); -//(cosf(a.x), cosf(a.y), cosf(a.z)) -PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a); - -//(a.y,a.z,a.z) -PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a); -//(a.x,a.y,a.x) -PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a); -//(a.y,a.z,a.x) -PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a); -//(a.z, a.x, a.y) -PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a); -//(a.z,a.z,a.y) -PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a); -//(a.y,a.x,a.x) -PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a); -//(0, v1.z, v0.y) -PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1); -//(v0.z, 0, v1.x) -PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1); -//(v1.y, v0.x, 0) -PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1); - -// Transpose 3 Vec3Vs inplace. Sets the w component to zero -// [ x0, y0, z0, w0] [ x1, y1, z1, w1] [ x2, y2, z2, w2] -> [x0 x1 x2 0] [y0 y1 y2 0] [z0 z1 z2 0] -PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2); - -////////////////////////////////////////////////////////////////// -// Math operations on Vec4V -////////////////////////////////////////////////////////////////// - -//(f,f,f,f) -PX_FORCE_INLINE Vec4V V4Splat(const FloatV f); - -//(f[0],f[1],f[2],f[3]) -PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const f); -//(x,y,z,w) -PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w); -//(x.w, y.w, z.w, w.w) -PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); -//(x.z, y.z, z.z, w.z) -PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); -//(x.y, y.y, z.y, w.y) -PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); -//(x.x, y.x, z.x, w.x) -PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w); - -//(a.x, b.x, a.y, b.y) -PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b); -//(a.z, b.z, a.w, b.w) -PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b); - -//(1,0,0,0) -PX_FORCE_INLINE Vec4V V4UnitW(); -//(0,1,0,0) -PX_FORCE_INLINE Vec4V V4UnitY(); -//(0,0,1,0) -PX_FORCE_INLINE Vec4V V4UnitZ(); -//(0,0,0,1) -PX_FORCE_INLINE Vec4V V4UnitW(); - -//(f.x,f.x,f.x,f.x) -PX_FORCE_INLINE FloatV V4GetX(const Vec4V f); -//(f.y,f.y,f.y,f.y) -PX_FORCE_INLINE FloatV V4GetY(const Vec4V f); -//(f.z,f.z,f.z,f.z) -PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f); -//(f.w,f.w,f.w,f.w) -PX_FORCE_INLINE FloatV V4GetW(const Vec4V f); - -//(f,v.y,v.z,v.w) -PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f); -//(v.x,f,v.z,v.w) -PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f); -//(v.x,v.y,f,v.w) -PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f); -//(v.x,v.y,v.z,f) -PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f); - -//(v.x,v.y,v.z,0) -PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v); - -//(a[elementIndex], a[elementIndex], a[elementIndex], a[elementIndex]) -template <int elementIndex> -PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a); - -// v.x=f -PX_FORCE_INLINE void V4WriteX(Vec4V& v, const PxF32 f); -// v.y=f -PX_FORCE_INLINE void V4WriteY(Vec4V& v, const PxF32 f); -// v.z=f -PX_FORCE_INLINE void V4WriteZ(Vec4V& v, const PxF32 f); -// v.w=f -PX_FORCE_INLINE void V4WriteW(Vec4V& v, const PxF32 f); -// v.x=f.x, v.y=f.y, v.z=f.z -PX_FORCE_INLINE void V4WriteXYZ(Vec4V& v, const PxVec3& f); -// return v.x -PX_FORCE_INLINE PxF32 V4ReadX(const Vec4V& v); -// return v.y -PX_FORCE_INLINE PxF32 V4ReadY(const Vec4V& v); -// return v.z -PX_FORCE_INLINE PxF32 V4ReadZ(const Vec4V& v); -// return v.w -PX_FORCE_INLINE PxF32 V4ReadW(const Vec4V& v); -// return (v.x,v.y,v.z) -PX_FORCE_INLINE const PxVec3& V4ReadXYZ(const Vec4V& v); - -//(0,0,0,0) -PX_FORCE_INLINE Vec4V V4Zero(); -//(1,1,1,1) -PX_FORCE_INLINE Vec4V V4One(); -//(PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL,PX_EPS_REAL) -PX_FORCE_INLINE Vec4V V4Eps(); - -//-c (per component) -PX_FORCE_INLINE Vec4V V4Neg(const Vec4V c); -// a+b (per component) -PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b); -// a-b (per component) -PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b); -// a*b (per component) -PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b); -// a*b (per component) -PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b); -// a/b (per component) -PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b); -// a/b (per component) -PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b); -// a/b (per component) -PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b); -// a/b (per component) -PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b); -// 1.0f/a -PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a); -// 1.0f/a -PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a); -// 1.0f/sqrt(a) -PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a); -// 1.0f/sqrt(a) -PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a); -// a*b+c -PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c); -// c-a*b -PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c); -// a*b+c -PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c); -// c-a*b -PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c); - -// fabs(a) -PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a); -// bitwise a & ~b -PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b); - -// a.b (W is taken into account) -PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b); -// a.b (same computation as V3Dot. W is ignored in input) -PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b); -// aXb (same computation as V3Cross. W is ignored in input and undefined in output) -PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b); - -//|a.a|^1/2 -PX_FORCE_INLINE FloatV V4Length(const Vec4V a); -// a.a -PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a); - -// a*|a.a|^-1/2 -PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a); -// a.a>0 ? a*|a.a|^-1/2 : unsafeReturnValue -PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue); -// a*|a.a|^-1/2 -PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a); - -// c ? a : b (per component) -PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b); -// a>b (per component) -PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b); -// a>=b (per component) -PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b); -// a==b (per component) -PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b); -// Max(a,b) (per component) -PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b); -// Min(a,b) (per component) -PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b); -// Get the maximum component from a -PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a); -// Get the minimum component from a -PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a); - -// Clamp(a,b) (per component) -PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV); - -// return 1 if all components of a are greater than all components of b. -PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b); -// return 1 if all components of a are greater than or equal to all components of b -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b); -// return 1 if XYZ components of a are greater than or equal to XYZ components of b. W is ignored. -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b); -// return 1 if all components of a are equal to all components of b -PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b); -// return 1 if any XYZ component of a is greater than the corresponding component of b. W is ignored. -PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b); - -// round(a)(per component) -PX_FORCE_INLINE Vec4V V4Round(const Vec4V a); -// sin(a) (per component) -PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a); -// cos(a) (per component) -PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a); - -// Permute v into a new vec4v with YXWZ format -PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V v); -// Permute v into a new vec4v with XZXZ format -PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V v); -// Permute v into a new vec4v with YWYW format -PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V v); -// Permute v into a new vec4v with YZXW format -PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V v); - -// Permute v into a new vec4v with format {a[x], a[y], a[z], a[w]} -// V4Perm<1,3,1,3> is equal to V4PermYWYW -// V4Perm<0,2,0,2> is equal to V4PermXZXZ -// V3Perm<1,0,3,2> is equal to V4PermYXWZ -template <PxU8 x, PxU8 y, PxU8 z, PxU8 w> -PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a); - -// Transpose 4 Vec4Vs inplace. -// [ x0, y0, z0, w0] [ x1, y1, z1, w1] [ x2, y2, z2, w2] [ x3, y3, z3, w3] -> -// [ x0, x1, x2, x3] [ y0, y1, y2, y3] [ z0, z1, z2, z3] [ w0, w1, w2, w3] -PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2); - -// q = cos(a/2) + u*sin(a/2) -PX_FORCE_INLINE QuatV QuatV_From_RotationAxisAngle(const Vec3V u, const FloatV a); -// convert q to a unit quaternion -PX_FORCE_INLINE QuatV QuatNormalize(const QuatV q); -//|q.q|^1/2 -PX_FORCE_INLINE FloatV QuatLength(const QuatV q); -// q.q -PX_FORCE_INLINE FloatV QuatLengthSq(const QuatV q); -// a.b -PX_FORCE_INLINE FloatV QuatDot(const QuatV a, const QuatV b); -//(-q.x, -q.y, -q.z, q.w) -PX_FORCE_INLINE QuatV QuatConjugate(const QuatV q); -//(q.x, q.y, q.z) -PX_FORCE_INLINE Vec3V QuatGetImaginaryPart(const QuatV q); -// convert quaternion to matrix 33 -PX_FORCE_INLINE Mat33V QuatGetMat33V(const QuatVArg q); -// convert quaternion to matrix 33 -PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2); -// convert matrix 33 to quaternion -PX_FORCE_INLINE QuatV Mat33GetQuatV(const Mat33V& a); -// brief computes rotation of x-axis -PX_FORCE_INLINE Vec3V QuatGetBasisVector0(const QuatV q); -// brief computes rotation of y-axis -PX_FORCE_INLINE Vec3V QuatGetBasisVector1(const QuatV q); -// brief computes rotation of z-axis -PX_FORCE_INLINE Vec3V QuatGetBasisVector2(const QuatV q); -// calculate the rotation vector from q and v -PX_FORCE_INLINE Vec3V QuatRotate(const QuatV q, const Vec3V v); -// calculate the rotation vector from the conjugate quaternion and v -PX_FORCE_INLINE Vec3V QuatRotateInv(const QuatV q, const Vec3V v); -// quaternion multiplication -PX_FORCE_INLINE QuatV QuatMul(const QuatV a, const QuatV b); -// quaternion add -PX_FORCE_INLINE QuatV QuatAdd(const QuatV a, const QuatV b); -// (-q.x, -q.y, -q.z, -q.w) -PX_FORCE_INLINE QuatV QuatNeg(const QuatV q); -// (a.x - b.x, a.y-b.y, a.z-b.z, a.w-b.w ) -PX_FORCE_INLINE QuatV QuatSub(const QuatV a, const QuatV b); -// (a.x*b, a.y*b, a.z*b, a.w*b) -PX_FORCE_INLINE QuatV QuatScale(const QuatV a, const FloatV b); -// (x = v[0], y = v[1], z = v[2], w =v[3]) -PX_FORCE_INLINE QuatV QuatMerge(const FloatV* const v); -// (x = v[0], y = v[1], z = v[2], w =v[3]) -PX_FORCE_INLINE QuatV QuatMerge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w); -// (x = 0.f, y = 0.f, z = 0.f, w = 1.f) -PX_FORCE_INLINE QuatV QuatIdentity(); -// check for each component is valid -PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q); -// check for each component is valid -PX_FORCE_INLINE bool isValidQuatV(const QuatV q); -// check for each component is valid -PX_FORCE_INLINE bool isSaneQuatV(const QuatV q); - -// Math operations on 16-byte aligned booleans. -// x=false y=false z=false w=false -PX_FORCE_INLINE BoolV BFFFF(); -// x=false y=false z=false w=true -PX_FORCE_INLINE BoolV BFFFT(); -// x=false y=false z=true w=false -PX_FORCE_INLINE BoolV BFFTF(); -// x=false y=false z=true w=true -PX_FORCE_INLINE BoolV BFFTT(); -// x=false y=true z=false w=false -PX_FORCE_INLINE BoolV BFTFF(); -// x=false y=true z=false w=true -PX_FORCE_INLINE BoolV BFTFT(); -// x=false y=true z=true w=false -PX_FORCE_INLINE BoolV BFTTF(); -// x=false y=true z=true w=true -PX_FORCE_INLINE BoolV BFTTT(); -// x=true y=false z=false w=false -PX_FORCE_INLINE BoolV BTFFF(); -// x=true y=false z=false w=true -PX_FORCE_INLINE BoolV BTFFT(); -// x=true y=false z=true w=false -PX_FORCE_INLINE BoolV BTFTF(); -// x=true y=false z=true w=true -PX_FORCE_INLINE BoolV BTFTT(); -// x=true y=true z=false w=false -PX_FORCE_INLINE BoolV BTTFF(); -// x=true y=true z=false w=true -PX_FORCE_INLINE BoolV BTTFT(); -// x=true y=true z=true w=false -PX_FORCE_INLINE BoolV BTTTF(); -// x=true y=true z=true w=true -PX_FORCE_INLINE BoolV BTTTT(); - -// x=false y=false z=false w=true -PX_FORCE_INLINE BoolV BWMask(); -// x=true y=false z=false w=false -PX_FORCE_INLINE BoolV BXMask(); -// x=false y=true z=false w=false -PX_FORCE_INLINE BoolV BYMask(); -// x=false y=false z=true w=false -PX_FORCE_INLINE BoolV BZMask(); - -// get x component -PX_FORCE_INLINE BoolV BGetX(const BoolV f); -// get y component -PX_FORCE_INLINE BoolV BGetY(const BoolV f); -// get z component -PX_FORCE_INLINE BoolV BGetZ(const BoolV f); -// get w component -PX_FORCE_INLINE BoolV BGetW(const BoolV f); - -// Use elementIndex to splat xxxx or yyyy or zzzz or wwww -template <int elementIndex> -PX_FORCE_INLINE BoolV BSplatElement(Vec4V a); - -// component-wise && (AND) -PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b); -// component-wise || (OR) -PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b); -// component-wise not -PX_FORCE_INLINE BoolV BNot(const BoolV a); - -// if all four components are true, return true, otherwise return false -PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a); - -// if any four components is true, return true, otherwise return false -PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a); - -// if all three(0, 1, 2) components are true, return true, otherwise return false -PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a); - -// if any three (0, 1, 2) components is true, return true, otherwise return false -PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a); - -// Return 1 if all components equal, zero otherwise. -PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b); - -// Specialized/faster BAllEq function for b==TTTT -PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a); -// Specialized/faster BAllEq function for b==FFFF -PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a); - -/// Get BoolV as bits set in an PxU32. A bit in the output is set if the element is 'true' in the input. -/// There is a bit for each element in a, with element 0s value held in bit0, element 1 in bit 1s and so forth. -/// If nothing is true in the input it will return 0, and if all are true if will return 0xf. -/// NOTE! That performance of the function varies considerably by platform, thus it is recommended to use -/// where your algorithm really needs a BoolV in an integer variable. -PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a); - -// VecI32V stuff - -PX_FORCE_INLINE VecI32V VecI32V_Zero(); - -PX_FORCE_INLINE VecI32V VecI32V_One(); - -PX_FORCE_INLINE VecI32V VecI32V_Two(); - -PX_FORCE_INLINE VecI32V VecI32V_MinusOne(); - -// Compute a shift parameter for VecI32V_LeftShift and VecI32V_RightShift -// Each element of shift must be identical ie the vector must have form {count, count, count, count} with count>=0 -PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift); - -// Shift each element of a leftwards by the same amount -// Compute shift with VecI32V_PrepareShift -//{a.x<<shift[0], a.y<<shift[0], a.z<<shift[0], a.w<<shift[0]} -PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg shift); - -// Shift each element of a rightwards by the same amount -// Compute shift with VecI32V_PrepareShift -//{a.x>>shift[0], a.y>>shift[0], a.z>>shift[0], a.w>>shift[0]} -PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg shift); - -PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b); - -PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b); - -PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a); - -PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a); - -PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a); - -PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a); - -PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b); - -PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b); - -PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b); - -PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b); - -// VecU32V stuff - -PX_FORCE_INLINE VecU32V U4Zero(); - -PX_FORCE_INLINE VecU32V U4One(); - -PX_FORCE_INLINE VecU32V U4Two(); - -PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b); - -PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b); - -PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b); - -PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b); - -PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b); - -PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b); - -// VecU32 - why does this not return a bool? -PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b); - -// Math operations on 16-byte aligned Mat33s (represents any 3x3 matrix) -// a*b -PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b); -// A*x + b -PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c); -// transpose(a) * b -PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b); -// a*b -PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b); -// a+b -PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b); -// a+b -PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b); -//-a -PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a); -// absolute value of the matrix -PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a); -// inverse mat -PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a); -// transpose(a) -PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a); -// create an identity matrix -PX_FORCE_INLINE Mat33V M33Identity(); - -// create a vec3 to store the diagonal element of the M33 -PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg); - -// Not implemented -// return 1 if all components of a are equal to all components of b -// PX_FORCE_INLINE PxU32 V4U32AllEq(const VecU32V a, const VecU32V b); -// v.w=f -// PX_FORCE_INLINE void V3WriteW(Vec3V& v, const PxF32 f); -// PX_FORCE_INLINE PxF32 V3ReadW(const Vec3V& v); - -// Not used -// PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr); -// PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr); -// floor(a)(per component) -// PX_FORCE_INLINE Vec4V V4Floor(Vec4V a); -// ceil(a) (per component) -// PX_FORCE_INLINE Vec4V V4Ceil(Vec4V a); -// PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V a, PxU32 power); - -// Math operations on 16-byte aligned Mat34s (represents transformation matrix - rotation and translation). -// namespace _Mat34V -//{ -// //a*b -// PX_FORCE_INLINE Vec3V multiplyV(const Mat34V& a, const Vec3V b); -// //a_rotation * b -// PX_FORCE_INLINE Vec3V multiply3X3V(const Mat34V& a, const Vec3V b); -// //transpose(a_rotation)*b -// PX_FORCE_INLINE Vec3V multiplyTranspose3X3V(const Mat34V& a, const Vec3V b); -// //a*b -// PX_FORCE_INLINE Mat34V multiplyV(const Mat34V& a, const Mat34V& b); -// //a_rotation*b -// PX_FORCE_INLINE Mat33V multiply3X3V(const Mat34V& a, const Mat33V& b); -// //a_rotation*b_rotation -// PX_FORCE_INLINE Mat33V multiply3X3V(const Mat34V& a, const Mat34V& b); -// //a+b -// PX_FORCE_INLINE Mat34V addV(const Mat34V& a, const Mat34V& b); -// //a^-1 -// PX_FORCE_INLINE Mat34V getInverseV(const Mat34V& a); -// //transpose(a_rotation) -// PX_FORCE_INLINE Mat33V getTranspose3X3(const Mat34V& a); -//}; //namespace _Mat34V - -// a*b -//#define M34MulV3(a,b) (M34MulV3(a,b)) -////a_rotation * b -//#define M34Mul33V3(a,b) (M34Mul33V3(a,b)) -////transpose(a_rotation)*b -//#define M34TrnspsMul33V3(a,b) (M34TrnspsMul33V3(a,b)) -////a*b -//#define M34MulM34(a,b) (_Mat34V::multiplyV(a,b)) -// a_rotation*b -//#define M34MulM33(a,b) (M34MulM33(a,b)) -// a_rotation*b_rotation -//#define M34Mul33MM34(a,b) (M34MulM33(a,b)) -// a+b -//#define M34Add(a,b) (M34Add(a,b)) -////a^-1 -//#define M34Inverse(a,b) (M34Inverse(a)) -// transpose(a_rotation) -//#define M34Trnsps33(a) (M33Trnsps3X3(a)) - -// Math operations on 16-byte aligned Mat44s (represents any 4x4 matrix) -// namespace _Mat44V -//{ -// //a*b -// PX_FORCE_INLINE Vec4V multiplyV(const Mat44V& a, const Vec4V b); -// //transpose(a)*b -// PX_FORCE_INLINE Vec4V multiplyTransposeV(const Mat44V& a, const Vec4V b); -// //a*b -// PX_FORCE_INLINE Mat44V multiplyV(const Mat44V& a, const Mat44V& b); -// //a+b -// PX_FORCE_INLINE Mat44V addV(const Mat44V& a, const Mat44V& b); -// //a&-1 -// PX_FORCE_INLINE Mat44V getInverseV(const Mat44V& a); -// //transpose(a) -// PX_FORCE_INLINE Mat44V getTransposeV(const Mat44V& a); -//}; //namespace _Mat44V - -// namespace _VecU32V -//{ -// // pack 8 U32s to 8 U16s with saturation -// PX_FORCE_INLINE VecU16V pack2U32VToU16VSaturate(VecU32V a, VecU32V b); -// PX_FORCE_INLINE VecU32V orV(VecU32V a, VecU32V b); -// PX_FORCE_INLINE VecU32V andV(VecU32V a, VecU32V b); -// PX_FORCE_INLINE VecU32V andcV(VecU32V a, VecU32V b); -// // conversion from integer to float -// PX_FORCE_INLINE Vec4V convertToVec4V(VecU32V a); -// // splat a[elementIndex] into all fields of a -// template<int elementIndex> -// PX_FORCE_INLINE VecU32V splatElement(VecU32V a); -// PX_FORCE_INLINE void storeAligned(VecU32V a, VecU32V* address); -//}; - -// namespace _VecI32V -//{ -// template<int a> PX_FORCE_INLINE VecI32V splatI32(); -//}; -// -// namespace _VecU16V -//{ -// PX_FORCE_INLINE VecU16V orV(VecU16V a, VecU16V b); -// PX_FORCE_INLINE VecU16V andV(VecU16V a, VecU16V b); -// PX_FORCE_INLINE VecU16V andcV(VecU16V a, VecU16V b); -// PX_FORCE_INLINE void storeAligned(VecU16V val, VecU16V *address); -// PX_FORCE_INLINE VecU16V loadAligned(VecU16V* addr); -// PX_FORCE_INLINE VecU16V loadUnaligned(VecU16V* addr); -// PX_FORCE_INLINE VecU16V compareGt(VecU16V a, VecU16V b); -// template<int elementIndex> -// PX_FORCE_INLINE VecU16V splatElement(VecU16V a); -// PX_FORCE_INLINE VecU16V subtractModulo(VecU16V a, VecU16V b); -// PX_FORCE_INLINE VecU16V addModulo(VecU16V a, VecU16V b); -// PX_FORCE_INLINE VecU32V getLo16(VecU16V a); // [0,2,4,6] 16-bit values to [0,1,2,3] 32-bit vector -// PX_FORCE_INLINE VecU32V getHi16(VecU16V a); // [1,3,5,7] 16-bit values to [0,1,2,3] 32-bit vector -//}; -// -// namespace _VecI16V -//{ -// template <int val> PX_FORCE_INLINE VecI16V splatImmediate(); -//}; -// -// namespace _VecU8V -//{ -//}; - -// a*b -//#define M44MulV4(a,b) (M44MulV4(a,b)) -////transpose(a)*b -//#define M44TrnspsMulV4(a,b) (M44TrnspsMulV4(a,b)) -////a*b -//#define M44MulM44(a,b) (M44MulM44(a,b)) -////a+b -//#define M44Add(a,b) (M44Add(a,b)) -////a&-1 -//#define M44Inverse(a) (M44Inverse(a)) -////transpose(a) -//#define M44Trnsps(a) (M44Trnsps(a)) - -// dsequeira: these used to be assert'd out in SIMD builds, but they're necessary if -// we want to be able to write some scalar functions which run using SIMD data structures - -PX_FORCE_INLINE void V3WriteX(Vec3V& v, const PxF32 f) -{ - reinterpret_cast<PxVec3&>(v).x = f; -} - -PX_FORCE_INLINE void V3WriteY(Vec3V& v, const PxF32 f) -{ - reinterpret_cast<PxVec3&>(v).y = f; -} - -PX_FORCE_INLINE void V3WriteZ(Vec3V& v, const PxF32 f) -{ - reinterpret_cast<PxVec3&>(v).z = f; -} - -PX_FORCE_INLINE void V3WriteXYZ(Vec3V& v, const PxVec3& f) -{ - reinterpret_cast<PxVec3&>(v) = f; -} - -PX_FORCE_INLINE PxF32 V3ReadX(const Vec3V& v) -{ - return reinterpret_cast<const PxVec3&>(v).x; -} - -PX_FORCE_INLINE PxF32 V3ReadY(const Vec3V& v) -{ - return reinterpret_cast<const PxVec3&>(v).y; -} - -PX_FORCE_INLINE PxF32 V3ReadZ(const Vec3V& v) -{ - return reinterpret_cast<const PxVec3&>(v).z; -} - -PX_FORCE_INLINE const PxVec3& V3ReadXYZ(const Vec3V& v) -{ - return reinterpret_cast<const PxVec3&>(v); -} - -PX_FORCE_INLINE void V4WriteX(Vec4V& v, const PxF32 f) -{ - reinterpret_cast<PxVec4&>(v).x = f; -} - -PX_FORCE_INLINE void V4WriteY(Vec4V& v, const PxF32 f) -{ - reinterpret_cast<PxVec4&>(v).y = f; -} - -PX_FORCE_INLINE void V4WriteZ(Vec4V& v, const PxF32 f) -{ - reinterpret_cast<PxVec4&>(v).z = f; -} - -PX_FORCE_INLINE void V4WriteW(Vec4V& v, const PxF32 f) -{ - reinterpret_cast<PxVec4&>(v).w = f; -} - -PX_FORCE_INLINE void V4WriteXYZ(Vec4V& v, const PxVec3& f) -{ - reinterpret_cast<PxVec3&>(v) = f; -} - -PX_FORCE_INLINE PxF32 V4ReadX(const Vec4V& v) -{ - return reinterpret_cast<const PxVec4&>(v).x; -} - -PX_FORCE_INLINE PxF32 V4ReadY(const Vec4V& v) -{ - return reinterpret_cast<const PxVec4&>(v).y; -} - -PX_FORCE_INLINE PxF32 V4ReadZ(const Vec4V& v) -{ - return reinterpret_cast<const PxVec4&>(v).z; -} - -PX_FORCE_INLINE PxF32 V4ReadW(const Vec4V& v) -{ - return reinterpret_cast<const PxVec4&>(v).w; -} - -PX_FORCE_INLINE const PxVec3& V4ReadXYZ(const Vec4V& v) -{ - return reinterpret_cast<const PxVec3&>(v); -} - -// this macro transposes 4 Vec4V into 3 Vec4V (assuming that the W component can be ignored -#define PX_TRANSPOSE_44_34(inA, inB, inC, inD, outA, outB, outC) \ - \ -outA = V4UnpackXY(inA, inC); \ - \ -inA = V4UnpackZW(inA, inC); \ - \ -inC = V4UnpackXY(inB, inD); \ - \ -inB = V4UnpackZW(inB, inD); \ - \ -outB = V4UnpackZW(outA, inC); \ - \ -outA = V4UnpackXY(outA, inC); \ - \ -outC = V4UnpackXY(inA, inB); - -// this macro transposes 3 Vec4V into 4 Vec4V (with W components as garbage!) -#define PX_TRANSPOSE_34_44(inA, inB, inC, outA, outB, outC, outD) \ - outA = V4UnpackXY(inA, inC); \ - inA = V4UnpackZW(inA, inC); \ - outC = V4UnpackXY(inB, inB); \ - inC = V4UnpackZW(inB, inB); \ - outB = V4UnpackZW(outA, outC); \ - outA = V4UnpackXY(outA, outC); \ - outC = V4UnpackXY(inA, inC); \ - outD = V4UnpackZW(inA, inC); - -#define PX_TRANSPOSE_44(inA, inB, inC, inD, outA, outB, outC, outD) \ - outA = V4UnpackXY(inA, inC); \ - inA = V4UnpackZW(inA, inC); \ - inC = V4UnpackXY(inB, inD); \ - inB = V4UnpackZW(inB, inD); \ - outB = V4UnpackZW(outA, inC); \ - outA = V4UnpackXY(outA, inC); \ - outC = V4UnpackXY(inA, inB); \ - outD = V4UnpackZW(inA, inB); - -// This function returns a Vec4V, where each element is the dot product of one pair of Vec3Vs. On PC, each element in -// the result should be identical to the results if V3Dot was performed -// for each pair of Vec3V. -// However, on other platforms, the result might diverge by some small margin due to differences in FP rounding, e.g. if -// _mm_dp_ps was used or some other approximate dot product or fused madd operations -// were used. -// Where there does not exist a hw-accelerated dot-product operation, this approach should be the fastest way to compute -// the dot product of 4 vectors. -PX_FORCE_INLINE Vec4V V3Dot4(const Vec3VArg a0, const Vec3VArg b0, const Vec3VArg a1, const Vec3VArg b1, - const Vec3VArg a2, const Vec3VArg b2, const Vec3VArg a3, const Vec3VArg b3) -{ - Vec4V a0b0 = Vec4V_From_Vec3V(V3Mul(a0, b0)); - Vec4V a1b1 = Vec4V_From_Vec3V(V3Mul(a1, b1)); - Vec4V a2b2 = Vec4V_From_Vec3V(V3Mul(a2, b2)); - Vec4V a3b3 = Vec4V_From_Vec3V(V3Mul(a3, b3)); - - Vec4V aTrnsps, bTrnsps, cTrnsps; - - PX_TRANSPOSE_44_34(a0b0, a1b1, a2b2, a3b3, aTrnsps, bTrnsps, cTrnsps); - - return V4Add(V4Add(aTrnsps, bTrnsps), cTrnsps); -} - -//(f.x,f.y,f.z,0) - Alternative/faster V3LoadU implementation when it is safe to read "W", i.e. the 32bits after the PxVec3. -PX_FORCE_INLINE Vec3V V3LoadU_SafeReadW(const PxVec3& f) -{ - return Vec3V_From_Vec4V(V4LoadU(&f.x)); -} - -// Now for the cross-platform implementations of the 16-byte aligned maths functions (win32/360/ppu/spu etc). -#if COMPILE_VECTOR_INTRINSICS -#include "PsInlineAoS.h" -#else // #if COMPILE_VECTOR_INTRINSICS -#include "PsVecMathAoSScalarInline.h" -#endif // #if !COMPILE_VECTOR_INTRINSICS -#include "PsVecQuat.h" - -} // namespace aos -} // namespace shdfnd -} // namespace physx - -#endif // PSFOUNDATION_PSVECMATH_H diff --git a/PxShared/src/foundation/include/PsVecMathAoSScalar.h b/PxShared/src/foundation/include/PsVecMathAoSScalar.h deleted file mode 100644 index b7fe8e4..0000000 --- a/PxShared/src/foundation/include/PsVecMathAoSScalar.h +++ /dev/null @@ -1,239 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECMATHAOSSCALAR_H -#define PSFOUNDATION_PSVECMATHAOSSCALAR_H - -#if COMPILE_VECTOR_INTRINSICS -#error Scalar version should not be included when using vector intrinsics. -#endif - -struct VecI16V; -struct VecU16V; -struct VecI32V; -struct VecU32V; -struct Vec4V; -typedef Vec4V QuatV; - -PX_ALIGN_PREFIX(16) -struct FloatV -{ - PxF32 x; - PxF32 pad[3]; - FloatV() - { - } - FloatV(const PxF32 _x) : x(_x) - { - } -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Vec4V -{ - PxF32 x, y, z, w; - Vec4V() - { - } - Vec4V(const PxF32 _x, const PxF32 _y, const PxF32 _z, const PxF32 _w) : x(_x), y(_y), z(_z), w(_w) - { - } -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Vec3V -{ - PxF32 x, y, z; - PxF32 pad; - Vec3V() - { - } - Vec3V(const PxF32 _x, const PxF32 _y, const PxF32 _z) : x(_x), y(_y), z(_z), pad(0.0f) - { - } -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct BoolV -{ - PxU32 ux, uy, uz, uw; - BoolV() - { - } - BoolV(const PxU32 _x, const PxU32 _y, const PxU32 _z, const PxU32 _w) : ux(_x), uy(_y), uz(_z), uw(_w) - { - } -} PX_ALIGN_SUFFIX(16); - -struct Mat33V -{ - Mat33V() - { - } - Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec3V col0; - Vec3V col1; - Vec3V col2; -}; - -struct Mat34V -{ - Mat34V() - { - } - Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec3V col0; - Vec3V col1; - Vec3V col2; - Vec3V col3; -}; - -struct Mat43V -{ - Mat43V() - { - } - Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec4V col0; - Vec4V col1; - Vec4V col2; -}; - -struct Mat44V -{ - Mat44V() - { - } - Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec4V col0; - Vec4V col1; - Vec4V col2; - Vec4V col3; -}; - -PX_ALIGN_PREFIX(16) -struct VecU32V -{ - PxU32 u32[4]; - PX_FORCE_INLINE VecU32V() - { - } - PX_FORCE_INLINE VecU32V(PxU32 a, PxU32 b, PxU32 c, PxU32 d) - { - u32[0] = a; - u32[1] = b; - u32[2] = c; - u32[3] = d; - } -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct VecI32V -{ - PxI32 i32[4]; - PX_FORCE_INLINE VecI32V() - { - } - PX_FORCE_INLINE VecI32V(PxI32 a, PxI32 b, PxI32 c, PxI32 d) - { - i32[0] = a; - i32[1] = b; - i32[2] = c; - i32[3] = d; - } -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct VecI16V -{ - PxI16 i16[8]; - PX_FORCE_INLINE VecI16V() - { - } - PX_FORCE_INLINE VecI16V(PxI16 a, PxI16 b, PxI16 c, PxI16 d, PxI16 e, PxI16 f, PxI16 g, PxI16 h) - { - i16[0] = a; - i16[1] = b; - i16[2] = c; - i16[3] = d; - i16[4] = e; - i16[5] = f; - i16[6] = g; - i16[7] = h; - } -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct VecU16V -{ - union - { - PxU16 u16[8]; - PxI16 i16[8]; - }; - PX_FORCE_INLINE VecU16V() - { - } - PX_FORCE_INLINE VecU16V(PxU16 a, PxU16 b, PxU16 c, PxU16 d, PxU16 e, PxU16 f, PxU16 g, PxU16 h) - { - u16[0] = a; - u16[1] = b; - u16[2] = c; - u16[3] = d; - u16[4] = e; - u16[5] = f; - u16[6] = g; - u16[7] = h; - } -} PX_ALIGN_SUFFIX(16); - -#define FloatVArg FloatV & -#define Vec3VArg Vec3V & -#define Vec4VArg Vec4V & -#define BoolVArg BoolV & -#define VecU32VArg VecU32V & -#define VecI32VArg VecI32V & -#define VecU16VArg VecU16V & -#define VecI16VArg VecI16V & -#define QuatVArg QuatV & - -#define VecCrossV Vec3V - -typedef VecI32V VecShiftV; -#define VecShiftVArg VecShiftV & - -#endif // PX_PHYSICS_COMMON_VECMATH_INLINE_SCALAR diff --git a/PxShared/src/foundation/include/PsVecMathAoSScalarInline.h b/PxShared/src/foundation/include/PsVecMathAoSScalarInline.h deleted file mode 100644 index f5dea7b..0000000 --- a/PxShared/src/foundation/include/PsVecMathAoSScalarInline.h +++ /dev/null @@ -1,2259 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECMATHAOSSCALARINLINE_H -#define PSFOUNDATION_PSVECMATHAOSSCALARINLINE_H - -#if COMPILE_VECTOR_INTRINSICS -#error Scalar version should not be included when using vector intrinsics. -#endif - -#define BOOL_TO_U32(b) (PxU32)(- PxI32(b)) -#define TRUE_TO_U32 (PxU32)(-1) -#define FALSE_TO_U32 (PxU32)(0) - -#define BOOL_TO_U16(b) (PxU16)(- PxI32(b)) - -#define PX_VECMATH_ASSERT_ENABLED 0 - -#if PX_VECMATH_ASSERT_ENABLED -#define VECMATHAOS_ASSERT(x) { PX_ASSERT(x); } -#else -#define VECMATHAOS_ASSERT(x) -#endif - -///////////////////////////////////////////////////////////////////// -////INTERNAL USE ONLY AND TESTS -///////////////////////////////////////////////////////////////////// - -namespace internalScalarSimd -{ -PX_FORCE_INLINE PxF32 FStore(const FloatV a) -{ - return a.x; -} - -PX_FORCE_INLINE bool hasZeroElementInFloatV(const FloatV a) -{ - return (0 == a.x); -} - -PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) -{ - return (0 == a.x || 0 == a.y || 0 == a.z); -} - -PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) -{ - return (0 == a.x || 0 == a.y || 0 == a.z || 0 == a.w); -} -} - -namespace _VecMathTests -{ -// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' -PX_FORCE_INLINE Vec3V getInvalidVec3V() -{ - Vec3V tmp; - tmp.x = tmp.y = tmp.z = 0.0f; - tmp.pad = 1.0f; - return tmp; -} - -PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) -{ - return (a.x == b.x); -} - -PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) -{ - return (a.x == b.x && a.y == b.y && a.z == b.z); -} - -PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) -{ - return (a.x == b.x && a.y == b.y && a.z == b.z && a.w == b.w); -} - -PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) -{ - return (a.ux == b.ux && a.uy == b.uy && a.uz == b.uz && a.uw == b.uw); -} - -PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) -{ - return (a.u32[0] == b.u32[0] && a.u32[1] == b.u32[1] && a.u32[2] == b.u32[2] && a.u32[3] == b.u32[3]); -} - -PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) -{ - return (a.i32[0] == b.i32[0] && a.i32[1] == b.i32[1] && a.i32[2] == b.i32[2] && a.i32[3] == b.i32[3]); -} - -#define VECMATH_AOS_EPSILON (1e-3f) - -PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) -{ - const PxF32 cx = a.x - b.x; - return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON); -} - -PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) -{ - const PxF32 cx = a.x - b.x; - const PxF32 cy = a.y - b.y; - const PxF32 cz = a.z - b.z; - return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON && cy > -VECMATH_AOS_EPSILON && - cy < VECMATH_AOS_EPSILON && cz > -VECMATH_AOS_EPSILON && cz < VECMATH_AOS_EPSILON); -} - -PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) -{ - const PxF32 cx = a.x - b.x; - const PxF32 cy = a.y - b.y; - const PxF32 cz = a.z - b.z; - const PxF32 cw = a.w - b.w; - return (cx > -VECMATH_AOS_EPSILON && cx < VECMATH_AOS_EPSILON && cy > -VECMATH_AOS_EPSILON && - cy < VECMATH_AOS_EPSILON && cz > -VECMATH_AOS_EPSILON && cz < VECMATH_AOS_EPSILON && - cw > -VECMATH_AOS_EPSILON && cw < VECMATH_AOS_EPSILON); -} -} - -/////////////////////////////////////////////////////// - -PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) -{ - return a.pad == 0.f; -} - -PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) -{ - return PxIsFinite(a.x); -} - -PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) -{ - return PxIsFinite(a.x) && PxIsFinite(a.y) && PxIsFinite(a.z); -} - -PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) -{ - return PxIsFinite(a.x) && PxIsFinite(a.y) && PxIsFinite(a.z) && PxIsFinite(a.w); -} - -///////////////////////////////////////////////////////////////////// -////VECTORISED FUNCTION IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -PX_FORCE_INLINE FloatV FLoad(const PxF32 f) -{ - return FloatV(f); -} - -PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) -{ - return Vec3V(f, f, f); -} - -PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) -{ - return Vec4V(f, f, f, f); -} - -PX_FORCE_INLINE BoolV BLoad(const bool f) -{ -#if PX_ARM - // SD: Android ARM builds fail if this is done with a cast. - // Might also fail because of something else but the select - // operator here seems to fix everything that failed in release builds. - return f ? BTTTT() : BFFFF(); -#else - return BoolV(BOOL_TO_U32(f), BOOL_TO_U32(f), BOOL_TO_U32(f), BOOL_TO_U32(f)); -#endif -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) -{ - return Vec3V(f.x, f.y, f.z); -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) -{ - return Vec3V(f.x, f.y, f.z); -} - -PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) -{ - return Vec3V(f.x, f.y, f.z); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) -{ - return Vec3V(f[0], f[1], f[2]); -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const f) -{ - return Vec3V(f[0], f[1], f[2]); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V f) -{ - return Vec3V(f.x, f.y, f.z); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) -{ - return Vec3V(v.x, v.y, v.z); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) -{ - return Vec4V(f.x, f.y, f.z, 0.0f); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) -{ - return Vec4V(f.x, f.x, f.x, f.x); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) -{ - return Vec3V(f.x, f.x, f.x); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) -{ - return Vec3V(f.x, f.x, f.x); -} - -PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) -{ - return Vec4V(f[0], f[1], f[2], f[3]); -} - -PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f) -{ - *reinterpret_cast<Vec4V*>(f) = a; -} - -PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) -{ - *reinterpret_cast<PxVec4*>(f) = *reinterpret_cast<const PxVec4*>(&a.x); -} - -PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) -{ - *reinterpret_cast<BoolV*>(f) = a; -} - -PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) -{ - *reinterpret_cast<VecU32V*>(u) = uv; -} - -PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) -{ - *reinterpret_cast<VecI32V*>(i) = iv; -} - -PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) -{ - return Vec4V(f[0], f[1], f[2], f[3]); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) -{ - return Vec4V(f[0], f[1], f[2], 0.0f); -} - -PX_FORCE_INLINE BoolV BLoad(const bool* const f) -{ - return BoolV(BOOL_TO_U32(f[0]), BOOL_TO_U32(f[1]), BOOL_TO_U32(f[2]), BOOL_TO_U32(f[3])); -} - -PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) -{ - *f = a.x; -} - -PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) -{ - f = PxVec3(a.x, a.y, a.z); -} - -PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) -{ - f = PxVec3(a.x, a.y, a.z); -} - -PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) -{ - *b2 = b.ux; -} - -////////////////////////// -// FLOATV -////////////////////////// - -PX_FORCE_INLINE FloatV FZero() -{ - return FLoad(0.0f); -} - -PX_FORCE_INLINE FloatV FOne() -{ - return FLoad(1.0f); -} - -PX_FORCE_INLINE FloatV FHalf() -{ - return FLoad(0.5f); -} - -PX_FORCE_INLINE FloatV FEps() -{ - return FLoad(PX_EPS_REAL); -} - -PX_FORCE_INLINE FloatV FEps6() -{ - return FLoad(1e-6f); -} - -PX_FORCE_INLINE FloatV FMax() -{ - return FLoad(PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV FNegMax() -{ - return FLoad(-PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV FNeg(const FloatV f) -{ - return FloatV(-f.x); -} - -PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) -{ - return FloatV(a.x + b.x); -} - -PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) -{ - return FloatV(a.x - b.x); -} - -PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) -{ - return FloatV(a.x * b.x); -} - -PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) -{ - VECMATHAOS_ASSERT(b.x != 0.0f); - return FloatV(a.x / b.x); -} - -PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) -{ - VECMATHAOS_ASSERT(b.x != 0.0f); - return FloatV(a.x / b.x); -} - -PX_FORCE_INLINE FloatV FRecip(const FloatV a) -{ - VECMATHAOS_ASSERT(a.x != 0.0f); - return 1.0f / a.x; -} - -PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) -{ - VECMATHAOS_ASSERT(a.x != 0.0f); - return 1.0f / a.x; -} - -PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) -{ - VECMATHAOS_ASSERT(a.x != 0.0f); - return PxRecipSqrt(a.x); -} - -PX_FORCE_INLINE FloatV FSqrt(const FloatV a) -{ - return PxSqrt(a.x); -} - -PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) -{ - VECMATHAOS_ASSERT(a.x != 0.0f); - return PxRecipSqrt(a.x); -} - -PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) -{ - return FAdd(FMul(a, b), c); -} - -PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) -{ - return FSub(c, FMul(a, b)); -} - -PX_FORCE_INLINE FloatV FAbs(const FloatV a) -{ - return FloatV(PxAbs(a.x)); -} - -PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) -{ - return FloatV(c.ux ? a.x : b.x); -} - -PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) -{ - return BLoad(a.x > b.x); -} - -PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) -{ - return BLoad(a.x >= b.x); -} - -PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) -{ - return BLoad(a.x == b.x); -} - -PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) -{ - return (a.x > b.x ? FloatV(a.x) : FloatV(b.x)); -} - -PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) -{ - return (a.x > b.x ? FloatV(b.x) : FloatV(a.x)); -} - -PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) -{ - return FMax(FMin(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) -{ - return BOOL_TO_U32(a.x > b.x); -} - -PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) -{ - return BOOL_TO_U32(a.x >= b.x); -} -PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) -{ - return BOOL_TO_U32(a.x == b.x); -} - -PX_FORCE_INLINE FloatV FRound(const FloatV a) -{ - return floorf(a.x + 0.5f); -} - -PX_FORCE_INLINE FloatV FSin(const FloatV a) -{ - return sinf(a.x); -} - -PX_FORCE_INLINE FloatV FCos(const FloatV a) -{ - return cosf(a.x); -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) -{ - return BOOL_TO_U32(a.x > max.x || a.x < min.x); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) -{ - return BOOL_TO_U32(a.x >= min.x && a.x <= max.x); -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) -{ - return FOutOfBounds(a, FNeg(bounds), bounds); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) -{ - return FInBounds(a, FNeg(bounds), bounds); -} - -///////////////////// -// VEC3V -///////////////////// - -PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) -{ - return Vec3V(f.x, f.x, f.x); -} - -PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) -{ - return Vec3V(x.x, y.x, z.x); -} - -PX_FORCE_INLINE Vec3V V3UnitX() -{ - return Vec3V(1.0f, 0.0f, 0.0f); -} - -PX_FORCE_INLINE Vec3V V3UnitY() -{ - return Vec3V(0.0f, 1.0f, 0.0f); -} - -PX_FORCE_INLINE Vec3V V3UnitZ() -{ - return Vec3V(0.0f, 0.0f, 1.0f); -} - -PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) -{ - return FloatV(f.x); -} - -PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) -{ - return FloatV(f.y); -} - -PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) -{ - return FloatV(f.z); -} - -PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) -{ - return Vec3V(f.x, v.y, v.z); -} - -PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) -{ - return Vec3V(v.x, f.x, v.z); -} - -PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) -{ - return Vec3V(v.x, v.y, f.x); -} - -PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) -{ - return Vec3V(a.x, b.x, c.x); -} - -PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) -{ - return Vec3V(a.y, b.y, c.y); -} - -PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) -{ - return Vec3V(a.z, b.z, c.z); -} - -PX_FORCE_INLINE Vec3V V3Zero() -{ - return V3Load(0.0f); -} - -PX_FORCE_INLINE Vec3V V3One() -{ - return V3Load(1.0f); -} - -PX_FORCE_INLINE Vec3V V3Eps() -{ - return V3Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec3V V3Neg(const Vec3V c) -{ - return Vec3V(-c.x, -c.y, -c.z); -} - -PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x + b.x, a.y + b.y, a.z + b.z); -} - -PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x - b.x, a.y - b.y, a.z - b.z); -} - -PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) -{ - return Vec3V(a.x * b.x, a.y * b.x, a.z * b.x); -} - -PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x * b.x, a.y * b.y, a.z * b.z); -} - -PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) -{ - const PxF32 bInv = 1.0f / b.x; - return Vec3V(a.x * bInv, a.y * bInv, a.z * bInv); -} - -PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x / b.x, a.y / b.y, a.z / b.z); -} - -PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) -{ - const PxF32 bInv = 1.0f / b.x; - return Vec3V(a.x * bInv, a.y * bInv, a.z * bInv); -} - -PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x / b.x, a.y / b.y, a.z / b.z); -} - -PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) -{ - return Vec3V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z); -} - -PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) -{ - return Vec3V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z); -} - -PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) -{ - return Vec3V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z)); -} - -PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) -{ - return Vec3V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z)); -} - -PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) -{ - return V3Add(V3Scale(a, b), c); -} - -PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) -{ - return V3Sub(c, V3Scale(a, b)); -} - -PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) -{ - return V3Add(V3Mul(a, b), c); -} - -PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) -{ - return V3Sub(c, V3Mul(a, b)); -} - -PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) -{ - return FloatV(a.x * b.x + a.y * b.y + a.z * b.z); -} - -PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3VArg normal) -{ - return normal; -} - -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); -} - -PX_FORCE_INLINE FloatV V3Length(const Vec3V a) -{ - return FloatV(PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z)); -} - -PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) -{ - return FloatV(a.x * a.x + a.y * a.y + a.z * a.z); -} - -PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) -{ - VECMATHAOS_ASSERT(a.x != 0 || a.y != 0 || a.z != 0); - const PxF32 lengthInv = 1.0f / PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); - return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); -} - -PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) -{ - const PxF32 length = PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); - if(PX_EPS_REAL >= length) - { - return unsafeReturnValue; - } - else - { - const PxF32 lengthInv = 1.0f / length; - return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); - } -} - -PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) -{ - VECMATHAOS_ASSERT(a.x != 0 || a.y != 0 || a.z != 0); - const PxF32 lengthInv = 1.0f / PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z); - return Vec3V(a.x * lengthInv, a.y * lengthInv, a.z * lengthInv); -} - -PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) -{ - return Vec3V(c.ux ? a.x : b.x, c.uy ? a.y : b.y, c.uz ? a.z : b.z); -} - -PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) -{ - return BoolV(BOOL_TO_U32(a.x > b.x), BOOL_TO_U32(a.y > b.y), BOOL_TO_U32(a.z > b.z), FALSE_TO_U32); -} - -PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) -{ - return BoolV(BOOL_TO_U32(a.x >= b.x), BOOL_TO_U32(a.y >= b.y), BOOL_TO_U32(a.z >= b.z), TRUE_TO_U32); -} - -PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) -{ - return BoolV(BOOL_TO_U32(a.x == b.x), BOOL_TO_U32(a.y == b.y), BOOL_TO_U32(a.z == b.z), TRUE_TO_U32); -} - -PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z); -} - -PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) -{ - return Vec3V(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y, a.z < b.z ? a.z : b.z); -} - -PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) -{ - const PxF32 t0 = (a.x >= a.y) ? a.x : a.y; - return t0 >= a.z ? t0 : a.z; -} - -PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) -{ - const PxF32 t0 = (a.x <= a.y) ? a.x : a.y; - return t0 <= a.z ? t0 : a.z; -} - -// return (a >= 0.0f) ? 1.0f : -1.0f; -PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) -{ - return Vec3V((a.x >= 0.f ? 1.f : -1.f), (a.y >= 0.f ? 1.f : -1.f), (a.z >= 0.f ? 1.f : -1.f)); -} - -PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) -{ - return V3Max(V3Min(a, maxV), minV); -} - -PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) -{ - return V3Max(a, V3Neg(a)); -} - -PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) -{ - return BOOL_TO_U32((a.x > b.x) & (a.y > b.y) & (a.z > b.z)); -} - -PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) -{ - return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z)); -} - -PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) -{ - return BOOL_TO_U32((a.x == b.x) & (a.y == b.y) & (a.z == b.z)); -} - -PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) -{ - return Vec3V(floorf(a.x + 0.5f), floorf(a.y + 0.5f), floorf(a.z + 0.5f)); -} - -PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) -{ - return Vec3V(sinf(a.x), sinf(a.y), sinf(a.z)); -} - -PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) -{ - return Vec3V(cosf(a.x), cosf(a.y), cosf(a.z)); -} - -PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) -{ - return Vec3V(a.y, a.z, a.z); -} - -PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) -{ - return Vec3V(a.x, a.y, a.x); -} - -PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) -{ - return Vec3V(a.y, a.z, a.x); -} - -PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) -{ - return Vec3V(a.z, a.x, a.y); -} - -PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) -{ - return Vec3V(a.z, a.z, a.y); -} - -PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) -{ - return Vec3V(a.y, a.x, a.x); -} - -PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) -{ - return Vec3V(0.0f, v1.z, v0.y); -} - -PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) -{ - return Vec3V(v0.z, 0.0f, v1.x); -} - -PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) -{ - return Vec3V(v1.y, v0.x, 0.0f); -} - -PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) -{ - return FloatV(a.x + a.y + a.z); -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - return BOOL_TO_U32(a.x > max.x || a.y > max.y || a.z > max.z || a.x < min.x || a.y < min.y || a.z < min.z); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - return BOOL_TO_U32(a.x <= max.x && a.y <= max.y && a.z <= max.z && a.x >= min.x && a.y >= min.y && a.z >= min.z); -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) -{ - return V3OutOfBounds(a, V3Neg(bounds), bounds); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) -{ - return V3InBounds(a, V3Neg(bounds), bounds); -} - -PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) -{ - const PxF32 t01 = col0.y, t02 = col0.z, t12 = col1.z; - col0.y = col1.x; - col0.z = col2.x; - col1.z = col2.y; - col1.x = t01; - col2.x = t02; - col2.y = t12; -} - -///////////////////////// -// VEC4V -///////////////////////// - -PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) -{ - return Vec4V(f.x, f.x, f.x, f.x); -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) -{ - return Vec4V(floatVArray[0].x, floatVArray[1].x, floatVArray[2].x, floatVArray[3].x); -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) -{ - return Vec4V(x.x, y.x, z.x, w.x); -} - -PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - return Vec4V(x.w, y.w, z.w, w.w); -} - -PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - return Vec4V(x.z, y.z, z.z, w.z); -} - -PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - return Vec4V(x.y, y.y, z.y, w.y); -} - -PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - return Vec4V(x.x, y.x, z.x, w.x); -} - -PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) -{ - return Vec4V(a.x, b.x, a.y, b.y); -} - -PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) -{ - return Vec4V(a.z, b.z, a.w, b.w); -} - -PX_FORCE_INLINE Vec4V V4UnitX() -{ - return Vec4V(1.0f, 0.0f, 0.0f, 0.0f); -} - -PX_FORCE_INLINE Vec4V V4UnitY() -{ - return Vec4V(0.0f, 1.0f, 0.0f, 0.0f); -} - -PX_FORCE_INLINE Vec4V V4UnitZ() -{ - return Vec4V(0.0f, 0.0f, 1.0f, 0.0f); -} - -PX_FORCE_INLINE Vec4V V4UnitW() -{ - return Vec4V(0.0f, 0.0f, 0.0f, 1.0f); -} - -PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) -{ - return FloatV(f.x); -} - -PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) -{ - return FloatV(f.y); -} - -PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) -{ - return FloatV(f.z); -} - -PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) -{ - return FloatV(f.w); -} - -PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) -{ - return Vec4V(f.x, v.y, v.z, v.w); -} - -PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) -{ - return Vec4V(v.x, f.x, v.z, v.w); -} - -PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) -{ - return Vec4V(v.x, v.y, f.x, v.w); -} - -PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) -{ - return Vec4V(v.x, v.y, v.z, f.x); -} - -PX_FORCE_INLINE Vec4V V4SetW(const Vec3V v, const FloatV f) -{ - return Vec4V(v.x, v.y, v.z, f.x); -} - -PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) -{ - return Vec4V(v.x, v.y, v.z, 0.0f); -} - -PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V v) -{ - return Vec4V(v.y, v.x, v.w, v.z); -} - -PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V v) -{ - return Vec4V(v.x, v.z, v.x, v.z); -} - -PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V v) -{ - return Vec4V(v.y, v.w, v.y, v.w); -} - -PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V v) -{ - return Vec4V(v.y, v.z, v.x, v.w); -} - -template <PxU8 _x, PxU8 _y, PxU8 _z, PxU8 _w> -PX_FORCE_INLINE Vec4V V4Perm(const Vec4V v) -{ - const PxF32 f[4] = { v.x, v.y, v.z, v.w }; - return Vec4V(f[_x], f[_y], f[_z], f[_w]); -} - -PX_FORCE_INLINE Vec4V V4Zero() -{ - return V4Load(0.0f); -} - -PX_FORCE_INLINE Vec4V V4One() -{ - return V4Load(1.0f); -} - -PX_FORCE_INLINE Vec4V V4Eps() -{ - return V4Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec4V V4Neg(const Vec4V c) -{ - return Vec4V(-c.x, -c.y, -c.z, -c.w); -} - -PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w); -} - -PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w); -} - -PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) -{ - return Vec4V(a.x * b.x, a.y * b.x, a.z * b.x, a.w * b.x); -} - -PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w); -} - -PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) -{ - const PxF32 bInv = 1.0f / b.x; - return Vec4V(a.x * bInv, a.y * bInv, a.z * bInv, a.w * bInv); -} - -PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) -{ - VECMATHAOS_ASSERT(b.x != 0 && b.y != 0 && b.z != 0 && b.w != 0); - return Vec4V(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); -} - -PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) -{ - const PxF32 bInv = 1.0f / b.x; - return Vec4V(a.x * bInv, a.y * bInv, a.z * bInv, a.w * bInv); -} - -PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w); -} - -PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) -{ - return Vec4V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w); -} - -PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) -{ - return Vec4V(1.0f / a.x, 1.0f / a.y, 1.0f / a.z, 1.0f / a.w); -} - -PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) -{ - return Vec4V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z), PxRecipSqrt(a.w)); -} - -PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) -{ - return Vec4V(PxRecipSqrt(a.x), PxRecipSqrt(a.y), PxRecipSqrt(a.z), PxRecipSqrt(a.w)); -} - -PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) -{ - return Vec4V(PxSqrt(a.x), PxSqrt(a.y), PxSqrt(a.z), PxSqrt(a.w)); -} - -PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) -{ - return V4Add(V4Scale(a, b), c); -} - -PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) -{ - return V4Sub(c, V4Scale(a, b)); -} - -PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return V4Add(V4Mul(a, b), c); -} - -PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return V4Sub(c, V4Mul(a, b)); -} - -PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) -{ - return FloatV(a.x + a.y + a.z + a.w); -} - -PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) -{ - return FloatV(a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w); -} - -PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) -{ - return FloatV(a.x * b.x + a.y * b.y + a.z * b.z); -} - -PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x, 0.0f); -} - -PX_FORCE_INLINE FloatV V4Length(const Vec4V a) -{ - return FloatV(PxSqrt(a.x * a.x + a.y * a.y + a.z * a.z + a.w * a.w)); -} - -PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) -{ - return V4Dot(a, a); -} - -PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) -{ - VECMATHAOS_ASSERT(0 != a.x || 0 != a.y || 0 != a.z || 0 != a.w); - const FloatV length = FloatV(V4Length(a)); - return V4ScaleInv(a, length); -} - -PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) -{ - const FloatV length = FloatV(V4Length(a)); - if(PX_EPS_REAL >= length.x) - { - return unsafeReturnValue; - } - else - { - return V4ScaleInv(a, length); - } -} -PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) -{ - VECMATHAOS_ASSERT(0 != a.x || 0 != a.y || 0 != a.z || 0 != a.w); - const FloatV length = FloatV(V4Length(a)); - return V4ScaleInv(a, length); -} - -PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) -{ - return Vec4V(c.ux ? a.x : b.x, c.uy ? a.y : b.y, c.uz ? a.z : b.z, c.uw ? a.w : b.w); -} - -PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) -{ - return BoolV(BOOL_TO_U32(a.x > b.x), BOOL_TO_U32(a.y > b.y), BOOL_TO_U32(a.z > b.z), BOOL_TO_U32(a.w > b.w)); -} - -PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return BoolV(BOOL_TO_U32(a.x >= b.x), BOOL_TO_U32(a.y >= b.y), BOOL_TO_U32(a.z >= b.z), BOOL_TO_U32(a.w >= b.w)); -} - -PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) -{ - return BoolV(BOOL_TO_U32(a.x == b.x), BOOL_TO_U32(a.y == b.y), BOOL_TO_U32(a.z == b.z), BOOL_TO_U32(a.w == b.w)); -} - -PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.x > b.x ? a.x : b.x, a.y > b.y ? a.y : b.y, a.z > b.z ? a.z : b.z, a.w > b.w ? a.w : b.w); -} - -PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) -{ - return Vec4V(a.x < b.x ? a.x : b.x, a.y < b.y ? a.y : b.y, a.z < b.z ? a.z : b.z, a.w < b.w ? a.w : b.w); -} - -PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) -{ - const PxF32 t0 = (a.x >= a.y) ? a.x : a.y; - const PxF32 t1 = (a.z >= a.w) ? a.x : a.w; - return t0 >= t1 ? t0 : t1; -} - -PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) -{ - const PxF32 t0 = (a.x <= a.y) ? a.x : a.y; - const PxF32 t1 = (a.z <= a.w) ? a.x : a.w; - return t0 <= t1 ? t0 : t1; -} - -PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) -{ - return V4Max(V4Min(a, maxV), minV); -} - -PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) -{ - return Vec4V(floorf(a.x + 0.5f), floorf(a.y + 0.5f), floorf(a.z + 0.5f), floorf(a.w + 0.5f)); -} - -PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) -{ - return Vec4V(sinf(a.x), sinf(a.y), sinf(a.z), sinf(a.w)); -} - -PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) -{ - return Vec4V(cosf(a.x), cosf(a.y), cosf(a.z), cosf(a.w)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) -{ - return BOOL_TO_U32((a.x > b.x) & (a.y > b.y) & (a.z > b.z) & (a.w > b.w)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z) & (a.w >= b.w)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) -{ - return BOOL_TO_U32((a.x >= b.x) & (a.y >= b.y) & (a.z >= b.z)); -} - -PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) -{ - return BOOL_TO_U32((a.x == b.x) & (a.y == b.y) & (a.z == b.z) & (a.w == b.w)); -} - -PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) -{ - return BOOL_TO_U32((a.x > b.x) | (a.y > b.y) | (a.z > b.z)); -} - -PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) -{ - const PxF32 t01 = col0.y, t02 = col0.z, t03 = col0.w; - const PxF32 t12 = col1.z, t13 = col1.w; - const PxF32 t23 = col2.w; - col0.y = col1.x; - col0.z = col2.x; - col0.w = col3.x; - col1.z = col2.y; - col1.w = col3.y; - col2.w = col3.z; - col1.x = t01; - col2.x = t02; - col3.x = t03; - col2.y = t12; - col3.y = t13; - col3.z = t23; -} - -PX_FORCE_INLINE BoolV BFFFF() -{ - return BoolV(FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BFFFT() -{ - return BoolV(FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BFFTF() -{ - return BoolV(FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BFFTT() -{ - return BoolV(FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BFTFF() -{ - return BoolV(FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BFTFT() -{ - return BoolV(FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BFTTF() -{ - return BoolV(FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BFTTT() -{ - return BoolV(FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BTFFF() -{ - return BoolV(TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BTFFT() -{ - return BoolV(TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BTFTF() -{ - return BoolV(TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BTFTT() -{ - return BoolV(TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BTTFF() -{ - return BoolV(TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BTTFT() -{ - return BoolV(TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32, TRUE_TO_U32); -} -PX_FORCE_INLINE BoolV BTTTF() -{ - return BoolV(TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, FALSE_TO_U32); -} -PX_FORCE_INLINE BoolV BTTTT() -{ - return BoolV(TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32, TRUE_TO_U32); -} - -PX_FORCE_INLINE BoolV BXMask() -{ - return BTFFF(); -} -PX_FORCE_INLINE BoolV BYMask() -{ - return BFTFF(); -} -PX_FORCE_INLINE BoolV BZMask() -{ - return BFFTF(); -} -PX_FORCE_INLINE BoolV BWMask() -{ - return BFFFT(); -} - -PX_FORCE_INLINE BoolV BGetX(const BoolV a) -{ - return BoolV(a.ux, a.ux, a.ux, a.ux); -} - -PX_FORCE_INLINE BoolV BGetY(const BoolV a) -{ - return BoolV(a.uy, a.uy, a.uy, a.uy); -} - -PX_FORCE_INLINE BoolV BGetZ(const BoolV a) -{ - return BoolV(a.uz, a.uz, a.uz, a.uz); -} - -PX_FORCE_INLINE BoolV BGetW(const BoolV a) -{ - return BoolV(a.uw, a.uw, a.uw, a.uw); -} - -PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) -{ - return BoolV(f.ux, v.uy, v.uz, v.uw); -} - -PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) -{ - return BoolV(v.ux, f.uy, v.uz, v.uw); -} - -PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) -{ - return BoolV(v.ux, v.uy, f.uz, v.uw); -} - -PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) -{ - return BoolV(v.ux, v.uy, v.uz, f.uw); -} - -template <int index> -BoolV BSplatElement(BoolV a) -{ - PxU32* b = (PxU32*)&a; - return BoolV(b[index], b[index], b[index], b[index]); -} - -PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) -{ - return BoolV(BOOL_TO_U32(a.ux && b.ux), BOOL_TO_U32(a.uy && b.uy), BOOL_TO_U32(a.uz && b.uz), BOOL_TO_U32(a.uw && b.uw)); -} - -PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) -{ - return BoolV(a.ux & ~b.ux, a.uy & ~b.uy, a.uz & ~b.uz, a.uw & ~b.uw); -} - -PX_FORCE_INLINE BoolV BNot(const BoolV a) -{ - return BoolV(~a.ux, ~a.uy, ~a.uz, ~a.uw); -} - -PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) -{ - return BoolV(BOOL_TO_U32(a.ux || b.ux), BOOL_TO_U32(a.uy || b.uy), BOOL_TO_U32(a.uz || b.uz), BOOL_TO_U32(a.uw || b.uw)); -} - -PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) -{ - return (a.ux == b.ux && a.uy == b.uy && a.uz == b.uz && a.uw == b.uw ? 1 : 0); -} - -PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) -{ - return BAllEq(a, BTTTT()); -} - -PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) -{ - return BAllEq(a, BFFFF()); -} - -PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) -{ - return (a.ux & a.uy & a.uz & a.uw) ? BTTTT() : BFFFF(); -} - -PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) -{ - return (a.ux | a.uy | a.uz | a.uw) ? BTTTT() : BFFFF(); -} - -PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) -{ - return (a.ux & a.uy & a.uz) ? BTTTT() : BFFFF(); -} - -PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) -{ - return (a.ux | a.uy | a.uz) ? BTTTT() : BFFFF(); -} - -PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) -{ - return (a.ux & 1) | (a.uy & 2) | (a.uz & 4) | (a.uw & 8); -} - -////////////////////////////////// -// MAT33V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) -{ - return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z, a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z, - a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z); -} - -PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) -{ - return Vec3V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z, a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z, - a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z); -} - -PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - Vec3V result = V3ScaleAdd(A.col0, x, c); - result = V3ScaleAdd(A.col1, y, result); - return V3ScaleAdd(A.col2, z, result); -} - -PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) -{ - return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); -} - -PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) -{ - return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); -} - -PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) -{ - return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); -} - -PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) -{ - const Vec3V x = V3Mul(V3UnitX(), d); - const Vec3V y = V3Mul(V3UnitY(), d); - const Vec3V z = V3Mul(V3UnitZ(), d); - return Mat33V(x, y, z); -} - -PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) -{ - const PxF32 det = a.col0.x * (a.col1.y * a.col2.z - a.col1.z * a.col2.y) - - a.col1.x * (a.col0.y * a.col2.z - a.col2.y * a.col0.z) + - a.col2.x * (a.col0.y * a.col1.z - a.col1.y * a.col0.z); - - const PxF32 invDet = 1.0f / det; - - Mat33V ret; - ret.col0.x = invDet * (a.col1.y * a.col2.z - a.col2.y * a.col1.z); - ret.col0.y = invDet * (a.col2.y * a.col0.z - a.col0.y * a.col2.z); - ret.col0.z = invDet * (a.col0.y * a.col1.z - a.col1.y * a.col0.z); - - ret.col1.x = invDet * (a.col2.x * a.col1.z - a.col1.x * a.col2.z); - ret.col1.y = invDet * (a.col0.x * a.col2.z - a.col2.x * a.col0.z); - ret.col1.z = invDet * (a.col1.x * a.col0.z - a.col0.x * a.col1.z); - - ret.col2.x = invDet * (a.col1.x * a.col2.y - a.col2.x * a.col1.y); - ret.col2.y = invDet * (a.col2.x * a.col0.y - a.col0.x * a.col2.y); - ret.col2.z = invDet * (a.col0.x * a.col1.y - a.col1.x * a.col0.y); - - return ret; -} - -PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) -{ - return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); -} - -PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) -{ - PX_ASSERT((size_t(&out) & 15) == 0); - V3StoreU(m.col0, out.column0); - V3StoreU(m.col1, out.column1); - V3StoreU(m.col2, out.column2); -} - -PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) -{ - return Mat33V(Vec3V(a.col0.x, a.col1.x, a.col2.x), Vec3V(a.col0.y, a.col1.y, a.col2.y), - Vec3V(a.col0.z, a.col1.z, a.col2.z)); -} - -PX_FORCE_INLINE Mat33V M33Identity() -{ - return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); -} - -////////////////////////////////// -// MAT34V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) -{ - return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z + a.col3.x, - a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z + a.col3.y, - a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z + a.col3.z); -} - -PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) -{ - return Vec3V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z, a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z, - a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z); -} - -PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) -{ - return Vec3V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z, a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z, - a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z); -} - -PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M34Mul33V3(const Mat34V& a, const Mat33V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) -{ - return Mat33V(Vec3V(a.col0.x, a.col1.x, a.col2.x), Vec3V(a.col0.y, a.col1.y, a.col2.y), - Vec3V(a.col0.z, a.col1.z, a.col2.z)); -} - -////////////////////////////////// -// MAT44V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) -{ - return Vec4V(a.col0.x * b.x + a.col1.x * b.y + a.col2.x * b.z + a.col3.x * b.w, - a.col0.y * b.x + a.col1.y * b.y + a.col2.y * b.z + a.col3.y * b.w, - a.col0.z * b.x + a.col1.z * b.y + a.col2.z * b.z + a.col3.z * b.w, - a.col0.w * b.x + a.col1.w * b.y + a.col2.w * b.z + a.col3.w * b.w); -} - -PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) -{ - return Vec4V(a.col0.x * b.x + a.col0.y * b.y + a.col0.z * b.z + a.col0.w * b.w, - a.col1.x * b.x + a.col1.y * b.y + a.col1.z * b.z + a.col1.w * b.w, - a.col2.x * b.x + a.col2.y * b.y + a.col2.z * b.z + a.col2.w * b.w, - a.col3.x * b.x + a.col3.y * b.y + a.col3.z * b.z + a.col3.w * b.w); -} - -PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) -{ - PxF32 tmp[12]; - PxF32 dst[16]; - PxF32 det; - - const PxF32 src[16] = { a.col0.x, a.col0.y, a.col0.z, a.col0.w, a.col1.x, a.col1.y, a.col1.z, a.col1.w, - a.col2.x, a.col2.y, a.col2.z, a.col2.w, a.col3.x, a.col3.y, a.col3.z, a.col3.w }; - - tmp[0] = src[10] * src[15]; - tmp[1] = src[11] * src[14]; - tmp[2] = src[9] * src[15]; - tmp[3] = src[11] * src[13]; - tmp[4] = src[9] * src[14]; - tmp[5] = src[10] * src[13]; - tmp[6] = src[8] * src[15]; - tmp[7] = src[11] * src[12]; - tmp[8] = src[8] * src[14]; - tmp[9] = src[10] * src[12]; - tmp[10] = src[8] * src[13]; - tmp[11] = src[9] * src[12]; - - dst[0] = tmp[0] * src[5] + tmp[3] * src[6] + tmp[4] * src[7]; - dst[0] -= tmp[1] * src[5] + tmp[2] * src[6] + tmp[5] * src[7]; - dst[1] = tmp[1] * src[4] + tmp[6] * src[6] + tmp[9] * src[7]; - dst[1] -= tmp[0] * src[4] + tmp[7] * src[6] + tmp[8] * src[7]; - dst[2] = tmp[2] * src[4] + tmp[7] * src[5] + tmp[10] * src[7]; - dst[2] -= tmp[3] * src[4] + tmp[6] * src[5] + tmp[11] * src[7]; - dst[3] = tmp[5] * src[4] + tmp[8] * src[5] + tmp[11] * src[6]; - dst[3] -= tmp[4] * src[4] + tmp[9] * src[5] + tmp[10] * src[6]; - dst[4] = tmp[1] * src[1] + tmp[2] * src[2] + tmp[5] * src[3]; - dst[4] -= tmp[0] * src[1] + tmp[3] * src[2] + tmp[4] * src[3]; - dst[5] = tmp[0] * src[0] + tmp[7] * src[2] + tmp[8] * src[3]; - dst[5] -= tmp[1] * src[0] + tmp[6] * src[2] + tmp[9] * src[3]; - dst[6] = tmp[3] * src[0] + tmp[6] * src[1] + tmp[11] * src[3]; - dst[6] -= tmp[2] * src[0] + tmp[7] * src[1] + tmp[10] * src[3]; - dst[7] = tmp[4] * src[0] + tmp[9] * src[1] + tmp[10] * src[2]; - dst[7] -= tmp[5] * src[0] + tmp[8] * src[1] + tmp[11] * src[2]; - - tmp[0] = src[2] * src[7]; - tmp[1] = src[3] * src[6]; - tmp[2] = src[1] * src[7]; - tmp[3] = src[3] * src[5]; - tmp[4] = src[1] * src[6]; - tmp[5] = src[2] * src[5]; - tmp[6] = src[0] * src[7]; - tmp[7] = src[3] * src[4]; - tmp[8] = src[0] * src[6]; - tmp[9] = src[2] * src[4]; - tmp[10] = src[0] * src[5]; - tmp[11] = src[1] * src[4]; - - dst[8] = tmp[0] * src[13] + tmp[3] * src[14] + tmp[4] * src[15]; - dst[8] -= tmp[1] * src[13] + tmp[2] * src[14] + tmp[5] * src[15]; - dst[9] = tmp[1] * src[12] + tmp[6] * src[14] + tmp[9] * src[15]; - dst[9] -= tmp[0] * src[12] + tmp[7] * src[14] + tmp[8] * src[15]; - dst[10] = tmp[2] * src[12] + tmp[7] * src[13] + tmp[10] * src[15]; - dst[10] -= tmp[3] * src[12] + tmp[6] * src[13] + tmp[11] * src[15]; - dst[11] = tmp[5] * src[12] + tmp[8] * src[13] + tmp[11] * src[14]; - dst[11] -= tmp[4] * src[12] + tmp[9] * src[13] + tmp[10] * src[14]; - dst[12] = tmp[2] * src[10] + tmp[5] * src[11] + tmp[1] * src[9]; - dst[12] -= tmp[4] * src[11] + tmp[0] * src[9] + tmp[3] * src[10]; - dst[13] = tmp[8] * src[11] + tmp[0] * src[8] + tmp[7] * src[10]; - dst[13] -= tmp[6] * src[10] + tmp[9] * src[11] + tmp[1] * src[8]; - dst[14] = tmp[6] * src[9] + tmp[11] * src[11] + tmp[3] * src[8]; - dst[14] -= tmp[10] * src[11] + tmp[2] * src[8] + tmp[7] * src[9]; - dst[15] = tmp[10] * src[10] + tmp[4] * src[8] + tmp[9] * src[9]; - dst[15] -= tmp[8] * src[9] + tmp[11] * src[10] + tmp[5] * src[8]; - - det = src[0] * dst[0] + src[1] * dst[1] + src[2] * dst[2] + src[3] * dst[3]; - - det = 1.0f / det; - for(PxU32 j = 0; j < 16; j++) - { - dst[j] *= det; - } - - return Mat44V(Vec4V(dst[0], dst[4], dst[8], dst[12]), Vec4V(dst[1], dst[5], dst[9], dst[13]), - Vec4V(dst[2], dst[6], dst[10], dst[14]), Vec4V(dst[3], dst[7], dst[11], dst[15])); -} - -PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) -{ - return Mat44V(Vec4V(a.col0.x, a.col1.x, a.col2.x, a.col3.x), Vec4V(a.col0.y, a.col1.y, a.col2.y, a.col3.y), - Vec4V(a.col0.z, a.col1.z, a.col2.z, a.col3.z), Vec4V(a.col0.w, a.col1.w, a.col2.w, a.col3.w)); -} - -PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) -{ - return Vec4V(x, y, z, w); -} - -/* -PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) -{ - return VecU16V( - PxU16(PxClamp<PxU32>((a).u32[0], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((a).u32[1], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((a).u32[2], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((a).u32[3], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((b).u32[0], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((b).u32[1], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((b).u32[2], 0, 0xFFFF)), - PxU16(PxClamp<PxU32>((b).u32[3], 0, 0xFFFF))); -} -*/ - -PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) -{ - return VecU32V(c.ux ? a.u32[0] : b.u32[0], c.uy ? a.u32[1] : b.u32[1], c.uz ? a.u32[2] : b.u32[2], - c.uw ? a.u32[3] : b.u32[3]); -} - -PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) -{ - return VecU32V((a).u32[0] | (b).u32[0], (a).u32[1] | (b).u32[1], (a).u32[2] | (b).u32[2], (a).u32[3] | (b).u32[3]); -} - -PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) -{ - return VecU32V((a).u32[0] ^ (b).u32[0], (a).u32[1] ^ (b).u32[1], (a).u32[2] ^ (b).u32[2], (a).u32[3] ^ (b).u32[3]); -} - -PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) -{ - return VecU32V((a).u32[0] & (b).u32[0], (a).u32[1] & (b).u32[1], (a).u32[2] & (b).u32[2], (a).u32[3] & (b).u32[3]); -} - -PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) -{ - return VecU32V((a).u32[0] & ~(b).u32[0], (a).u32[1] & ~(b).u32[1], (a).u32[2] & ~(b).u32[2], - (a).u32[3] & ~(b).u32[3]); -} - -/* -PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) -{ - return VecU16V( - (a).u16[0]|(b).u16[0], (a).u16[1]|(b).u16[1], (a).u16[2]|(b).u16[2], (a).u16[3]|(b).u16[3], - (a).u16[4]|(b).u16[4], (a).u16[5]|(b).u16[5], (a).u16[6]|(b).u16[6], (a).u16[7]|(b).u16[7]); -} -*/ - -/* -PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) -{ - return VecU16V( - (a).u16[0]&(b).u16[0], (a).u16[1]&(b).u16[1], (a).u16[2]&(b).u16[2], (a).u16[3]&(b).u16[3], - (a).u16[4]&(b).u16[4], (a).u16[5]&(b).u16[5], (a).u16[6]&(b).u16[6], (a).u16[7]&(b).u16[7]); -} -*/ - -/* -PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) -{ - return VecU16V( - (a).u16[0]&~(b).u16[0], (a).u16[1]&~(b).u16[1], (a).u16[2]&~(b).u16[2], (a).u16[3]&~(b).u16[3], - (a).u16[4]&~(b).u16[4], (a).u16[5]&~(b).u16[5], (a).u16[6]&~(b).u16[6], (a).u16[7]&~(b).u16[7]); -} -*/ - -/* -template<int a> PX_FORCE_INLINE VecI32V V4ISplat() -{ - return VecI32V(a, a, a, a); -} - -template<PxU32 a> PX_FORCE_INLINE VecU32V V4USplat() -{ - return VecU32V(a, a, a, a); -} -*/ - -/* -PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) -{ - *address = val; -} -*/ - -PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) -{ - *address = val; -} - -PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) -{ - VecU32V r = V4U32Andc(*reinterpret_cast<const VecU32V*>(&a), b); - return (*reinterpret_cast<const Vec4V*>(&r)); -} - -PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) -{ - return VecU32V(a.x > b.x ? 0xFFFFffff : 0, a.y > b.y ? 0xFFFFffff : 0, a.z > b.z ? 0xFFFFffff : 0, - a.w > b.w ? 0xFFFFffff : 0); -} - -PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) -{ - return *addr; -} - -PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) -{ - return *addr; -} - -PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) -{ - return VecU16V - ( - BOOL_TO_U16(a.u16[0] > b.u16[0]), BOOL_TO_U16(a.u16[1] > b.u16[1]), BOOL_TO_U16(a.u16[2] > b.u16[2]), BOOL_TO_U16(a.u16[3] > b.u16[3]), - BOOL_TO_U16(a.u16[4] > b.u16[4]), BOOL_TO_U16(a.u16[5] > b.u16[5]), BOOL_TO_U16(a.u16[6] > b.u16[6]), BOOL_TO_U16(a.u16[7] > b.u16[7]) - ); -} - -PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) -{ - return VecU16V - ( - BOOL_TO_U16(a.i16[0] > b.i16[0]), BOOL_TO_U16(a.i16[1] > b.i16[1]), BOOL_TO_U16(a.i16[2] > b.i16[2]), BOOL_TO_U16(a.i16[3] > b.i16[3]), - BOOL_TO_U16(a.i16[4] > b.i16[4]), BOOL_TO_U16(a.i16[5] > b.i16[5]), BOOL_TO_U16(a.i16[6] > b.i16[6]), BOOL_TO_U16(a.i16[7] > b.i16[7]) - ); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) -{ - return Vec4V(PxF32((a).u32[0]), PxF32((a).u32[1]), PxF32((a).u32[2]), PxF32((a).u32[3])); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) -{ - return Vec4V(PxF32((a).i32[0]), PxF32((a).i32[1]), PxF32((a).i32[2]), PxF32((a).i32[3])); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) -{ - float* data = (float*)&a; - return VecI32V(PxI32(data[0]), PxI32(data[1]), PxI32(data[2]), PxI32(data[3])); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) -{ - Vec4V b = *reinterpret_cast<Vec4V*>(&a); - return b; -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) -{ - Vec4V b = *reinterpret_cast<Vec4V*>(&a); - return b; -} - -PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - VecU32V b = *reinterpret_cast<VecU32V*>(&a); - return b; -} - -PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - VecI32V b = *reinterpret_cast<VecI32V*>(&a); - return b; -} - -template <int index> -PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) -{ - return VecU32V((a).u32[index], (a).u32[index], (a).u32[index], (a).u32[index]); -} - -template <int index> -PX_FORCE_INLINE VecU32V V4U32SplatElement(BoolV a) -{ - const PxU32 u = (&a.ux)[index]; - return VecU32V(u, u, u, u); -} - -template <int index> -PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) -{ - float* data = (float*)&a; - return Vec4V(data[index], data[index], data[index], data[index]); -} - -PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) -{ - return VecU32V(x, y, z, w); -} - -PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) -{ - return V4Max(a, V4Neg(a)); -} - -PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) -{ - return BoolV(BOOL_TO_U32(a.u32[0] == b.u32[0]), BOOL_TO_U32(a.u32[1] == b.u32[1]), BOOL_TO_U32(a.u32[2] == b.u32[2]), BOOL_TO_U32(a.u32[3] == b.u32[3])); -} - -PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) -{ - return VecU32V(i, i, i, i); -} - -PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) -{ - return VecU32V(i[0], i[1], i[2], i[3]); -} - -PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) -{ - return VecU32V(i[0], i[1], i[2], i[3]); -} - -PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) -{ - return VecI32V(i, i, i, i); -} - -PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) -{ - return VecI32V(i[0], i[1], i[2], i[3]); -} - -PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) -{ - return VecI32V(i[0], i[1], i[2], i[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) -{ - return VecI32V(a.i32[0] + b.i32[0], a.i32[1] + b.i32[1], a.i32[2] + b.i32[2], a.i32[3] + b.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) -{ - return VecI32V(a.i32[0] - b.i32[0], a.i32[1] - b.i32[1], a.i32[2] - b.i32[2], a.i32[3] - b.i32[3]); -} - -PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) -{ - return BoolV(BOOL_TO_U32(a.i32[0] > b.i32[0]), BOOL_TO_U32(a.i32[1] > b.i32[1]), BOOL_TO_U32(a.i32[2] > b.i32[2]), BOOL_TO_U32(a.i32[3] > b.i32[3])); -} - -PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) -{ - return BoolV(BOOL_TO_U32(a.i32[0] == b.i32[0]), BOOL_TO_U32(a.i32[1] == b.i32[1]), BOOL_TO_U32(a.i32[2] == b.i32[2]), BOOL_TO_U32(a.i32[3] == b.i32[3])); -} - -PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) -{ - return VecI32V(c.ux ? a.i32[0] : b.i32[0], c.uy ? a.i32[1] : b.i32[1], c.uz ? a.i32[2] : b.i32[2], - c.uw ? a.i32[3] : b.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_Zero() -{ - return VecI32V(0, 0, 0, 0); -} - -PX_FORCE_INLINE VecI32V VecI32V_One() -{ - return VecI32V(1, 1, 1, 1); -} - -PX_FORCE_INLINE VecI32V VecI32V_Two() -{ - return VecI32V(2, 2, 2, 2); -} - -PX_FORCE_INLINE VecI32V VecI32V_MinusOne() -{ - return VecI32V(-1, -1, -1, -1); -} - -PX_FORCE_INLINE VecU32V U4Zero() -{ - return VecU32V(0, 0, 0, 0); -} - -PX_FORCE_INLINE VecU32V U4One() -{ - return VecU32V(1, 1, 1, 1); -} - -PX_FORCE_INLINE VecU32V U4Two() -{ - return VecU32V(2, 2, 2, 2); -} - -PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) -{ - return shift; -} - -PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) -{ - return VecI32V(a.i32[0] << count.i32[0], a.i32[1] << count.i32[1], a.i32[2] << count.i32[2], a.i32[3] - << count.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) -{ - return VecI32V(a.i32[0] >> count.i32[0], a.i32[1] >> count.i32[1], a.i32[2] >> count.i32[2], - a.i32[3] >> count.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) -{ - return VecI32V(a.i32[0] & b.i32[0], a.i32[1] & b.i32[1], a.i32[2] & b.i32[2], a.i32[3] & b.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) -{ - return VecI32V(a.i32[0] | b.i32[0], a.i32[1] | b.i32[1], a.i32[2] | b.i32[2], a.i32[3] | b.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) -{ - return VecI32V(a.i32[0], a.i32[0], a.i32[0], a.i32[0]); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) -{ - return VecI32V(a.i32[1], a.i32[1], a.i32[1], a.i32[1]); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) -{ - return VecI32V(a.i32[2], a.i32[2], a.i32[2], a.i32[2]); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) -{ - return VecI32V(a.i32[3], a.i32[3], a.i32[3], a.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) -{ - return VecI32V(c.ux ? a.i32[0] : b.i32[0], c.uy ? a.i32[1] : b.i32[1], c.uz ? a.i32[2] : b.i32[2], - c.uw ? a.i32[3] : b.i32[3]); -} - -PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) -{ - return VecI32V(a.i32[0], b.i32[0], c.i32[0], d.i32[0]); -} - -PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) -{ - *i = a.i32[0]; -} - -PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg b) -{ - return VecI32V(PxI32(b.ux), PxI32(b.uy), PxI32(b.uz), PxI32(b.uw)); -} - -PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg b) -{ - return VecU32V(b.ux, b.uy, b.uz, b.uw); -} - -PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) -{ - const FloatV one = FOne(); - const FloatV x = V4GetX(q); - const FloatV y = V4GetY(q); - const FloatV z = V4GetZ(q); - const FloatV w = V4GetW(q); - - const FloatV x2 = FAdd(x, x); - const FloatV y2 = FAdd(y, y); - const FloatV z2 = FAdd(z, z); - - const FloatV xx = FMul(x2, x); - const FloatV yy = FMul(y2, y); - const FloatV zz = FMul(z2, z); - - const FloatV xy = FMul(x2, y); - const FloatV xz = FMul(x2, z); - const FloatV xw = FMul(x2, w); - - const FloatV yz = FMul(y2, z); - const FloatV yw = FMul(y2, w); - const FloatV zw = FMul(z2, w); - - const FloatV v = FSub(one, xx); - - column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); - column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); - column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); -} - - -// not used - -/* -PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) -{ - return *addr; -} -*/ - -/* -PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) -{ - return *addr; -} -*/ - -/* -PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V a) -{ - return Vec4V(PxCeil(a.x), PxCeil(a.y), PxCeil(a.z), PxCeil(a.w)); -} - -PX_FORCE_INLINE Vec4V V4Floor(const Vec4V a) -{ - return Vec4V(PxFloor(a.x), PxFloor(a.y), PxFloor(a.z), PxFloor(a.w)); -} -*/ - -/* -PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V a, PxU32 power) -{ - PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); - PX_UNUSED(power); // prevent warning in release builds - PxF32 ffffFFFFasFloat = PxF32(0xFFFF0000); - return VecU32V( - PxU32(PxClamp<PxF32>((a).x, 0.0f, ffffFFFFasFloat)), - PxU32(PxClamp<PxF32>((a).y, 0.0f, ffffFFFFasFloat)), - PxU32(PxClamp<PxF32>((a).z, 0.0f, ffffFFFFasFloat)), - PxU32(PxClamp<PxF32>((a).w, 0.0f, ffffFFFFasFloat))); -} -*/ - -#endif // PSFOUNDATION_PSVECMATHAOSSCALARINLINE_H diff --git a/PxShared/src/foundation/include/PsVecMathSSE.h b/PxShared/src/foundation/include/PsVecMathSSE.h deleted file mode 100644 index 559fa68..0000000 --- a/PxShared/src/foundation/include/PsVecMathSSE.h +++ /dev/null @@ -1,56 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECMATHSSE_H -#define PSFOUNDATION_PSVECMATHSSE_H - -namespace -{ - const PX_ALIGN(16, PxF32) minus1w[4] = { 0.0f, 0.0f, 0.0f, -1.0f }; -} - -PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) -{ - const __m128 q2 = V4Add(q, q); - const __m128 qw2 = V4MulAdd(q2, V4GetW(q), _mm_load_ps(minus1w)); // (2wx, 2wy, 2wz, 2ww-1) - const __m128 nw2 = Vec3V_From_Vec4V(V4Neg(qw2)); // (-2wx, -2wy, -2wz, 0) - const __m128 v = Vec3V_From_Vec4V(q); - - const __m128 a0 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 1, 2, 3)); // (2ww-1, 2wz, -2wy, 0) - column0 = V4MulAdd(v, V4GetX(q2), a0); - - const __m128 a1 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 2, 0, 3)); // (2ww-1, 2wx, -2wz, 0) - column1 = V4MulAdd(v, V4GetY(q2), _mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 1, 0, 2))); - - const __m128 a2 = _mm_shuffle_ps(qw2, nw2, _MM_SHUFFLE(3, 0, 1, 3)); // (2ww-1, 2wy, -2wx, 0) - column2 = V4MulAdd(v, V4GetZ(q2), _mm_shuffle_ps(a2, a2, _MM_SHUFFLE(3, 0, 2, 1))); -} - -#endif // PSFOUNDATION_PSVECMATHSSE_H - diff --git a/PxShared/src/foundation/include/PsVecMathUtilities.h b/PxShared/src/foundation/include/PsVecMathUtilities.h deleted file mode 100644 index 21bc50a..0000000 --- a/PxShared/src/foundation/include/PsVecMathUtilities.h +++ /dev/null @@ -1,57 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECMATHUTILITIES_H -#define PSFOUNDATION_PSVECMATHUTILITIES_H - -#include "PsVecMath.h" - -namespace physx -{ -namespace shdfnd -{ -namespace aos -{ -/*! - Extend an edge along its length by a factor - */ -PX_FORCE_INLINE void makeFatEdge(Vec3V& p0, Vec3V& p1, const FloatVArg fatCoeff) -{ - const Vec3V delta = V3Sub(p1, p0); - const FloatV m = V3Length(delta); - const BoolV con = FIsGrtr(m, FZero()); - const Vec3V fatDelta = V3Scale(V3ScaleInv(delta, m), fatCoeff); - p0 = V3Sel(con, V3Sub(p0, fatDelta), p0); - p1 = V3Sel(con, V3Add(p1, fatDelta), p1); -} -} -} -} - -#endif diff --git a/PxShared/src/foundation/include/PsVecQuat.h b/PxShared/src/foundation/include/PsVecQuat.h deleted file mode 100644 index c4726fc..0000000 --- a/PxShared/src/foundation/include/PsVecQuat.h +++ /dev/null @@ -1,455 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECQUAT_H -#define PSFOUNDATION_PSVECQUAT_H - -//#include "PsInlineAoS.h" - -#ifndef PX_PIDIV2 -#define PX_PIDIV2 1.570796327f -#endif - -////////////////////////////////// -// QuatV -////////////////////////////////// -PX_FORCE_INLINE QuatV QuatVLoadXYZW(const PxF32 x, const PxF32 y, const PxF32 z, const PxF32 w) -{ - return V4LoadXYZW(x, y, z, w); -} - -PX_FORCE_INLINE QuatV QuatVLoadU(const PxF32* v) -{ - return V4LoadU(v); -} - -PX_FORCE_INLINE QuatV QuatVLoadA(const PxF32* v) -{ - return V4LoadA(v); -} - -PX_FORCE_INLINE QuatV QuatV_From_RotationAxisAngle(const Vec3V u, const FloatV a) -{ - // q = cos(a/2) + u*sin(a/2) - const FloatV half = FLoad(0.5f); - const FloatV hangle = FMul(a, half); - const FloatV piByTwo(FLoad(PX_PIDIV2)); - const FloatV PiByTwoMinHangle(FSub(piByTwo, hangle)); - const Vec4V hangle2(Vec4V_From_Vec3V(V3Merge(hangle, PiByTwoMinHangle, hangle))); - - /*const FloatV sina = FSin(hangle); - const FloatV cosa = FCos(hangle);*/ - - const Vec4V _sina = V4Sin(hangle2); - const FloatV sina = V4GetX(_sina); - const FloatV cosa = V4GetY(_sina); - - const Vec3V v = V3Scale(u, sina); - // return V4Sel(BTTTF(), Vec4V_From_Vec3V(v), V4Splat(cosa)); - return V4SetW(Vec4V_From_Vec3V(v), cosa); -} - -// Normalize -PX_FORCE_INLINE QuatV QuatNormalize(const QuatV q) -{ - return V4Normalize(q); -} - -PX_FORCE_INLINE FloatV QuatLength(const QuatV q) -{ - return V4Length(q); -} - -PX_FORCE_INLINE FloatV QuatLengthSq(const QuatV q) -{ - return V4LengthSq(q); -} - -PX_FORCE_INLINE FloatV QuatDot(const QuatV a, const QuatV b) // convert this PxQuat to a unit quaternion -{ - return V4Dot(a, b); -} - -PX_FORCE_INLINE QuatV QuatConjugate(const QuatV q) -{ - return V4SetW(V4Neg(q), V4GetW(q)); -} - -PX_FORCE_INLINE Vec3V QuatGetImaginaryPart(const QuatV q) -{ - return Vec3V_From_Vec4V(q); -} - -/** brief computes rotation of x-axis */ -PX_FORCE_INLINE Vec3V QuatGetBasisVector0(const QuatV q) -{ - /*const PxF32 x2 = x*2.0f; - const PxF32 w2 = w*2.0f; - return PxVec3( (w * w2) - 1.0f + x*x2, - (z * w2) + y*x2, - (-y * w2) + z*x2);*/ - - const FloatV two = FLoad(2.f); - const FloatV w = V4GetW(q); - const Vec3V u = Vec3V_From_Vec4V(q); - - const FloatV x2 = FMul(V3GetX(u), two); - const FloatV w2 = FMul(w, two); - - const Vec3V a = V3Scale(u, x2); - const Vec3V tmp = V3Merge(w, V3GetZ(u), FNeg(V3GetY(u))); - // const Vec3V b = V3Scale(tmp, w2); - // const Vec3V ab = V3Add(a, b); - const Vec3V ab = V3ScaleAdd(tmp, w2, a); - return V3SetX(ab, FSub(V3GetX(ab), FOne())); -} - -/** brief computes rotation of y-axis */ -PX_FORCE_INLINE Vec3V QuatGetBasisVector1(const QuatV q) -{ - /*const PxF32 y2 = y*2.0f; - const PxF32 w2 = w*2.0f; - return PxVec3( (-z * w2) + x*y2, - (w * w2) - 1.0f + y*y2, - (x * w2) + z*y2);*/ - - const FloatV two = FLoad(2.f); - const FloatV w = V4GetW(q); - const Vec3V u = Vec3V_From_Vec4V(q); - - const FloatV y2 = FMul(V3GetY(u), two); - const FloatV w2 = FMul(w, two); - - const Vec3V a = V3Scale(u, y2); - const Vec3V tmp = V3Merge(FNeg(V3GetZ(u)), w, V3GetX(u)); - // const Vec3V b = V3Scale(tmp, w2); - // const Vec3V ab = V3Add(a, b); - const Vec3V ab = V3ScaleAdd(tmp, w2, a); - return V3SetY(ab, FSub(V3GetY(ab), FOne())); -} - -/** brief computes rotation of z-axis */ -PX_FORCE_INLINE Vec3V QuatGetBasisVector2(const QuatV q) -{ - /*const PxF32 z2 = z*2.0f; - const PxF32 w2 = w*2.0f; - return PxVec3( (y * w2) + x*z2, - (-x * w2) + y*z2, - (w * w2) - 1.0f + z*z2);*/ - - const FloatV two = FLoad(2.f); - const FloatV w = V4GetW(q); - const Vec3V u = Vec3V_From_Vec4V(q); - - const FloatV z2 = FMul(V3GetZ(u), two); - const FloatV w2 = FMul(w, two); - - const Vec3V a = V3Scale(u, z2); - const Vec3V tmp = V3Merge(V3GetY(u), FNeg(V3GetX(u)), w); - /*const Vec3V b = V3Scale(tmp, w2); - const Vec3V ab = V3Add(a, b);*/ - const Vec3V ab = V3ScaleAdd(tmp, w2, a); - return V3SetZ(ab, FSub(V3GetZ(ab), FOne())); -} - -PX_FORCE_INLINE Vec3V QuatRotate(const QuatV q, const Vec3V v) -{ - /* - const PxVec3 qv(x,y,z); - return (v*(w*w-0.5f) + (qv.cross(v))*w + qv*(qv.dot(v)))*2; - */ - - const FloatV two = FLoad(2.f); - // const FloatV half = FloatV_From_F32(0.5f); - const FloatV nhalf = FLoad(-0.5f); - const Vec3V u = Vec3V_From_Vec4V(q); - const FloatV w = V4GetW(q); - // const FloatV w2 = FSub(FMul(w, w), half); - const FloatV w2 = FScaleAdd(w, w, nhalf); - const Vec3V a = V3Scale(v, w2); - // const Vec3V b = V3Scale(V3Cross(u, v), w); - // const Vec3V c = V3Scale(u, V3Dot(u, v)); - // return V3Scale(V3Add(V3Add(a, b), c), two); - const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); - return V3Scale(V3ScaleAdd(u, V3Dot(u, v), temp), two); -} - -PX_FORCE_INLINE Vec3V QuatTransform(const QuatV q, const Vec3V p, const Vec3V v) -{ - // p + q.rotate(v) - const FloatV two = FLoad(2.f); - // const FloatV half = FloatV_From_F32(0.5f); - const FloatV nhalf = FLoad(-0.5f); - const Vec3V u = Vec3V_From_Vec4V(q); - const FloatV w = V4GetW(q); - // const FloatV w2 = FSub(FMul(w, w), half); - const FloatV w2 = FScaleAdd(w, w, nhalf); - const Vec3V a = V3Scale(v, w2); - /*const Vec3V b = V3Scale(V3Cross(u, v), w); - const Vec3V c = V3Scale(u, V3Dot(u, v)); - return V3ScaleAdd(V3Add(V3Add(a, b), c), two, p);*/ - const Vec3V temp = V3ScaleAdd(V3Cross(u, v), w, a); - const Vec3V z = V3ScaleAdd(u, V3Dot(u, v), temp); - return V3ScaleAdd(z, two, p); -} - -PX_FORCE_INLINE Vec3V QuatRotateInv(const QuatV q, const Vec3V v) -{ - - // const PxVec3 qv(x,y,z); - // return (v*(w*w-0.5f) - (qv.cross(v))*w + qv*(qv.dot(v)))*2; - - const FloatV two = FLoad(2.f); - const FloatV nhalf = FLoad(-0.5f); - const Vec3V u = Vec3V_From_Vec4V(q); - const FloatV w = V4GetW(q); - const FloatV w2 = FScaleAdd(w, w, nhalf); - const Vec3V a = V3Scale(v, w2); - /*const Vec3V b = V3Scale(V3Cross(u, v), w); - const Vec3V c = V3Scale(u, V3Dot(u, v)); - return V3Scale(V3Add(V3Sub(a, b), c), two);*/ - const Vec3V temp = V3NegScaleSub(V3Cross(u, v), w, a); - return V3Scale(V3ScaleAdd(u, V3Dot(u, v), temp), two); -} - -PX_FORCE_INLINE QuatV QuatMul(const QuatV a, const QuatV b) -{ - const Vec3V imagA = Vec3V_From_Vec4V(a); - const Vec3V imagB = Vec3V_From_Vec4V(b); - const FloatV rA = V4GetW(a); - const FloatV rB = V4GetW(b); - - const FloatV real = FSub(FMul(rA, rB), V3Dot(imagA, imagB)); - const Vec3V v0 = V3Scale(imagA, rB); - const Vec3V v1 = V3Scale(imagB, rA); - const Vec3V v2 = V3Cross(imagA, imagB); - const Vec3V imag = V3Add(V3Add(v0, v1), v2); - - return V4SetW(Vec4V_From_Vec3V(imag), real); -} - -PX_FORCE_INLINE QuatV QuatAdd(const QuatV a, const QuatV b) -{ - return V4Add(a, b); -} - -PX_FORCE_INLINE QuatV QuatNeg(const QuatV q) -{ - return V4Neg(q); -} - -PX_FORCE_INLINE QuatV QuatSub(const QuatV a, const QuatV b) -{ - return V4Sub(a, b); -} - -PX_FORCE_INLINE QuatV QuatScale(const QuatV a, const FloatV b) -{ - return V4Scale(a, b); -} - -PX_FORCE_INLINE QuatV QuatMerge(const FloatV* const floatVArray) -{ - return V4Merge(floatVArray); -} - -PX_FORCE_INLINE QuatV QuatMerge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) -{ - return V4Merge(x, y, z, w); -} - -PX_FORCE_INLINE QuatV QuatIdentity() -{ - return V4SetW(V4Zero(), FOne()); -} - -PX_FORCE_INLINE bool isFiniteQuatV(const QuatV q) -{ - return isFiniteVec4V(q); -} - -PX_FORCE_INLINE bool isValidQuatV(const QuatV q) -{ - const FloatV unitTolerance = FLoad(1e-4f); - const FloatV tmp = FAbs(FSub(QuatLength(q), FOne())); - const BoolV con = FIsGrtr(unitTolerance, tmp); - return isFiniteVec4V(q) & (BAllEqTTTT(con) == 1); -} - -PX_FORCE_INLINE bool isSaneQuatV(const QuatV q) -{ - const FloatV unitTolerance = FLoad(1e-2f); - const FloatV tmp = FAbs(FSub(QuatLength(q), FOne())); - const BoolV con = FIsGrtr(unitTolerance, tmp); - return isFiniteVec4V(q) & (BAllEqTTTT(con) == 1); -} - -PX_FORCE_INLINE Mat33V QuatGetMat33V(const QuatVArg q) -{ - // const FloatV two = FloatV_From_F32(2.f); - // const FloatV one = FOne(); - - // const FloatV x = V4GetX(q); - // const FloatV y = V4GetY(q); - // const FloatV z = V4GetZ(q); - // const Vec4V _q = V4Mul(q, two); - // - ////const FloatV w = V4GetW(q); - - // const Vec4V t0 = V4Mul(_q, x); // 2xx, 2xy, 2xz, 2xw - // const Vec4V t1 = V4Mul(_q, y); // 2xy, 2yy, 2yz, 2yw - // const Vec4V t2 = V4Mul(_q, z); // 2xz, 2yz, 2zz, 2zw - ////const Vec4V t3 = V4Mul(_q, w); // 2xw, 2yw, 2zw, 2ww - - // const FloatV xx2 = V4GetX(t0); - // const FloatV xy2 = V4GetY(t0); - // const FloatV xz2 = V4GetZ(t0); - // const FloatV xw2 = V4GetW(t0); - - // const FloatV yy2 = V4GetY(t1); - // const FloatV yz2 = V4GetZ(t1); - // const FloatV yw2 = V4GetW(t1); - - // const FloatV zz2 = V4GetZ(t2); - // const FloatV zw2 = V4GetW(t2); - - ////const FloatV ww2 = V4GetW(t3); - - // const FloatV c00 = FSub(one, FAdd(yy2, zz2)); - // const FloatV c01 = FSub(xy2, zw2); - // const FloatV c02 = FAdd(xz2, yw2); - - // const FloatV c10 = FAdd(xy2, zw2); - // const FloatV c11 = FSub(one, FAdd(xx2, zz2)); - // const FloatV c12 = FSub(yz2, xw2); - - // const FloatV c20 = FSub(xz2, yw2); - // const FloatV c21 = FAdd(yz2, xw2); - // const FloatV c22 = FSub(one, FAdd(xx2, yy2)); - - // const Vec3V c0 = V3Merge(c00, c10, c20); - // const Vec3V c1 = V3Merge(c01, c11, c21); - // const Vec3V c2 = V3Merge(c02, c12, c22); - - // return Mat33V(c0, c1, c2); - - const FloatV one = FOne(); - const FloatV x = V4GetX(q); - const FloatV y = V4GetY(q); - const FloatV z = V4GetZ(q); - const FloatV w = V4GetW(q); - - const FloatV x2 = FAdd(x, x); - const FloatV y2 = FAdd(y, y); - const FloatV z2 = FAdd(z, z); - - const FloatV xx = FMul(x2, x); - const FloatV yy = FMul(y2, y); - const FloatV zz = FMul(z2, z); - - const FloatV xy = FMul(x2, y); - const FloatV xz = FMul(x2, z); - const FloatV xw = FMul(x2, w); - - const FloatV yz = FMul(y2, z); - const FloatV yw = FMul(y2, w); - const FloatV zw = FMul(z2, w); - - const FloatV v = FSub(one, xx); - - const Vec3V column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); - const Vec3V column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); - const Vec3V column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); - return Mat33V(column0, column1, column2); -} - -PX_FORCE_INLINE QuatV Mat33GetQuatV(const Mat33V& a) -{ - const FloatV one = FOne(); - const FloatV zero = FZero(); - const FloatV half = FLoad(0.5f); - const FloatV two = FLoad(2.f); - const FloatV scale = FLoad(0.25f); - const FloatV a00 = V3GetX(a.col0); - const FloatV a11 = V3GetY(a.col1); - const FloatV a22 = V3GetZ(a.col2); - - const FloatV a21 = V3GetZ(a.col1); // row=2, col=1; - const FloatV a12 = V3GetY(a.col2); // row=1, col=2; - const FloatV a02 = V3GetX(a.col2); // row=0, col=2; - const FloatV a20 = V3GetZ(a.col0); // row=2, col=0; - const FloatV a10 = V3GetY(a.col0); // row=1, col=0; - const FloatV a01 = V3GetX(a.col1); // row=0, col=1; - - const Vec3V vec0 = V3Merge(a21, a02, a10); - const Vec3V vec1 = V3Merge(a12, a20, a01); - const Vec3V v = V3Sub(vec0, vec1); - const Vec3V g = V3Add(vec0, vec1); - - const FloatV trace = FAdd(a00, FAdd(a11, a22)); - - if(FAllGrtrOrEq(trace, zero)) - { - const FloatV h = FSqrt(FAdd(trace, one)); - const FloatV w = FMul(half, h); - const FloatV s = FMul(half, FRecip(h)); - const Vec3V u = V3Scale(v, s); - return V4SetW(Vec4V_From_Vec3V(u), w); - } - else - { - const FloatV ntrace = FNeg(trace); - const Vec3V d = V3Merge(a00, a11, a22); - const BoolV con0 = BAllTrue3(V3IsGrtrOrEq(V3Splat(a00), d)); - const BoolV con1 = BAllTrue3(V3IsGrtrOrEq(V3Splat(a11), d)); - - const FloatV t0 = FAdd(one, FScaleAdd(a00, two, ntrace)); - const FloatV t1 = FAdd(one, FScaleAdd(a11, two, ntrace)); - const FloatV t2 = FAdd(one, FScaleAdd(a22, two, ntrace)); - - const FloatV t = FSel(con0, t0, FSel(con1, t1, t2)); - - const FloatV h = FMul(two, FSqrt(t)); - const FloatV s = FRecip(h); - const FloatV g0 = FMul(scale, h); - const Vec3V vs = V3Scale(v, s); - const Vec3V gs = V3Scale(g, s); - const FloatV gsx = V3GetX(gs); - const FloatV gsy = V3GetY(gs); - const FloatV gsz = V3GetZ(gs); - // vs.x= (a21 - a12)*s; vs.y=(a02 - a20)*s; vs.z=(a10 - a01)*s; - // gs.x= (a21 + a12)*s; gs.y=(a02 + a20)*s; gs.z=(a10 + a01)*s; - const Vec4V v0 = V4Merge(g0, gsz, gsy, V3GetX(vs)); - const Vec4V v1 = V4Merge(gsz, g0, gsx, V3GetY(vs)); - const Vec4V v2 = V4Merge(gsy, gsx, g0, V3GetZ(vs)); - return V4Sel(con0, v0, V4Sel(con1, v1, v2)); - } -} - -#endif diff --git a/PxShared/src/foundation/include/PsVecTransform.h b/PxShared/src/foundation/include/PsVecTransform.h deleted file mode 100644 index 5c16339..0000000 --- a/PxShared/src/foundation/include/PsVecTransform.h +++ /dev/null @@ -1,283 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSVECTRANSFORM_H -#define PSFOUNDATION_PSVECTRANSFORM_H - -#include "PsVecMath.h" -#include "foundation/PxTransform.h" - -namespace physx -{ -namespace shdfnd -{ -namespace aos -{ - -class PsTransformV -{ - public: - QuatV q; - Vec3V p; - - PX_FORCE_INLINE PsTransformV(const PxTransform& orientation) - { - // const PxQuat oq = orientation.q; - // const PxF32 f[4] = {oq.x, oq.y, oq.z, oq.w}; - q = QuatVLoadXYZW(orientation.q.x, orientation.q.y, orientation.q.z, orientation.q.w); - // q = QuatV_From_F32Array(&oq.x); - p = V3LoadU(orientation.p); - } - - PX_FORCE_INLINE PsTransformV(const Vec3VArg p0 = V3Zero(), const QuatVArg q0 = QuatIdentity()) : q(q0), p(p0) - { - PX_ASSERT(isSaneQuatV(q0)); - } - - PX_FORCE_INLINE PsTransformV operator*(const PsTransformV& x) const - { - PX_ASSERT(x.isSane()); - return transform(x); - } - - PX_FORCE_INLINE PsTransformV getInverse() const - { - PX_ASSERT(isFinite()); - // return PxTransform(q.rotateInv(-p),q.getConjugate()); - return PsTransformV(QuatRotateInv(q, V3Neg(p)), QuatConjugate(q)); - } - - PX_FORCE_INLINE void normalize() - { - p = V3Zero(); - q = QuatIdentity(); - } - - PX_FORCE_INLINE void Invalidate() - { - p = V3Splat(FMax()); - q = QuatIdentity(); - } - - PX_FORCE_INLINE Vec3V transform(const Vec3VArg input) const - { - PX_ASSERT(isFinite()); - // return q.rotate(input) + p; - return QuatTransform(q, p, input); - } - - PX_FORCE_INLINE Vec3V transformInv(const Vec3VArg input) const - { - PX_ASSERT(isFinite()); - // return q.rotateInv(input-p); - return QuatRotateInv(q, V3Sub(input, p)); - } - - PX_FORCE_INLINE Vec3V rotate(const Vec3VArg input) const - { - PX_ASSERT(isFinite()); - // return q.rotate(input); - return QuatRotate(q, input); - } - - PX_FORCE_INLINE Vec3V rotateInv(const Vec3VArg input) const - { - PX_ASSERT(isFinite()); - // return q.rotateInv(input); - return QuatRotateInv(q, input); - } - - //! Transform transform to parent (returns compound transform: first src, then *this) - PX_FORCE_INLINE PsTransformV transform(const PsTransformV& src) const - { - PX_ASSERT(src.isSane()); - PX_ASSERT(isSane()); - // src = [srct, srcr] -> [r*srct + t, r*srcr] - // return PxTransform(q.rotate(src.p) + p, q*src.q); - return PsTransformV(V3Add(QuatRotate(q, src.p), p), QuatMul(q, src.q)); - } - - /** - \brief returns true if finite and q is a unit quaternion - */ - - PX_FORCE_INLINE bool isValid() const - { - // return p.isFinite() && q.isFinite() && q.isValid(); - return isFiniteVec3V(p) & isFiniteQuatV(q) & isValidQuatV(q); - } - - /** - \brief returns true if finite and quat magnitude is reasonably close to unit to allow for some accumulation of error - vs isValid - */ - - PX_FORCE_INLINE bool isSane() const - { - // return isFinite() && q.isSane(); - return isFinite() & isSaneQuatV(q); - } - - /** - \brief returns true if all elems are finite (not NAN or INF, etc.) - */ - PX_FORCE_INLINE bool isFinite() const - { - // return p.isFinite() && q.isFinite(); - return isFiniteVec3V(p) & isFiniteQuatV(q); - } - - //! Transform transform from parent (returns compound transform: first src, then this->inverse) - PX_FORCE_INLINE PsTransformV transformInv(const PsTransformV& src) const - { - PX_ASSERT(src.isSane()); - PX_ASSERT(isFinite()); - // src = [srct, srcr] -> [r^-1*(srct-t), r^-1*srcr] - /*PxQuat qinv = q.getConjugate(); - return PxTransform(qinv.rotate(src.p - p), qinv*src.q);*/ - const QuatV qinv = QuatConjugate(q); - const Vec3V v = QuatRotate(qinv, V3Sub(src.p, p)); - const QuatV rot = QuatMul(qinv, src.q); - return PsTransformV(v, rot); - } - - static PX_FORCE_INLINE PsTransformV createIdentity() - { - return PsTransformV(V3Zero()); - } -}; - -PX_FORCE_INLINE PsTransformV loadTransformA(const PxTransform& transform) -{ - const QuatV q0 = QuatVLoadA(&transform.q.x); - const Vec3V p0 = V3LoadA(&transform.p.x); - - return PsTransformV(p0, q0); -} - -PX_FORCE_INLINE PsTransformV loadTransformU(const PxTransform& transform) -{ - const QuatV q0 = QuatVLoadU(&transform.q.x); - const Vec3V p0 = V3LoadU(&transform.p.x); - - return PsTransformV(p0, q0); -} - -class PsMatTransformV -{ - public: - Mat33V rot; - Vec3V p; - - PX_FORCE_INLINE PsMatTransformV() - { - p = V3Zero(); - rot = M33Identity(); - } - PX_FORCE_INLINE PsMatTransformV(const Vec3VArg _p, const Mat33V& _rot) - { - p = _p; - rot = _rot; - } - - PX_FORCE_INLINE PsMatTransformV(const PsTransformV& other) - { - p = other.p; - QuatGetMat33V(other.q, rot.col0, rot.col1, rot.col2); - } - - PX_FORCE_INLINE PsMatTransformV(const Vec3VArg _p, const QuatV& quat) - { - p = _p; - QuatGetMat33V(quat, rot.col0, rot.col1, rot.col2); - } - - PX_FORCE_INLINE Vec3V getCol0() const - { - return rot.col0; - } - - PX_FORCE_INLINE Vec3V getCol1() const - { - return rot.col1; - } - - PX_FORCE_INLINE Vec3V getCol2() const - { - return rot.col2; - } - - PX_FORCE_INLINE void setCol0(const Vec3VArg col0) - { - rot.col0 = col0; - } - - PX_FORCE_INLINE void setCol1(const Vec3VArg col1) - { - rot.col1 = col1; - } - - PX_FORCE_INLINE void setCol2(const Vec3VArg col2) - { - rot.col2 = col2; - } - - PX_FORCE_INLINE Vec3V transform(const Vec3VArg input) const - { - return V3Add(p, M33MulV3(rot, input)); - } - - PX_FORCE_INLINE Vec3V transformInv(const Vec3VArg input) const - { - return M33TrnspsMulV3(rot, V3Sub(input, p)); // QuatRotateInv(q, V3Sub(input, p)); - } - - PX_FORCE_INLINE Vec3V rotate(const Vec3VArg input) const - { - return M33MulV3(rot, input); - } - - PX_FORCE_INLINE Vec3V rotateInv(const Vec3VArg input) const - { - return M33TrnspsMulV3(rot, input); - } - - PX_FORCE_INLINE PsMatTransformV transformInv(const PsMatTransformV& src) const - { - - const Vec3V v = M33TrnspsMulV3(rot, V3Sub(src.p, p)); - const Mat33V mat = M33MulM33(M33Trnsps(rot), src.rot); - return PsMatTransformV(v, mat); - } -}; -} -} -} - -#endif diff --git a/PxShared/src/foundation/include/unix/PsUnixAoS.h b/PxShared/src/foundation/include/unix/PsUnixAoS.h deleted file mode 100644 index 122879f..0000000 --- a/PxShared/src/foundation/include/unix/PsUnixAoS.h +++ /dev/null @@ -1,47 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXAOS_H -#define PSFOUNDATION_PSUNIXAOS_H - -// no includes here! this file should be included from PxcVecMath.h only!!! - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -#if PX_INTEL_FAMILY -#include "sse2/PsUnixSse2AoS.h" -#elif PX_NEON -#include "neon/PsUnixNeonAoS.h" -#else -#error No SIMD implementation for this unix platform. -#endif - -#endif // PSFOUNDATION_PSUNIXAOS_H diff --git a/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h b/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h deleted file mode 100644 index 74002d5..0000000 --- a/PxShared/src/foundation/include/unix/PsUnixInlineAoS.h +++ /dev/null @@ -1,45 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXINLINEAOS_H -#define PSFOUNDATION_PSUNIXINLINEAOS_H - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -#if PX_INTEL_FAMILY -#include "sse2/PsUnixSse2InlineAoS.h" -#elif PX_NEON -#include "neon/PsUnixNeonInlineAoS.h" -#else -#error No SIMD implementation for this unix platform. -#endif - -#endif // PSFOUNDATION_PSUNIXINLINEAOS_H diff --git a/PxShared/src/foundation/include/unix/PsUnixTrigConstants.h b/PxShared/src/foundation/include/unix/PsUnixTrigConstants.h deleted file mode 100644 index 7f54733..0000000 --- a/PxShared/src/foundation/include/unix/PsUnixTrigConstants.h +++ /dev/null @@ -1,82 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXTRIGCONSTANTS_H -#define PSFOUNDATION_PSUNIXTRIGCONSTANTS_H - -//#define PX_GLOBALCONST extern const __declspec(selectany) -#define PX_GLOBALCONST extern const __attribute__((weak)) - -PX_ALIGN_PREFIX(16) -struct PX_VECTORF32 -{ - float f[4]; -} PX_ALIGN_SUFFIX(16); - -PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXTanCoefficients0 = { { 1.0f, 0.333333333f, 0.133333333f, 5.396825397e-2f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXTanCoefficients1 = { { 2.186948854e-2f, 8.863235530e-3f, 3.592128167e-3f, 1.455834485e-3f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXTanCoefficients2 = { { 5.900274264e-4f, 2.391290764e-4f, 9.691537707e-5f, 3.927832950e-5f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinCoefficients0 = { { -0.05806367563904f, -0.41861972469416f, 0.22480114791621f, 2.17337241360606f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinCoefficients1 = { { 0.61657275907170f, 4.29696498283455f, -1.18942822255452f, -6.53784832094831f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinCoefficients2 = { { -1.36926553863413f, -4.48179294237210f, 1.41810672941833f, 5.48179257935713f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXATanCoefficients0 = { { 1.0f, 0.333333334f, 0.2f, 0.142857143f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXATanCoefficients1 = { { 1.111111111e-1f, 9.090909091e-2f, 7.692307692e-2f, 6.666666667e-2f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXATanCoefficients2 = { { 5.882352941e-2f, 5.263157895e-2f, 4.761904762e-2f, 4.347826087e-2f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXSinEstCoefficients = { { 1.0f, -1.66521856991541e-1f, 8.199913018755e-3f, -1.61475937228e-4f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXCosEstCoefficients = { { 1.0f, -4.95348008918096e-1f, 3.878259962881e-2f, -9.24587976263e-4f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXTanEstCoefficients = { { 2.484f, -1.954923183e-1f, 2.467401101f, PxInvPi } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXATanEstCoefficients = { { 7.689891418951e-1f, 1.104742493348f, 8.661844266006e-1f, PxPiDivTwo } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinEstCoefficients = { { -1.36178272886711f, 2.37949493464538f, -8.08228565650486e-1f, 2.78440142746736e-1f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXASinEstConstants = { { 1.00000011921f, PxPiDivTwo, 0.0f, 0.0f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXPiConstants0 = { { PxPi, PxTwoPi, PxInvPi, PxInvTwoPi } }; -PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } }; -PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } }; - -#endif diff --git a/PxShared/src/foundation/include/unix/neon/PsUnixNeonAoS.h b/PxShared/src/foundation/include/unix/neon/PsUnixNeonAoS.h deleted file mode 100644 index 60a5be8..0000000 --- a/PxShared/src/foundation/include/unix/neon/PsUnixNeonAoS.h +++ /dev/null @@ -1,129 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXNEONAOS_H -#define PSFOUNDATION_PSUNIXNEONAOS_H - -// no includes here! this file should be included from PxcVecMath.h only!!! - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -// only ARM NEON compatible platforms should reach this -#include <arm_neon.h> - -typedef float32x2_t FloatV; -typedef float32x4_t Vec3V; -typedef float32x4_t Vec4V; -typedef uint32x4_t BoolV; -typedef float32x4_t QuatV; - -typedef uint32x4_t VecU32V; -typedef int32x4_t VecI32V; -typedef uint16x8_t VecU16V; -typedef int16x8_t VecI16V; -typedef uint8x16_t VecU8V; - -#define FloatVArg FloatV & -#define Vec3VArg Vec3V & -#define Vec4VArg Vec4V & -#define BoolVArg BoolV & -#define VecU32VArg VecU32V & -#define VecI32VArg VecI32V & -#define VecU16VArg VecU16V & -#define VecI16VArg VecI16V & -#define VecU8VArg VecU8V & -#define QuatVArg QuatV & - -// KS - TODO - make an actual VecCrossV type for NEON -#define VecCrossV Vec3V - -typedef VecI32V VecShiftV; -#define VecShiftVArg VecShiftV & - -PX_ALIGN_PREFIX(16) -struct Mat33V -{ - Mat33V() - { - } - Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec3V PX_ALIGN(16, col0); - Vec3V PX_ALIGN(16, col1); - Vec3V PX_ALIGN(16, col2); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat34V -{ - Mat34V() - { - } - Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec3V PX_ALIGN(16, col0); - Vec3V PX_ALIGN(16, col1); - Vec3V PX_ALIGN(16, col2); - Vec3V PX_ALIGN(16, col3); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat43V -{ - Mat43V() - { - } - Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec4V PX_ALIGN(16, col0); - Vec4V PX_ALIGN(16, col1); - Vec4V PX_ALIGN(16, col2); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat44V -{ - Mat44V() - { - } - Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec4V PX_ALIGN(16, col0); - Vec4V PX_ALIGN(16, col1); - Vec4V PX_ALIGN(16, col2); - Vec4V PX_ALIGN(16, col3); -} PX_ALIGN_SUFFIX(16); - -#endif // PSFOUNDATION_PSUNIXNEONAOS_H diff --git a/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h b/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h deleted file mode 100644 index 4df3ff6..0000000 --- a/PxShared/src/foundation/include/unix/neon/PsUnixNeonInlineAoS.h +++ /dev/null @@ -1,3579 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXNEONINLINEAOS_H -#define PSFOUNDATION_PSUNIXNEONINLINEAOS_H - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -// improved estimates -#define VRECIPEQ recipq_newton<1> -#define VRECIPE recip_newton<1> -#define VRECIPSQRTEQ rsqrtq_newton<1> -#define VRECIPSQRTE rsqrt_newton<1> - -// "exact" -#define VRECIPQ recipq_newton<4> -#if PX_SWITCH -// StabilizationTests.AveragePoint needs more precision to succeed. -#define VRECIP recip_newton<5> -#else -#define VRECIP recip_newton<4> -#endif -#define VRECIPSQRTQ rsqrtq_newton<4> -#define VRECIPSQRT rsqrt_newton<4> - -#define VECMATH_AOS_EPSILON (1e-3f) - -////////////////////////////////////////////////////////////////////// -//Test that Vec3V and FloatV are legal -////////////////////////////////// - -#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f -PX_FORCE_INLINE bool isValidFloatV(const FloatV a) -{ - /* - PX_ALIGN(16, PxF32) data[4]; - vst1_f32(reinterpret_cast<float32_t*>(data), a); - return - PxU32* intData = reinterpret_cast<PxU32*>(data); - return intData[0] == intData[1]; - */ - PX_ALIGN(16, PxF32) data[4]; - vst1_f32(reinterpret_cast<float32_t*>(data), a); - const float32_t x = data[0]; - const float32_t y = data[1]; - - if (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) - { - return true; - } - - if (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) - { - return true; - } - - return false; -} - -PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) -{ - const float32_t w = vgetq_lane_f32(a, 3); - return (0.0f == w); - //const PxU32* intData = reinterpret_cast<const PxU32*>(&w); - //return *intData == 0; -} - -PX_FORCE_INLINE bool isAligned16(const void* a) -{ - return(0 == (size_t(a) & 0x0f)); -} - -#if PX_DEBUG -#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) -#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) -#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16(static_cast<const void*>(a))) -#else -#define ASSERT_ISVALIDVEC3V(a) -#define ASSERT_ISVALIDFLOATV(a) -#define ASSERT_ISALIGNED16(a) -#endif - -namespace internalUnitNeonSimd -{ -PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) -{ - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - const uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - return PxU32(vget_lane_u32(finalReduce, 0) == 0xffffFFFF); -} - -PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) -{ - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - const uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - return PxU32((vget_lane_u32(finalReduce, 0) & 0xffFFff) == 0xffFFff); -} - -PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) -{ - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - const uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - return PxU32(vget_lane_u32(finalReduce, 0) != 0x0); -} - -PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) -{ - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - const uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - return PxU32((vget_lane_u32(finalReduce, 0) & 0xffFFff) != 0); -} -} - -namespace _VecMathTests -{ -// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' -PX_FORCE_INLINE Vec3V getInvalidVec3V() -{ - PX_ALIGN(16, PxF32) data[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vget_lane_u32(vceq_f32(a, b), 0) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return V3AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) -{ - return V4AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) -{ - return internalUnitNeonSimd::BAllTrue4_R(vceqq_u32(a, b)) != 0; -} - -PX_FORCE_INLINE PxU32 V4U32AllEq(const VecU32V a, const VecU32V b) -{ - return internalUnitNeonSimd::BAllTrue4_R(V4IsEqU32(a, b)); -} - -PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) -{ - return V4U32AllEq(a, b) != 0; -} - -PX_FORCE_INLINE BoolV V4IsEqI32(const VecI32V a, const VecI32V b) -{ - return vceqq_s32(a, b); -} - -PX_FORCE_INLINE PxU32 V4I32AllEq(const VecI32V a, const VecI32V b) -{ - return internalUnitNeonSimd::BAllTrue4_R(V4IsEqI32(a, b)); -} - -PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) -{ - return V4I32AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - - const float32x2_t c = vsub_f32(a, b); - const float32x2_t error = vdup_n_f32(VECMATH_AOS_EPSILON); -// absolute compare abs(error) > abs(c) - const uint32x2_t greater = vcagt_f32(error, c); - const uint32x2_t min = vpmin_u32(greater, greater); - return vget_lane_u32(min, 0) != 0x0; -} - -PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - const float32x4_t c = vsubq_f32(a, b); - const float32x4_t error = vdupq_n_f32(VECMATH_AOS_EPSILON); -// absolute compare abs(error) > abs(c) - const uint32x4_t greater = vcagtq_f32(error, c); - return internalUnitNeonSimd::BAllTrue3_R(greater) != 0; -} - -PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) -{ - const float32x4_t c = vsubq_f32(a, b); - const float32x4_t error = vdupq_n_f32(VECMATH_AOS_EPSILON); -// absolute compare abs(error) > abs(c) - const uint32x4_t greater = vcagtq_f32(error, c); - return internalUnitNeonSimd::BAllTrue4_R(greater) != 0x0; -} -} - -#if 0 // debugging printfs -#include <stdio.h> -PX_FORCE_INLINE void printVec(const float32x4_t& v, const char* name) -{ - PX_ALIGN(16, float32_t) data[4]; - vst1q_f32(data, v); - printf("%s: (%f, %f, %f, %f)\n", name, data[0], data[1], data[2], data[3]); -} - -PX_FORCE_INLINE void printVec(const float32x2_t& v, const char* name) -{ - PX_ALIGN(16, float32_t) data[2]; - vst1_f32(data, v); - printf("%s: (%f, %f)\n", name, data[0], data[1]); -} - -PX_FORCE_INLINE void printVec(const uint32x4_t& v, const char* name) -{ - PX_ALIGN(16, uint32_t) data[4]; - vst1q_u32(data, v); - printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); -} - -PX_FORCE_INLINE void printVec(const uint16x8_t& v, const char* name) -{ - PX_ALIGN(16, uint16_t) data[8]; - vst1q_u16(data, v); - printf("%s: (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7]); -} - -PX_FORCE_INLINE void printVec(const int32x4_t& v, const char* name) -{ - PX_ALIGN(16, int32_t) data[4]; - vst1q_s32(data, v); - printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); -} - -PX_FORCE_INLINE void printVec(const int16x8_t& v, const char* name) -{ - PX_ALIGN(16, int16_t) data[8]; - vst1q_s16(data, v); - printf("%s: (0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3], - data[4], data[5], data[6], data[7]); -} - -PX_FORCE_INLINE void printVec(const uint16x4_t& v, const char* name) -{ - PX_ALIGN(16, uint16_t) data[4]; - vst1_u16(data, v); - printf("%s: (0x%x, 0x%x, 0x%x, 0x%x)\n", name, data[0], data[1], data[2], data[3]); -} - -PX_FORCE_INLINE void printVec(const uint32x2_t& v, const char* name) -{ - PX_ALIGN(16, uint32_t) data[2]; - vst1_u32(data, v); - printf("%s: (0x%x, 0x%x)\n", name, data[0], data[1]); -} - -PX_FORCE_INLINE void printVar(const PxU32 v, const char* name) -{ - printf("%s: 0x%x\n", name, v); -} - -PX_FORCE_INLINE void printVar(const PxF32 v, const char* name) -{ - printf("%s: %f\n", name, v); -} - -#define PRINT_VAR(X) printVar((X), #X) -#define PRINT_VEC(X) printVec((X), #X) -#define PRINT_VEC_TITLE(TITLE, X) printVec((X), TITLE #X) -#endif // debugging printf - -///////////////////////////////////////////////////////////////////// -////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) -{ - PX_ALIGN(16, PxF32) data[4]; - vst1_f32(reinterpret_cast<float32_t*>(data), a); - return PxIsFinite(data[0]) && PxIsFinite(data[1]); -} - -PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) -{ - PX_ALIGN(16, PxF32) data[4]; - vst1q_f32(reinterpret_cast<float32_t*>(data), a); - return PxIsFinite(data[0]) && PxIsFinite(data[1]) && PxIsFinite(data[2]); -} - -PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) -{ - PX_ALIGN(16, PxF32) data[4]; - vst1q_f32(reinterpret_cast<float32_t*>(data), a); - return PxIsFinite(data[0]) && PxIsFinite(data[1]) && PxIsFinite(data[2]) && PxIsFinite(data[3]); -} - -PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return vget_lane_u32(vreinterpret_u32_f32(a), 0) == 0; -} - -PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) -{ - const uint32x2_t dLow = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t dMin = vpmin_u32(dLow, dLow); - - return vget_lane_u32(dMin, 0) == 0 || vgetq_lane_u32(vreinterpretq_u32_f32(a), 2) == 0; -} - -PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) -{ - const uint32x2_t dHigh = vget_high_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t dLow = vget_low_u32(vreinterpretq_u32_f32(a)); - - const uint32x2_t dMin = vmin_u32(dHigh, dLow); - const uint32x2_t pairMin = vpmin_u32(dMin, dMin); - return vget_lane_u32(pairMin, 0) == 0; -} - -///////////////////////////////////////////////////////////////////// -////VECTORISED FUNCTION IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -PX_FORCE_INLINE FloatV FLoad(const PxF32 f) -{ - return vdup_n_f32(reinterpret_cast<const float32_t&>(f)); -} - -PX_FORCE_INLINE FloatV FLoadA(const PxF32* const f) -{ - ASSERT_ISALIGNED16(f); - return vld1_f32(reinterpret_cast<const float32_t*>(f)); -} - -PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) -{ - PX_ALIGN(16, PxF32) data[4] = { f, f, f, 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) -{ - return vdupq_n_f32(reinterpret_cast<const float32_t&>(f)); -} - -PX_FORCE_INLINE BoolV BLoad(const bool f) -{ - const PxU32 i = static_cast<PxU32>(-(static_cast<PxI32>(f))); - return vdupq_n_u32(i); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) -{ - PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* f) -{ - ASSERT_ISALIGNED16(f); - PX_ALIGN(16, PxF32) data[4] = { f[0], f[1], f[2], 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* f) -{ - PX_ALIGN(16, PxF32) data[4] = { f[0], f[1], f[2], 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) -{ - return vsetq_lane_f32(0.0f, v, 3); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(Vec4V v) -{ - return v; -} - -PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) -{ - return f; // ok if it is implemented as the same type. -} - -PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) -{ - return vcombine_f32(f, f); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) -{ - return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) -{ - return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) -{ - PX_ALIGN(16, PxF32) data[4] = { f.x, f.y, f.z, 0.0f }; - return V4LoadA(data); -} - -PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) -{ - return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); -} - -PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) -{ - V3StoreU(m.col0, out.column0); - V3StoreU(m.col1, out.column1); - V3StoreU(m.col2, out.column2); -} - -PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) -{ - ASSERT_ISALIGNED16(f); - return vld1q_f32(reinterpret_cast<const float32_t*>(f)); -} - -PX_FORCE_INLINE void V4StoreA(Vec4V a, PxF32* f) -{ - ASSERT_ISALIGNED16(f); - vst1q_f32(reinterpret_cast<float32_t*>(f), a); -} - -PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) -{ - PX_ALIGN(16, PxF32) f2[4]; - vst1q_f32(reinterpret_cast<float32_t*>(f2), a); - f[0] = f2[0]; - f[1] = f2[1]; - f[2] = f2[2]; - f[3] = f2[3]; -} - -PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* u) -{ - ASSERT_ISALIGNED16(u); - vst1q_u32(reinterpret_cast<uint32_t*>(u), a); -} - -PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) -{ - ASSERT_ISALIGNED16(u); - vst1q_u32(reinterpret_cast<uint32_t*>(u), uv); -} - -PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) -{ - ASSERT_ISALIGNED16(i); - vst1q_s32(reinterpret_cast<int32_t*>(i), iv); -} - -PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) -{ - return vld1q_f32(reinterpret_cast<const float32_t*>(f)); -} - -PX_FORCE_INLINE BoolV BLoad(const bool* const f) -{ - const PX_ALIGN(16, PxU32) b[4] = { static_cast<PxU32>(-static_cast<PxI32>(f[0])), - static_cast<PxU32>(-static_cast<PxI32>(f[1])), - static_cast<PxU32>(-static_cast<PxI32>(f[2])), - static_cast<PxU32>(-static_cast<PxI32>(f[3])) }; - return vld1q_u32(b); -} - -PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) -{ - ASSERT_ISVALIDFLOATV(a); - // vst1q_lane_f32(f, a, 0); // causes vst1 alignment bug - *f = vget_lane_f32(a, 0); -} - -PX_FORCE_INLINE void Store_From_BoolV(const BoolV a, PxU32* PX_RESTRICT f) -{ - *f = vget_lane_u32(vget_low_u32(a), 0); -} - -PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - PX_ALIGN(16, PxF32) f2[4]; - vst1q_f32(reinterpret_cast<float32_t*>(f2), a); - f = PxVec3(f2[0], f2[1], f2[2]); -} - -PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) -{ - PX_ALIGN(16, PxF32) f2[4]; - vst1q_f32(reinterpret_cast<float32_t*>(f2), a); - f = PxVec3(f2[0], f2[1], f2[2]); -} - -////////////////////////////////// -// FLOATV -////////////////////////////////// - -PX_FORCE_INLINE FloatV FZero() -{ - return FLoad(0.0f); -} - -PX_FORCE_INLINE FloatV FOne() -{ - return FLoad(1.0f); -} - -PX_FORCE_INLINE FloatV FHalf() -{ - return FLoad(0.5f); -} - -PX_FORCE_INLINE FloatV FEps() -{ - return FLoad(PX_EPS_REAL); -} - -PX_FORCE_INLINE FloatV FEps6() -{ - return FLoad(1e-6f); -} - -PX_FORCE_INLINE FloatV FMax() -{ - return FLoad(PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV FNegMax() -{ - return FLoad(-PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV IZero() -{ - return vreinterpret_f32_u32(vdup_n_u32(0)); -} - -PX_FORCE_INLINE FloatV IOne() -{ - return vreinterpret_f32_u32(vdup_n_u32(1)); -} - -PX_FORCE_INLINE FloatV ITwo() -{ - return vreinterpret_f32_u32(vdup_n_u32(2)); -} - -PX_FORCE_INLINE FloatV IThree() -{ - return vreinterpret_f32_u32(vdup_n_u32(3)); -} - -PX_FORCE_INLINE FloatV IFour() -{ - return vreinterpret_f32_u32(vdup_n_u32(4)); -} - -PX_FORCE_INLINE FloatV FNeg(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return vneg_f32(f); -} - -PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vadd_f32(a, b); -} - -PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vsub_f32(a, b); -} - -PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vmul_f32(a, b); -} - -template <int n> -PX_FORCE_INLINE float32x2_t recip_newton(const float32x2_t& in) -{ - float32x2_t recip = vrecpe_f32(in); - for(int i = 0; i < n; ++i) - recip = vmul_f32(recip, vrecps_f32(in, recip)); - return recip; -} - -template <int n> -PX_FORCE_INLINE float32x4_t recipq_newton(const float32x4_t& in) -{ - float32x4_t recip = vrecpeq_f32(in); - for(int i = 0; i < n; ++i) - recip = vmulq_f32(recip, vrecpsq_f32(recip, in)); - return recip; -} - -template <int n> -PX_FORCE_INLINE float32x2_t rsqrt_newton(const float32x2_t& in) -{ - float32x2_t rsqrt = vrsqrte_f32(in); - for(int i = 0; i < n; ++i) - rsqrt = vmul_f32(rsqrt, vrsqrts_f32(vmul_f32(rsqrt, rsqrt), in)); - return rsqrt; -} - -template <int n> -PX_FORCE_INLINE float32x4_t rsqrtq_newton(const float32x4_t& in) -{ - float32x4_t rsqrt = vrsqrteq_f32(in); - for(int i = 0; i < n; ++i) - rsqrt = vmulq_f32(rsqrt, vrsqrtsq_f32(vmulq_f32(rsqrt, rsqrt), in)); - return rsqrt; -} - -PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vmul_f32(a, VRECIP(b)); -} - -PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vmul_f32(a, VRECIPE(b)); -} - -PX_FORCE_INLINE FloatV FRecip(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return VRECIP(a); -} - -PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return VRECIPE(a); -} - -PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return VRECIPSQRT(a); -} - -PX_FORCE_INLINE FloatV FSqrt(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return FSel(FIsEq(a, FZero()), a, vmul_f32(a, VRECIPSQRT(a))); -} - -PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return VRECIPSQRTE(a); -} - -PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDFLOATV(c); - return vmla_f32(c, a, b); -} - -PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDFLOATV(c); - return vmls_f32(c, a, b); -} - -PX_FORCE_INLINE FloatV FAbs(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return vabs_f32(a); -} - -PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) -{ - PX_ASSERT( _VecMathTests::allElementsEqualBoolV(c, BTTTT()) || - _VecMathTests::allElementsEqualBoolV(c, BFFFF())); - ASSERT_ISVALIDFLOATV(vbsl_f32(vget_low_u32(c), a, b)); - return vbsl_f32(vget_low_u32(c), a, b); -} - -PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vdupq_lane_u32(vcgt_f32(a, b), 0); -} - -PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vdupq_lane_u32(vcge_f32(a, b), 0); -} - -PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vdupq_lane_u32(vceq_f32(a, b), 0); -} - -PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) -{ - //ASSERT_ISVALIDFLOATV(a); - //ASSERT_ISVALIDFLOATV(b); - return vmax_f32(a, b); -} - -PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) -{ - //ASSERT_ISVALIDFLOATV(a); - //ASSERT_ISVALIDFLOATV(b); - return vmin_f32(a, b); -} - -PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) -{ - ASSERT_ISVALIDFLOATV(minV); - ASSERT_ISVALIDFLOATV(maxV); - return vmax_f32(vmin_f32(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vget_lane_u32(vcgt_f32(a, b), 0); -} - -PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vget_lane_u32(vcge_f32(a, b), 0); -} - -PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return vget_lane_u32(vceq_f32(a, b), 0); -} - -PX_FORCE_INLINE FloatV FRound(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - - // truncate(a + (0.5f - sign(a))) - const float32x2_t half = vdup_n_f32(0.5f); - const float32x2_t sign = vcvt_f32_u32((vshr_n_u32(vreinterpret_u32_f32(a), 31))); - const float32x2_t aPlusHalf = vadd_f32(a, half); - const float32x2_t aRound = vsub_f32(aPlusHalf, sign); - int32x2_t tmp = vcvt_s32_f32(aRound); - return vcvt_f32_s32(tmp); -} - -PX_FORCE_INLINE FloatV FSin(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const FloatV recipTwoPi = FLoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = FLoadA(g_PXTwoPi.f); - const FloatV tmp = FMul(a, recipTwoPi); - const FloatV b = FRound(tmp); - const FloatV V1 = FNegScaleSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const FloatV V2 = FMul(V1, V1); - const FloatV V3 = FMul(V2, V1); - const FloatV V5 = FMul(V3, V2); - const FloatV V7 = FMul(V5, V2); - const FloatV V9 = FMul(V7, V2); - const FloatV V11 = FMul(V9, V2); - const FloatV V13 = FMul(V11, V2); - const FloatV V15 = FMul(V13, V2); - const FloatV V17 = FMul(V15, V2); - const FloatV V19 = FMul(V17, V2); - const FloatV V21 = FMul(V19, V2); - const FloatV V23 = FMul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - FloatV Result; - Result = FScaleAdd(S1, V3, V1); - Result = FScaleAdd(S2, V5, Result); - Result = FScaleAdd(S3, V7, Result); - Result = FScaleAdd(S4, V9, Result); - Result = FScaleAdd(S5, V11, Result); - Result = FScaleAdd(S6, V13, Result); - Result = FScaleAdd(S7, V15, Result); - Result = FScaleAdd(S8, V17, Result); - Result = FScaleAdd(S9, V19, Result); - Result = FScaleAdd(S10, V21, Result); - Result = FScaleAdd(S11, V23, Result); - - return Result; -} - -PX_FORCE_INLINE FloatV FCos(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const FloatV recipTwoPi = FLoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = FLoadA(g_PXTwoPi.f); - const FloatV tmp = FMul(a, recipTwoPi); - const FloatV b = FRound(tmp); - const FloatV V1 = FNegScaleSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const FloatV V2 = FMul(V1, V1); - const FloatV V4 = FMul(V2, V2); - const FloatV V6 = FMul(V4, V2); - const FloatV V8 = FMul(V4, V4); - const FloatV V10 = FMul(V6, V4); - const FloatV V12 = FMul(V6, V6); - const FloatV V14 = FMul(V8, V6); - const FloatV V16 = FMul(V8, V8); - const FloatV V18 = FMul(V10, V8); - const FloatV V20 = FMul(V10, V10); - const FloatV V22 = FMul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - FloatV Result; - Result = FScaleAdd(C1, V2, FOne()); - Result = FScaleAdd(C2, V4, Result); - Result = FScaleAdd(C3, V6, Result); - Result = FScaleAdd(C4, V8, Result); - Result = FScaleAdd(C5, V10, Result); - Result = FScaleAdd(C6, V12, Result); - Result = FScaleAdd(C7, V14, Result); - Result = FScaleAdd(C8, V16, Result); - Result = FScaleAdd(C9, V18, Result); - Result = FScaleAdd(C10, V20, Result); - Result = FScaleAdd(C11, V22, Result); - - return Result; -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(min); - ASSERT_ISVALIDFLOATV(max); - - const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); - return PxU32(!BAllEqFFFF(c)); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(min); - ASSERT_ISVALIDFLOATV(max); - - const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); - return PxU32(BAllEqTTTT(c)); -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(bounds); - const uint32x2_t greater = vcagt_f32(a, bounds); - return vget_lane_u32(greater, 0); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(bounds); - const uint32x2_t geq = vcage_f32(bounds, a); - return vget_lane_u32(geq, 0); -} - -////////////////////////////////// -// VEC3V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - - const uint32x2_t mask = { 0xffffFFFF, 0x0 }; - - const uint32x2_t uHigh = vreinterpret_u32_f32(f); - const float32x2_t dHigh = vreinterpret_f32_u32(vand_u32(uHigh, mask)); - - return vcombine_f32(f, dHigh); -} - -PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) -{ - ASSERT_ISVALIDFLOATV(x); - ASSERT_ISVALIDFLOATV(y); - ASSERT_ISVALIDFLOATV(z); - - const uint32x2_t mask = { 0xffffFFFF, 0x0 }; - - const uint32x2_t dHigh = vand_u32(vreinterpret_u32_f32(z), mask); - const uint32x2_t dLow = vext_u32(vreinterpret_u32_f32(x), vreinterpret_u32_f32(y), 1); - return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); -} - -PX_FORCE_INLINE Vec3V V3UnitX() -{ - const float32x4_t x = { 1.0f, 0.0f, 0.0f, 0.0f }; - return x; -} - -PX_FORCE_INLINE Vec3V V3UnitY() -{ - const float32x4_t y = { 0, 1.0f, 0, 0 }; - return y; -} - -PX_FORCE_INLINE Vec3V V3UnitZ() -{ - const float32x4_t z = { 0, 0, 1.0f, 0 }; - return z; -} - -PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - const float32x2_t fLow = vget_low_f32(f); - return vdup_lane_f32(fLow, 0); -} - -PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - const float32x2_t fLow = vget_low_f32(f); - return vdup_lane_f32(fLow, 1); -} - -PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - const float32x2_t fhigh = vget_high_f32(f); - return vdup_lane_f32(fhigh, 0); -} - -PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BFTTT(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTFTT(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTFT(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - - const float32x2_t aLow = vget_low_f32(a); - const float32x2_t bLow = vget_low_f32(b); - const float32x2_t cLow = vget_low_f32(c); - const float32x2_t zero = vdup_n_f32(0.0f); - - const float32x2x2_t zipL = vzip_f32(aLow, bLow); - const float32x2x2_t zipH = vzip_f32(cLow, zero); - - return vcombine_f32(zipL.val[0], zipH.val[0]); -} - -PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - - const float32x2_t aLow = vget_low_f32(a); - const float32x2_t bLow = vget_low_f32(b); - const float32x2_t cLow = vget_low_f32(c); - const float32x2_t zero = vdup_n_f32(0.0f); - - const float32x2x2_t zipL = vzip_f32(aLow, bLow); - const float32x2x2_t zipH = vzip_f32(cLow, zero); - - return vcombine_f32(zipL.val[1], zipH.val[1]); -} - -PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - - const float32x2_t aHi = vget_high_f32(a); - const float32x2_t bHi = vget_high_f32(b); - const float32x2_t cHi = vget_high_f32(c); - - const float32x2x2_t zipL = vzip_f32(aHi, bHi); - - return vcombine_f32(zipL.val[0], cHi); -} - -PX_FORCE_INLINE Vec3V V3Zero() -{ - return vdupq_n_f32(0.0f); -} - -PX_FORCE_INLINE Vec3V V3Eps() -{ - return V3Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec3V V3One() -{ - return V3Load(1.0f); -} - -PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - const float32x4_t tmp = vnegq_f32(f); - return vsetq_lane_f32(0.0f, tmp, 3); -} - -PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vaddq_f32(a, b); -} - -PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return vaddq_f32(a, Vec3V_From_FloatV(b)); -} - -PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vsubq_f32(a, b); -} - -PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return vsubq_f32(a, Vec3V_From_FloatV(b)); -} - -PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - const float32x4_t tmp = vmulq_lane_f32(a, b, 0); - return vsetq_lane_f32(0.0f, tmp, 3); -} - -PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vmulq_f32(a, b); -} - -PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - const float32x2_t invB = VRECIP(b); - const float32x4_t tmp = vmulq_lane_f32(a, invB, 0); - return vsetq_lane_f32(0.0f, tmp, 3); -} - -PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - float32x4_t invB = VRECIPQ(b); - invB = vsetq_lane_f32(0.0f, invB, 3); - return vmulq_f32(a, invB); -} - -PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - const float32x2_t invB = VRECIPE(b); - const float32x4_t tmp = vmulq_lane_f32(a, invB, 0); - return vsetq_lane_f32(0.0f, tmp, 3); -} - -PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - float32x4_t invB = VRECIPEQ(b); - invB = vsetq_lane_f32(0.0f, invB, 3); - return vmulq_f32(a, invB); -} - -PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const float32x4_t recipA = VRECIPQ(a); - return vsetq_lane_f32(0.0f, recipA, 3); -} - -PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const float32x4_t recipA = VRECIPEQ(a); - return vsetq_lane_f32(0.0f, recipA, 3); -} - -PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const float32x4_t rSqrA = VRECIPSQRTQ(a); - return vsetq_lane_f32(0.0f, rSqrA, 3); -} - -PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const float32x4_t rSqrA = VRECIPSQRTEQ(a); - return vsetq_lane_f32(0.0f, rSqrA, 3); -} - -PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDVEC3V(c); - - float32x4_t tmp = vmlaq_lane_f32(c, a, b, 0); - // using vsetq_lane_f32 resulted in failures, - // probably related to a compiler bug on - // ndk r9d-win32, gcc 4.8, cardhu/shield - - // code with issue - // return vsetq_lane_f32(0.0f, tmp, 3); - - // workaround - float32x2_t w_z = vget_high_f32(tmp); - float32x2_t y_x = vget_low_f32(tmp); - w_z = vset_lane_f32(0.0f, w_z, 1); - return vcombine_f32(y_x, w_z); -} - -PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDVEC3V(c); - - float32x4_t tmp = vmlsq_lane_f32(c, a, b, 0); - // using vsetq_lane_f32 resulted in failures, - // probably related to a compiler bug on - // ndk r9d-win32, gcc 4.8, cardhu/shield - - // code with issue - // return vsetq_lane_f32(0.0f, tmp, 3); - - // workaround - float32x2_t w_z = vget_high_f32(tmp); - float32x2_t y_x = vget_low_f32(tmp); - w_z = vset_lane_f32(0.0f, w_z, 1); - return vcombine_f32(y_x, w_z); -} - -PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - return vmlaq_f32(c, a, b); -} - -PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - return vmlsq_f32(c, a, b); -} - -PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return vabsq_f32(a); -} - -PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - - // const uint32x2_t mask = {0xffffFFFF, 0x0}; - const float32x4_t tmp = vmulq_f32(a, b); - - const float32x2_t low = vget_low_f32(tmp); - const float32x2_t high = vget_high_f32(tmp); - // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); - - const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} - const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} - - return sum0ZYX; -} - -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - - const uint32x2_t TF = { 0xffffFFFF, 0x0 }; - const float32x2_t ay_ax = vget_low_f32(a); // d2 - const float32x2_t aw_az = vget_high_f32(a); // d3 - const float32x2_t by_bx = vget_low_f32(b); // d4 - const float32x2_t bw_bz = vget_high_f32(b); // d5 - // Hi, Lo - const float32x2_t bz_by = vext_f32(by_bx, bw_bz, 1); // bz, by - const float32x2_t az_ay = vext_f32(ay_ax, aw_az, 1); // az, ay - - const float32x2_t azbx = vmul_f32(aw_az, by_bx); // 0, az*bx - const float32x2_t aybz_axby = vmul_f32(ay_ax, bz_by); // ay*bz, ax*by - - const float32x2_t azbxSUBaxbz = vmls_f32(azbx, bw_bz, ay_ax); // 0, az*bx-ax*bz - const float32x2_t aybzSUBazby_axbySUBaybx = vmls_f32(aybz_axby, by_bx, az_ay); // ay*bz-az*by, ax*by-ay*bx - - const float32x2_t retLow = vext_f32(aybzSUBazby_axbySUBaybx, azbxSUBaxbz, 1); // az*bx-ax*bz, ay*bz-az*by - const uint32x2_t retHigh = vand_u32(TF, vreinterpret_u32_f32(aybzSUBazby_axbySUBaybx)); // 0, ax*by-ay*bx - - return vcombine_f32(retLow, vreinterpret_f32_u32(retHigh)); -} - -PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return a; -} - -PX_FORCE_INLINE FloatV V3Length(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // const uint32x2_t mask = {0xffffFFFF, 0x0}; - - const float32x4_t tmp = vmulq_f32(a, a); - const float32x2_t low = vget_low_f32(tmp); - const float32x2_t high = vget_high_f32(tmp); - // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); - - const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} - const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} - - return FSqrt(sum0ZYX); -} - -PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return V3Dot(a, a); -} - -PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); - return V3ScaleInv(a, V3Length(a)); -} - -PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); - return V3Scale(a, VRECIPSQRTE(V3Dot(a, a))); -} - -PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) -{ - ASSERT_ISVALIDVEC3V(a); - const FloatV zero = vdup_n_f32(0.0f); - const FloatV length = V3Length(a); - const uint32x4_t isGreaterThanZero = FIsGrtr(length, zero); - return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); -} - -PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V( vbslq_f32(c, a, b)); - return vbslq_f32(c, a, b); -} - -PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vcgtq_f32(a, b); -} - -PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vcgeq_f32(a, b); -} - -PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vceqq_f32(a, b); -} - -PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vmaxq_f32(a, b); -} - -PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return vminq_f32(a, b); -} - -PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - const float32x2_t low = vget_low_f32(a); - const float32x2_t high = vget_high_f32(a); - - const float32x2_t zz = vdup_lane_f32(high, 0); - const float32x2_t max0 = vpmax_f32(zz, low); - const float32x2_t max1 = vpmax_f32(max0, max0); - - return max1; -} - -PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - const float32x2_t low = vget_low_f32(a); - const float32x2_t high = vget_high_f32(a); - - const float32x2_t zz = vdup_lane_f32(high, 0); - const float32x2_t min0 = vpmin_f32(zz, low); - const float32x2_t min1 = vpmin_f32(min0, min0); - - return min1; -} - -// return (a >= 0.0f) ? 1.0f : -1.0f; -PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const Vec3V zero = V3Zero(); - const Vec3V one = V3One(); - const Vec3V none = V3Neg(one); - return V3Sel(V3IsGrtrOrEq(a, zero), one, none); -} - -PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) -{ - ASSERT_ISVALIDVEC3V(minV); - ASSERT_ISVALIDVEC3V(maxV); - return V3Max(V3Min(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalUnitNeonSimd::BAllTrue3_R(V4IsEq(a, b)); -} - -PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - // truncate(a + (0.5f - sign(a))) - const Vec3V half = V3Load(0.5f); - const float32x4_t sign = vcvtq_f32_u32((vshrq_n_u32(vreinterpretq_u32_f32(a), 31))); - const Vec3V aPlusHalf = V3Add(a, half); - const Vec3V aRound = V3Sub(aPlusHalf, sign); - return vcvtq_f32_s32(vcvtq_s32_f32(aRound)); -} - -PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec3V tmp = V4Mul(a, recipTwoPi); - const Vec3V b = V3Round(tmp); - const Vec3V V1 = V4NegMulSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const Vec3V V2 = V3Mul(V1, V1); - const Vec3V V3 = V3Mul(V2, V1); - const Vec3V V5 = V3Mul(V3, V2); - const Vec3V V7 = V3Mul(V5, V2); - const Vec3V V9 = V3Mul(V7, V2); - const Vec3V V11 = V3Mul(V9, V2); - const Vec3V V13 = V3Mul(V11, V2); - const Vec3V V15 = V3Mul(V13, V2); - const Vec3V V17 = V3Mul(V15, V2); - const Vec3V V19 = V3Mul(V17, V2); - const Vec3V V21 = V3Mul(V19, V2); - const Vec3V V23 = V3Mul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - Vec3V Result; - Result = V4ScaleAdd(V3, S1, V1); - Result = V4ScaleAdd(V5, S2, Result); - Result = V4ScaleAdd(V7, S3, Result); - Result = V4ScaleAdd(V9, S4, Result); - Result = V4ScaleAdd(V11, S5, Result); - Result = V4ScaleAdd(V13, S6, Result); - Result = V4ScaleAdd(V15, S7, Result); - Result = V4ScaleAdd(V17, S8, Result); - Result = V4ScaleAdd(V19, S9, Result); - Result = V4ScaleAdd(V21, S10, Result); - Result = V4ScaleAdd(V23, S11, Result); - - return Result; -} - -PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec3V tmp = V4Mul(a, recipTwoPi); - const Vec3V b = V3Round(tmp); - const Vec3V V1 = V4NegMulSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const Vec3V V2 = V3Mul(V1, V1); - const Vec3V V4 = V3Mul(V2, V2); - const Vec3V V6 = V3Mul(V4, V2); - const Vec3V V8 = V3Mul(V4, V4); - const Vec3V V10 = V3Mul(V6, V4); - const Vec3V V12 = V3Mul(V6, V6); - const Vec3V V14 = V3Mul(V8, V6); - const Vec3V V16 = V3Mul(V8, V8); - const Vec3V V18 = V3Mul(V10, V8); - const Vec3V V20 = V3Mul(V10, V10); - const Vec3V V22 = V3Mul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - Vec3V Result; - Result = V4ScaleAdd(V2, C1, V4One()); - Result = V4ScaleAdd(V4, C2, Result); - Result = V4ScaleAdd(V6, C3, Result); - Result = V4ScaleAdd(V8, C4, Result); - Result = V4ScaleAdd(V10, C5, Result); - Result = V4ScaleAdd(V12, C6, Result); - Result = V4ScaleAdd(V14, C7, Result); - Result = V4ScaleAdd(V16, C8, Result); - Result = V4ScaleAdd(V18, C9, Result); - Result = V4ScaleAdd(V20, C10, Result); - Result = V4ScaleAdd(V22, C11, Result); - - return V4ClearW(Result); -} - -PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const float32x2_t xy = vget_low_f32(a); - const float32x2_t zw = vget_high_f32(a); - const float32x2_t yz = vext_f32(xy, zw, 1); - return vcombine_f32(yz, zw); -} - -PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const uint32x2_t mask = { 0xffffFFFF, 0x0 }; - - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t xw = vand_u32(xy, mask); - return vreinterpretq_f32_u32(vcombine_u32(xy, xw)); -} - -PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const uint32x2_t mask = { 0xffffFFFF, 0x0 }; - - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t yz = vext_u32(xy, zw, 1); - const uint32x2_t xw = vand_u32(xy, mask); - return vreinterpretq_f32_u32(vcombine_u32(yz, xw)); -} - -PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t wz = vrev64_u32(zw); - - const uint32x2_t zx = vext_u32(wz, xy, 1); - const uint32x2_t yw = vext_u32(xy, wz, 1); - - return vreinterpretq_f32_u32(vcombine_u32(zx, yw)); -} - -PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); - - const uint32x2_t wz = vrev64_u32(zw); - const uint32x2_t yw = vext_u32(xy, wz, 1); - const uint32x2_t zz = vdup_lane_u32(wz, 1); - - return vreinterpretq_f32_u32(vcombine_u32(zz, yw)); -} - -PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - const uint32x2_t mask = { 0xffffFFFF, 0x0 }; - - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t yx = vrev64_u32(xy); - const uint32x2_t xw = vand_u32(xy, mask); - return vreinterpretq_f32_u32(vcombine_u32(yx, xw)); -} - -PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(v0)); - const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(v1)); - const uint32x2_t wz = vrev64_u32(zw); - const uint32x2_t yw = vext_u32(xy, wz, 1); - - return vreinterpretq_f32_u32(vcombine_u32(wz, yw)); -} - -PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - - const uint32x2_t mask = { 0xffffFFFF, 0x0 }; - - const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(v0)); - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(v1)); - const uint32x2_t xw = vand_u32(xy, mask); - - return vreinterpretq_f32_u32(vcombine_u32(zw, xw)); -} - -PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - - const uint32x2_t axy = vget_low_u32(vreinterpretq_u32_f32(v0)); - const uint32x2_t bxy = vget_low_u32(vreinterpretq_u32_f32(v1)); - const uint32x2_t byax = vext_u32(bxy, axy, 1); - const uint32x2_t ww = vdup_n_u32(0); - - return vreinterpretq_f32_u32(vcombine_u32(byax, ww)); -} - -PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // const uint32x2_t mask = {0xffffFFFF, 0x0}; - - const float32x2_t low = vget_low_f32(a); - const float32x2_t high = vget_high_f32(a); - // const float32x2_t high = vreinterpret_f32_u32(vand_u32(vreinterpret_u32_f32(high_), mask)); - - const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} - const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} - - return sum0ZYX; -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(min); - ASSERT_ISVALIDVEC3V(max); - - const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); - return internalUnitNeonSimd::BAnyTrue3_R(c); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(min); - ASSERT_ISVALIDVEC3V(max); - - const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); - return internalUnitNeonSimd::BAllTrue4_R(c); -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(bounds); - - const BoolV greater = V3IsGrtr(V3Abs(a), bounds); - return internalUnitNeonSimd::BAnyTrue3_R(greater); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(bounds); - - const BoolV greaterOrEq = V3IsGrtrOrEq(bounds, V3Abs(a)); - return internalUnitNeonSimd::BAllTrue4_R(greaterOrEq); -} - -PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) -{ - ASSERT_ISVALIDVEC3V(col0); - ASSERT_ISVALIDVEC3V(col1); - ASSERT_ISVALIDVEC3V(col2); - - Vec3V col3 = V3Zero(); - const float32x4x2_t v0v1 = vzipq_f32(col0, col2); - const float32x4x2_t v2v3 = vzipq_f32(col1, col3); - const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); - const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); - col0 = zip0.val[0]; - col1 = zip0.val[1]; - col2 = zip1.val[0]; - // col3 = zip1.val[1]; -} - -////////////////////////////////// -// VEC4V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return vcombine_f32(f, f); -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) -{ - ASSERT_ISVALIDFLOATV(floatVArray[0]); - ASSERT_ISVALIDFLOATV(floatVArray[1]); - ASSERT_ISVALIDFLOATV(floatVArray[2]); - ASSERT_ISVALIDFLOATV(floatVArray[3]); - - const uint32x2_t xLow = vreinterpret_u32_f32(floatVArray[0]); - const uint32x2_t yLow = vreinterpret_u32_f32(floatVArray[1]); - const uint32x2_t zLow = vreinterpret_u32_f32(floatVArray[2]); - const uint32x2_t wLow = vreinterpret_u32_f32(floatVArray[3]); - - const uint32x2_t dLow = vext_u32(xLow, yLow, 1); - const uint32x2_t dHigh = vext_u32(zLow, wLow, 1); - - return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) -{ - ASSERT_ISVALIDFLOATV(x); - ASSERT_ISVALIDFLOATV(y); - ASSERT_ISVALIDFLOATV(z); - ASSERT_ISVALIDFLOATV(w); - - const uint32x2_t xLow = vreinterpret_u32_f32(x); - const uint32x2_t yLow = vreinterpret_u32_f32(y); - const uint32x2_t zLow = vreinterpret_u32_f32(z); - const uint32x2_t wLow = vreinterpret_u32_f32(w); - - const uint32x2_t dLow = vext_u32(xLow, yLow, 1); - const uint32x2_t dHigh = vext_u32(zLow, wLow, 1); - - return vreinterpretq_f32_u32(vcombine_u32(dLow, dHigh)); -} - -PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const float32x2_t xx = vget_high_f32(x); - const float32x2_t yy = vget_high_f32(y); - const float32x2_t zz = vget_high_f32(z); - const float32x2_t ww = vget_high_f32(w); - - const float32x2x2_t zipL = vzip_f32(xx, yy); - const float32x2x2_t zipH = vzip_f32(zz, ww); - - return vcombine_f32(zipL.val[1], zipH.val[1]); -} - -PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const float32x2_t xx = vget_high_f32(x); - const float32x2_t yy = vget_high_f32(y); - const float32x2_t zz = vget_high_f32(z); - const float32x2_t ww = vget_high_f32(w); - - const float32x2x2_t zipL = vzip_f32(xx, yy); - const float32x2x2_t zipH = vzip_f32(zz, ww); - - return vcombine_f32(zipL.val[0], zipH.val[0]); -} - -PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const float32x2_t xx = vget_low_f32(x); - const float32x2_t yy = vget_low_f32(y); - const float32x2_t zz = vget_low_f32(z); - const float32x2_t ww = vget_low_f32(w); - - const float32x2x2_t zipL = vzip_f32(xx, yy); - const float32x2x2_t zipH = vzip_f32(zz, ww); - - return vcombine_f32(zipL.val[1], zipH.val[1]); -} - -PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const float32x2_t xx = vget_low_f32(x); - const float32x2_t yy = vget_low_f32(y); - const float32x2_t zz = vget_low_f32(z); - const float32x2_t ww = vget_low_f32(w); - - const float32x2x2_t zipL = vzip_f32(xx, yy); - const float32x2x2_t zipH = vzip_f32(zz, ww); - - return vcombine_f32(zipL.val[0], zipH.val[0]); -} - -PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) -{ - return vzipq_f32(a, b).val[0]; -} - -PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) -{ - return vzipq_f32(a, b).val[1]; -} - -PX_FORCE_INLINE Vec4V V4UnitW() -{ - const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); - const float32x2_t ones = vmov_n_f32(1.0f); - const float32x2_t zo = vext_f32(zeros, ones, 1); - return vcombine_f32(zeros, zo); -} - -PX_FORCE_INLINE Vec4V V4UnitX() -{ - const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); - const float32x2_t ones = vmov_n_f32(1.0f); - const float32x2_t oz = vext_f32(ones, zeros, 1); - return vcombine_f32(oz, zeros); -} - -PX_FORCE_INLINE Vec4V V4UnitY() -{ - const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); - const float32x2_t ones = vmov_n_f32(1.0f); - const float32x2_t zo = vext_f32(zeros, ones, 1); - return vcombine_f32(zo, zeros); -} - -PX_FORCE_INLINE Vec4V V4UnitZ() -{ - const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); - const float32x2_t ones = vmov_n_f32(1.0f); - const float32x2_t oz = vext_f32(ones, zeros, 1); - return vcombine_f32(zeros, oz); -} - -PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) -{ - const float32x2_t fhigh = vget_high_f32(f); - return vdup_lane_f32(fhigh, 1); -} - -PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) -{ - const float32x2_t fLow = vget_low_f32(f); - return vdup_lane_f32(fLow, 0); -} - -PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) -{ - const float32x2_t fLow = vget_low_f32(f); - return vdup_lane_f32(fLow, 1); -} - -PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) -{ - const float32x2_t fhigh = vget_high_f32(f); - return vdup_lane_f32(fhigh, 0); -} - -PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTTF(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BFTTT(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTFTT(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTFT(), v, vcombine_f32(f, f)); -} - -PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) -{ - return V4Sel(BTTTF(), v, V4Zero()); -} - -PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) -{ - const float32x2_t xy = vget_low_f32(a); - const float32x2_t zw = vget_high_f32(a); - const float32x2_t yx = vext_f32(xy, xy, 1); - const float32x2_t wz = vext_f32(zw, zw, 1); - return vcombine_f32(yx, wz); -} - -PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) -{ - const float32x2_t xy = vget_low_f32(a); - const float32x2_t zw = vget_high_f32(a); - const float32x2x2_t xzyw = vzip_f32(xy, zw); - return vcombine_f32(xzyw.val[0], xzyw.val[0]); -} - -PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) -{ - const float32x2_t xy = vget_low_f32(a); - const float32x2_t zw = vget_high_f32(a); - const float32x2x2_t xzyw = vzip_f32(xy, zw); - return vcombine_f32(xzyw.val[1], xzyw.val[1]); -} - -PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) -{ - const uint32x2_t xy = vget_low_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t zw = vget_high_u32(vreinterpretq_u32_f32(a)); - const uint32x2_t yz = vext_u32(xy, zw, 1); - const uint32x2_t xw = vrev64_u32(vext_u32(zw, xy, 1)); - return vreinterpretq_f32_u32(vcombine_u32(yz, xw)); -} - -template <PxU8 E0, PxU8 E1, PxU8 E2, PxU8 E3> -PX_FORCE_INLINE Vec4V V4Perm(const Vec4V V) -{ - static const uint32_t ControlElement[4] = - { -#if 1 - 0x03020100, // XM_SWIZZLE_X - 0x07060504, // XM_SWIZZLE_Y - 0x0B0A0908, // XM_SWIZZLE_Z - 0x0F0E0D0C, // XM_SWIZZLE_W -#else - 0x00010203, // XM_SWIZZLE_X - 0x04050607, // XM_SWIZZLE_Y - 0x08090A0B, // XM_SWIZZLE_Z - 0x0C0D0E0F, // XM_SWIZZLE_W -#endif - }; - - uint8x8x2_t tbl; - tbl.val[0] = vreinterpret_u8_f32(vget_low_f32(V)); - tbl.val[1] = vreinterpret_u8_f32(vget_high_f32(V)); - - uint8x8_t idx = - vcreate_u8(static_cast<uint64_t>(ControlElement[E0]) | (static_cast<uint64_t>(ControlElement[E1]) << 32)); - const uint8x8_t rL = vtbl2_u8(tbl, idx); - idx = vcreate_u8(static_cast<uint64_t>(ControlElement[E2]) | (static_cast<uint64_t>(ControlElement[E3]) << 32)); - const uint8x8_t rH = vtbl2_u8(tbl, idx); - return vreinterpretq_f32_u8(vcombine_u8(rL, rH)); -} - -// PT: this seems measurably slower than the hardcoded version -/*PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) -{ - return V4Perm<1, 2, 0, 3>(a); -}*/ - -PX_FORCE_INLINE Vec4V V4Zero() -{ - return vreinterpretq_f32_u32(vmovq_n_u32(0)); - // return vmovq_n_f32(0.0f); -} - -PX_FORCE_INLINE Vec4V V4One() -{ - return vmovq_n_f32(1.0f); -} - -PX_FORCE_INLINE Vec4V V4Eps() -{ - // return vmovq_n_f32(PX_EPS_REAL); - return V4Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) -{ - return vnegq_f32(f); -} - -PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) -{ - return vaddq_f32(a, b); -} - -PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) -{ - return vsubq_f32(a, b); -} - -PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) -{ - return vmulq_lane_f32(a, b, 0); -} - -PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) -{ - return vmulq_f32(a, b); -} - -PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(b); - const float32x2_t invB = VRECIP(b); - return vmulq_lane_f32(a, invB, 0); -} - -PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) -{ - const float32x4_t invB = VRECIPQ(b); - return vmulq_f32(a, invB); -} - -PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(b); - const float32x2_t invB = VRECIPE(b); - return vmulq_lane_f32(a, invB, 0); -} - -PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) -{ - const float32x4_t invB = VRECIPEQ(b); - return vmulq_f32(a, invB); -} - -PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) -{ - return VRECIPQ(a); -} - -PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) -{ - return VRECIPEQ(a); -} - -PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) -{ - return VRECIPSQRTQ(a); -} - -PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) -{ - return VRECIPSQRTEQ(a); -} - -PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) -{ - return V4Sel(V4IsEq(a, V4Zero()), a, V4Mul(a, VRECIPSQRTQ(a))); -} - -PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) -{ - ASSERT_ISVALIDFLOATV(b); - return vmlaq_lane_f32(c, a, b, 0); -} - -PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) -{ - ASSERT_ISVALIDFLOATV(b); - return vmlsq_lane_f32(c, a, b, 0); -} - -PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return vmlaq_f32(c, a, b); -} - -PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return vmlsq_f32(c, a, b); -} - -PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) -{ - return vabsq_f32(a); -} - -PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) -{ - const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y - const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w - const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w - const FloatV xz = V4GetX(xz_yw); // x+z - const FloatV yw = V4GetZ(xz_yw); // y+w - return FAdd(xz, yw); // sum -} - -PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) -{ - const float32x4_t tmp = vmulq_f32(a, b); - const float32x2_t low = vget_low_f32(tmp); - const float32x2_t high = vget_high_f32(tmp); - - const float32x2_t sumTmp = vpadd_f32(low, high); // = {z+w, x+y} - const float32x2_t sumWZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z+w, x+y+z+w} - return sumWZYX; -} - -PX_FORCE_INLINE FloatV V4Dot3(const Vec4V aa, const Vec4V bb) -{ - // PT: the V3Dot code relies on the fact that W=0 so we can't reuse it as-is, we need to clear W first. - // TODO: find a better implementation that does not need to clear W. - const Vec4V a = V4ClearW(aa); - const Vec4V b = V4ClearW(bb); - - const float32x4_t tmp = vmulq_f32(a, b); - const float32x2_t low = vget_low_f32(tmp); - const float32x2_t high = vget_high_f32(tmp); - - const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} - const float32x2_t sum0ZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} - return sum0ZYX; -} - -PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) -{ - const uint32x2_t TF = { 0xffffFFFF, 0x0 }; - const float32x2_t ay_ax = vget_low_f32(a); // d2 - const float32x2_t aw_az = vget_high_f32(a); // d3 - const float32x2_t by_bx = vget_low_f32(b); // d4 - const float32x2_t bw_bz = vget_high_f32(b); // d5 - // Hi, Lo - const float32x2_t bz_by = vext_f32(by_bx, bw_bz, 1); // bz, by - const float32x2_t az_ay = vext_f32(ay_ax, aw_az, 1); // az, ay - - const float32x2_t azbx = vmul_f32(aw_az, by_bx); // 0, az*bx - const float32x2_t aybz_axby = vmul_f32(ay_ax, bz_by); // ay*bz, ax*by - - const float32x2_t azbxSUBaxbz = vmls_f32(azbx, bw_bz, ay_ax); // 0, az*bx-ax*bz - const float32x2_t aybzSUBazby_axbySUBaybx = vmls_f32(aybz_axby, by_bx, az_ay); // ay*bz-az*by, ax*by-ay*bx - - const float32x2_t retLow = vext_f32(aybzSUBazby_axbySUBaybx, azbxSUBaxbz, 1); // az*bx-ax*bz, ay*bz-az*by - const uint32x2_t retHigh = vand_u32(TF, vreinterpret_u32_f32(aybzSUBazby_axbySUBaybx)); // 0, ax*by-ay*bx - - return vcombine_f32(retLow, vreinterpret_f32_u32(retHigh)); -} - -PX_FORCE_INLINE FloatV V4Length(const Vec4V a) -{ - const float32x4_t tmp = vmulq_f32(a, a); - const float32x2_t low = vget_low_f32(tmp); - const float32x2_t high = vget_high_f32(tmp); - - const float32x2_t sumTmp = vpadd_f32(low, high); // = {0+z, x+y} - const float32x2_t sumWZYX = vpadd_f32(sumTmp, sumTmp); // = {x+y+z, x+y+z} - return FSqrt(sumWZYX); -} - -PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) -{ - return V4Dot(a, a); -} - -PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) -{ - //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); - return V4ScaleInv(a, V4Length(a)); -} - -PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) -{ - //PX_ASSERT(!FAllEq(V4LengthSq(a), FZero())); - return V4Scale(a, FRsqrtFast(V4Dot(a, a))); -} - -PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) -{ - const FloatV zero = FZero(); - const FloatV length = V4Length(a); - const uint32x4_t isGreaterThanZero = FIsGrtr(length, zero); - return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); -} - -PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) -{ - return vceqq_u32(a, b); -} - -PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) -{ - return vbslq_f32(c, a, b); -} - -PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) -{ - return vcgtq_f32(a, b); -} - -PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return vcgeq_f32(a, b); -} - -PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) -{ - return vceqq_f32(a, b); -} - -PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) -{ - return vmaxq_f32(a, b); -} - -PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) -{ - return vminq_f32(a, b); -} - -PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) -{ - const float32x2_t low = vget_low_f32(a); - const float32x2_t high = vget_high_f32(a); - - const float32x2_t max0 = vpmax_f32(high, low); - const float32x2_t max1 = vpmax_f32(max0, max0); - - return max1; -} - -PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) -{ - const float32x2_t low = vget_low_f32(a); - const float32x2_t high = vget_high_f32(a); - - const float32x2_t min0 = vpmin_f32(high, low); - const float32x2_t min1 = vpmin_f32(min0, min0); - - return min1; -} - -PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) -{ - return V4Max(V4Min(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) -{ - return internalUnitNeonSimd::BAllTrue4_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return internalUnitNeonSimd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) -{ - return internalUnitNeonSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) -{ - return internalUnitNeonSimd::BAllTrue4_R(V4IsEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) -{ - return internalUnitNeonSimd::BAnyTrue3_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) -{ - // truncate(a + (0.5f - sign(a))) - const Vec4V half = V4Load(0.5f); - const float32x4_t sign = vcvtq_f32_u32((vshrq_n_u32(vreinterpretq_u32_f32(a), 31))); - const Vec4V aPlusHalf = V4Add(a, half); - const Vec4V aRound = V4Sub(aPlusHalf, sign); - return vcvtq_f32_s32(vcvtq_s32_f32(aRound)); -} - -PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) -{ - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec4V tmp = V4Mul(a, recipTwoPi); - const Vec4V b = V4Round(tmp); - const Vec4V V1 = V4NegMulSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const Vec4V V2 = V4Mul(V1, V1); - const Vec4V V3 = V4Mul(V2, V1); - const Vec4V V5 = V4Mul(V3, V2); - const Vec4V V7 = V4Mul(V5, V2); - const Vec4V V9 = V4Mul(V7, V2); - const Vec4V V11 = V4Mul(V9, V2); - const Vec4V V13 = V4Mul(V11, V2); - const Vec4V V15 = V4Mul(V13, V2); - const Vec4V V17 = V4Mul(V15, V2); - const Vec4V V19 = V4Mul(V17, V2); - const Vec4V V21 = V4Mul(V19, V2); - const Vec4V V23 = V4Mul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - Vec4V Result; - Result = V4ScaleAdd(V3, S1, V1); - Result = V4ScaleAdd(V5, S2, Result); - Result = V4ScaleAdd(V7, S3, Result); - Result = V4ScaleAdd(V9, S4, Result); - Result = V4ScaleAdd(V11, S5, Result); - Result = V4ScaleAdd(V13, S6, Result); - Result = V4ScaleAdd(V15, S7, Result); - Result = V4ScaleAdd(V17, S8, Result); - Result = V4ScaleAdd(V19, S9, Result); - Result = V4ScaleAdd(V21, S10, Result); - Result = V4ScaleAdd(V23, S11, Result); - - return Result; -} - -PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) -{ - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec4V tmp = V4Mul(a, recipTwoPi); - const Vec4V b = V4Round(tmp); - const Vec4V V1 = V4NegMulSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const Vec4V V2 = V4Mul(V1, V1); - const Vec4V V4 = V4Mul(V2, V2); - const Vec4V V6 = V4Mul(V4, V2); - const Vec4V V8 = V4Mul(V4, V4); - const Vec4V V10 = V4Mul(V6, V4); - const Vec4V V12 = V4Mul(V6, V6); - const Vec4V V14 = V4Mul(V8, V6); - const Vec4V V16 = V4Mul(V8, V8); - const Vec4V V18 = V4Mul(V10, V8); - const Vec4V V20 = V4Mul(V10, V10); - const Vec4V V22 = V4Mul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - Vec4V Result; - Result = V4ScaleAdd(V2, C1, V4One()); - Result = V4ScaleAdd(V4, C2, Result); - Result = V4ScaleAdd(V6, C3, Result); - Result = V4ScaleAdd(V8, C4, Result); - Result = V4ScaleAdd(V10, C5, Result); - Result = V4ScaleAdd(V12, C6, Result); - Result = V4ScaleAdd(V14, C7, Result); - Result = V4ScaleAdd(V16, C8, Result); - Result = V4ScaleAdd(V18, C9, Result); - Result = V4ScaleAdd(V20, C10, Result); - Result = V4ScaleAdd(V22, C11, Result); - - return Result; -} - -PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) -{ - const float32x4x2_t v0v1 = vzipq_f32(col0, col2); - const float32x4x2_t v2v3 = vzipq_f32(col1, col3); - const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); - const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); - col0 = zip0.val[0]; - col1 = zip0.val[1]; - col2 = zip1.val[0]; - col3 = zip1.val[1]; -} - -////////////////////////////////// -// VEC4V -////////////////////////////////// - -PX_FORCE_INLINE BoolV BFFFF() -{ - return vmovq_n_u32(0); -} - -PX_FORCE_INLINE BoolV BFFFT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - return vcombine_u32(zeros, zo); -} - -PX_FORCE_INLINE BoolV BFFTF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(zeros, oz); -} - -PX_FORCE_INLINE BoolV BFFTT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - return vcombine_u32(zeros, ones); -} - -PX_FORCE_INLINE BoolV BFTFF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - return vcombine_u32(zo, zeros); -} - -PX_FORCE_INLINE BoolV BFTFT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - return vcombine_u32(zo, zo); -} - -PX_FORCE_INLINE BoolV BFTTF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(zo, oz); -} - -PX_FORCE_INLINE BoolV BFTTT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - return vcombine_u32(zo, ones); -} - -PX_FORCE_INLINE BoolV BTFFF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - // const uint32x2_t zo = vext_u32(zeros, ones, 1); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(oz, zeros); -} - -PX_FORCE_INLINE BoolV BTFFT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(oz, zo); -} - -PX_FORCE_INLINE BoolV BTFTF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(oz, oz); -} - -PX_FORCE_INLINE BoolV BTFTT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(oz, ones); -} - -PX_FORCE_INLINE BoolV BTTFF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - return vcombine_u32(ones, zeros); -} - -PX_FORCE_INLINE BoolV BTTFT() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t zo = vext_u32(zeros, ones, 1); - return vcombine_u32(ones, zo); -} - -PX_FORCE_INLINE BoolV BTTTF() -{ - const uint32x2_t zeros = vmov_n_u32(0); - const uint32x2_t ones = vmov_n_u32(0xffffFFFF); - const uint32x2_t oz = vext_u32(ones, zeros, 1); - return vcombine_u32(ones, oz); -} - -PX_FORCE_INLINE BoolV BTTTT() -{ - return vmovq_n_u32(0xffffFFFF); -} - -PX_FORCE_INLINE BoolV BXMask() -{ - return BTFFF(); -} - -PX_FORCE_INLINE BoolV BYMask() -{ - return BFTFF(); -} - -PX_FORCE_INLINE BoolV BZMask() -{ - return BFFTF(); -} - -PX_FORCE_INLINE BoolV BWMask() -{ - return BFFFT(); -} - -PX_FORCE_INLINE BoolV BGetX(const BoolV f) -{ - const uint32x2_t fLow = vget_low_u32(f); - return vdupq_lane_u32(fLow, 0); -} - -PX_FORCE_INLINE BoolV BGetY(const BoolV f) -{ - const uint32x2_t fLow = vget_low_u32(f); - return vdupq_lane_u32(fLow, 1); -} - -PX_FORCE_INLINE BoolV BGetZ(const BoolV f) -{ - const uint32x2_t fHigh = vget_high_u32(f); - return vdupq_lane_u32(fHigh, 0); -} - -PX_FORCE_INLINE BoolV BGetW(const BoolV f) -{ - const uint32x2_t fHigh = vget_high_u32(f); - return vdupq_lane_u32(fHigh, 1); -} - -PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) -{ - return vbslq_u32(BFTTT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) -{ - return vbslq_u32(BTFTT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) -{ - return vbslq_u32(BTTFT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) -{ - return vbslq_u32(BTTTF(), v, f); -} - -PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) -{ - return vandq_u32(a, b); -} - -PX_FORCE_INLINE BoolV BNot(const BoolV a) -{ - return vmvnq_u32(a); -} - -PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) -{ - // return vbicq_u32(a, b); - return vandq_u32(a, vmvnq_u32(b)); -} - -PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) -{ - return vorrq_u32(a, b); -} - -PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) -{ - const uint32x2_t allTrue = vmov_n_u32(0xffffFFFF); - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - const uint32x2_t result = vceq_u32(finalReduce, allTrue); - return vdupq_lane_u32(result, 0); -} - -PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) -{ - const uint32x2_t allTrue = vmov_n_u32(0xffffFFFF); - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - const uint32x2_t result = vtst_u32(finalReduce, allTrue); - return vdupq_lane_u32(result, 0); -} - -PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) -{ - const uint32x2_t allTrue3 = vmov_n_u32(0x00ffFFFF); - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - const uint32x2_t result = vceq_u32(vand_u32(finalReduce, allTrue3), allTrue3); - return vdupq_lane_u32(result, 0); -} - -PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) -{ - const uint32x2_t allTrue3 = vmov_n_u32(0x00ffFFFF); - const uint16x4_t dHigh = vget_high_u16(vreinterpretq_u16_u32(a)); - const uint16x4_t dLow = vmovn_u32(a); - uint16x8_t combined = vcombine_u16(dLow, dHigh); - const uint32x2_t finalReduce = vreinterpret_u32_u8(vmovn_u16(combined)); - const uint32x2_t result = vtst_u32(vand_u32(finalReduce, allTrue3), allTrue3); - return vdupq_lane_u32(result, 0); -} - -PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) -{ - const BoolV bTest = vceqq_u32(a, b); - return internalUnitNeonSimd::BAllTrue4_R(bTest); -} - -PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) -{ - return BAllEq(a, BTTTT()); -} - -PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) -{ - return BAllEq(a, BFFFF()); -} - -PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) -{ - static PX_ALIGN(16, const PxU32) bitMaskData[4] = { 1, 2, 4, 8 }; - const uint32x4_t bitMask = *(reinterpret_cast<const uint32x4_t*>(bitMaskData)); - const uint32x4_t t0 = vandq_u32(a, bitMask); - const uint32x2_t t1 = vpadd_u32(vget_low_u32(t0), vget_high_u32(t0)); // Pairwise add (0 + 1), (2 + 3) - return PxU32(vget_lane_u32(vpadd_u32(t1, t1), 0)); -} - -////////////////////////////////// -// MAT33V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - return V3Add(v0PlusV1, v2); -} - -PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) -{ - const FloatV x = V3Dot(a.col0, b); - const FloatV y = V3Dot(a.col1, b); - const FloatV z = V3Dot(a.col2, b); - return V3Merge(x, y, z); -} - -PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - Vec3V result = V3ScaleAdd(A.col0, x, c); - result = V3ScaleAdd(A.col1, y, result); - return V3ScaleAdd(A.col2, z, result); -} - -PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) -{ - return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); -} - -PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) -{ - const float32x2_t zeros = vreinterpret_f32_u32(vmov_n_u32(0)); - const BoolV btttf = BTTTF(); - - const Vec3V cross01 = V3Cross(a.col0, a.col1); - const Vec3V cross12 = V3Cross(a.col1, a.col2); - const Vec3V cross20 = V3Cross(a.col2, a.col0); - const FloatV dot = V3Dot(cross01, a.col2); - const FloatV invDet = FRecipFast(dot); - - const float32x4x2_t merge = vzipq_f32(cross12, cross01); - const float32x4_t mergeh = merge.val[0]; - const float32x4_t mergel = merge.val[1]; - - // const Vec3V colInv0 = XMVectorPermute(mergeh,cross20,PxPermuteControl(0,4,1,7)); - const float32x4_t colInv0_xxyy = vzipq_f32(mergeh, cross20).val[0]; - const float32x4_t colInv0 = vreinterpretq_f32_u32(vandq_u32(vreinterpretq_u32_f32(colInv0_xxyy), btttf)); - - // const Vec3V colInv1 = XMVectorPermute(mergeh,cross20,PxPermuteControl(2,5,3,7)); - const float32x2_t zw0 = vget_high_f32(mergeh); - const float32x2_t xy1 = vget_low_f32(cross20); - const float32x2_t yzero1 = vext_f32(xy1, zeros, 1); - const float32x2x2_t merge1 = vzip_f32(zw0, yzero1); - const float32x4_t colInv1 = vcombine_f32(merge1.val[0], merge1.val[1]); - - // const Vec3V colInv2 = XMVectorPermute(mergel,cross20,PxPermuteControl(0,6,1,7)); - const float32x2_t x0y0 = vget_low_f32(mergel); - const float32x2_t z1w1 = vget_high_f32(cross20); - const float32x2x2_t merge2 = vzip_f32(x0y0, z1w1); - const float32x4_t colInv2 = vcombine_f32(merge2.val[0], merge2.val[1]); - - return Mat33V(vmulq_lane_f32(colInv0, invDet, 0), vmulq_lane_f32(colInv1, invDet, 0), - vmulq_lane_f32(colInv2, invDet, 0)); -} - -PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) -{ - return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), - V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), - V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); -} - -PX_FORCE_INLINE Mat33V M33Identity() -{ - return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); -} - -PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) -{ - return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); -} - -PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) -{ - return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); -} - -PX_FORCE_INLINE Mat33V PromoteVec3V(const Vec3V v) -{ - const BoolV bTFFF = BTFFF(); - const BoolV bFTFF = BFTFF(); - const BoolV bFFTF = BTFTF(); - - const Vec3V zero = V3Zero(); - - return Mat33V(V3Sel(bTFFF, v, zero), V3Sel(bFTFF, v, zero), V3Sel(bFFTF, v, zero)); -} - -PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) -{ - const Vec3V x = V3Mul(V3UnitX(), d); - const Vec3V y = V3Mul(V3UnitY(), d); - const Vec3V z = V3Mul(V3UnitZ(), d); - return Mat33V(x, y, z); -} - -////////////////////////////////// -// MAT34V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); - return V3Add(v0PlusV1Plusv2, a.col3); -} - -PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - return V3Add(v0PlusV1, v2); -} - -PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3Dot(a.col0, b); - const FloatV y = V3Dot(a.col1, b); - const FloatV z = V3Dot(a.col2, b); - return V3Merge(x, y, z); -} - -PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) -{ - return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), - V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), - V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); -} - -////////////////////////////////// -// MAT44V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) -{ - const FloatV x = V4GetX(b); - const FloatV y = V4GetY(b); - const FloatV z = V4GetZ(b); - const FloatV w = V4GetW(b); - - const Vec4V v0 = V4Scale(a.col0, x); - const Vec4V v1 = V4Scale(a.col1, y); - const Vec4V v2 = V4Scale(a.col2, z); - const Vec4V v3 = V4Scale(a.col3, w); - const Vec4V v0PlusV1 = V4Add(v0, v1); - const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); - return V4Add(v0PlusV1Plusv2, v3); -} - -PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) -{ - return V4Merge(V4Dot(a.col0, b), V4Dot(a.col1, b), V4Dot(a.col2, b), V4Dot(a.col3, b)); -} - -PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) -{ - // asm volatile( - // "vzip.f32 %q0, %q2 \n\t" - // "vzip.f32 %q1, %q3 \n\t" - // "vzip.f32 %q0, %q1 \n\t" - // "vzip.f32 %q2, %q3 \n\t" - // : "+w" (a.col0), "+w" (a.col1), "+w" (a.col2), "+w" a.col3)); - - const float32x4x2_t v0v1 = vzipq_f32(a.col0, a.col2); - const float32x4x2_t v2v3 = vzipq_f32(a.col1, a.col3); - const float32x4x2_t zip0 = vzipq_f32(v0v1.val[0], v2v3.val[0]); - const float32x4x2_t zip1 = vzipq_f32(v0v1.val[1], v2v3.val[1]); - - return Mat44V(zip0.val[0], zip0.val[1], zip1.val[0], zip1.val[1]); -} - -PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) -{ - float32x4_t minor0, minor1, minor2, minor3; - float32x4_t row0, row1, row2, row3; - float32x4_t det, tmp1; - - tmp1 = vmovq_n_f32(0.0f); - row1 = vmovq_n_f32(0.0f); - row3 = vmovq_n_f32(0.0f); - - row0 = a.col0; - row1 = vextq_f32(a.col1, a.col1, 2); - row2 = a.col2; - row3 = vextq_f32(a.col3, a.col3, 2); - - tmp1 = vmulq_f32(row2, row3); - tmp1 = vrev64q_f32(tmp1); - minor0 = vmulq_f32(row1, tmp1); - minor1 = vmulq_f32(row0, tmp1); - tmp1 = vextq_f32(tmp1, tmp1, 2); - minor0 = vsubq_f32(vmulq_f32(row1, tmp1), minor0); - minor1 = vsubq_f32(vmulq_f32(row0, tmp1), minor1); - minor1 = vextq_f32(minor1, minor1, 2); - - tmp1 = vmulq_f32(row1, row2); - tmp1 = vrev64q_f32(tmp1); - minor0 = vaddq_f32(vmulq_f32(row3, tmp1), minor0); - minor3 = vmulq_f32(row0, tmp1); - tmp1 = vextq_f32(tmp1, tmp1, 2); - minor0 = vsubq_f32(minor0, vmulq_f32(row3, tmp1)); - minor3 = vsubq_f32(vmulq_f32(row0, tmp1), minor3); - minor3 = vextq_f32(minor3, minor3, 2); - - tmp1 = vmulq_f32(vextq_f32(row1, row1, 2), row3); - tmp1 = vrev64q_f32(tmp1); - row2 = vextq_f32(row2, row2, 2); - minor0 = vaddq_f32(vmulq_f32(row2, tmp1), minor0); - minor2 = vmulq_f32(row0, tmp1); - tmp1 = vextq_f32(tmp1, tmp1, 2); - minor0 = vsubq_f32(minor0, vmulq_f32(row2, tmp1)); - minor2 = vsubq_f32(vmulq_f32(row0, tmp1), minor2); - minor2 = vextq_f32(minor2, minor2, 2); - - tmp1 = vmulq_f32(row0, row1); - tmp1 = vrev64q_f32(tmp1); - minor2 = vaddq_f32(vmulq_f32(row3, tmp1), minor2); - minor3 = vsubq_f32(vmulq_f32(row2, tmp1), minor3); - tmp1 = vextq_f32(tmp1, tmp1, 2); - minor2 = vsubq_f32(vmulq_f32(row3, tmp1), minor2); - minor3 = vsubq_f32(minor3, vmulq_f32(row2, tmp1)); - - tmp1 = vmulq_f32(row0, row3); - tmp1 = vrev64q_f32(tmp1); - minor1 = vsubq_f32(minor1, vmulq_f32(row2, tmp1)); - minor2 = vaddq_f32(vmulq_f32(row1, tmp1), minor2); - tmp1 = vextq_f32(tmp1, tmp1, 2); - minor1 = vaddq_f32(vmulq_f32(row2, tmp1), minor1); - minor2 = vsubq_f32(minor2, vmulq_f32(row1, tmp1)); - - tmp1 = vmulq_f32(row0, row2); - tmp1 = vrev64q_f32(tmp1); - minor1 = vaddq_f32(vmulq_f32(row3, tmp1), minor1); - minor3 = vsubq_f32(minor3, vmulq_f32(row1, tmp1)); - tmp1 = vextq_f32(tmp1, tmp1, 2); - minor1 = vsubq_f32(minor1, vmulq_f32(row3, tmp1)); - minor3 = vaddq_f32(vmulq_f32(row1, tmp1), minor3); - - det = vmulq_f32(row0, minor0); - det = vaddq_f32(vextq_f32(det, det, 2), det); - det = vaddq_f32(vrev64q_f32(det), det); - det = vdupq_lane_f32(VRECIPE(vget_low_f32(det)), 0); - - minor0 = vmulq_f32(det, minor0); - minor1 = vmulq_f32(det, minor1); - minor2 = vmulq_f32(det, minor2); - minor3 = vmulq_f32(det, minor3); - Mat44V invTrans(minor0, minor1, minor2, minor3); - return M44Trnsps(invTrans); -} - -PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) -{ - const float32x4_t ret = { x, y, z, w }; - return ret; -} - -/* -PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) -{ - return vcombine_u16(vqmovn_u32(a), vqmovn_u32(b)); -} -*/ - -PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) -{ - return vbslq_u32(c, a, b); -} - -PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) -{ - return vorrq_u32(a, b); -} - -PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) -{ - return veorq_u32(a, b); -} - -PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) -{ - return vandq_u32(a, b); -} - -PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) -{ - // return vbicq_u32(a, b); // creates gcc compiler bug in RTreeQueries.cpp - return vandq_u32(a, vmvnq_u32(b)); -} - -/* -PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) -{ - return vorrq_u16(a, b); -} -*/ - -/* -PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) -{ - return vandq_u16(a, b); -} -*/ -/* -PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) -{ - return vbicq_u16(a, b); -} -*/ - -PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) -{ - return vdupq_n_s32(i); -} - -PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) -{ - return vld1q_s32(i); -} - -PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) -{ - return vld1q_s32(i); -} - -PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) -{ - return vaddq_s32(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) -{ - return vsubq_s32(a, b); -} - -PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) -{ - return vcgtq_s32(a, b); -} - -PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) -{ - return vceqq_s32(a, b); -} - -PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) -{ - return vbslq_s32(c, a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Zero() -{ - return vdupq_n_s32(0); -} - -PX_FORCE_INLINE VecI32V VecI32V_One() -{ - return vdupq_n_s32(1); -} - -PX_FORCE_INLINE VecI32V VecI32V_Two() -{ - return vdupq_n_s32(2); -} - -PX_FORCE_INLINE VecI32V VecI32V_MinusOne() -{ - return vdupq_n_s32(-1); -} - -PX_FORCE_INLINE VecU32V U4Zero() -{ - return U4Load(0); -} - -PX_FORCE_INLINE VecU32V U4One() -{ - return U4Load(1); -} - -PX_FORCE_INLINE VecU32V U4Two() -{ - return U4Load(2); -} - -PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) -{ - return shift; -} - -PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) -{ - return vshlq_s32(a, count); -} - -PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) -{ - return vshlq_s32(a, VecI32V_Sub(I4Load(0), count)); -} - -PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) -{ - return vandq_s32(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) -{ - return vorrq_s32(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg f) -{ - const int32x2_t fLow = vget_low_s32(f); - return vdupq_lane_s32(fLow, 0); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg f) -{ - const int32x2_t fLow = vget_low_s32(f); - return vdupq_lane_s32(fLow, 1); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg f) -{ - const int32x2_t fHigh = vget_high_s32(f); - return vdupq_lane_s32(fHigh, 0); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg f) -{ - const int32x2_t fHigh = vget_high_s32(f); - return vdupq_lane_s32(fHigh, 1); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) -{ - return vbslq_s32(c, a, b); -} - -PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) -{ - *i = vgetq_lane_s32(a, 0); -} - -PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) -{ - const int32x2_t aLow = vget_low_s32(a); - const int32x2_t bLow = vget_low_s32(b); - const int32x2_t cLow = vget_low_s32(c); - const int32x2_t dLow = vget_low_s32(d); - - const int32x2_t low = vext_s32(aLow, bLow, 1); - const int32x2_t high = vext_s32(cLow, dLow, 1); - - return vcombine_s32(low, high); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) -{ - return vreinterpretq_s32_u32(a); -} - -PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) -{ - return a; -} - -/* -template<int a> PX_FORCE_INLINE VecI32V V4ISplat() -{ - return vdupq_n_s32(a); -} - -template<PxU32 a> PX_FORCE_INLINE VecU32V V4USplat() -{ - return vdupq_n_u32(a); -} -*/ - -/* -PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) -{ - vst1q_u16((uint16_t*)address, val); -} -*/ - -PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) -{ - vst1q_u32(reinterpret_cast<uint32_t*>(address), val); -} - -PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) -{ - return vld1q_f32(reinterpret_cast<float32_t*>(addr)); -} - -PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) -{ - return vld1q_f32(reinterpret_cast<float32_t*>(addr)); -} - -PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) -{ - return vreinterpretq_f32_u32(V4U32Andc(vreinterpretq_u32_f32(a), b)); -} - -PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) -{ - return V4IsGrtr(a, b); -} - -PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) -{ - return vld1q_u16(reinterpret_cast<uint16_t*>(addr)); -} - -PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) -{ - return vld1q_u16(reinterpret_cast<uint16_t*>(addr)); -} - -PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) -{ - return vcgtq_u16(a, b); -} - -PX_FORCE_INLINE VecU16V V4I16CompareGt(VecI16V a, VecI16V b) -{ - return vcgtq_s16(a, b); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) -{ - return vcvtq_f32_u32(a); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) -{ - return vcvtq_f32_s32(a); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) -{ - return vcvtq_s32_f32(a); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) -{ - return vreinterpretq_f32_u32(a); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) -{ - return vreinterpretq_f32_s32(a); -} - -PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - return vreinterpretq_u32_f32(a); -} - -PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - return vreinterpretq_s32_f32(a); -} - -template <int index> -PX_FORCE_INLINE BoolV BSplatElement(BoolV a) -{ - if(index < 2) - { - return vdupq_lane_u32(vget_low_u32(a), index); - } - else if(index == 2) - { - return vdupq_lane_u32(vget_high_u32(a), 0); - } - else if(index == 3) - { - return vdupq_lane_u32(vget_high_u32(a), 1); - } -} - -template <int index> -PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) -{ - if(index < 2) - { - return vdupq_lane_u32(vget_low_u32(a), index); - } - else if(index == 2) - { - return vdupq_lane_u32(vget_high_u32(a), 0); - } - else if(index == 3) - { - return vdupq_lane_u32(vget_high_u32(a), 1); - } -} - -template <int index> -PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) -{ - if(index < 2) - { - return vdupq_lane_f32(vget_low_f32(a), index); - } - else if(index == 2) - { - return vdupq_lane_f32(vget_high_f32(a), 0); - } - else if(index == 3) - { - return vdupq_lane_f32(vget_high_f32(a), 1); - } -} - -PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) -{ - const uint32x4_t ret = { x, y, z, w }; - return ret; -} - -PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) -{ - return vdupq_n_u32(i); -} - -PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) -{ - return vld1q_u32(i); -} - -PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) -{ - return vld1q_u32(i); -} - -PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V in) -{ - const float32x4_t ones = vdupq_n_f32(1.0f); - const float32x4_t rdToZero = vcvtq_f32_s32(vcvtq_s32_f32(in)); - const float32x4_t rdToZeroPlusOne = vaddq_f32(rdToZero, ones); - const uint32x4_t gt = vcgtq_f32(in, rdToZero); - return vbslq_f32(gt, rdToZeroPlusOne, rdToZero); -} - -PX_FORCE_INLINE Vec4V V4Floor(const Vec4V in) -{ - const float32x4_t ones = vdupq_n_f32(1.0f); - const float32x4_t rdToZero = vcvtq_f32_s32(vcvtq_s32_f32(in)); - const float32x4_t rdToZeroMinusOne = vsubq_f32(rdToZero, ones); - const uint32x4_t lt = vcltq_f32(in, rdToZero); - return vbslq_f32(lt, rdToZeroMinusOne, rdToZero); -} - -PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V in, PxU32 power) -{ - PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); - PX_UNUSED(power); // prevent warning in release builds - - return vcvtq_u32_f32(in); -} - -PX_FORCE_INLINE void QuatGetMat33V(const QuatVArg q, Vec3V& column0, Vec3V& column1, Vec3V& column2) -{ - const FloatV one = FOne(); - const FloatV x = V4GetX(q); - const FloatV y = V4GetY(q); - const FloatV z = V4GetZ(q); - const FloatV w = V4GetW(q); - - const FloatV x2 = FAdd(x, x); - const FloatV y2 = FAdd(y, y); - const FloatV z2 = FAdd(z, z); - - const FloatV xx = FMul(x2, x); - const FloatV yy = FMul(y2, y); - const FloatV zz = FMul(z2, z); - - const FloatV xy = FMul(x2, y); - const FloatV xz = FMul(x2, z); - const FloatV xw = FMul(x2, w); - - const FloatV yz = FMul(y2, z); - const FloatV yw = FMul(y2, w); - const FloatV zw = FMul(z2, w); - - const FloatV v = FSub(one, xx); - - column0 = V3Merge(FSub(FSub(one, yy), zz), FAdd(xy, zw), FSub(xz, yw)); - column1 = V3Merge(FSub(xy, zw), FSub(v, zz), FAdd(yz, xw)); - column2 = V3Merge(FAdd(xz, yw), FSub(yz, xw), FSub(v, yy)); -} - -#endif // PSFOUNDATION_PSUNIXNEONINLINEAOS_H diff --git a/PxShared/src/foundation/include/unix/sse2/PsUnixSse2AoS.h b/PxShared/src/foundation/include/unix/sse2/PsUnixSse2AoS.h deleted file mode 100644 index 9c76438..0000000 --- a/PxShared/src/foundation/include/unix/sse2/PsUnixSse2AoS.h +++ /dev/null @@ -1,179 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXSSE2AOS_H -#define PSFOUNDATION_PSUNIXSSE2AOS_H - -// no includes here! this file should be included from PxcVecMath.h only!!! - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif -#if PX_EMSCRIPTEN -typedef int8_t __int8_t; -typedef int16_t __int16_t; -typedef int32_t __int32_t; -typedef int64_t __int64_t; -typedef uint16_t __uint16_t; -typedef uint32_t __uint32_t; -typedef uint64_t __uint64_t; -#endif - -typedef union UnionM128 -{ - UnionM128() - { - } - UnionM128(__m128 in) - { - m128 = in; - } - - UnionM128(__m128i in) - { - m128i = in; - } - - operator __m128() - { - return m128; - } - - operator const __m128() const - { - return m128; - } - - float m128_f32[4]; - __int8_t m128_i8[16]; - __int16_t m128_i16[8]; - __int32_t m128_i32[4]; - __int64_t m128_i64[2]; - __uint16_t m128_u16[8]; - __uint32_t m128_u32[4]; - __uint64_t m128_u64[2]; - __m128 m128; - __m128i m128i; -} UnionM128; - -typedef __m128 FloatV; -typedef __m128 Vec3V; -typedef __m128 Vec4V; -typedef __m128 BoolV; -typedef __m128 QuatV; -typedef __m128i VecI32V; -typedef UnionM128 VecU32V; -typedef UnionM128 VecU16V; -typedef UnionM128 VecI16V; -typedef UnionM128 VecU8V; - -#define FloatVArg FloatV & -#define Vec3VArg Vec3V & -#define Vec4VArg Vec4V & -#define BoolVArg BoolV & -#define VecU32VArg VecU32V & -#define VecI32VArg VecI32V & -#define VecU16VArg VecU16V & -#define VecI16VArg VecI16V & -#define VecU8VArg VecU8V & -#define QuatVArg QuatV & - -// Optimization for situations in which you cross product multiple vectors with the same vector. -// Avoids 2X shuffles per product -struct VecCrossV -{ - Vec3V mL1; - Vec3V mR1; -}; - -struct VecShiftV -{ - VecI32V shift; -}; -#define VecShiftVArg VecShiftV & - -PX_ALIGN_PREFIX(16) -struct Mat33V -{ - Mat33V() - { - } - Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec3V PX_ALIGN(16, col0); - Vec3V PX_ALIGN(16, col1); - Vec3V PX_ALIGN(16, col2); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat34V -{ - Mat34V() - { - } - Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec3V PX_ALIGN(16, col0); - Vec3V PX_ALIGN(16, col1); - Vec3V PX_ALIGN(16, col2); - Vec3V PX_ALIGN(16, col3); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat43V -{ - Mat43V() - { - } - Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec4V PX_ALIGN(16, col0); - Vec4V PX_ALIGN(16, col1); - Vec4V PX_ALIGN(16, col2); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat44V -{ - Mat44V() - { - } - Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec4V PX_ALIGN(16, col0); - Vec4V PX_ALIGN(16, col1); - Vec4V PX_ALIGN(16, col2); - Vec4V PX_ALIGN(16, col3); -} PX_ALIGN_SUFFIX(16); - -#endif // PSFOUNDATION_PSUNIXSSE2AOS_H diff --git a/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h b/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h deleted file mode 100644 index cdb20fa..0000000 --- a/PxShared/src/foundation/include/unix/sse2/PsUnixSse2InlineAoS.h +++ /dev/null @@ -1,3223 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSUNIXSSE2INLINEAOS_H -#define PSFOUNDATION_PSUNIXSSE2INLINEAOS_H - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -#ifdef __SSE4_2__ -#include "smmintrin.h" -#endif - -#include "../../PsVecMathSSE.h" - -#define PX_FPCLASS_SNAN 0x0001 /* signaling NaN */ -#define PX_FPCLASS_QNAN 0x0002 /* quiet NaN */ -#define PX_FPCLASS_NINF 0x0004 /* negative infinity */ -#define PX_FPCLASS_PINF 0x0200 /* positive infinity */ - -PX_FORCE_INLINE __m128 m128_I2F(__m128i n) -{ - return _mm_castsi128_ps(n); -} -PX_FORCE_INLINE __m128i m128_F2I(__m128 n) -{ - return _mm_castps_si128(n); -} - -////////////////////////////////////////////////////////////////////// -//Test that Vec3V and FloatV are legal -////////////////////////////////////////////////////////////////////// - -#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f -PX_FORCE_INLINE static bool isValidFloatV(const FloatV a) -{ - const PxF32 x = V4ReadX(a); - const PxF32 y = V4ReadY(a); - const PxF32 z = V4ReadZ(a); - const PxF32 w = V4ReadW(a); - - if ( - (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs(x - z) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs(x - w) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) - ) - { - return true; - } - - if ( - (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs((x - z) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs((x - w) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) - ) - { - return true; - } - - return false; -} - -PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) -{ - PX_ALIGN(16, PxF32 f[4]); - V4StoreA(a, f); - return (f[3] == 0.0f); -} - -PX_FORCE_INLINE bool isFiniteLength(const Vec3V a) -{ - return !FAllEq(V4LengthSq(a), FZero()); -} - -PX_FORCE_INLINE bool isAligned16(void* a) -{ - return(0 == (size_t(a) & 0x0f)); -} - -//ASSERT_FINITELENGTH is deactivated because there is a lot of code that calls a simd normalisation function with zero length but then ignores the result. - -#if PX_DEBUG -#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) -#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) -#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16(reinterpret_cast<void*>(a))) -#define ASSERT_ISFINITELENGTH(a) //PX_ASSERT(isFiniteLength(a)) -#else -#define ASSERT_ISVALIDVEC3V(a) -#define ASSERT_ISVALIDFLOATV(a) -#define ASSERT_ISALIGNED16(a) -#define ASSERT_ISFINITELENGTH(a) -#endif - - -namespace internalUnitSSE2Simd -{ -PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32(moveMask == 0xf); -} - -PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32((moveMask & 0x7) == 0x7); -} - -PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32(moveMask != 0x0); -} - -PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32((moveMask & 0x7) != 0x0); -} - -PX_FORCE_INLINE PxU32 FiniteTestEq(const Vec4V a, const Vec4V b) -{ - // This is a bit of a bodge. - //_mm_comieq_ss returns 1 if either value is nan so we need to re-cast a and b with true encoded as a non-nan - // number. - // There must be a better way of doing this in sse. - const BoolV one = FOne(); - const BoolV zero = FZero(); - const BoolV a1 = V4Sel(a, one, zero); - const BoolV b1 = V4Sel(b, one, zero); - return ( - _mm_comieq_ss(a1, b1) && - _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 1, 1, 1)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(1, 1, 1, 1))) && - _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(2, 2, 2, 2)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(2, 2, 2, 2))) && - _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 3, 3, 3)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(3, 3, 3, 3)))); -} - -#if !PX_EMSCRIPTEN -const PX_ALIGN(16, PxF32 gMaskXYZ[4]) = { physx::PxUnionCast<PxF32>(0xffffffff), physx::PxUnionCast<PxF32>(0xffffffff), - physx::PxUnionCast<PxF32>(0xffffffff), 0 }; -} -#else -// emscripten doesn't like the PxUnionCast data structure -// the following is what windows and xbox does -- using these for emscripten -const PX_ALIGN(16, PxU32 gMaskXYZ[4]) = { 0xffffffff, 0xffffffff, 0xffffffff, 0 }; } -#endif - -namespace _VecMathTests -{ -// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' -PX_FORCE_INLINE Vec3V getInvalidVec3V() -{ - const float f = 1.0f; - return _mm_load1_ps(&f); -} - -PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_comieq_ss(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) -{ - return V3AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) -{ - return V4AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) -{ - return internalUnitSSE2Simd::BAllTrue4_R(VecI32V_IsEq(m128_F2I(a), m128_F2I(b))) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) -{ - return internalUnitSSE2Simd::BAllTrue4_R(V4IsEqU32(a, b)) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) -{ - BoolV c = m128_I2F(_mm_cmpeq_epi32(a, b)); - return internalUnitSSE2Simd::BAllTrue4_R(c) != 0; -} - -#define VECMATH_AOS_EPSILON (1e-3f) - -PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - const FloatV c = FSub(a, b); - const FloatV minError = FLoad(-VECMATH_AOS_EPSILON); - const FloatV maxError = FLoad(VECMATH_AOS_EPSILON); - return _mm_comigt_ss(c, minError) && _mm_comilt_ss(c, maxError); -} - -PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) -{ - const Vec3V c = V3Sub(a, b); - const Vec3V minError = V3Load(-VECMATH_AOS_EPSILON); - const Vec3V maxError = V3Load(VECMATH_AOS_EPSILON); - return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxError) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxError) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxError)); -} - -PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) -{ - const Vec4V c = V4Sub(a, b); - const Vec4V minError = V4Load(-VECMATH_AOS_EPSILON); - const Vec4V maxError = V4Load(VECMATH_AOS_EPSILON); - return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxError) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxError) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxError) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), minError) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), maxError)); -} -} - -///////////////////////////////////////////////////////////////////// -////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) -{ - PxF32 badNumber = - physx::PxUnionCast<PxF32, PxU32>(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); - const FloatV vBadNum = FLoad(badNumber); - const BoolV vMask = BAnd(vBadNum, a); - return internalUnitSSE2Simd::FiniteTestEq(vMask, BFFFF()) == 1; -} - -PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) -{ - PxF32 badNumber = - physx::PxUnionCast<PxF32, PxU32>(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); - const Vec3V vBadNum = V3Load(badNumber); - const BoolV vMask = BAnd(BAnd(vBadNum, a), BTTTF()); - return internalUnitSSE2Simd::FiniteTestEq(vMask, BFFFF()) == 1; -} - -PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) -{ - /*Vec4V a; - PX_ALIGN(16, PxF32 f[4]); - F32Array_Aligned_From_Vec4V(a, f); - return PxIsFinite(f[0]) - && PxIsFinite(f[1]) - && PxIsFinite(f[2]) - && PxIsFinite(f[3]);*/ - - PxF32 badNumber = - physx::PxUnionCast<PxF32, PxU32>(PX_FPCLASS_SNAN | PX_FPCLASS_QNAN | PX_FPCLASS_NINF | PX_FPCLASS_PINF); - const Vec4V vBadNum = V4Load(badNumber); - const BoolV vMask = BAnd(vBadNum, a); - - return internalUnitSSE2Simd::FiniteTestEq(vMask, BFFFF()) == 1; -} - -PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) ? true : false; -} - -PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) -{ - return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero())); -} - -PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) -{ - return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)), FZero())); -} - -///////////////////////////////////////////////////////////////////// -////VECTORISED FUNCTION IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -PX_FORCE_INLINE FloatV FLoad(const PxF32 f) -{ - return _mm_load1_ps(&f); -} - -PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) -{ - return _mm_set_ps(0.0f, f, f, f); -} - -PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) -{ - return _mm_load1_ps(&f); -} - -PX_FORCE_INLINE BoolV BLoad(const bool f) -{ - const PxU32 i = -PxI32(f); - return _mm_load1_ps(reinterpret_cast<const float*>(&i)); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) -{ - ASSERT_ISALIGNED16(const_cast<PxVec3*>(&f)); -#if !PX_EMSCRIPTEN - return _mm_and_ps(reinterpret_cast<const Vec3V&>(f), V4LoadA(internalUnitSSE2Simd::gMaskXYZ)); -#else - return _mm_and_ps((Vec3V&)f, (VecI32V&)internalUnitSSE2Simd::gMaskXYZ); -#endif -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) -{ - return _mm_set_ps(0.0f, f.z, f.y, f.x); -} - -PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) -{ - ASSERT_ISALIGNED16(const_cast<PxVec3*>(&f)); - return _mm_set_ps(0.0f, f.z, f.y, f.x); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) -{ - ASSERT_ISALIGNED16(const_cast<PxF32*>(f)); -#if !PX_EMSCRIPTEN - return _mm_and_ps(V4LoadA(f), V4LoadA(internalUnitSSE2Simd::gMaskXYZ)); -#else - return _mm_and_ps((Vec3V&)*f, (VecI32V&)internalUnitSSE2Simd::gMaskXYZ); -#endif -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const i) -{ - return _mm_set_ps(0.0f, i[2], i[1], i[0]); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) -{ - return V4ClearW(v); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) -{ - return v; -} - -PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return f; // ok if it is implemented as the same type. -} - -PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) -{ - return _mm_set_ps(0.0f, f.z, f.y, f.x); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) -{ - return f; -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) -{ - ASSERT_ISVALIDVEC3V(f); - return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); -} - -PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) -{ - return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); -} - -PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) -{ - V3StoreU(m.col0, out.column0); - V3StoreU(m.col1, out.column1); - V3StoreU(m.col2, out.column2); -} - -PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) -{ - ASSERT_ISALIGNED16(const_cast<PxF32*>(f)); - return _mm_load_ps(f); -} - -PX_FORCE_INLINE void V4StoreA(Vec4V a, PxF32* f) -{ - ASSERT_ISALIGNED16(f); - _mm_store_ps(f, a); -} - -PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) -{ - _mm_storeu_ps(f, a); -} - -PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) -{ - ASSERT_ISALIGNED16(f); - _mm_store_ps(reinterpret_cast<PxF32*>(f), a); -} - -PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) -{ - ASSERT_ISALIGNED16(u); - _mm_store_ps(reinterpret_cast<float*>(u), uv); -} - -PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) -{ - ASSERT_ISALIGNED16(i); - _mm_store_ps(reinterpret_cast<float*>(i), m128_I2F(iv)); -} - -PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) -{ - return _mm_loadu_ps(f); -} - -PX_FORCE_INLINE BoolV BLoad(const bool* const f) -{ - const PX_ALIGN(16, PxI32) b[4] = { -PxI32(f[0]), -PxI32(f[1]), -PxI32(f[2]), -PxI32(f[3]) }; - return _mm_load_ps(reinterpret_cast<const float*>(&b)); -} - -PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) -{ - ASSERT_ISVALIDFLOATV(a); - _mm_store_ss(f, a); -} - -PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - PX_ALIGN(16, PxF32) f2[4]; - _mm_store_ps(f2, a); - f = PxVec3(f2[0], f2[1], f2[2]); -} - -PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) -{ - PX_ALIGN(16, PxF32) f2[4]; - _mm_store_ps(f2, a); - f = PxVec3(f2[0], f2[1], f2[2]); -} - -PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) -{ - _mm_store_ss(reinterpret_cast<PxF32*>(b2), b); -} - -PX_FORCE_INLINE VecU32V U4Load(const PxU32 i) -{ - return _mm_load1_ps(reinterpret_cast<const PxF32*>(&i)); -} - -PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) -{ - return _mm_loadu_ps(reinterpret_cast<const PxF32*>(i)); -} - -PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) -{ - ASSERT_ISALIGNED16(const_cast<PxU32*>(i)); - return _mm_load_ps(reinterpret_cast<const PxF32*>(i)); -} - -////////////////////////////////// -// FLOATV -////////////////////////////////// - -PX_FORCE_INLINE FloatV FZero() -{ - return FLoad(0.0f); -} - -PX_FORCE_INLINE FloatV FOne() -{ - return FLoad(1.0f); -} - -PX_FORCE_INLINE FloatV FHalf() -{ - return FLoad(0.5f); -} - -PX_FORCE_INLINE FloatV FEps() -{ - return FLoad(PX_EPS_REAL); -} - -PX_FORCE_INLINE FloatV FEps6() -{ - return FLoad(1e-6f); -} - -PX_FORCE_INLINE FloatV FMax() -{ - return FLoad(PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV FNegMax() -{ - return FLoad(-PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV IZero() -{ - const PxU32 zero = 0; - return _mm_load1_ps(reinterpret_cast<const PxF32*>(&zero)); -} - -PX_FORCE_INLINE FloatV IOne() -{ - const PxU32 one = 1; - return _mm_load1_ps(reinterpret_cast<const PxF32*>(&one)); -} - -PX_FORCE_INLINE FloatV ITwo() -{ - const PxU32 two = 2; - return _mm_load1_ps(reinterpret_cast<const PxF32*>(&two)); -} - -PX_FORCE_INLINE FloatV IThree() -{ - const PxU32 three = 3; - return _mm_load1_ps(reinterpret_cast<const PxF32*>(&three)); -} - -PX_FORCE_INLINE FloatV IFour() -{ - PxU32 four = 4; - return _mm_load1_ps(reinterpret_cast<const PxF32*>(&four)); -} - -PX_FORCE_INLINE FloatV FNeg(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return _mm_sub_ps(_mm_setzero_ps(), f); -} - -PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); -/* - if(!isValidFloatV(a)) - { -assert(false); - } - if(!isValidFloatV(b)) - { -assert(false); - } -*/ - return _mm_add_ps(a, b); -} - -PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_sub_ps(a, b); -} - -PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE FloatV FRecip(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_div_ps(FOne(), a); -} - -PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_rcp_ps(a); -} - -PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_div_ps(FOne(), _mm_sqrt_ps(a)); -} - -PX_FORCE_INLINE FloatV FSqrt(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_sqrt_ps(a); -} - -PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_rsqrt_ps(a); -} - -PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDFLOATV(c); - return FAdd(FMul(a, b), c); -} - -PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDFLOATV(c); - return FSub(c, FMul(a, b)); -} - -PX_FORCE_INLINE FloatV FAbs(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - PX_ALIGN(16, const PxU32) absMask[4] = { 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF }; - return _mm_and_ps(a, _mm_load_ps(reinterpret_cast<const PxF32*>(absMask))); -} - -PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) -{ - PX_ASSERT(_VecMathTests::allElementsEqualBoolV(c,BTTTT()) || - _VecMathTests::allElementsEqualBoolV(c,BFFFF())); - ASSERT_ISVALIDFLOATV(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_cmpgt_ps(a, b); -} - -PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_cmpge_ps(a, b); -} - -PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_cmpeq_ps(a, b); -} - -PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_max_ps(a, b); -} - -PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_min_ps(a, b); -} - -PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) -{ - ASSERT_ISVALIDFLOATV(minV); - ASSERT_ISVALIDFLOATV(maxV); - return _mm_max_ps(_mm_min_ps(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_comigt_ss(a, b); -} - -PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_comige_ss(a, b); -} - -PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_comieq_ss(a, b); -} - -PX_FORCE_INLINE FloatV FRound(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); -#ifdef __SSE4_2__ - return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); -#else - // return _mm_round_ps(a, 0x0); - const FloatV half = FLoad(0.5f); - const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); - const FloatV aRound = FSub(FAdd(a, half), signBit); - __m128i tmp = _mm_cvttps_epi32(aRound); - return _mm_cvtepi32_ps(tmp); -#endif -} - -PX_FORCE_INLINE FloatV FSin(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = V4LoadA(g_PXTwoPi.f); - const FloatV tmp = FMul(a, recipTwoPi); - const FloatV b = FRound(tmp); - const FloatV V1 = FNegScaleSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const FloatV V2 = FMul(V1, V1); - const FloatV V3 = FMul(V2, V1); - const FloatV V5 = FMul(V3, V2); - const FloatV V7 = FMul(V5, V2); - const FloatV V9 = FMul(V7, V2); - const FloatV V11 = FMul(V9, V2); - const FloatV V13 = FMul(V11, V2); - const FloatV V15 = FMul(V13, V2); - const FloatV V17 = FMul(V15, V2); - const FloatV V19 = FMul(V17, V2); - const FloatV V21 = FMul(V19, V2); - const FloatV V23 = FMul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - FloatV Result; - Result = FScaleAdd(S1, V3, V1); - Result = FScaleAdd(S2, V5, Result); - Result = FScaleAdd(S3, V7, Result); - Result = FScaleAdd(S4, V9, Result); - Result = FScaleAdd(S5, V11, Result); - Result = FScaleAdd(S6, V13, Result); - Result = FScaleAdd(S7, V15, Result); - Result = FScaleAdd(S8, V17, Result); - Result = FScaleAdd(S9, V19, Result); - Result = FScaleAdd(S10, V21, Result); - Result = FScaleAdd(S11, V23, Result); - - return Result; -} - -PX_FORCE_INLINE FloatV FCos(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = V4LoadA(g_PXTwoPi.f); - const FloatV tmp = FMul(a, recipTwoPi); - const FloatV b = FRound(tmp); - const FloatV V1 = FNegScaleSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const FloatV V2 = FMul(V1, V1); - const FloatV V4 = FMul(V2, V2); - const FloatV V6 = FMul(V4, V2); - const FloatV V8 = FMul(V4, V4); - const FloatV V10 = FMul(V6, V4); - const FloatV V12 = FMul(V6, V6); - const FloatV V14 = FMul(V8, V6); - const FloatV V16 = FMul(V8, V8); - const FloatV V18 = FMul(V10, V8); - const FloatV V20 = FMul(V10, V10); - const FloatV V22 = FMul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - FloatV Result; - Result = FScaleAdd(C1, V2, V4One()); - Result = FScaleAdd(C2, V4, Result); - Result = FScaleAdd(C3, V6, Result); - Result = FScaleAdd(C4, V8, Result); - Result = FScaleAdd(C5, V10, Result); - Result = FScaleAdd(C6, V12, Result); - Result = FScaleAdd(C7, V14, Result); - Result = FScaleAdd(C8, V16, Result); - Result = FScaleAdd(C9, V18, Result); - Result = FScaleAdd(C10, V20, Result); - Result = FScaleAdd(C11, V22, Result); - - return Result; -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(min); - ASSERT_ISVALIDFLOATV(max); - const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); - return !BAllEqFFFF(c); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(min); - ASSERT_ISVALIDFLOATV(max) - const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); - return BAllEqTTTT(c); -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(bounds); - return FOutOfBounds(a, FNeg(bounds), bounds); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(bounds); - return FInBounds(a, FNeg(bounds), bounds); -} - -////////////////////////////////// -// VEC3V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - const __m128 zero = FZero(); - const __m128 fff0 = _mm_move_ss(f, zero); - return _mm_shuffle_ps(fff0, fff0, _MM_SHUFFLE(0, 1, 2, 3)); -} - -PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) -{ - ASSERT_ISVALIDFLOATV(x); - ASSERT_ISVALIDFLOATV(y); - ASSERT_ISVALIDFLOATV(z); - // static on zero causes compiler crash on x64 debug_opt - const __m128 zero = FZero(); - const __m128 xy = _mm_move_ss(x, y); - const __m128 z0 = _mm_move_ss(zero, z); - - return _mm_shuffle_ps(xy, z0, _MM_SHUFFLE(1, 0, 0, 1)); -} - -PX_FORCE_INLINE Vec3V V3UnitX() -{ - const PX_ALIGN(16, PxF32) x[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; - const __m128 x128 = _mm_load_ps(x); - return x128; -} - -PX_FORCE_INLINE Vec3V V3UnitY() -{ - const PX_ALIGN(16, PxF32) y[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; - const __m128 y128 = _mm_load_ps(y); - return y128; -} - -PX_FORCE_INLINE Vec3V V3UnitZ() -{ - const PX_ALIGN(16, PxF32) z[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; - const __m128 z128 = _mm_load_ps(z); - return z128; -} - -PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f) - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BFTTT(), v, f); -} - -PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTFTT(), v, f); -} - -PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTFT(), v, f); -} - -PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 0, 3, 0)); - return V3SetY(r, V3GetX(b)); -} - -PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c) - Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 1, 3, 1)); - return V3SetY(r, V3GetY(b)); -} - -PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 2, 3, 2)); - return V3SetY(r, V3GetZ(b)); -} - -PX_FORCE_INLINE Vec3V V3Zero() -{ - return V3Load(0.0f); -} - -PX_FORCE_INLINE Vec3V V3Eps() -{ - return V3Load(PX_EPS_REAL); -} -PX_FORCE_INLINE Vec3V V3One() -{ - return V3Load(1.0f); -} - -PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_sub_ps(_mm_setzero_ps(), f); -} - -PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_add_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_sub_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return V4ClearW(_mm_div_ps(a, b)); -} - -PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return V4ClearW(_mm_mul_ps(a, _mm_rcp_ps(b))); -} - -PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_div_ps(V3One(), a); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_rcp_ps(a); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_div_ps(V3One(), _mm_sqrt_ps(a)); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_rsqrt_ps(a); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDVEC3V(c); - return V3Add(V3Scale(a, b), c); -} - -PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDVEC3V(c); - return V3Sub(c, V3Scale(a, b)); -} - -PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - return V3Add(V3Mul(a, b), c); -} - -PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - return V3Sub(c, V3Mul(a, b)); -} - -PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return V3Max(a, V3Neg(a)); -} - -PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); -#ifdef __SSE4_2__ - return _mm_dp_ps(a, b, 0x7f); -#else - const __m128 t0 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx - const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); // ay*by | ax*bx | aw*bw | az*bz - const __m128 t2 = _mm_add_ps(t0, t1); // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx - const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by - return _mm_add_ps(t3, t2); // ax*bx + az*bz + ay*by + aw*bw - // ay*by + aw*bw + ax*bx + az*bz - // az*bz + ax*bx + aw*bw + ay*by - // aw*bw + ay*by + az*bz + ax*bx -#endif -} - -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); -} - -PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - VecCrossV v; - v.mR1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - v.mL1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - return v; -} - -PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(b); - const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(a.mL1, l2), _mm_mul_ps(a.mR1, r2)); -} - -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const VecCrossV& b) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 r2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(b.mR1, r2), _mm_mul_ps(b.mL1, l2)); -} - -PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const VecCrossV& b) -{ - return _mm_sub_ps(_mm_mul_ps(a.mL1, b.mR1), _mm_mul_ps(a.mR1, b.mL1)); -} - -PX_FORCE_INLINE FloatV V3Length(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_sqrt_ps(V3Dot(a, a)); -} - -PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return V3Dot(a, a); -} - -PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISFINITELENGTH(a); - return V3ScaleInv(a, _mm_sqrt_ps(V3Dot(a, a))); -} - -PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISFINITELENGTH(a); - return V3Scale(a, _mm_rsqrt_ps(V3Dot(a, a))); -} - -PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 eps = V3Eps(); - const __m128 length = V3Length(a); - const __m128 isGreaterThanZero = FIsGrtr(length, eps); - return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); -} - -PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_cmpgt_ps(a, b); -} - -PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_cmpge_ps(a, b); -} - -PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_cmpeq_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_max_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_min_ps(a, b); -} - -PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); - - return _mm_max_ps(_mm_max_ps(shuf1, shuf2), shuf3); -} - -PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); - - return _mm_min_ps(_mm_min_ps(shuf1, shuf2), shuf3); -} - -// return (a >= 0.0f) ? 1.0f : -1.0f; -PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 one = V3One(); - const __m128 none = V3Neg(one); - return V3Sel(V3IsGrtrOrEq(a, zero), one, none); -} - -PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) -{ - ASSERT_ISVALIDVEC3V(maxV); - ASSERT_ISVALIDVEC3V(minV); - return V3Max(V3Min(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalUnitSSE2Simd::BAllTrue3_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalUnitSSE2Simd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalUnitSSE2Simd::BAllTrue3_R(V4IsEq(a, b)); -} - -PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); -#ifdef __SSE4_2__ - return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); -#else - // return _mm_round_ps(a, 0x0); - const Vec3V half = V3Load(0.5f); - const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); - const Vec3V aRound = V3Sub(V3Add(a, half), signBit); - __m128i tmp = _mm_cvttps_epi32(aRound); - return _mm_cvtepi32_ps(tmp); -#endif -} - -PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec3V tmp = V3Scale(a, recipTwoPi); - const Vec3V b = V3Round(tmp); - const Vec3V V1 = V3NegScaleSub(b, twoPi, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const Vec3V V2 = V3Mul(V1, V1); - const Vec3V V3 = V3Mul(V2, V1); - const Vec3V V5 = V3Mul(V3, V2); - const Vec3V V7 = V3Mul(V5, V2); - const Vec3V V9 = V3Mul(V7, V2); - const Vec3V V11 = V3Mul(V9, V2); - const Vec3V V13 = V3Mul(V11, V2); - const Vec3V V15 = V3Mul(V13, V2); - const Vec3V V17 = V3Mul(V15, V2); - const Vec3V V19 = V3Mul(V17, V2); - const Vec3V V21 = V3Mul(V19, V2); - const Vec3V V23 = V3Mul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - Vec3V Result; - Result = V3ScaleAdd(V3, S1, V1); - Result = V3ScaleAdd(V5, S2, Result); - Result = V3ScaleAdd(V7, S3, Result); - Result = V3ScaleAdd(V9, S4, Result); - Result = V3ScaleAdd(V11, S5, Result); - Result = V3ScaleAdd(V13, S6, Result); - Result = V3ScaleAdd(V15, S7, Result); - Result = V3ScaleAdd(V17, S8, Result); - Result = V3ScaleAdd(V19, S9, Result); - Result = V3ScaleAdd(V21, S10, Result); - Result = V3ScaleAdd(V23, S11, Result); - - ASSERT_ISVALIDVEC3V(Result); - return Result; -} - -PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec3V tmp = V3Scale(a, recipTwoPi); - const Vec3V b = V3Round(tmp); - const Vec3V V1 = V3NegScaleSub(b, twoPi, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const Vec3V V2 = V3Mul(V1, V1); - const Vec3V V4 = V3Mul(V2, V2); - const Vec3V V6 = V3Mul(V4, V2); - const Vec3V V8 = V3Mul(V4, V4); - const Vec3V V10 = V3Mul(V6, V4); - const Vec3V V12 = V3Mul(V6, V6); - const Vec3V V14 = V3Mul(V8, V6); - const Vec3V V16 = V3Mul(V8, V8); - const Vec3V V18 = V3Mul(V10, V8); - const Vec3V V20 = V3Mul(V10, V10); - const Vec3V V22 = V3Mul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - Vec3V Result; - Result = V3ScaleAdd(V2, C1, V3One()); - Result = V3ScaleAdd(V4, C2, Result); - Result = V3ScaleAdd(V6, C3, Result); - Result = V3ScaleAdd(V8, C4, Result); - Result = V3ScaleAdd(V10, C5, Result); - Result = V3ScaleAdd(V12, C6, Result); - Result = V3ScaleAdd(V14, C7, Result); - Result = V3ScaleAdd(V16, C8, Result); - Result = V3ScaleAdd(V18, C9, Result); - Result = V3ScaleAdd(V20, C10, Result); - Result = V3ScaleAdd(V22, C11, Result); - - ASSERT_ISVALIDVEC3V(Result); - return Result; -} - -PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 2, 1)); -} - -PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 1, 0)); -} - -PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); -} - -PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); -} - -PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 2, 2)); -} - -PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 0, 1)); -} - -PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - return _mm_shuffle_ps(v1, v0, _MM_SHUFFLE(3, 1, 2, 3)); -} - -PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - return _mm_shuffle_ps(v0, v1, _MM_SHUFFLE(3, 0, 3, 2)); -} - -PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - // There must be a better way to do this. - Vec3V v2 = V3Zero(); - FloatV y1 = V3GetY(v1); - FloatV x0 = V3GetX(v0); - v2 = V3SetX(v2, y1); - return V3SetY(v2, x0); -} - -PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); -#ifdef __SSE4_2__ - Vec3V r = _mm_hadd_ps(a, a); - r = _mm_hadd_ps(r, r); - return r; -#else - __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w - __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z - __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y - return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); -#endif -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(min); - ASSERT_ISVALIDVEC3V(max); - const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); - return !BAllEqFFFF(c); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(min); - ASSERT_ISVALIDVEC3V(max); - const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); - return BAllEqTTTT(c); -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(bounds); - return V3OutOfBounds(a, V3Neg(bounds), bounds); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(bounds) - return V3InBounds(a, V3Neg(bounds), bounds); -} - -PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) -{ - ASSERT_ISVALIDVEC3V(col0); - ASSERT_ISVALIDVEC3V(col1); - ASSERT_ISVALIDVEC3V(col2); - - const Vec3V col3 = _mm_setzero_ps(); - Vec3V tmp0 = _mm_unpacklo_ps(col0, col1); - Vec3V tmp2 = _mm_unpacklo_ps(col2, col3); - Vec3V tmp1 = _mm_unpackhi_ps(col0, col1); - Vec3V tmp3 = _mm_unpackhi_ps(col2, col3); - col0 = _mm_movelh_ps(tmp0, tmp2); - col1 = _mm_movehl_ps(tmp2, tmp0); - col2 = _mm_movelh_ps(tmp1, tmp3); -} - -////////////////////////////////// -// VEC4V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - // return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0,0,0,0)); - return f; -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) -{ - ASSERT_ISVALIDFLOATV(floatVArray[0]); - ASSERT_ISVALIDFLOATV(floatVArray[1]); - ASSERT_ISVALIDFLOATV(floatVArray[2]); - ASSERT_ISVALIDFLOATV(floatVArray[3]); - const __m128 xw = _mm_move_ss(floatVArray[1], floatVArray[0]); // y, y, y, x - const __m128 yz = _mm_move_ss(floatVArray[2], floatVArray[3]); // z, z, z, w - return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) -{ - ASSERT_ISVALIDFLOATV(x); - ASSERT_ISVALIDFLOATV(y); - ASSERT_ISVALIDFLOATV(z); - ASSERT_ISVALIDFLOATV(w); - const __m128 xw = _mm_move_ss(y, x); // y, y, y, x - const __m128 yz = _mm_move_ss(z, w); // z, z, z, w - return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); -} - -PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpackhi_ps(x, z); - const Vec4V yw = _mm_unpackhi_ps(y, w); - return _mm_unpackhi_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpackhi_ps(x, z); - const Vec4V yw = _mm_unpackhi_ps(y, w); - return _mm_unpacklo_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpacklo_ps(x, z); - const Vec4V yw = _mm_unpacklo_ps(y, w); - return _mm_unpackhi_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpacklo_ps(x, z); - const Vec4V yw = _mm_unpacklo_ps(y, w); - return _mm_unpacklo_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) -{ - return _mm_unpacklo_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) -{ - return _mm_unpackhi_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4UnitW() -{ - const PX_ALIGN(16, PxF32) w[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; - const __m128 w128 = _mm_load_ps(w); - return w128; -} - -PX_FORCE_INLINE Vec4V V4UnitX() -{ - const PX_ALIGN(16, PxF32) x[4] = { 1.0f, 0.0f, 0.0f, 0.0f }; - const __m128 x128 = _mm_load_ps(x); - return x128; -} - -PX_FORCE_INLINE Vec4V V4UnitY() -{ - const PX_ALIGN(16, PxF32) y[4] = { 0.0f, 1.0f, 0.0f, 0.0f }; - const __m128 y128 = _mm_load_ps(y); - return y128; -} - -PX_FORCE_INLINE Vec4V V4UnitZ() -{ - const PX_ALIGN(16, PxF32) z[4] = { 0.0f, 0.0f, 1.0f, 0.0f }; - const __m128 z128 = _mm_load_ps(z); - return z128; -} - -PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); -} - -PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTTF(), v, f); -} - -PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BFTTT(), v, f); -} - -PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTFTT(), v, f); -} - -PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTFT(), v, f); -} - -PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) -{ -#if !PX_EMSCRIPTEN - return _mm_and_ps(v, V4LoadA(internalUnitSSE2Simd::gMaskXYZ)); -#else - return _mm_and_ps(v, (VecI32V&)internalUnitSSE2Simd::gMaskXYZ); -#endif -} - -PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 0, 1)); -} - -PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 0, 2, 0)); -} - -PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 3, 1)); -} - -PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); -} - -template <PxU8 x, PxU8 y, PxU8 z, PxU8 w> -PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(w, z, y, x)); -} - -PX_FORCE_INLINE Vec4V V4Zero() -{ - return V4Load(0.0f); -} - -PX_FORCE_INLINE Vec4V V4One() -{ - return V4Load(1.0f); -} - -PX_FORCE_INLINE Vec4V V4Eps() -{ - return V4Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) -{ - return _mm_sub_ps(_mm_setzero_ps(), f); -} - -PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) -{ - return _mm_add_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) -{ - return _mm_sub_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) -{ - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) -{ - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(b); - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) -{ - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) -{ - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) -{ - return _mm_div_ps(V4One(), a); -} - -PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) -{ - return _mm_rcp_ps(a); -} - -PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) -{ - return _mm_div_ps(V4One(), _mm_sqrt_ps(a)); -} - -PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) -{ - return _mm_rsqrt_ps(a); -} - -PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) -{ - return _mm_sqrt_ps(a); -} - -PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) -{ - ASSERT_ISVALIDFLOATV(b); - return V4Add(V4Scale(a, b), c); -} - -PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) -{ - ASSERT_ISVALIDFLOATV(b); - return V4Sub(c, V4Scale(a, b)); -} - -PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return V4Add(V4Mul(a, b), c); -} - -PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return V4Sub(c, V4Mul(a, b)); -} - -PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) -{ - return V4Max(a, V4Neg(a)); -} - -PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) -{ -#ifdef __SSE4_2__ - Vec4V r = _mm_hadd_ps(a, a); - r = _mm_hadd_ps(r, r); - return r; -#else - const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y - const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w - const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w - const FloatV xz = V4GetX(xz_yw); // x+z - const FloatV yw = V4GetZ(xz_yw); // y+w - return FAdd(xz, yw); // sum -#endif -} - -PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) -{ -#ifdef __SSE4_2__ - return _mm_dp_ps(a, b, 0xff); -#else - const __m128 dot1 = _mm_mul_ps(a, b); // x,y,z,w - const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 1, 0, 3)); // w,x,y,z - const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 0, 3, 2)); // z,w,x,y - const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 3, 2, 1)); // y,z,w,x - return _mm_add_ps(_mm_add_ps(shuf2, shuf3), _mm_add_ps(dot1, shuf1)); -#endif -} - -PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) -{ -#ifdef __SSE4_2__ - return _mm_dp_ps(a, b, 0x7f); -#else - const __m128 dot1 = _mm_mul_ps(a, b); // w,z,y,x - const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w - const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z - const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y - return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); -#endif -} - -PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) -{ - const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); -} - -PX_FORCE_INLINE FloatV V4Length(const Vec4V a) -{ - return _mm_sqrt_ps(V4Dot(a, a)); -} - -PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) -{ - return V4Dot(a, a); -} - -PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) -{ - ASSERT_ISFINITELENGTH(a); - return V4ScaleInv(a, _mm_sqrt_ps(V4Dot(a, a))); -} - -PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) -{ - ASSERT_ISFINITELENGTH(a); - return V4ScaleInvFast(a, _mm_sqrt_ps(V4Dot(a, a))); -} - -PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec3V unsafeReturnValue) -{ - const __m128 eps = V3Eps(); - const __m128 length = V4Length(a); - const __m128 isGreaterThanZero = V4IsGrtr(length, eps); - return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); -} - -PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) -{ - return m128_I2F(_mm_cmpeq_epi32(m128_F2I(a), m128_F2I(b))); -} - -PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) -{ - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) -{ - return _mm_cmpgt_ps(a, b); -} - -PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return _mm_cmpge_ps(a, b); -} - -PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) -{ - return _mm_cmpeq_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) -{ - return _mm_max_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) -{ - return _mm_min_ps(a, b); -} - -PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) -{ - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); - - return _mm_max_ps(_mm_max_ps(a, shuf1), _mm_max_ps(shuf2, shuf3)); -} - -PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) -{ - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); - - return _mm_min_ps(_mm_min_ps(a, shuf1), _mm_min_ps(shuf2, shuf3)); -} - -PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) -{ - return V4Max(V4Min(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) -{ - return internalUnitSSE2Simd::BAllTrue4_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return internalUnitSSE2Simd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) -{ - return internalUnitSSE2Simd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) -{ - return internalUnitSSE2Simd::BAllTrue4_R(V4IsEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) -{ - return internalUnitSSE2Simd::BAnyTrue3_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) -{ -#ifdef __SSE4_2__ - return _mm_round_ps(a, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC); -#else - // return _mm_round_ps(a, 0x0); - const Vec4V half = V4Load(0.5f); - const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); - const Vec4V aRound = V4Sub(V4Add(a, half), signBit); - __m128i tmp = _mm_cvttps_epi32(aRound); - return _mm_cvtepi32_ps(tmp); -#endif -} - -PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) -{ - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec4V tmp = V4Mul(a, recipTwoPi); - const Vec4V b = V4Round(tmp); - const Vec4V V1 = V4NegMulSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const Vec4V V2 = V4Mul(V1, V1); - const Vec4V V3 = V4Mul(V2, V1); - const Vec4V V5 = V4Mul(V3, V2); - const Vec4V V7 = V4Mul(V5, V2); - const Vec4V V9 = V4Mul(V7, V2); - const Vec4V V11 = V4Mul(V9, V2); - const Vec4V V13 = V4Mul(V11, V2); - const Vec4V V15 = V4Mul(V13, V2); - const Vec4V V17 = V4Mul(V15, V2); - const Vec4V V19 = V4Mul(V17, V2); - const Vec4V V21 = V4Mul(V19, V2); - const Vec4V V23 = V4Mul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - Vec4V Result; - Result = V4MulAdd(S1, V3, V1); - Result = V4MulAdd(S2, V5, Result); - Result = V4MulAdd(S3, V7, Result); - Result = V4MulAdd(S4, V9, Result); - Result = V4MulAdd(S5, V11, Result); - Result = V4MulAdd(S6, V13, Result); - Result = V4MulAdd(S7, V15, Result); - Result = V4MulAdd(S8, V17, Result); - Result = V4MulAdd(S9, V19, Result); - Result = V4MulAdd(S10, V21, Result); - Result = V4MulAdd(S11, V23, Result); - - return Result; -} - -PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) -{ - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec4V tmp = V4Mul(a, recipTwoPi); - const Vec4V b = V4Round(tmp); - const Vec4V V1 = V4NegMulSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const Vec4V V2 = V4Mul(V1, V1); - const Vec4V V4 = V4Mul(V2, V2); - const Vec4V V6 = V4Mul(V4, V2); - const Vec4V V8 = V4Mul(V4, V4); - const Vec4V V10 = V4Mul(V6, V4); - const Vec4V V12 = V4Mul(V6, V6); - const Vec4V V14 = V4Mul(V8, V6); - const Vec4V V16 = V4Mul(V8, V8); - const Vec4V V18 = V4Mul(V10, V8); - const Vec4V V20 = V4Mul(V10, V10); - const Vec4V V22 = V4Mul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - Vec4V Result; - Result = V4MulAdd(C1, V2, V4One()); - Result = V4MulAdd(C2, V4, Result); - Result = V4MulAdd(C3, V6, Result); - Result = V4MulAdd(C4, V8, Result); - Result = V4MulAdd(C5, V10, Result); - Result = V4MulAdd(C6, V12, Result); - Result = V4MulAdd(C7, V14, Result); - Result = V4MulAdd(C8, V16, Result); - Result = V4MulAdd(C9, V18, Result); - Result = V4MulAdd(C10, V20, Result); - Result = V4MulAdd(C11, V22, Result); - - return Result; -} - -PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) -{ - Vec4V tmp0 = _mm_unpacklo_ps(col0, col1); - Vec4V tmp2 = _mm_unpacklo_ps(col2, col3); - Vec4V tmp1 = _mm_unpackhi_ps(col0, col1); - Vec4V tmp3 = _mm_unpackhi_ps(col2, col3); - col0 = _mm_movelh_ps(tmp0, tmp2); - col1 = _mm_movehl_ps(tmp2, tmp0); - col2 = _mm_movelh_ps(tmp1, tmp3); - col3 = _mm_movehl_ps(tmp3, tmp1); -} - -////////////////////////////////// -// BoolV -////////////////////////////////// - -PX_FORCE_INLINE BoolV BFFFF() -{ - return _mm_setzero_ps(); -} - -PX_FORCE_INLINE BoolV BFFFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; - const __m128 ffft=_mm_load_ps((float*)&f); - return ffft;*/ - return m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); -} - -PX_FORCE_INLINE BoolV BFFTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; - const __m128 fftf=_mm_load_ps((float*)&f); - return fftf;*/ - return m128_I2F(_mm_set_epi32(0, -1, 0, 0)); -} - -PX_FORCE_INLINE BoolV BFFTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 fftt=_mm_load_ps((float*)&f); - return fftt;*/ - return m128_I2F(_mm_set_epi32(-1, -1, 0, 0)); -} - -PX_FORCE_INLINE BoolV BFTFF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; - const __m128 ftff=_mm_load_ps((float*)&f); - return ftff;*/ - return m128_I2F(_mm_set_epi32(0, 0, -1, 0)); -} - -PX_FORCE_INLINE BoolV BFTFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0xFFFFFFFF}; - const __m128 ftft=_mm_load_ps((float*)&f); - return ftft;*/ - return m128_I2F(_mm_set_epi32(-1, 0, -1, 0)); -} - -PX_FORCE_INLINE BoolV BFTTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0}; - const __m128 fttf=_mm_load_ps((float*)&f); - return fttf;*/ - return m128_I2F(_mm_set_epi32(0, -1, -1, 0)); -} - -PX_FORCE_INLINE BoolV BFTTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 fttt=_mm_load_ps((float*)&f); - return fttt;*/ - return m128_I2F(_mm_set_epi32(-1, -1, -1, 0)); -} - -PX_FORCE_INLINE BoolV BTFFF() -{ - // const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; - // const __m128 tfff=_mm_load_ps((float*)&f); - // return tfff; - return m128_I2F(_mm_set_epi32(0, 0, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTFFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0xFFFFFFFF}; - const __m128 tfft=_mm_load_ps((float*)&f); - return tfft;*/ - return m128_I2F(_mm_set_epi32(-1, 0, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTFTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0}; - const __m128 tftf=_mm_load_ps((float*)&f); - return tftf;*/ - return m128_I2F(_mm_set_epi32(0, -1, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTFTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 tftt=_mm_load_ps((float*)&f); - return tftt;*/ - return m128_I2F(_mm_set_epi32(-1, -1, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTTFF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0}; - const __m128 ttff=_mm_load_ps((float*)&f); - return ttff;*/ - return m128_I2F(_mm_set_epi32(0, 0, -1, -1)); -} - -PX_FORCE_INLINE BoolV BTTFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0xFFFFFFFF}; - const __m128 ttft=_mm_load_ps((float*)&f); - return ttft;*/ - return m128_I2F(_mm_set_epi32(-1, 0, -1, -1)); -} - -PX_FORCE_INLINE BoolV BTTTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0}; - const __m128 tttf=_mm_load_ps((float*)&f); - return tttf;*/ - return m128_I2F(_mm_set_epi32(0, -1, -1, -1)); -} - -PX_FORCE_INLINE BoolV BTTTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 tttt=_mm_load_ps((float*)&f); - return tttt;*/ - return m128_I2F(_mm_set_epi32(-1, -1, -1, -1)); -} - -PX_FORCE_INLINE BoolV BXMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; - const __m128 tfff=_mm_load_ps((float*)&f); - return tfff;*/ - return m128_I2F(_mm_set_epi32(0, 0, 0, -1)); -} - -PX_FORCE_INLINE BoolV BYMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; - const __m128 ftff=_mm_load_ps((float*)&f); - return ftff;*/ - return m128_I2F(_mm_set_epi32(0, 0, -1, 0)); -} - -PX_FORCE_INLINE BoolV BZMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; - const __m128 fftf=_mm_load_ps((float*)&f); - return fftf;*/ - return m128_I2F(_mm_set_epi32(0, -1, 0, 0)); -} - -PX_FORCE_INLINE BoolV BWMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; - const __m128 ffft=_mm_load_ps((float*)&f); - return ffft;*/ - return m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); -} - -PX_FORCE_INLINE BoolV BGetX(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE BoolV BGetY(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE BoolV BGetZ(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE BoolV BGetW(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); -} - -PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) -{ - return V4Sel(BFTTT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) -{ - return V4Sel(BTFTT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) -{ - return V4Sel(BTTFT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) -{ - return V4Sel(BTTTF(), v, f); -} - -PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) -{ - return _mm_and_ps(a, b); -} - -PX_FORCE_INLINE BoolV BNot(const BoolV a) -{ - const BoolV bAllTrue(BTTTT()); - return _mm_xor_ps(a, bAllTrue); -} - -PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) -{ - return _mm_andnot_ps(b, a); -} - -PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) -{ - return _mm_or_ps(a, b); -} - -PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) -{ - const BoolV bTmp = - _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); - return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) -{ - const BoolV bTmp = - _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); - return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) -{ - const BoolV bTmp = - _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); - return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) -{ - const BoolV bTmp = - _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); - return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) -{ - const BoolV bTest = m128_I2F(_mm_cmpeq_epi32(m128_F2I(a), m128_F2I(b))); - return internalUnitSSE2Simd::BAllTrue4_R(bTest); -} - -PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) -{ - return PxU32(_mm_movemask_ps(a)==15); -} - -PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) -{ - return PxU32(_mm_movemask_ps(a)==0); -} - -PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) -{ - return PxU32(_mm_movemask_ps(a)); -} - -////////////////////////////////// -// MAT33V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - return V3Add(v0PlusV1, v2); -} - -PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) -{ - const FloatV x = V3Dot(a.col0, b); - const FloatV y = V3Dot(a.col1, b); - const FloatV z = V3Dot(a.col2, b); - return V3Merge(x, y, z); -} - -PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - Vec3V result = V3ScaleAdd(A.col0, x, c); - result = V3ScaleAdd(A.col1, y, result); - return V3ScaleAdd(A.col2, z, result); -} - -PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) -{ - return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); -} - -PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) -{ - const BoolV tfft = BTFFT(); - const BoolV tttf = BTTTF(); - const FloatV zero = FZero(); - const Vec3V cross01 = V3Cross(a.col0, a.col1); - const Vec3V cross12 = V3Cross(a.col1, a.col2); - const Vec3V cross20 = V3Cross(a.col2, a.col0); - const FloatV dot = V3Dot(cross01, a.col2); - const FloatV invDet = _mm_rcp_ps(dot); - const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); - const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); - Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); - colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); - const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); - const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); - const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); - const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); - const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); - const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); - - return Mat33V(_mm_mul_ps(colInv0, invDet), _mm_mul_ps(colInv1, invDet), _mm_mul_ps(colInv2, invDet)); -} - -PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) -{ - return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), - V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), - V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); -} - -PX_FORCE_INLINE Mat33V M33Identity() -{ - return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); -} - -PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) -{ - return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); -} - -PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) -{ - return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); -} - -PX_FORCE_INLINE Mat33V PromoteVec3V(const Vec3V v) -{ - const BoolV bTFFF = BTFFF(); - const BoolV bFTFF = BFTFF(); - const BoolV bFFTF = BTFTF(); - - const Vec3V zero = V3Zero(); - - return Mat33V(V3Sel(bTFFF, v, zero), V3Sel(bFTFF, v, zero), V3Sel(bFFTF, v, zero)); -} - -PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) -{ - const FloatV x = V3Mul(V3UnitX(), d); - const FloatV y = V3Mul(V3UnitY(), d); - const FloatV z = V3Mul(V3UnitZ(), d); - return Mat33V(x, y, z); -} - -////////////////////////////////// -// MAT34V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); - return V3Add(v0PlusV1Plusv2, a.col3); -} - -PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - return V3Add(v0PlusV1, v2); -} - -PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3Dot(a.col0, b); - const FloatV y = V3Dot(a.col1, b); - const FloatV z = V3Dot(a.col2, b); - return V3Merge(x, y, z); -} - -PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) -{ - return Mat33V(V3Merge(V3GetX(a.col0), V3GetX(a.col1), V3GetX(a.col2)), - V3Merge(V3GetY(a.col0), V3GetY(a.col1), V3GetY(a.col2)), - V3Merge(V3GetZ(a.col0), V3GetZ(a.col1), V3GetZ(a.col2))); -} - -////////////////////////////////// -// MAT44V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) -{ - const FloatV x = V4GetX(b); - const FloatV y = V4GetY(b); - const FloatV z = V4GetZ(b); - const FloatV w = V4GetW(b); - - const Vec4V v0 = V4Scale(a.col0, x); - const Vec4V v1 = V4Scale(a.col1, y); - const Vec4V v2 = V4Scale(a.col2, z); - const Vec4V v3 = V4Scale(a.col3, w); - const Vec4V v0PlusV1 = V4Add(v0, v1); - const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); - return V4Add(v0PlusV1Plusv2, v3); -} - -PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) -{ - PX_ALIGN(16, FloatV) dotProdArray[4] = { V4Dot(a.col0, b), V4Dot(a.col1, b), V4Dot(a.col2, b), V4Dot(a.col3, b) }; - return V4Merge(dotProdArray); -} - -PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) -{ - const Vec4V v0 = _mm_unpacklo_ps(a.col0, a.col2); - const Vec4V v1 = _mm_unpackhi_ps(a.col0, a.col2); - const Vec4V v2 = _mm_unpacklo_ps(a.col1, a.col3); - const Vec4V v3 = _mm_unpackhi_ps(a.col1, a.col3); - return Mat44V(_mm_unpacklo_ps(v0, v2), _mm_unpackhi_ps(v0, v2), _mm_unpacklo_ps(v1, v3), _mm_unpackhi_ps(v1, v3)); -} - -PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) -{ - __m128 minor0, minor1, minor2, minor3; - __m128 row0, row1, row2, row3; - __m128 det, tmp1; - - tmp1 = V4Zero(); - row1 = V4Zero(); - row3 = V4Zero(); - - row0 = a.col0; - row1 = _mm_shuffle_ps(a.col1, a.col1, _MM_SHUFFLE(1, 0, 3, 2)); - row2 = a.col2; - row3 = _mm_shuffle_ps(a.col3, a.col3, _MM_SHUFFLE(1, 0, 3, 2)); - - tmp1 = _mm_mul_ps(row2, row3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor0 = _mm_mul_ps(row1, tmp1); - minor1 = _mm_mul_ps(row0, tmp1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor0 = _mm_sub_ps(_mm_mul_ps(row1, tmp1), minor0); - minor1 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor1); - minor1 = _mm_shuffle_ps(minor1, minor1, 0x4E); - - tmp1 = _mm_mul_ps(row1, row2); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor0 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor0); - minor3 = _mm_mul_ps(row0, tmp1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row3, tmp1)); - minor3 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor3); - minor3 = _mm_shuffle_ps(minor3, minor3, 0x4E); - - tmp1 = _mm_mul_ps(_mm_shuffle_ps(row1, row1, 0x4E), row3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - row2 = _mm_shuffle_ps(row2, row2, 0x4E); - minor0 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor0); - minor2 = _mm_mul_ps(row0, tmp1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row2, tmp1)); - minor2 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor2); - minor2 = _mm_shuffle_ps(minor2, minor2, 0x4E); - - tmp1 = _mm_mul_ps(row0, row1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor2 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor2); - minor3 = _mm_sub_ps(_mm_mul_ps(row2, tmp1), minor3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor2 = _mm_sub_ps(_mm_mul_ps(row3, tmp1), minor2); - minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row2, tmp1)); - - tmp1 = _mm_mul_ps(row0, row3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row2, tmp1)); - minor2 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor2); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor1 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor1); - minor2 = _mm_sub_ps(minor2, _mm_mul_ps(row1, tmp1)); - - tmp1 = _mm_mul_ps(row0, row2); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor1 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor1); - minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row1, tmp1)); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row3, tmp1)); - minor3 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor3); - - det = _mm_mul_ps(row0, minor0); - det = _mm_add_ps(_mm_shuffle_ps(det, det, 0x4E), det); - det = _mm_add_ss(_mm_shuffle_ps(det, det, 0xB1), det); - tmp1 = _mm_rcp_ss(det); -#if 0 - det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1), _mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1))); - det = _mm_shuffle_ps(det, det, 0x00); -#else - det = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(0, 0, 0, 0)); -#endif - - minor0 = _mm_mul_ps(det, minor0); - minor1 = _mm_mul_ps(det, minor1); - minor2 = _mm_mul_ps(det, minor2); - minor3 = _mm_mul_ps(det, minor3); - Mat44V invTrans(minor0, minor1, minor2, minor3); - return M44Trnsps(invTrans); -} - -PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) -{ - return _mm_set_ps(w, z, y, x); -} - -/* -// AP: work in progress - use proper SSE intrinsics where possible -PX_FORCE_INLINE VecU16V V4U32PK(VecU32V a, VecU32V b) -{ - VecU16V result; - result.m128_u16[0] = PxU16(PxClamp<PxU32>((a).m128_u32[0], 0, 0xFFFF)); - result.m128_u16[1] = PxU16(PxClamp<PxU32>((a).m128_u32[1], 0, 0xFFFF)); - result.m128_u16[2] = PxU16(PxClamp<PxU32>((a).m128_u32[2], 0, 0xFFFF)); - result.m128_u16[3] = PxU16(PxClamp<PxU32>((a).m128_u32[3], 0, 0xFFFF)); - result.m128_u16[4] = PxU16(PxClamp<PxU32>((b).m128_u32[0], 0, 0xFFFF)); - result.m128_u16[5] = PxU16(PxClamp<PxU32>((b).m128_u32[1], 0, 0xFFFF)); - result.m128_u16[6] = PxU16(PxClamp<PxU32>((b).m128_u32[2], 0, 0xFFFF)); - result.m128_u16[7] = PxU16(PxClamp<PxU32>((b).m128_u32[3], 0, 0xFFFF)); - return result; -} -*/ - -PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) -{ - return m128_I2F(_mm_or_si128(_mm_andnot_si128(m128_F2I(c), m128_F2I(b)), _mm_and_si128(m128_F2I(c), m128_F2I(a)))); -} - -PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) -{ - return m128_I2F(_mm_or_si128(m128_F2I(a), m128_F2I(b))); -} - -PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) -{ - return m128_I2F(_mm_xor_si128(m128_F2I(a), m128_F2I(b))); -} - -PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) -{ - return m128_I2F(_mm_and_si128(m128_F2I(a), m128_F2I(b))); -} - -PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) -{ - return m128_I2F(_mm_andnot_si128(m128_F2I(b), m128_F2I(a))); -} - -/* -PX_FORCE_INLINE VecU16V V4U16Or(VecU16V a, VecU16V b) -{ - return m128_I2F(_mm_or_si128(m128_F2I(a), m128_F2I(b))); -} -*/ - -/* -PX_FORCE_INLINE VecU16V V4U16And(VecU16V a, VecU16V b) -{ - return m128_I2F(_mm_and_si128(m128_F2I(a), m128_F2I(b))); -} -*/ - -/* -PX_FORCE_INLINE VecU16V V4U16Andc(VecU16V a, VecU16V b) -{ - return m128_I2F(_mm_andnot_si128(m128_F2I(b), m128_F2I(a))); -} -*/ - -PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) -{ - return m128_F2I(_mm_load1_ps(reinterpret_cast<const PxF32*>(&i))); -} - -PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) -{ - return m128_F2I(_mm_loadu_ps(reinterpret_cast<const PxF32*>(i))); -} - -PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) -{ - return m128_F2I(_mm_load_ps(reinterpret_cast<const PxF32*>(i))); -} - -PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) -{ - return _mm_add_epi32(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) -{ - return _mm_sub_epi32(a, b); -} - -PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) -{ - return m128_I2F(_mm_cmpgt_epi32(a, b)); -} - -PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) -{ - return m128_I2F(_mm_cmpeq_epi32(a, b)); -} - -PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) -{ - return _mm_or_si128(_mm_andnot_si128(m128_F2I(c), b), _mm_and_si128(m128_F2I(c), a)); -} - -PX_FORCE_INLINE VecI32V VecI32V_Zero() -{ - return _mm_setzero_si128(); -} - -PX_FORCE_INLINE VecI32V VecI32V_One() -{ - return I4Load(1); -} - -PX_FORCE_INLINE VecI32V VecI32V_Two() -{ - return I4Load(2); -} - -PX_FORCE_INLINE VecI32V VecI32V_MinusOne() -{ - return I4Load(-1); -} - -PX_FORCE_INLINE VecU32V U4Zero() -{ - return U4Load(0); -} - -PX_FORCE_INLINE VecU32V U4One() -{ - return U4Load(1); -} - -PX_FORCE_INLINE VecU32V U4Two() -{ - return U4Load(2); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) -{ - return _mm_or_si128(_mm_andnot_si128(m128_F2I(c), b), _mm_and_si128(m128_F2I(c), a)); -} - -PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) -{ - VecShiftV s; - s.shift = VecI32V_Sel(BTFFF(), shift, VecI32V_Zero()); - return s; -} - -PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) -{ - return _mm_sll_epi32(a, count.shift); -} - -PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) -{ - return _mm_srl_epi32(a, count.shift); -} - -PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) -{ - return _mm_and_si128(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) -{ - return _mm_or_si128(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) -{ - return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(0, 0, 0, 0))); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) -{ - return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) -{ - return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(2, 2, 2, 2))); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) -{ - return m128_F2I(_mm_shuffle_ps(m128_I2F(a), m128_I2F(a), _MM_SHUFFLE(3, 3, 3, 3))); -} - -PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) -{ - _mm_store_ss(reinterpret_cast<PxF32*>(i), m128_I2F(a)); -} - -PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg x, const VecI32VArg y, const VecI32VArg z, const VecI32VArg w) -{ - const __m128 xw = _mm_move_ss(m128_I2F(y), m128_I2F(x)); // y, y, y, x - const __m128 yz = _mm_move_ss(m128_I2F(z), m128_I2F(w)); // z, z, z, w - return m128_F2I(_mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0))); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) -{ - return m128_F2I(a); -} - -PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) -{ - return a; -} - -/* -template<int a> PX_FORCE_INLINE VecI32V V4ISplat() -{ - VecI32V result; - result.m128_i32[0] = a; - result.m128_i32[1] = a; - result.m128_i32[2] = a; - result.m128_i32[3] = a; - return result; -} - -template<PxU32 a> PX_FORCE_INLINE VecU32V V4USplat() -{ - VecU32V result; - result.m128_u32[0] = a; - result.m128_u32[1] = a; - result.m128_u32[2] = a; - result.m128_u32[3] = a; - return result; -} -*/ - -/* -PX_FORCE_INLINE void V4U16StoreAligned(VecU16V val, VecU16V* address) -{ - *address = val; -} -*/ - -PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) -{ - *address = val; -} - -PX_FORCE_INLINE Vec4V V4LoadAligned(Vec4V* addr) -{ - return *addr; -} - -PX_FORCE_INLINE Vec4V V4LoadUnaligned(Vec4V* addr) -{ - return V4LoadU(reinterpret_cast<float*>(addr)); -} - -PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) -{ - VecU32V result32(a); - result32 = V4U32Andc(result32, b); - return Vec4V(result32); -} - -PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) -{ - return V4IsGrtr(a, b); -} - -PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) -{ - return *addr; -} - -PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) -{ - return *addr; -} - -PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) -{ - // _mm_cmpgt_epi16 doesn't work for unsigned values unfortunately - // return m128_I2F(_mm_cmpgt_epi16(m128_F2I(a), m128_F2I(b))); - VecU16V result; - result.m128_u16[0] = (a).m128_u16[0] > (b).m128_u16[0]; - result.m128_u16[1] = (a).m128_u16[1] > (b).m128_u16[1]; - result.m128_u16[2] = (a).m128_u16[2] > (b).m128_u16[2]; - result.m128_u16[3] = (a).m128_u16[3] > (b).m128_u16[3]; - result.m128_u16[4] = (a).m128_u16[4] > (b).m128_u16[4]; - result.m128_u16[5] = (a).m128_u16[5] > (b).m128_u16[5]; - result.m128_u16[6] = (a).m128_u16[6] > (b).m128_u16[6]; - result.m128_u16[7] = (a).m128_u16[7] > (b).m128_u16[7]; - return result; -} - -PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) -{ - return m128_I2F(_mm_cmpgt_epi16(m128_F2I(a), m128_F2I(b))); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) -{ - Vec4V result = V4LoadXYZW(PxF32(a.m128_u32[0]), PxF32(a.m128_u32[1]), PxF32(a.m128_u32[2]), PxF32(a.m128_u32[3])); - return result; -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V in) -{ - return _mm_cvtepi32_ps(in); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) -{ - return _mm_cvttps_epi32(a); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) -{ - return Vec4V(a); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) -{ - return m128_I2F(a); -} - -PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - return VecU32V(a); -} - -PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - return m128_F2I(a); -} - -/* -template<int index> PX_FORCE_INLINE BoolV BSplatElement(BoolV a) -{ - BoolV result; - result[0] = result[1] = result[2] = result[3] = a[index]; - return result; -} -*/ - -template <int index> -BoolV BSplatElement(BoolV a) -{ - float* data = reinterpret_cast<float*>(&a); - return V4Load(data[index]); -} - -template <int index> -PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) -{ - VecU32V result; - result.m128_u32[0] = result.m128_u32[1] = result.m128_u32[2] = result.m128_u32[3] = a.m128_u32[index]; - return result; -} - -template <int index> -PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) -{ - float* data = reinterpret_cast<float*>(&a); - return V4Load(data[index]); -} - -PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) -{ - VecU32V result; - result.m128_u32[0] = x; - result.m128_u32[1] = y; - result.m128_u32[2] = z; - result.m128_u32[3] = w; - return result; -} - -PX_FORCE_INLINE Vec4V V4Ceil(const Vec4V in) -{ - UnionM128 a(in); - return V4LoadXYZW(PxCeil(a.m128_f32[0]), PxCeil(a.m128_f32[1]), PxCeil(a.m128_f32[2]), PxCeil(a.m128_f32[3])); -} - -PX_FORCE_INLINE Vec4V V4Floor(const Vec4V in) -{ - UnionM128 a(in); - return V4LoadXYZW(PxFloor(a.m128_f32[0]), PxFloor(a.m128_f32[1]), PxFloor(a.m128_f32[2]), PxFloor(a.m128_f32[3])); -} - -PX_FORCE_INLINE VecU32V V4ConvertToU32VSaturate(const Vec4V in, PxU32 power) -{ - PX_ASSERT(power == 0 && "Non-zero power not supported in convertToU32VSaturate"); - PX_UNUSED(power); // prevent warning in release builds - PxF32 ffffFFFFasFloat = PxF32(0xFFFF0000); - UnionM128 a(in); - VecU32V result; - result.m128_u32[0] = PxU32(PxClamp<PxF32>((a).m128_f32[0], 0.0f, ffffFFFFasFloat)); - result.m128_u32[1] = PxU32(PxClamp<PxF32>((a).m128_f32[1], 0.0f, ffffFFFFasFloat)); - result.m128_u32[2] = PxU32(PxClamp<PxF32>((a).m128_f32[2], 0.0f, ffffFFFFasFloat)); - result.m128_u32[3] = PxU32(PxClamp<PxF32>((a).m128_f32[3], 0.0f, ffffFFFFasFloat)); - return result; -} - -#endif // PSFOUNDATION_PSUNIXSSE2INLINEAOS_H diff --git a/PxShared/src/foundation/include/windows/PsWindowsAoS.h b/PxShared/src/foundation/include/windows/PsWindowsAoS.h deleted file mode 100644 index aab0712..0000000 --- a/PxShared/src/foundation/include/windows/PsWindowsAoS.h +++ /dev/null @@ -1,131 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSWINDOWSAOS_H -#define PSFOUNDATION_PSWINDOWSAOS_H - -// no includes here! this file should be included from PxcVecMath.h only!!! - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -typedef __m128 FloatV; -typedef __m128 Vec3V; -typedef __m128 Vec4V; -typedef __m128 BoolV; -typedef __m128 VecU32V; -typedef __m128 VecI32V; -typedef __m128 VecU16V; -typedef __m128 VecI16V; -typedef __m128 QuatV; - -#define FloatVArg FloatV & -#define Vec3VArg Vec3V & -#define Vec4VArg Vec4V & -#define BoolVArg BoolV & -#define VecU32VArg VecU32V & -#define VecI32VArg VecI32V & -#define VecU16VArg VecU16V & -#define VecI16VArg VecI16V & -#define QuatVArg QuatV & - -// Optimization for situations in which you cross product multiple vectors with the same vector. -// Avoids 2X shuffles per product -struct VecCrossV -{ - Vec3V mL1; - Vec3V mR1; -}; - -struct VecShiftV -{ - VecI32V shift; -}; -#define VecShiftVArg VecShiftV & - -PX_ALIGN_PREFIX(16) -struct Mat33V -{ - Mat33V() - { - } - Mat33V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec3V PX_ALIGN(16, col0); - Vec3V PX_ALIGN(16, col1); - Vec3V PX_ALIGN(16, col2); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat34V -{ - Mat34V() - { - } - Mat34V(const Vec3V& c0, const Vec3V& c1, const Vec3V& c2, const Vec3V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec3V PX_ALIGN(16, col0); - Vec3V PX_ALIGN(16, col1); - Vec3V PX_ALIGN(16, col2); - Vec3V PX_ALIGN(16, col3); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat43V -{ - Mat43V() - { - } - Mat43V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2) : col0(c0), col1(c1), col2(c2) - { - } - Vec4V PX_ALIGN(16, col0); - Vec4V PX_ALIGN(16, col1); - Vec4V PX_ALIGN(16, col2); -} PX_ALIGN_SUFFIX(16); - -PX_ALIGN_PREFIX(16) -struct Mat44V -{ - Mat44V() - { - } - Mat44V(const Vec4V& c0, const Vec4V& c1, const Vec4V& c2, const Vec4V& c3) : col0(c0), col1(c1), col2(c2), col3(c3) - { - } - Vec4V PX_ALIGN(16, col0); - Vec4V PX_ALIGN(16, col1); - Vec4V PX_ALIGN(16, col2); - Vec4V PX_ALIGN(16, col3); -} PX_ALIGN_SUFFIX(16); - -#endif // PSFOUNDATION_PSWINDOWSAOS_H diff --git a/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h b/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h deleted file mode 100644 index 5fd1b8d..0000000 --- a/PxShared/src/foundation/include/windows/PsWindowsInlineAoS.h +++ /dev/null @@ -1,3116 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSWINDOWSINLINEAOS_H -#define PSFOUNDATION_PSWINDOWSINLINEAOS_H - -#if !COMPILE_VECTOR_INTRINSICS -#error Vector intrinsics should not be included when using scalar implementation. -#endif - -#include "../PsVecMathSSE.h" - -////////////////////////////////////////////////////////////////////// -//Test that Vec3V and FloatV are legal -////////////////////////////////////////////////////////////////////// - -#define FLOAT_COMPONENTS_EQUAL_THRESHOLD 0.01f -PX_FORCE_INLINE bool isValidFloatV(const FloatV a) -{ - const PxF32 x = V4ReadX(a); - const PxF32 y = V4ReadY(a); - const PxF32 z = V4ReadZ(a); - const PxF32 w = V4ReadW(a); - - if ( - (PxAbs(x - y) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs(x - z) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs(x - w) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) - ) - { - return true; - } - - if ( - (PxAbs((x - y) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs((x - z) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) && - (PxAbs((x - w) / x) < FLOAT_COMPONENTS_EQUAL_THRESHOLD) - ) - { - return true; - } - return false; -} - -PX_FORCE_INLINE bool isValidVec3V(const Vec3V a) -{ - //using _mm_comieq_ss to do the comparison doesn't work for NaN. - PX_ALIGN(16, PxF32 f[4]); - V4StoreA((const Vec4V&)a, f); - return f[3] == 0.0f; -} - -PX_FORCE_INLINE bool isFiniteLength(const Vec3V a) -{ - return !FAllEq(V4LengthSq(a), FZero()); -} - -PX_FORCE_INLINE bool isAligned16(void* a) -{ - return(0 == ((size_t)a & 0x0f)); -} - -//ASSERT_FINITELENGTH is deactivated because there is a lot of code that calls a simd normalisation function with zero length but then ignores the result. - -#if PX_DEBUG -#define ASSERT_ISVALIDVEC3V(a) PX_ASSERT(isValidVec3V(a)) -#define ASSERT_ISVALIDFLOATV(a) PX_ASSERT(isValidFloatV(a)) -#define ASSERT_ISALIGNED16(a) PX_ASSERT(isAligned16((void*)a)) -#define ASSERT_ISFINITELENGTH(a) //PX_ASSERT(isFiniteLength(a)) -#else -#define ASSERT_ISVALIDVEC3V(a) -#define ASSERT_ISVALIDFLOATV(a) -#define ASSERT_ISALIGNED16(a) -#define ASSERT_ISFINITELENGTH(a) -#endif -///////////////////////////////////////////////////////////////////// -////FUNCTIONS USED ONLY FOR ASSERTS IN VECTORISED IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -////////////////////////////////////////////////////////////////////// -// USED ONLY INTERNALLY -////////////////////////////////////////////////////////////////////// - -namespace internalWindowsSimd -{ -PX_FORCE_INLINE __m128 m128_I2F(__m128i n) -{ - return _mm_castsi128_ps(n); -} - -PX_FORCE_INLINE __m128i m128_F2I(__m128 n) -{ - return _mm_castps_si128(n); -} - -PX_FORCE_INLINE PxU32 BAllTrue4_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32(moveMask == 0xf); -} - -PX_FORCE_INLINE PxU32 BAllTrue3_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32((moveMask & 0x7) == 0x7); -} - -PX_FORCE_INLINE PxU32 BAnyTrue4_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32(moveMask != 0x0); -} - -PX_FORCE_INLINE PxU32 BAnyTrue3_R(const BoolV a) -{ - const PxI32 moveMask = _mm_movemask_ps(a); - return PxU32(((moveMask & 0x7) != 0x0)); -} - -PX_FORCE_INLINE PxU32 FiniteTestEq(const Vec4V a, const Vec4V b) -{ - // This is a bit of a bodge. - //_mm_comieq_ss returns 1 if either value is nan so we need to re-cast a and b with true encoded as a non-nan - // number. - // There must be a better way of doing this in sse. - const BoolV one = FOne(); - const BoolV zero = FZero(); - const BoolV a1 = V4Sel(a, one, zero); - const BoolV b1 = V4Sel(b, one, zero); - return (PxU32( - _mm_comieq_ss(a1, b1) && - _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(1, 1, 1, 1)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(1, 1, 1, 1))) && - _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(2, 2, 2, 2)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(2, 2, 2, 2))) && - _mm_comieq_ss(_mm_shuffle_ps(a1, a1, _MM_SHUFFLE(3, 3, 3, 3)), _mm_shuffle_ps(b1, b1, _MM_SHUFFLE(3, 3, 3, 3))))); -} - -PX_FORCE_INLINE bool hasZeroElementinFloatV(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) ? true : false; -} - -PX_FORCE_INLINE bool hasZeroElementInVec3V(const Vec3V a) -{ - return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero())); -} - -PX_FORCE_INLINE bool hasZeroElementInVec4V(const Vec4V a) -{ - return (_mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)), FZero()) || - _mm_comieq_ss(_mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)), FZero())); -} - -const PX_ALIGN(16, PxU32 gMaskXYZ[4]) = { 0xffffffff, 0xffffffff, 0xffffffff, 0 }; -} //internalWindowsSimd - -namespace _VecMathTests -{ -// PT: this function returns an invalid Vec3V (W!=0.0f) just for unit-testing 'isValidVec3V' -PX_FORCE_INLINE Vec3V getInvalidVec3V() -{ - const float f = 1.0f; - return _mm_load1_ps(&f); -} - -PX_FORCE_INLINE bool allElementsEqualFloatV(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_comieq_ss(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVec3V(const Vec3V a, const Vec3V b) -{ - return V3AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVec4V(const Vec4V a, const Vec4V b) -{ - return V4AllEq(a, b) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualBoolV(const BoolV a, const BoolV b) -{ - return internalWindowsSimd::BAllTrue4_R(VecI32V_IsEq(a, b)) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVecU32V(const VecU32V a, const VecU32V b) -{ - return internalWindowsSimd::BAllTrue4_R(V4IsEqU32(a, b)) != 0; -} - -PX_FORCE_INLINE bool allElementsEqualVecI32V(const VecI32V a, const VecI32V b) -{ - BoolV c = internalWindowsSimd::m128_I2F( - _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); - return internalWindowsSimd::BAllTrue4_R(c) != 0; -} - -#define VECMATH_AOS_EPSILON (1e-3f) -static const FloatV minFError = FLoad(-VECMATH_AOS_EPSILON); -static const FloatV maxFError = FLoad(VECMATH_AOS_EPSILON); -static const Vec3V minV3Error = V3Load(-VECMATH_AOS_EPSILON); -static const Vec3V maxV3Error = V3Load(VECMATH_AOS_EPSILON); -static const Vec4V minV4Error = V4Load(-VECMATH_AOS_EPSILON); -static const Vec4V maxV4Error = V4Load(VECMATH_AOS_EPSILON); - -PX_FORCE_INLINE bool allElementsNearEqualFloatV(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - const FloatV c = FSub(a, b); - return _mm_comigt_ss(c, minFError) && _mm_comilt_ss(c, maxFError); -} - -PX_FORCE_INLINE bool allElementsNearEqualVec3V(const Vec3V a, const Vec3V b) -{ - const Vec3V c = V3Sub(a, b); - return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minV3Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxV3Error) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minV3Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxV3Error) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minV3Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxV3Error)); -} - -PX_FORCE_INLINE bool allElementsNearEqualVec4V(const Vec4V a, const Vec4V b) -{ - const Vec4V c = V4Sub(a, b); - return (_mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), minV4Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(0, 0, 0, 0)), maxV4Error) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), minV4Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(1, 1, 1, 1)), maxV4Error) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), minV4Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(2, 2, 2, 2)), maxV4Error) && - _mm_comigt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), minV4Error) && - _mm_comilt_ss(_mm_shuffle_ps(c, c, _MM_SHUFFLE(3, 3, 3, 3)), maxV4Error)); -} -} //_VecMathTests - -PX_FORCE_INLINE bool isFiniteFloatV(const FloatV a) -{ - PxF32 f; - FStore(a, &f); - return PxIsFinite(f); - /* - const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); - const FloatV vBadNum = FloatV_From_F32((PxF32&)badNumber); - const BoolV vMask = BAnd(vBadNum, a); - return FiniteTestEq(vMask, BFFFF()) == 1; - */ -} - -PX_FORCE_INLINE bool isFiniteVec3V(const Vec3V a) -{ - PX_ALIGN(16, PxF32 f[4]); - V4StoreA((Vec4V&)a, f); - return PxIsFinite(f[0]) && PxIsFinite(f[1]) && PxIsFinite(f[2]); - - /* - const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); - const Vec3V vBadNum = Vec3V_From_F32((PxF32&)badNumber); - const BoolV vMask = BAnd(BAnd(vBadNum, a), BTTTF()); - return FiniteTestEq(vMask, BFFFF()) == 1; - */ -} - -PX_FORCE_INLINE bool isFiniteVec4V(const Vec4V a) -{ - PX_ALIGN(16, PxF32 f[4]); - V4StoreA(a, f); - return PxIsFinite(f[0]) && PxIsFinite(f[1]) && PxIsFinite(f[2]) && PxIsFinite(f[3]); - - /* - const PxU32 badNumber = (_FPCLASS_SNAN | _FPCLASS_QNAN | _FPCLASS_NINF | _FPCLASS_PINF); - const Vec4V vBadNum = Vec4V_From_U32((PxF32&)badNumber); - const BoolV vMask = BAnd(vBadNum, a); - - return FiniteTestEq(vMask, BFFFF()) == 1; - */ -} - -///////////////////////////////////////////////////////////////////// -////VECTORISED FUNCTION IMPLEMENTATIONS -///////////////////////////////////////////////////////////////////// - -PX_FORCE_INLINE FloatV FLoad(const PxF32 f) -{ - return _mm_load1_ps(&f); -} - -PX_FORCE_INLINE Vec3V V3Load(const PxF32 f) -{ - return _mm_set_ps(0.0f, f, f, f); -} - -PX_FORCE_INLINE Vec4V V4Load(const PxF32 f) -{ - return _mm_load1_ps(&f); -} - -PX_FORCE_INLINE BoolV BLoad(const bool f) -{ - const PxU32 i = PxU32(-(PxI32)f); - return _mm_load1_ps((float*)&i); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - return _mm_and_ps(_mm_load_ps(&f.x), reinterpret_cast<const Vec4V&>(internalWindowsSimd::gMaskXYZ)); -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxVec3& f) -{ - return _mm_set_ps(0.0f, f.z, f.y, f.x); -} - -// w component of result is undefined -PX_FORCE_INLINE Vec3V V3LoadUnsafeA(const PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - return _mm_load_ps(&f.x); -} - -PX_FORCE_INLINE Vec3V V3LoadA(const PxF32* const f) -{ - ASSERT_ISALIGNED16(f); - return V4ClearW(_mm_load_ps(f)); -} - -PX_FORCE_INLINE Vec3V V3LoadU(const PxF32* const i) -{ - return _mm_set_ps(0.0f, i[2], i[1], i[0]); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V(Vec4V v) -{ - return V4ClearW(v); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_Vec4V_WUndefined(const Vec4V v) -{ - return v; -} - -PX_FORCE_INLINE Vec4V Vec4V_From_Vec3V(Vec3V f) -{ - return f; // ok if it is implemented as the same type. -} - -PX_FORCE_INLINE Vec4V Vec4V_From_FloatV(FloatV f) -{ - return f; -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV(FloatV f) -{ - return Vec3V_From_Vec4V(Vec4V_From_FloatV(f)); -} - -PX_FORCE_INLINE Vec3V Vec3V_From_FloatV_WUndefined(FloatV f) -{ - return Vec3V_From_Vec4V_WUndefined(Vec4V_From_FloatV(f)); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_PxVec3_WUndefined(const PxVec3& f) -{ - return _mm_set_ps(0.0f, f.z, f.y, f.x); -} - -PX_FORCE_INLINE Vec4V V4LoadA(const PxF32* const f) -{ - ASSERT_ISALIGNED16(f); - return _mm_load_ps(f); -} - -PX_FORCE_INLINE void V4StoreA(const Vec4V a, PxF32* f) -{ - ASSERT_ISALIGNED16(f); - _mm_store_ps(f, a); -} - -PX_FORCE_INLINE void V4StoreU(const Vec4V a, PxF32* f) -{ - _mm_storeu_ps(f, a); -} - -PX_FORCE_INLINE void BStoreA(const BoolV a, PxU32* f) -{ - ASSERT_ISALIGNED16(f); - _mm_store_ps((PxF32*)f, a); -} - -PX_FORCE_INLINE void U4StoreA(const VecU32V uv, PxU32* u) -{ - ASSERT_ISALIGNED16(u); - _mm_store_ps((PxF32*)u, uv); -} - -PX_FORCE_INLINE void I4StoreA(const VecI32V iv, PxI32* i) -{ - ASSERT_ISALIGNED16(i); - _mm_store_ps((PxF32*)i, iv); -} - -PX_FORCE_INLINE Vec4V V4LoadU(const PxF32* const f) -{ - return _mm_loadu_ps(f); -} - -PX_FORCE_INLINE BoolV BLoad(const bool* const f) -{ - const PX_ALIGN(16, PxU32 b[4]) = { PxU32(-(PxI32)f[0]), PxU32(-(PxI32)f[1]), - PxU32(-(PxI32)f[2]), PxU32(-(PxI32)f[3]) }; - return _mm_load_ps((float*)&b); -} - -PX_FORCE_INLINE void FStore(const FloatV a, PxF32* PX_RESTRICT f) -{ - ASSERT_ISVALIDFLOATV(a); - _mm_store_ss(f, a); -} - -PX_FORCE_INLINE void V3StoreA(const Vec3V a, PxVec3& f) -{ - ASSERT_ISALIGNED16(&f); - PX_ALIGN(16, PxF32 f2[4]); - _mm_store_ps(f2, a); - f = PxVec3(f2[0], f2[1], f2[2]); -} - -PX_FORCE_INLINE void Store_From_BoolV(const BoolV b, PxU32* b2) -{ - _mm_store_ss((PxF32*)b2, b); -} - -PX_FORCE_INLINE void V3StoreU(const Vec3V a, PxVec3& f) -{ - PX_ALIGN(16, PxF32 f2[4]); - _mm_store_ps(f2, a); - f = PxVec3(f2[0], f2[1], f2[2]); -} - -PX_FORCE_INLINE Mat33V Mat33V_From_PxMat33(const PxMat33& m) -{ - return Mat33V(V3LoadU(m.column0), V3LoadU(m.column1), V3LoadU(m.column2)); -} - -PX_FORCE_INLINE void PxMat33_From_Mat33V(const Mat33V& m, PxMat33& out) -{ - ASSERT_ISALIGNED16(&out); - V3StoreU(m.col0, out.column0); - V3StoreU(m.col1, out.column1); - V3StoreU(m.col2, out.column2); -} - -////////////////////////////////// -// FLOATV -////////////////////////////////// - -PX_FORCE_INLINE FloatV FZero() -{ - return _mm_setzero_ps(); -} - -PX_FORCE_INLINE FloatV FOne() -{ - return FLoad(1.0f); -} - -PX_FORCE_INLINE FloatV FHalf() -{ - return FLoad(0.5f); -} - -PX_FORCE_INLINE FloatV FEps() -{ - return FLoad(PX_EPS_REAL); -} - -PX_FORCE_INLINE FloatV FEps6() -{ - return FLoad(1e-6f); -} - -PX_FORCE_INLINE FloatV FMax() -{ - return FLoad(PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV FNegMax() -{ - return FLoad(-PX_MAX_REAL); -} - -PX_FORCE_INLINE FloatV IZero() -{ - const PxU32 zero = 0; - return _mm_load1_ps((PxF32*)&zero); -} - -PX_FORCE_INLINE FloatV IOne() -{ - const PxU32 one = 1; - return _mm_load1_ps((PxF32*)&one); -} - -PX_FORCE_INLINE FloatV ITwo() -{ - const PxU32 two = 2; - return _mm_load1_ps((PxF32*)&two); -} - -PX_FORCE_INLINE FloatV IThree() -{ - const PxU32 three = 3; - return _mm_load1_ps((PxF32*)&three); -} - -PX_FORCE_INLINE FloatV IFour() -{ - const PxU32 four = 4; - return _mm_load1_ps((PxF32*)&four); -} - -PX_FORCE_INLINE FloatV FNeg(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return _mm_sub_ps(_mm_setzero_ps(), f); -} - -PX_FORCE_INLINE FloatV FAdd(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_add_ps(a, b); -} - -PX_FORCE_INLINE FloatV FSub(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_sub_ps(a, b); -} - -PX_FORCE_INLINE FloatV FMul(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE FloatV FDiv(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE FloatV FDivFast(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE FloatV FRecip(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_div_ps(FOne(), a); -} - -PX_FORCE_INLINE FloatV FRecipFast(const FloatV a) -{ - return _mm_rcp_ps(a); -} - -PX_FORCE_INLINE FloatV FRsqrt(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_div_ps(FOne(), _mm_sqrt_ps(a)); -} - -PX_FORCE_INLINE FloatV FSqrt(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_sqrt_ps(a); -} - -PX_FORCE_INLINE FloatV FRsqrtFast(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - return _mm_rsqrt_ps(a); -} - -PX_FORCE_INLINE FloatV FScaleAdd(const FloatV a, const FloatV b, const FloatV c) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDFLOATV(c); - return FAdd(FMul(a, b), c); -} - -PX_FORCE_INLINE FloatV FNegScaleSub(const FloatV a, const FloatV b, const FloatV c) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDFLOATV(c); - return FSub(c, FMul(a, b)); -} - -PX_FORCE_INLINE FloatV FAbs(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - PX_ALIGN(16, const static PxU32 absMask[4]) = { 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF, 0x7fFFffFF }; - return _mm_and_ps(a, _mm_load_ps((PxF32*)absMask)); -} - -PX_FORCE_INLINE FloatV FSel(const BoolV c, const FloatV a, const FloatV b) -{ - PX_ASSERT(_VecMathTests::allElementsEqualBoolV(c, BTTTT()) || - _VecMathTests::allElementsEqualBoolV(c, BFFFF())); - ASSERT_ISVALIDFLOATV(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE BoolV FIsGrtr(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_cmpgt_ps(a, b); -} - -PX_FORCE_INLINE BoolV FIsGrtrOrEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_cmpge_ps(a, b); -} - -PX_FORCE_INLINE BoolV FIsEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_cmpeq_ps(a, b); -} - -PX_FORCE_INLINE FloatV FMax(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_max_ps(a, b); -} - -PX_FORCE_INLINE FloatV FMin(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_min_ps(a, b); -} - -PX_FORCE_INLINE FloatV FClamp(const FloatV a, const FloatV minV, const FloatV maxV) -{ - ASSERT_ISVALIDFLOATV(minV); - ASSERT_ISVALIDFLOATV(maxV); - return _mm_max_ps(_mm_min_ps(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 FAllGrtr(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return PxU32(_mm_comigt_ss(a, b)); -} - -PX_FORCE_INLINE PxU32 FAllGrtrOrEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return PxU32(_mm_comige_ss(a, b)); -} - -PX_FORCE_INLINE PxU32 FAllEq(const FloatV a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(b); - return PxU32(_mm_comieq_ss(a, b)); -} - -PX_FORCE_INLINE FloatV FRound(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - // return _mm_round_ps(a, 0x0); - const FloatV half = FLoad(0.5f); - const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); - const FloatV aRound = FSub(FAdd(a, half), signBit); - __m128i tmp = _mm_cvttps_epi32(aRound); - return _mm_cvtepi32_ps(tmp); -} - -PX_FORCE_INLINE FloatV FSin(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = V4LoadA(g_PXTwoPi.f); - const FloatV tmp = FMul(a, recipTwoPi); - const FloatV b = FRound(tmp); - const FloatV V1 = FNegScaleSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const FloatV V2 = FMul(V1, V1); - const FloatV V3 = FMul(V2, V1); - const FloatV V5 = FMul(V3, V2); - const FloatV V7 = FMul(V5, V2); - const FloatV V9 = FMul(V7, V2); - const FloatV V11 = FMul(V9, V2); - const FloatV V13 = FMul(V11, V2); - const FloatV V15 = FMul(V13, V2); - const FloatV V17 = FMul(V15, V2); - const FloatV V19 = FMul(V17, V2); - const FloatV V21 = FMul(V19, V2); - const FloatV V23 = FMul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - FloatV Result; - Result = FScaleAdd(S1, V3, V1); - Result = FScaleAdd(S2, V5, Result); - Result = FScaleAdd(S3, V7, Result); - Result = FScaleAdd(S4, V9, Result); - Result = FScaleAdd(S5, V11, Result); - Result = FScaleAdd(S6, V13, Result); - Result = FScaleAdd(S7, V15, Result); - Result = FScaleAdd(S8, V17, Result); - Result = FScaleAdd(S9, V19, Result); - Result = FScaleAdd(S10, V21, Result); - Result = FScaleAdd(S11, V23, Result); - - return Result; -} - -PX_FORCE_INLINE FloatV FCos(const FloatV a) -{ - ASSERT_ISVALIDFLOATV(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const FloatV recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = V4LoadA(g_PXTwoPi.f); - const FloatV tmp = FMul(a, recipTwoPi); - const FloatV b = FRound(tmp); - const FloatV V1 = FNegScaleSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const FloatV V2 = FMul(V1, V1); - const FloatV V4 = FMul(V2, V2); - const FloatV V6 = FMul(V4, V2); - const FloatV V8 = FMul(V4, V4); - const FloatV V10 = FMul(V6, V4); - const FloatV V12 = FMul(V6, V6); - const FloatV V14 = FMul(V8, V6); - const FloatV V16 = FMul(V8, V8); - const FloatV V18 = FMul(V10, V8); - const FloatV V20 = FMul(V10, V10); - const FloatV V22 = FMul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - FloatV Result; - Result = FScaleAdd(C1, V2, V4One()); - Result = FScaleAdd(C2, V4, Result); - Result = FScaleAdd(C3, V6, Result); - Result = FScaleAdd(C4, V8, Result); - Result = FScaleAdd(C5, V10, Result); - Result = FScaleAdd(C6, V12, Result); - Result = FScaleAdd(C7, V14, Result); - Result = FScaleAdd(C8, V16, Result); - Result = FScaleAdd(C9, V18, Result); - Result = FScaleAdd(C10, V20, Result); - Result = FScaleAdd(C11, V22, Result); - - return Result; -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV min, const FloatV max) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(min); - ASSERT_ISVALIDFLOATV(max); - const BoolV c = BOr(FIsGrtr(a, max), FIsGrtr(min, a)); - return PxU32(!BAllEqFFFF(c)); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV min, const FloatV max) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(min); - ASSERT_ISVALIDFLOATV(max); - const BoolV c = BAnd(FIsGrtrOrEq(a, min), FIsGrtrOrEq(max, a)); - return BAllEqTTTT(c); -} - -PX_FORCE_INLINE PxU32 FOutOfBounds(const FloatV a, const FloatV bounds) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(bounds); - return FOutOfBounds(a, FNeg(bounds), bounds); -} - -PX_FORCE_INLINE PxU32 FInBounds(const FloatV a, const FloatV bounds) -{ - ASSERT_ISVALIDFLOATV(a); - ASSERT_ISVALIDFLOATV(bounds); - return FInBounds(a, FNeg(bounds), bounds); -} - -////////////////////////////////// -// VEC3V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V V3Splat(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - const __m128 zero = V3Zero(); - const __m128 fff0 = _mm_move_ss(f, zero); - return _mm_shuffle_ps(fff0, fff0, _MM_SHUFFLE(0, 1, 2, 3)); -} - -PX_FORCE_INLINE Vec3V V3Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z) -{ - ASSERT_ISVALIDFLOATV(x); - ASSERT_ISVALIDFLOATV(y); - ASSERT_ISVALIDFLOATV(z); - // static on zero causes compiler crash on x64 debug_opt - const __m128 zero = V3Zero(); - const __m128 xy = _mm_move_ss(x, y); - const __m128 z0 = _mm_move_ss(zero, z); - - return _mm_shuffle_ps(xy, z0, _MM_SHUFFLE(1, 0, 0, 1)); -} - -PX_FORCE_INLINE Vec3V V3UnitX() -{ - const PX_ALIGN(16, PxF32 x[4]) = { 1.0f, 0.0f, 0.0f, 0.0f }; - const __m128 x128 = _mm_load_ps(x); - return x128; -} - -PX_FORCE_INLINE Vec3V V3UnitY() -{ - const PX_ALIGN(16, PxF32 y[4]) = { 0.0f, 1.0f, 0.0f, 0.0f }; - const __m128 y128 = _mm_load_ps(y); - return y128; -} - -PX_FORCE_INLINE Vec3V V3UnitZ() -{ - const PX_ALIGN(16, PxF32 z[4]) = { 0.0f, 0.0f, 1.0f, 0.0f }; - const __m128 z128 = _mm_load_ps(z); - return z128; -} - -PX_FORCE_INLINE FloatV V3GetX(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE FloatV V3GetY(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE FloatV V3GetZ(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE Vec3V V3SetX(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BFTTT(), v, f); -} - -PX_FORCE_INLINE Vec3V V3SetY(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTFTT(), v, f); -} - -PX_FORCE_INLINE Vec3V V3SetZ(const Vec3V v, const FloatV f) -{ - ASSERT_ISVALIDVEC3V(v); - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTFT(), v, f); -} - -PX_FORCE_INLINE Vec3V V3ColX(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 0, 3, 0)); - return V3SetY(r, V3GetX(b)); -} - -PX_FORCE_INLINE Vec3V V3ColY(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 1, 3, 1)); - return V3SetY(r, V3GetY(b)); -} - -PX_FORCE_INLINE Vec3V V3ColZ(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - Vec3V r = _mm_shuffle_ps(a, c, _MM_SHUFFLE(3, 2, 3, 2)); - return V3SetY(r, V3GetZ(b)); -} - -PX_FORCE_INLINE Vec3V V3Zero() -{ - return _mm_setzero_ps(); -} - -PX_FORCE_INLINE Vec3V V3One() -{ - return V3Load(1.0f); -} - -PX_FORCE_INLINE Vec3V V3Eps() -{ - return V3Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec3V V3Neg(const Vec3V f) -{ - ASSERT_ISVALIDVEC3V(f); - return _mm_sub_ps(_mm_setzero_ps(), f); -} - -PX_FORCE_INLINE Vec3V V3Add(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_add_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Sub(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_sub_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Scale(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Mul(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3ScaleInv(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Div(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return V4ClearW(_mm_div_ps(a, b)); -} - -PX_FORCE_INLINE Vec3V V3ScaleInvFast(const Vec3V a, const FloatV b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE Vec3V V3DivFast(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return V4ClearW(_mm_mul_ps(a, _mm_rcp_ps(b))); -} - -PX_FORCE_INLINE Vec3V V3Recip(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_div_ps(V3One(), a); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3RecipFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_rcp_ps(a); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3Rsqrt(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_div_ps(V3One(), _mm_sqrt_ps(a)); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3RsqrtFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 tttf = BTTTF(); - const __m128 recipA = _mm_rsqrt_ps(a); - return V4Sel(tttf, recipA, zero); -} - -PX_FORCE_INLINE Vec3V V3ScaleAdd(const Vec3V a, const FloatV b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDVEC3V(c); - return V3Add(V3Scale(a, b), c); -} - -PX_FORCE_INLINE Vec3V V3NegScaleSub(const Vec3V a, const FloatV b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDFLOATV(b); - ASSERT_ISVALIDVEC3V(c); - return V3Sub(c, V3Scale(a, b)); -} - -PX_FORCE_INLINE Vec3V V3MulAdd(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - return V3Add(V3Mul(a, b), c); -} - -PX_FORCE_INLINE Vec3V V3NegMulSub(const Vec3V a, const Vec3V b, const Vec3V c) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - ASSERT_ISVALIDVEC3V(c); - return V3Sub(c, V3Mul(a, b)); -} - -PX_FORCE_INLINE Vec3V V3Abs(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return V3Max(a, V3Neg(a)); -} - -PX_FORCE_INLINE FloatV V3Dot(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - - const __m128 t0 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx - const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); // ay*by | ax*bx | aw*bw | az*bz - const __m128 t2 = _mm_add_ps(t0, t1); // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx - const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by - return _mm_add_ps(t3, t2); // ax*bx + az*bz + ay*by + aw*bw - // ay*by + aw*bw + ax*bx + az*bz - // az*bz + ax*bx + aw*bw + ay*by - // aw*bw + ay*by + az*bz + ax*bx -} - -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); -} - -PX_FORCE_INLINE VecCrossV V3PrepareCross(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - VecCrossV v; - v.mR1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - v.mL1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - return v; -} - -PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(b); - const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(a.mL1, l2), _mm_mul_ps(a.mR1, r2)); -} - -PX_FORCE_INLINE Vec3V V3Cross(const Vec3V a, const VecCrossV& b) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 r2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(b.mR1, r2), _mm_mul_ps(b.mL1, l2)); -} - -PX_FORCE_INLINE Vec3V V3Cross(const VecCrossV& a, const VecCrossV& b) -{ - return _mm_sub_ps(_mm_mul_ps(a.mL1, b.mR1), _mm_mul_ps(a.mR1, b.mL1)); -} - -PX_FORCE_INLINE FloatV V3Length(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_sqrt_ps(V3Dot(a, a)); -} - -PX_FORCE_INLINE FloatV V3LengthSq(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return V3Dot(a, a); -} - -PX_FORCE_INLINE Vec3V V3Normalize(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISFINITELENGTH(a); - return V3ScaleInv(a, _mm_sqrt_ps(V3Dot(a, a))); -} - -PX_FORCE_INLINE Vec3V V3NormalizeFast(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISFINITELENGTH(a); - return V3Scale(a, _mm_rsqrt_ps(V3Dot(a, a))); -} - -PX_FORCE_INLINE Vec3V V3NormalizeSafe(const Vec3V a, const Vec3V unsafeReturnValue) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 eps = FEps(); - const __m128 length = V3Length(a); - const __m128 isGreaterThanZero = FIsGrtr(length, eps); - return V3Sel(isGreaterThanZero, V3ScaleInv(a, length), unsafeReturnValue); -} - -PX_FORCE_INLINE Vec3V V3Sel(const BoolV c, const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(_mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a))); - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE BoolV V3IsGrtr(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_cmpgt_ps(a, b); -} - -PX_FORCE_INLINE BoolV V3IsGrtrOrEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_cmpge_ps(a, b); -} - -PX_FORCE_INLINE BoolV V3IsEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_cmpeq_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Max(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_max_ps(a, b); -} - -PX_FORCE_INLINE Vec3V V3Min(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return _mm_min_ps(a, b); -} - -PX_FORCE_INLINE FloatV V3ExtractMax(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); - return _mm_max_ps(_mm_max_ps(shuf1, shuf2), shuf3); -} - -PX_FORCE_INLINE FloatV V3ExtractMin(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); - return _mm_min_ps(_mm_min_ps(shuf1, shuf2), shuf3); -} - -//// if(a > 0.0f) return 1.0f; else if a == 0.f return 0.f, else return -1.f; -// PX_FORCE_INLINE Vec3V V3MathSign(const Vec3V a) -//{ -// VECMATHAOS_ASSERT(isValidVec3V(a)); -// -// const __m128i ai = _mm_cvtps_epi32(a); -// const __m128i bi = _mm_cvtps_epi32(V3Neg(a)); -// const __m128 aa = _mm_cvtepi32_ps(_mm_srai_epi32(ai, 31)); -// const __m128 bb = _mm_cvtepi32_ps(_mm_srai_epi32(bi, 31)); -// return _mm_or_ps(aa, bb); -//} - -// return (a >= 0.0f) ? 1.0f : -1.0f; -PX_FORCE_INLINE Vec3V V3Sign(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 zero = V3Zero(); - const __m128 one = V3One(); - const __m128 none = V3Neg(one); - return V3Sel(V3IsGrtrOrEq(a, zero), one, none); -} - -PX_FORCE_INLINE Vec3V V3Clamp(const Vec3V a, const Vec3V minV, const Vec3V maxV) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(minV); - ASSERT_ISVALIDVEC3V(maxV); - return V3Max(V3Min(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 V3AllGrtr(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalWindowsSimd::BAllTrue3_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE PxU32 V3AllGrtrOrEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalWindowsSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V3AllEq(const Vec3V a, const Vec3V b) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(b); - return internalWindowsSimd::BAllTrue3_R(V4IsEq(a, b)); -} - -PX_FORCE_INLINE Vec3V V3Round(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // return _mm_round_ps(a, 0x0); - const Vec3V half = V3Load(0.5f); - const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); - const Vec3V aRound = V3Sub(V3Add(a, half), signBit); - __m128i tmp = _mm_cvttps_epi32(aRound); - return _mm_cvtepi32_ps(tmp); -} - -PX_FORCE_INLINE Vec3V V3Sin(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec3V tmp = V3Scale(a, recipTwoPi); - const Vec3V b = V3Round(tmp); - const Vec3V V1 = V3NegScaleSub(b, twoPi, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const Vec3V V2 = V3Mul(V1, V1); - const Vec3V V3 = V3Mul(V2, V1); - const Vec3V V5 = V3Mul(V3, V2); - const Vec3V V7 = V3Mul(V5, V2); - const Vec3V V9 = V3Mul(V7, V2); - const Vec3V V11 = V3Mul(V9, V2); - const Vec3V V13 = V3Mul(V11, V2); - const Vec3V V15 = V3Mul(V13, V2); - const Vec3V V17 = V3Mul(V15, V2); - const Vec3V V19 = V3Mul(V17, V2); - const Vec3V V21 = V3Mul(V19, V2); - const Vec3V V23 = V3Mul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - Vec3V Result; - Result = V3ScaleAdd(V3, S1, V1); - Result = V3ScaleAdd(V5, S2, Result); - Result = V3ScaleAdd(V7, S3, Result); - Result = V3ScaleAdd(V9, S4, Result); - Result = V3ScaleAdd(V11, S5, Result); - Result = V3ScaleAdd(V13, S6, Result); - Result = V3ScaleAdd(V15, S7, Result); - Result = V3ScaleAdd(V17, S8, Result); - Result = V3ScaleAdd(V19, S9, Result); - Result = V3ScaleAdd(V21, S10, Result); - Result = V3ScaleAdd(V23, S11, Result); - - ASSERT_ISVALIDVEC3V(Result); - return Result; -} - -PX_FORCE_INLINE Vec3V V3Cos(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - - // Modulo the range of the given angles such that -XM_2PI <= Angles < XM_2PI - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec3V tmp = V3Scale(a, recipTwoPi); - const Vec3V b = V3Round(tmp); - const Vec3V V1 = V3NegScaleSub(b, twoPi, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const Vec3V V2 = V3Mul(V1, V1); - const Vec3V V4 = V3Mul(V2, V2); - const Vec3V V6 = V3Mul(V4, V2); - const Vec3V V8 = V3Mul(V4, V4); - const Vec3V V10 = V3Mul(V6, V4); - const Vec3V V12 = V3Mul(V6, V6); - const Vec3V V14 = V3Mul(V8, V6); - const Vec3V V16 = V3Mul(V8, V8); - const Vec3V V18 = V3Mul(V10, V8); - const Vec3V V20 = V3Mul(V10, V10); - const Vec3V V22 = V3Mul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - Vec3V Result; - Result = V3ScaleAdd(V2, C1, V3One()); - Result = V3ScaleAdd(V4, C2, Result); - Result = V3ScaleAdd(V6, C3, Result); - Result = V3ScaleAdd(V8, C4, Result); - Result = V3ScaleAdd(V10, C5, Result); - Result = V3ScaleAdd(V12, C6, Result); - Result = V3ScaleAdd(V14, C7, Result); - Result = V3ScaleAdd(V16, C8, Result); - Result = V3ScaleAdd(V18, C9, Result); - Result = V3ScaleAdd(V20, C10, Result); - Result = V3ScaleAdd(V22, C11, Result); - - ASSERT_ISVALIDVEC3V(Result); - return Result; -} - -PX_FORCE_INLINE Vec3V V3PermYZZ(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 2, 1)); -} - -PX_FORCE_INLINE Vec3V V3PermXYX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 1, 0)); -} - -PX_FORCE_INLINE Vec3V V3PermYZX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); -} - -PX_FORCE_INLINE Vec3V V3PermZXY(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); -} - -PX_FORCE_INLINE Vec3V V3PermZZY(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 2, 2)); -} - -PX_FORCE_INLINE Vec3V V3PermYXX(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 0, 1)); -} - -PX_FORCE_INLINE Vec3V V3Perm_Zero_1Z_0Y(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - return _mm_shuffle_ps(v1, v0, _MM_SHUFFLE(3, 1, 2, 3)); -} - -PX_FORCE_INLINE Vec3V V3Perm_0Z_Zero_1X(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - return _mm_shuffle_ps(v0, v1, _MM_SHUFFLE(3, 0, 3, 2)); -} - -PX_FORCE_INLINE Vec3V V3Perm_1Y_0X_Zero(const Vec3V v0, const Vec3V v1) -{ - ASSERT_ISVALIDVEC3V(v0); - ASSERT_ISVALIDVEC3V(v1); - // There must be a better way to do this. - Vec3V v2 = V3Zero(); - FloatV y1 = V3GetY(v1); - FloatV x0 = V3GetX(v0); - v2 = V3SetX(v2, y1); - return V3SetY(v2, x0); -} - -PX_FORCE_INLINE FloatV V3SumElems(const Vec3V a) -{ - ASSERT_ISVALIDVEC3V(a); - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); // z,y,x,w - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); // y,x,w,z - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); // x,w,z,y - return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(min); - ASSERT_ISVALIDVEC3V(max); - const BoolV c = BOr(V3IsGrtr(a, max), V3IsGrtr(min, a)); - return PxU32(!BAllEqFFFF(c)); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V min, const Vec3V max) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(min); - ASSERT_ISVALIDVEC3V(max); - const BoolV c = BAnd(V3IsGrtrOrEq(a, min), V3IsGrtrOrEq(max, a)); - return BAllEqTTTT(c); -} - -PX_FORCE_INLINE PxU32 V3OutOfBounds(const Vec3V a, const Vec3V bounds) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(bounds); - return V3OutOfBounds(a, V3Neg(bounds), bounds); -} - -PX_FORCE_INLINE PxU32 V3InBounds(const Vec3V a, const Vec3V bounds) -{ - ASSERT_ISVALIDVEC3V(a); - ASSERT_ISVALIDVEC3V(bounds); - return V3InBounds(a, V3Neg(bounds), bounds); -} - -PX_FORCE_INLINE void V3Transpose(Vec3V& col0, Vec3V& col1, Vec3V& col2) -{ - ASSERT_ISVALIDVEC3V(col0); - ASSERT_ISVALIDVEC3V(col1); - ASSERT_ISVALIDVEC3V(col2); - const Vec3V col3 = _mm_setzero_ps(); - Vec3V tmp0 = _mm_unpacklo_ps(col0, col1); - Vec3V tmp2 = _mm_unpacklo_ps(col2, col3); - Vec3V tmp1 = _mm_unpackhi_ps(col0, col1); - Vec3V tmp3 = _mm_unpackhi_ps(col2, col3); - col0 = _mm_movelh_ps(tmp0, tmp2); - col1 = _mm_movehl_ps(tmp2, tmp0); - col2 = _mm_movelh_ps(tmp1, tmp3); -} - -////////////////////////////////// -// VEC4V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V V4Splat(const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - // return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0,0,0,0)); - return f; -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatV* const floatVArray) -{ - ASSERT_ISVALIDFLOATV(floatVArray[0]); - ASSERT_ISVALIDFLOATV(floatVArray[1]); - ASSERT_ISVALIDFLOATV(floatVArray[2]); - ASSERT_ISVALIDFLOATV(floatVArray[3]); - const __m128 xw = _mm_move_ss(floatVArray[1], floatVArray[0]); // y, y, y, x - const __m128 yz = _mm_move_ss(floatVArray[2], floatVArray[3]); // z, z, z, w - return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); -} - -PX_FORCE_INLINE Vec4V V4Merge(const FloatVArg x, const FloatVArg y, const FloatVArg z, const FloatVArg w) -{ - ASSERT_ISVALIDFLOATV(x); - ASSERT_ISVALIDFLOATV(y); - ASSERT_ISVALIDFLOATV(z); - ASSERT_ISVALIDFLOATV(w); - const __m128 xw = _mm_move_ss(y, x); // y, y, y, x - const __m128 yz = _mm_move_ss(z, w); // z, z, z, w - return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); -} - -PX_FORCE_INLINE Vec4V V4MergeW(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpackhi_ps(x, z); - const Vec4V yw = _mm_unpackhi_ps(y, w); - return _mm_unpackhi_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4MergeZ(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpackhi_ps(x, z); - const Vec4V yw = _mm_unpackhi_ps(y, w); - return _mm_unpacklo_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4MergeY(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpacklo_ps(x, z); - const Vec4V yw = _mm_unpacklo_ps(y, w); - return _mm_unpackhi_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4MergeX(const Vec4VArg x, const Vec4VArg y, const Vec4VArg z, const Vec4VArg w) -{ - const Vec4V xz = _mm_unpacklo_ps(x, z); - const Vec4V yw = _mm_unpacklo_ps(y, w); - return _mm_unpacklo_ps(xz, yw); -} - -PX_FORCE_INLINE Vec4V V4UnpackXY(const Vec4VArg a, const Vec4VArg b) -{ - return _mm_unpacklo_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4UnpackZW(const Vec4VArg a, const Vec4VArg b) -{ - return _mm_unpackhi_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4PermYXWZ(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 0, 1)); -} - -PX_FORCE_INLINE Vec4V V4PermXZXZ(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 0, 2, 0)); -} - -PX_FORCE_INLINE Vec4V V4PermYWYW(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 3, 1)); -} - -PX_FORCE_INLINE Vec4V V4PermYZXW(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); -} - -template <PxU8 x, PxU8 y, PxU8 z, PxU8 w> -PX_FORCE_INLINE Vec4V V4Perm(const Vec4V a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(w, z, y, x)); -} - -PX_FORCE_INLINE Vec4V V4UnitW() -{ - const PX_ALIGN(16, PxF32 w[4]) = { 0.0f, 0.0f, 0.0f, 1.0f }; - const __m128 w128 = _mm_load_ps(w); - return w128; -} - -PX_FORCE_INLINE Vec4V V4UnitX() -{ - const PX_ALIGN(16, PxF32 x[4]) = { 1.0f, 0.0f, 0.0f, 0.0f }; - const __m128 x128 = _mm_load_ps(x); - return x128; -} - -PX_FORCE_INLINE Vec4V V4UnitY() -{ - const PX_ALIGN(16, PxF32 y[4]) = { 0.0f, 1.0f, 0.0f, 0.0f }; - const __m128 y128 = _mm_load_ps(y); - return y128; -} - -PX_FORCE_INLINE Vec4V V4UnitZ() -{ - const PX_ALIGN(16, PxF32 z[4]) = { 0.0f, 0.0f, 1.0f, 0.0f }; - const __m128 z128 = _mm_load_ps(z); - return z128; -} - -PX_FORCE_INLINE FloatV V4GetW(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); -} - -PX_FORCE_INLINE FloatV V4GetX(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE FloatV V4GetY(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE FloatV V4GetZ(const Vec4V f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE Vec4V V4SetW(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTTF(), v, f); -} - -PX_FORCE_INLINE Vec4V V4ClearW(const Vec4V v) -{ - return _mm_and_ps(v, (VecI32V&)internalWindowsSimd::gMaskXYZ); -} - -PX_FORCE_INLINE Vec4V V4SetX(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BFTTT(), v, f); -} - -PX_FORCE_INLINE Vec4V V4SetY(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTFTT(), v, f); -} - -PX_FORCE_INLINE Vec4V V4SetZ(const Vec4V v, const FloatV f) -{ - ASSERT_ISVALIDFLOATV(f); - return V4Sel(BTTFT(), v, f); -} - -PX_FORCE_INLINE Vec4V V4Zero() -{ - return _mm_setzero_ps(); -} - -PX_FORCE_INLINE Vec4V V4One() -{ - return V4Load(1.0f); -} - -PX_FORCE_INLINE Vec4V V4Eps() -{ - return V4Load(PX_EPS_REAL); -} - -PX_FORCE_INLINE Vec4V V4Neg(const Vec4V f) -{ - return _mm_sub_ps(_mm_setzero_ps(), f); -} - -PX_FORCE_INLINE Vec4V V4Add(const Vec4V a, const Vec4V b) -{ - return _mm_add_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Sub(const Vec4V a, const Vec4V b) -{ - return _mm_sub_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Scale(const Vec4V a, const FloatV b) -{ - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Mul(const Vec4V a, const Vec4V b) -{ - return _mm_mul_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4ScaleInv(const Vec4V a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(b); - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Div(const Vec4V a, const Vec4V b) -{ - return _mm_div_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4ScaleInvFast(const Vec4V a, const FloatV b) -{ - ASSERT_ISVALIDFLOATV(b); - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE Vec4V V4DivFast(const Vec4V a, const Vec4V b) -{ - return _mm_mul_ps(a, _mm_rcp_ps(b)); -} - -PX_FORCE_INLINE Vec4V V4Recip(const Vec4V a) -{ - return _mm_div_ps(V4One(), a); -} - -PX_FORCE_INLINE Vec4V V4RecipFast(const Vec4V a) -{ - return _mm_rcp_ps(a); -} - -PX_FORCE_INLINE Vec4V V4Rsqrt(const Vec4V a) -{ - return _mm_div_ps(V4One(), _mm_sqrt_ps(a)); -} - -PX_FORCE_INLINE Vec4V V4RsqrtFast(const Vec4V a) -{ - return _mm_rsqrt_ps(a); -} - -PX_FORCE_INLINE Vec4V V4Sqrt(const Vec4V a) -{ - return _mm_sqrt_ps(a); -} - -PX_FORCE_INLINE Vec4V V4ScaleAdd(const Vec4V a, const FloatV b, const Vec4V c) -{ - ASSERT_ISVALIDFLOATV(b); - return V4Add(V4Scale(a, b), c); -} - -PX_FORCE_INLINE Vec4V V4NegScaleSub(const Vec4V a, const FloatV b, const Vec4V c) -{ - ASSERT_ISVALIDFLOATV(b); - return V4Sub(c, V4Scale(a, b)); -} - -PX_FORCE_INLINE Vec4V V4MulAdd(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return V4Add(V4Mul(a, b), c); -} - -PX_FORCE_INLINE Vec4V V4NegMulSub(const Vec4V a, const Vec4V b, const Vec4V c) -{ - return V4Sub(c, V4Mul(a, b)); -} - -PX_FORCE_INLINE Vec4V V4Abs(const Vec4V a) -{ - return V4Max(a, V4Neg(a)); -} - -PX_FORCE_INLINE FloatV V4SumElements(const Vec4V a) -{ - const Vec4V xy = V4UnpackXY(a, a); // x,x,y,y - const Vec4V zw = V4UnpackZW(a, a); // z,z,w,w - const Vec4V xz_yw = V4Add(xy, zw); // x+z,x+z,y+w,y+w - const FloatV xz = V4GetX(xz_yw); // x+z - const FloatV yw = V4GetZ(xz_yw); // y+w - return FAdd(xz, yw); // sum -} - -PX_FORCE_INLINE FloatV V4Dot(const Vec4V a, const Vec4V b) -{ - const __m128 dot1 = _mm_mul_ps(a, b); // x,y,z,w - const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 1, 0, 3)); // w,x,y,z - const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 0, 3, 2)); // z,w,x,y - const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 3, 2, 1)); // y,z,w,x - return _mm_add_ps(_mm_add_ps(shuf2, shuf3), _mm_add_ps(dot1, shuf1)); - - // PT: this version has two less instructions but we should check its accuracy - // aw*bw | az*bz | ay*by | ax*bx - // const __m128 t0 = _mm_mul_ps(a, b); - // ay*by | ax*bx | aw*bw | az*bz - // const __m128 t1 = _mm_shuffle_ps(t0, t0, _MM_SHUFFLE(1,0,3,2)); - // ay*by + aw*bw | ax*bx + az*bz | aw*bw + ay*by | az*bz + ax*bx - // const __m128 t2 = _mm_add_ps(t0, t1); - // ax*bx + az*bz | ay*by + aw*bw | az*bz + ax*bx | aw*bw + ay*by - // const __m128 t3 = _mm_shuffle_ps(t2, t2, _MM_SHUFFLE(2,3,0,1)); - // ax*bx + az*bz + ay*by + aw*bw - // return _mm_add_ps(t3, t2); - // ay*by + aw*bw + ax*bx + az*bz - // az*bz + ax*bx + aw*bw + ay*by - // aw*bw + ay*by + az*bz + ax*bx -} - -PX_FORCE_INLINE FloatV V4Dot3(const Vec4V a, const Vec4V b) -{ - const __m128 dot1 = _mm_mul_ps(a, b); // aw*bw | az*bz | ay*by | ax*bx - const __m128 shuf1 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(0, 0, 0, 0)); // ax*bx | ax*bx | ax*bx | ax*bx - const __m128 shuf2 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(1, 1, 1, 1)); // ay*by | ay*by | ay*by | ay*by - const __m128 shuf3 = _mm_shuffle_ps(dot1, dot1, _MM_SHUFFLE(2, 2, 2, 2)); // az*bz | az*bz | az*bz | az*bz - return _mm_add_ps(_mm_add_ps(shuf1, shuf2), shuf3); // ax*bx + ay*by + az*bz in each component -} - -PX_FORCE_INLINE Vec4V V4Cross(const Vec4V a, const Vec4V b) -{ - const __m128 r1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - const __m128 r2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 0, 2, 1)); // y,z,x,w - const __m128 l2 = _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 1, 0, 2)); // z,x,y,w - return _mm_sub_ps(_mm_mul_ps(l1, l2), _mm_mul_ps(r1, r2)); -} - -PX_FORCE_INLINE FloatV V4Length(const Vec4V a) -{ - return _mm_sqrt_ps(V4Dot(a, a)); -} - -PX_FORCE_INLINE FloatV V4LengthSq(const Vec4V a) -{ - return V4Dot(a, a); -} - -PX_FORCE_INLINE Vec4V V4Normalize(const Vec4V a) -{ - ASSERT_ISFINITELENGTH(a); - return V4ScaleInv(a, _mm_sqrt_ps(V4Dot(a, a))); -} - -PX_FORCE_INLINE Vec4V V4NormalizeFast(const Vec4V a) -{ - ASSERT_ISFINITELENGTH(a); - return V4ScaleInvFast(a, _mm_sqrt_ps(V4Dot(a, a))); -} - -PX_FORCE_INLINE Vec4V V4NormalizeSafe(const Vec4V a, const Vec4V unsafeReturnValue) -{ - const __m128 eps = V3Eps(); - const __m128 length = V4Length(a); - const __m128 isGreaterThanZero = V4IsGrtr(length, eps); - return V4Sel(isGreaterThanZero, V4ScaleInv(a, length), unsafeReturnValue); -} - -PX_FORCE_INLINE Vec4V V4Sel(const BoolV c, const Vec4V a, const Vec4V b) -{ - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE BoolV V4IsGrtr(const Vec4V a, const Vec4V b) -{ - return _mm_cmpgt_ps(a, b); -} - -PX_FORCE_INLINE BoolV V4IsGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return _mm_cmpge_ps(a, b); -} - -PX_FORCE_INLINE BoolV V4IsEq(const Vec4V a, const Vec4V b) -{ - return _mm_cmpeq_ps(a, b); -} - -PX_FORCE_INLINE BoolV V4IsEqU32(const VecU32V a, const VecU32V b) -{ - return internalWindowsSimd::m128_I2F( - _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE Vec4V V4Max(const Vec4V a, const Vec4V b) -{ - return _mm_max_ps(a, b); -} - -PX_FORCE_INLINE Vec4V V4Min(const Vec4V a, const Vec4V b) -{ - return _mm_min_ps(a, b); -} - -PX_FORCE_INLINE FloatV V4ExtractMax(const Vec4V a) -{ - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); - - return _mm_max_ps(_mm_max_ps(a, shuf1), _mm_max_ps(shuf2, shuf3)); -} - -PX_FORCE_INLINE FloatV V4ExtractMin(const Vec4V a) -{ - const __m128 shuf1 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 1, 0, 3)); - const __m128 shuf2 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 0, 3, 2)); - const __m128 shuf3 = _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 3, 2, 1)); - - return _mm_min_ps(_mm_min_ps(a, shuf1), _mm_min_ps(shuf2, shuf3)); -} - -PX_FORCE_INLINE Vec4V V4Clamp(const Vec4V a, const Vec4V minV, const Vec4V maxV) -{ - return V4Max(V4Min(a, maxV), minV); -} - -PX_FORCE_INLINE PxU32 V4AllGrtr(const Vec4V a, const Vec4V b) -{ - return internalWindowsSimd::BAllTrue4_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq(const Vec4V a, const Vec4V b) -{ - return internalWindowsSimd::BAllTrue4_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllGrtrOrEq3(const Vec4V a, const Vec4V b) -{ - return internalWindowsSimd::BAllTrue3_R(V4IsGrtrOrEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AllEq(const Vec4V a, const Vec4V b) -{ - return internalWindowsSimd::BAllTrue4_R(V4IsEq(a, b)); -} - -PX_FORCE_INLINE PxU32 V4AnyGrtr3(const Vec4V a, const Vec4V b) -{ - return internalWindowsSimd::BAnyTrue3_R(V4IsGrtr(a, b)); -} - -PX_FORCE_INLINE Vec4V V4Round(const Vec4V a) -{ - // return _mm_round_ps(a, 0x0); - const Vec4V half = V4Load(0.5f); - const __m128 signBit = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_cvtps_epi32(a), 31)); - const Vec4V aRound = V4Sub(V4Add(a, half), signBit); - const __m128i tmp = _mm_cvttps_epi32(aRound); - return _mm_cvtepi32_ps(tmp); -} - -PX_FORCE_INLINE Vec4V V4Sin(const Vec4V a) -{ - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const Vec4V twoPi = V4LoadA(g_PXTwoPi.f); - const Vec4V tmp = V4Mul(a, recipTwoPi); - const Vec4V b = V4Round(tmp); - const Vec4V V1 = V4NegMulSub(twoPi, b, a); - - // sin(V) ~= V - V^3 / 3! + V^5 / 5! - V^7 / 7! + V^9 / 9! - V^11 / 11! + V^13 / 13! - - // V^15 / 15! + V^17 / 17! - V^19 / 19! + V^21 / 21! - V^23 / 23! (for -PI <= V < PI) - const Vec4V V2 = V4Mul(V1, V1); - const Vec4V V3 = V4Mul(V2, V1); - const Vec4V V5 = V4Mul(V3, V2); - const Vec4V V7 = V4Mul(V5, V2); - const Vec4V V9 = V4Mul(V7, V2); - const Vec4V V11 = V4Mul(V9, V2); - const Vec4V V13 = V4Mul(V11, V2); - const Vec4V V15 = V4Mul(V13, V2); - const Vec4V V17 = V4Mul(V15, V2); - const Vec4V V19 = V4Mul(V17, V2); - const Vec4V V21 = V4Mul(V19, V2); - const Vec4V V23 = V4Mul(V21, V2); - - const Vec4V sinCoefficients0 = V4LoadA(g_PXSinCoefficients0.f); - const Vec4V sinCoefficients1 = V4LoadA(g_PXSinCoefficients1.f); - const Vec4V sinCoefficients2 = V4LoadA(g_PXSinCoefficients2.f); - - const FloatV S1 = V4GetY(sinCoefficients0); - const FloatV S2 = V4GetZ(sinCoefficients0); - const FloatV S3 = V4GetW(sinCoefficients0); - const FloatV S4 = V4GetX(sinCoefficients1); - const FloatV S5 = V4GetY(sinCoefficients1); - const FloatV S6 = V4GetZ(sinCoefficients1); - const FloatV S7 = V4GetW(sinCoefficients1); - const FloatV S8 = V4GetX(sinCoefficients2); - const FloatV S9 = V4GetY(sinCoefficients2); - const FloatV S10 = V4GetZ(sinCoefficients2); - const FloatV S11 = V4GetW(sinCoefficients2); - - Vec4V Result; - Result = V4MulAdd(S1, V3, V1); - Result = V4MulAdd(S2, V5, Result); - Result = V4MulAdd(S3, V7, Result); - Result = V4MulAdd(S4, V9, Result); - Result = V4MulAdd(S5, V11, Result); - Result = V4MulAdd(S6, V13, Result); - Result = V4MulAdd(S7, V15, Result); - Result = V4MulAdd(S8, V17, Result); - Result = V4MulAdd(S9, V19, Result); - Result = V4MulAdd(S10, V21, Result); - Result = V4MulAdd(S11, V23, Result); - - return Result; -} - -PX_FORCE_INLINE Vec4V V4Cos(const Vec4V a) -{ - const Vec4V recipTwoPi = V4LoadA(g_PXReciprocalTwoPi.f); - const FloatV twoPi = V4LoadA(g_PXTwoPi.f); - const Vec4V tmp = V4Mul(a, recipTwoPi); - const Vec4V b = V4Round(tmp); - const Vec4V V1 = V4NegMulSub(twoPi, b, a); - - // cos(V) ~= 1 - V^2 / 2! + V^4 / 4! - V^6 / 6! + V^8 / 8! - V^10 / 10! + V^12 / 12! - - // V^14 / 14! + V^16 / 16! - V^18 / 18! + V^20 / 20! - V^22 / 22! (for -PI <= V < PI) - const Vec4V V2 = V4Mul(V1, V1); - const Vec4V V4 = V4Mul(V2, V2); - const Vec4V V6 = V4Mul(V4, V2); - const Vec4V V8 = V4Mul(V4, V4); - const Vec4V V10 = V4Mul(V6, V4); - const Vec4V V12 = V4Mul(V6, V6); - const Vec4V V14 = V4Mul(V8, V6); - const Vec4V V16 = V4Mul(V8, V8); - const Vec4V V18 = V4Mul(V10, V8); - const Vec4V V20 = V4Mul(V10, V10); - const Vec4V V22 = V4Mul(V12, V10); - - const Vec4V cosCoefficients0 = V4LoadA(g_PXCosCoefficients0.f); - const Vec4V cosCoefficients1 = V4LoadA(g_PXCosCoefficients1.f); - const Vec4V cosCoefficients2 = V4LoadA(g_PXCosCoefficients2.f); - - const FloatV C1 = V4GetY(cosCoefficients0); - const FloatV C2 = V4GetZ(cosCoefficients0); - const FloatV C3 = V4GetW(cosCoefficients0); - const FloatV C4 = V4GetX(cosCoefficients1); - const FloatV C5 = V4GetY(cosCoefficients1); - const FloatV C6 = V4GetZ(cosCoefficients1); - const FloatV C7 = V4GetW(cosCoefficients1); - const FloatV C8 = V4GetX(cosCoefficients2); - const FloatV C9 = V4GetY(cosCoefficients2); - const FloatV C10 = V4GetZ(cosCoefficients2); - const FloatV C11 = V4GetW(cosCoefficients2); - - Vec4V Result; - Result = V4MulAdd(C1, V2, V4One()); - Result = V4MulAdd(C2, V4, Result); - Result = V4MulAdd(C3, V6, Result); - Result = V4MulAdd(C4, V8, Result); - Result = V4MulAdd(C5, V10, Result); - Result = V4MulAdd(C6, V12, Result); - Result = V4MulAdd(C7, V14, Result); - Result = V4MulAdd(C8, V16, Result); - Result = V4MulAdd(C9, V18, Result); - Result = V4MulAdd(C10, V20, Result); - Result = V4MulAdd(C11, V22, Result); - - return Result; -} - -PX_FORCE_INLINE void V4Transpose(Vec4V& col0, Vec4V& col1, Vec4V& col2, Vec4V& col3) -{ - Vec4V tmp0 = _mm_unpacklo_ps(col0, col1); - Vec4V tmp2 = _mm_unpacklo_ps(col2, col3); - Vec4V tmp1 = _mm_unpackhi_ps(col0, col1); - Vec4V tmp3 = _mm_unpackhi_ps(col2, col3); - col0 = _mm_movelh_ps(tmp0, tmp2); - col1 = _mm_movehl_ps(tmp2, tmp0); - col2 = _mm_movelh_ps(tmp1, tmp3); - col3 = _mm_movehl_ps(tmp3, tmp1); -} - -////////////////////////////////// -// BoolV -////////////////////////////////// - -PX_FORCE_INLINE BoolV BFFFF() -{ - return _mm_setzero_ps(); -} - -PX_FORCE_INLINE BoolV BFFFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; - const __m128 ffft=_mm_load_ps((float*)&f); - return ffft;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); -} - -PX_FORCE_INLINE BoolV BFFTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; - const __m128 fftf=_mm_load_ps((float*)&f); - return fftf;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, 0, 0)); -} - -PX_FORCE_INLINE BoolV BFFTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 fftt=_mm_load_ps((float*)&f); - return fftt;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, 0, 0)); -} - -PX_FORCE_INLINE BoolV BFTFF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; - const __m128 ftff=_mm_load_ps((float*)&f); - return ftff;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, -1, 0)); -} - -PX_FORCE_INLINE BoolV BFTFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0xFFFFFFFF}; - const __m128 ftft=_mm_load_ps((float*)&f); - return ftft;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, -1, 0)); -} - -PX_FORCE_INLINE BoolV BFTTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0}; - const __m128 fttf=_mm_load_ps((float*)&f); - return fttf;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, -1, 0)); -} - -PX_FORCE_INLINE BoolV BFTTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 fttt=_mm_load_ps((float*)&f); - return fttt;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, -1, 0)); -} - -PX_FORCE_INLINE BoolV BTFFF() -{ - // const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; - // const __m128 tfff=_mm_load_ps((float*)&f); - // return tfff; - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTFFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0xFFFFFFFF}; - const __m128 tfft=_mm_load_ps((float*)&f); - return tfft;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTFTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0}; - const __m128 tftf=_mm_load_ps((float*)&f); - return tftf;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTFTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 tftt=_mm_load_ps((float*)&f); - return tftt;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, 0, -1)); -} - -PX_FORCE_INLINE BoolV BTTFF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0}; - const __m128 ttff=_mm_load_ps((float*)&f); - return ttff;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, -1, -1)); -} - -PX_FORCE_INLINE BoolV BTTFT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0,0xFFFFFFFF}; - const __m128 ttft=_mm_load_ps((float*)&f); - return ttft;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, -1, -1)); -} - -PX_FORCE_INLINE BoolV BTTTF() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0}; - const __m128 tttf=_mm_load_ps((float*)&f); - return tttf;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, -1, -1)); -} - -PX_FORCE_INLINE BoolV BTTTT() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}; - const __m128 tttt=_mm_load_ps((float*)&f); - return tttt;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, -1, -1, -1)); -} - -PX_FORCE_INLINE BoolV BXMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0xFFFFFFFF,0,0,0}; - const __m128 tfff=_mm_load_ps((float*)&f); - return tfff;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, 0, -1)); -} - -PX_FORCE_INLINE BoolV BYMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0xFFFFFFFF,0,0}; - const __m128 ftff=_mm_load_ps((float*)&f); - return ftff;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, 0, -1, 0)); -} - -PX_FORCE_INLINE BoolV BZMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0xFFFFFFFF,0}; - const __m128 fftf=_mm_load_ps((float*)&f); - return fftf;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(0, -1, 0, 0)); -} - -PX_FORCE_INLINE BoolV BWMask() -{ - /*const PX_ALIGN(16, PxU32 f[4])={0,0,0,0xFFFFFFFF}; - const __m128 ffft=_mm_load_ps((float*)&f); - return ffft;*/ - return internalWindowsSimd::m128_I2F(_mm_set_epi32(-1, 0, 0, 0)); -} - -PX_FORCE_INLINE BoolV BGetX(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE BoolV BGetY(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE BoolV BGetZ(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE BoolV BGetW(const BoolV f) -{ - return _mm_shuffle_ps(f, f, _MM_SHUFFLE(3, 3, 3, 3)); -} - -PX_FORCE_INLINE BoolV BSetX(const BoolV v, const BoolV f) -{ - return V4Sel(BFTTT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetY(const BoolV v, const BoolV f) -{ - return V4Sel(BTFTT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetZ(const BoolV v, const BoolV f) -{ - return V4Sel(BTTFT(), v, f); -} - -PX_FORCE_INLINE BoolV BSetW(const BoolV v, const BoolV f) -{ - return V4Sel(BTTTF(), v, f); -} - -template <int index> -BoolV BSplatElement(BoolV a) -{ - return internalWindowsSimd::m128_I2F( - _mm_shuffle_epi32(internalWindowsSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); -} - -PX_FORCE_INLINE BoolV BAnd(const BoolV a, const BoolV b) -{ - return _mm_and_ps(a, b); -} - -PX_FORCE_INLINE BoolV BNot(const BoolV a) -{ - const BoolV bAllTrue(BTTTT()); - return _mm_xor_ps(a, bAllTrue); -} - -PX_FORCE_INLINE BoolV BAndNot(const BoolV a, const BoolV b) -{ - return _mm_andnot_ps(b, a); -} - -PX_FORCE_INLINE BoolV BOr(const BoolV a, const BoolV b) -{ - return _mm_or_ps(a, b); -} - -PX_FORCE_INLINE BoolV BAllTrue4(const BoolV a) -{ - const BoolV bTmp = - _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); - return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE BoolV BAnyTrue4(const BoolV a) -{ - const BoolV bTmp = - _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 3, 2, 3))); - return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE BoolV BAllTrue3(const BoolV a) -{ - const BoolV bTmp = - _mm_and_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); - return _mm_and_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE BoolV BAnyTrue3(const BoolV a) -{ - const BoolV bTmp = - _mm_or_ps(_mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 0, 1)), _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2))); - return _mm_or_ps(_mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(0, 0, 0, 0)), - _mm_shuffle_ps(bTmp, bTmp, _MM_SHUFFLE(1, 1, 1, 1))); -} - -PX_FORCE_INLINE PxU32 BAllEq(const BoolV a, const BoolV b) -{ - const BoolV bTest = internalWindowsSimd::m128_I2F( - _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); - return internalWindowsSimd::BAllTrue4_R(bTest); -} - -PX_FORCE_INLINE PxU32 BAllEqTTTT(const BoolV a) -{ - return PxU32(_mm_movemask_ps(a)==15); -} - -PX_FORCE_INLINE PxU32 BAllEqFFFF(const BoolV a) -{ - return PxU32(_mm_movemask_ps(a)==0); -} - -PX_FORCE_INLINE PxU32 BGetBitMask(const BoolV a) -{ - return PxU32(_mm_movemask_ps(a)); -} - -////////////////////////////////// -// MAT33V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M33MulV3(const Mat33V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - return V3Add(v0PlusV1, v2); -} - -PX_FORCE_INLINE Vec3V M33TrnspsMulV3(const Mat33V& a, const Vec3V b) -{ - Vec3V v0 = V3Mul(a.col0, b); - Vec3V v1 = V3Mul(a.col1, b); - Vec3V v2 = V3Mul(a.col2, b); - V3Transpose(v0, v1, v2); - return V3Add(V3Add(v0, v1), v2); -} - -PX_FORCE_INLINE Vec3V M33MulV3AddV3(const Mat33V& A, const Vec3V b, const Vec3V c) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - Vec3V result = V3ScaleAdd(A.col0, x, c); - result = V3ScaleAdd(A.col1, y, result); - return V3ScaleAdd(A.col2, z, result); -} - -PX_FORCE_INLINE Mat33V M33MulM33(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(M33MulV3(a, b.col0), M33MulV3(a, b.col1), M33MulV3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Add(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Scale(const Mat33V& a, const FloatV& b) -{ - return Mat33V(V3Scale(a.col0, b), V3Scale(a.col1, b), V3Scale(a.col2, b)); -} - -PX_FORCE_INLINE Mat33V M33Sub(const Mat33V& a, const Mat33V& b) -{ - return Mat33V(V3Sub(a.col0, b.col0), V3Sub(a.col1, b.col1), V3Sub(a.col2, b.col2)); -} - -PX_FORCE_INLINE Mat33V M33Neg(const Mat33V& a) -{ - return Mat33V(V3Neg(a.col0), V3Neg(a.col1), V3Neg(a.col2)); -} - -PX_FORCE_INLINE Mat33V M33Abs(const Mat33V& a) -{ - return Mat33V(V3Abs(a.col0), V3Abs(a.col1), V3Abs(a.col2)); -} - -PX_FORCE_INLINE Mat33V M33Inverse(const Mat33V& a) -{ - const BoolV tfft = BTFFT(); - const BoolV tttf = BTTTF(); - const FloatV zero = V3Zero(); - const Vec3V cross01 = V3Cross(a.col0, a.col1); - const Vec3V cross12 = V3Cross(a.col1, a.col2); - const Vec3V cross20 = V3Cross(a.col2, a.col0); - const FloatV dot = V3Dot(cross01, a.col2); - const FloatV invDet = _mm_rcp_ps(dot); - const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); - const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); - Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); - colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); - const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); - const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); - const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); - const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); - const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); - const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); - - return Mat33V(_mm_mul_ps(colInv0, invDet), _mm_mul_ps(colInv1, invDet), _mm_mul_ps(colInv2, invDet)); -} - -PX_FORCE_INLINE Mat33V M33Trnsps(const Mat33V& a) -{ - Vec3V col0 = a.col0, col1 = a.col1, col2 = a.col2; - V3Transpose(col0, col1, col2); - return Mat33V(col0, col1, col2); -} - -PX_FORCE_INLINE Mat33V M33Identity() -{ - return Mat33V(V3UnitX(), V3UnitY(), V3UnitZ()); -} - -PX_FORCE_INLINE Mat33V M33Diagonal(const Vec3VArg d) -{ - const FloatV x = V3Mul(V3UnitX(), d); - const FloatV y = V3Mul(V3UnitY(), d); - const FloatV z = V3Mul(V3UnitZ(), d); - return Mat33V(x, y, z); -} - -////////////////////////////////// -// MAT34V -////////////////////////////////// - -PX_FORCE_INLINE Vec3V M34MulV3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - const Vec3V v0PlusV1Plusv2 = V3Add(v0PlusV1, v2); - return V3Add(v0PlusV1Plusv2, a.col3); -} - -PX_FORCE_INLINE Vec3V M34Mul33V3(const Mat34V& a, const Vec3V b) -{ - const FloatV x = V3GetX(b); - const FloatV y = V3GetY(b); - const FloatV z = V3GetZ(b); - const Vec3V v0 = V3Scale(a.col0, x); - const Vec3V v1 = V3Scale(a.col1, y); - const Vec3V v2 = V3Scale(a.col2, z); - const Vec3V v0PlusV1 = V3Add(v0, v1); - return V3Add(v0PlusV1, v2); -} - -PX_FORCE_INLINE Vec3V M34TrnspsMul33V3(const Mat34V& a, const Vec3V b) -{ - Vec3V v0 = V3Mul(a.col0, b); - Vec3V v1 = V3Mul(a.col1, b); - Vec3V v2 = V3Mul(a.col2, b); - V3Transpose(v0, v1, v2); - return V3Add(V3Add(v0, v1), v2); -} - -PX_FORCE_INLINE Mat34V M34MulM34(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2), M34MulV3(a, b.col3)); -} - -PX_FORCE_INLINE Mat33V M34MulM33(const Mat34V& a, const Mat33V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat33V M34Mul33MM34(const Mat34V& a, const Mat34V& b) -{ - return Mat33V(M34Mul33V3(a, b.col0), M34Mul33V3(a, b.col1), M34Mul33V3(a, b.col2)); -} - -PX_FORCE_INLINE Mat34V M34Add(const Mat34V& a, const Mat34V& b) -{ - return Mat34V(V3Add(a.col0, b.col0), V3Add(a.col1, b.col1), V3Add(a.col2, b.col2), V3Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat34V M34Inverse(const Mat34V& a) -{ - Mat34V aInv; - const BoolV tfft = BTFFT(); - const BoolV tttf = BTTTF(); - const FloatV zero = V3Zero(); - const Vec3V cross01 = V3Cross(a.col0, a.col1); - const Vec3V cross12 = V3Cross(a.col1, a.col2); - const Vec3V cross20 = V3Cross(a.col2, a.col0); - const FloatV dot = V3Dot(cross01, a.col2); - const FloatV invDet = _mm_rcp_ps(dot); - const Vec3V mergeh = _mm_unpacklo_ps(cross12, cross01); - const Vec3V mergel = _mm_unpackhi_ps(cross12, cross01); - Vec3V colInv0 = _mm_unpacklo_ps(mergeh, cross20); - colInv0 = _mm_or_ps(_mm_andnot_ps(tttf, zero), _mm_and_ps(tttf, colInv0)); - const Vec3V zppd = _mm_shuffle_ps(mergeh, cross20, _MM_SHUFFLE(3, 0, 0, 2)); - const Vec3V pbwp = _mm_shuffle_ps(cross20, mergeh, _MM_SHUFFLE(3, 3, 1, 0)); - const Vec3V colInv1 = _mm_or_ps(_mm_andnot_ps(BTFFT(), pbwp), _mm_and_ps(BTFFT(), zppd)); - const Vec3V xppd = _mm_shuffle_ps(mergel, cross20, _MM_SHUFFLE(3, 0, 0, 0)); - const Vec3V pcyp = _mm_shuffle_ps(cross20, mergel, _MM_SHUFFLE(3, 1, 2, 0)); - const Vec3V colInv2 = _mm_or_ps(_mm_andnot_ps(tfft, pcyp), _mm_and_ps(tfft, xppd)); - aInv.col0 = _mm_mul_ps(colInv0, invDet); - aInv.col1 = _mm_mul_ps(colInv1, invDet); - aInv.col2 = _mm_mul_ps(colInv2, invDet); - aInv.col3 = M34Mul33V3(aInv, V3Neg(a.col3)); - return aInv; -} - -PX_FORCE_INLINE Mat33V M34Trnsps33(const Mat34V& a) -{ - Vec3V col0 = a.col0, col1 = a.col1, col2 = a.col2; - V3Transpose(col0, col1, col2); - return Mat33V(col0, col1, col2); -} - -////////////////////////////////// -// MAT44V -////////////////////////////////// - -PX_FORCE_INLINE Vec4V M44MulV4(const Mat44V& a, const Vec4V b) -{ - const FloatV x = V4GetX(b); - const FloatV y = V4GetY(b); - const FloatV z = V4GetZ(b); - const FloatV w = V4GetW(b); - - const Vec4V v0 = V4Scale(a.col0, x); - const Vec4V v1 = V4Scale(a.col1, y); - const Vec4V v2 = V4Scale(a.col2, z); - const Vec4V v3 = V4Scale(a.col3, w); - const Vec4V v0PlusV1 = V4Add(v0, v1); - const Vec4V v0PlusV1Plusv2 = V4Add(v0PlusV1, v2); - return V4Add(v0PlusV1Plusv2, v3); -} - -PX_FORCE_INLINE Vec4V M44TrnspsMulV4(const Mat44V& a, const Vec4V b) -{ - Vec4V v0 = V4Mul(a.col0, b); - Vec4V v1 = V4Mul(a.col1, b); - Vec4V v2 = V4Mul(a.col2, b); - Vec4V v3 = V4Mul(a.col3, b); - V4Transpose(v0, v1, v2, v3); - return V4Add(V4Add(v0, v1), V4Add(v2, v3)); -} - -PX_FORCE_INLINE Mat44V M44MulM44(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(M44MulV4(a, b.col0), M44MulV4(a, b.col1), M44MulV4(a, b.col2), M44MulV4(a, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Add(const Mat44V& a, const Mat44V& b) -{ - return Mat44V(V4Add(a.col0, b.col0), V4Add(a.col1, b.col1), V4Add(a.col2, b.col2), V4Add(a.col3, b.col3)); -} - -PX_FORCE_INLINE Mat44V M44Trnsps(const Mat44V& a) -{ - Vec4V col0 = a.col0, col1 = a.col1, col2 = a.col2, col3 = a.col3; - V4Transpose(col0, col1, col2, col3); - return Mat44V(col0, col1, col2, col3); -} - -PX_FORCE_INLINE Mat44V M44Inverse(const Mat44V& a) -{ - __m128 minor0, minor1, minor2, minor3; - __m128 row0, row1, row2, row3; - __m128 det, tmp1; - - tmp1 = V4Zero(); - row1 = V4Zero(); - row3 = V4Zero(); - - row0 = a.col0; - row1 = _mm_shuffle_ps(a.col1, a.col1, _MM_SHUFFLE(1, 0, 3, 2)); - row2 = a.col2; - row3 = _mm_shuffle_ps(a.col3, a.col3, _MM_SHUFFLE(1, 0, 3, 2)); - - tmp1 = _mm_mul_ps(row2, row3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor0 = _mm_mul_ps(row1, tmp1); - minor1 = _mm_mul_ps(row0, tmp1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor0 = _mm_sub_ps(_mm_mul_ps(row1, tmp1), minor0); - minor1 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor1); - minor1 = _mm_shuffle_ps(minor1, minor1, 0x4E); - - tmp1 = _mm_mul_ps(row1, row2); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor0 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor0); - minor3 = _mm_mul_ps(row0, tmp1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row3, tmp1)); - minor3 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor3); - minor3 = _mm_shuffle_ps(minor3, minor3, 0x4E); - - tmp1 = _mm_mul_ps(_mm_shuffle_ps(row1, row1, 0x4E), row3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - row2 = _mm_shuffle_ps(row2, row2, 0x4E); - minor0 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor0); - minor2 = _mm_mul_ps(row0, tmp1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor0 = _mm_sub_ps(minor0, _mm_mul_ps(row2, tmp1)); - minor2 = _mm_sub_ps(_mm_mul_ps(row0, tmp1), minor2); - minor2 = _mm_shuffle_ps(minor2, minor2, 0x4E); - - tmp1 = _mm_mul_ps(row0, row1); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor2 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor2); - minor3 = _mm_sub_ps(_mm_mul_ps(row2, tmp1), minor3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor2 = _mm_sub_ps(_mm_mul_ps(row3, tmp1), minor2); - minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row2, tmp1)); - - tmp1 = _mm_mul_ps(row0, row3); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row2, tmp1)); - minor2 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor2); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor1 = _mm_add_ps(_mm_mul_ps(row2, tmp1), minor1); - minor2 = _mm_sub_ps(minor2, _mm_mul_ps(row1, tmp1)); - - tmp1 = _mm_mul_ps(row0, row2); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0xB1); - minor1 = _mm_add_ps(_mm_mul_ps(row3, tmp1), minor1); - minor3 = _mm_sub_ps(minor3, _mm_mul_ps(row1, tmp1)); - tmp1 = _mm_shuffle_ps(tmp1, tmp1, 0x4E); - minor1 = _mm_sub_ps(minor1, _mm_mul_ps(row3, tmp1)); - minor3 = _mm_add_ps(_mm_mul_ps(row1, tmp1), minor3); - - det = _mm_mul_ps(row0, minor0); - det = _mm_add_ps(_mm_shuffle_ps(det, det, 0x4E), det); - det = _mm_add_ss(_mm_shuffle_ps(det, det, 0xB1), det); - tmp1 = _mm_rcp_ss(det); -#if 0 - det = _mm_sub_ss(_mm_add_ss(tmp1, tmp1), _mm_mul_ss(det, _mm_mul_ss(tmp1, tmp1))); - det = _mm_shuffle_ps(det, det, 0x00); -#else - det = _mm_shuffle_ps(tmp1, tmp1, _MM_SHUFFLE(0, 0, 0, 0)); -#endif - - minor0 = _mm_mul_ps(det, minor0); - minor1 = _mm_mul_ps(det, minor1); - minor2 = _mm_mul_ps(det, minor2); - minor3 = _mm_mul_ps(det, minor3); - Mat44V invTrans(minor0, minor1, minor2, minor3); - return M44Trnsps(invTrans); -} - -PX_FORCE_INLINE Vec4V V4LoadXYZW(const PxF32& x, const PxF32& y, const PxF32& z, const PxF32& w) -{ - return _mm_set_ps(w, z, y, x); -} - -PX_FORCE_INLINE VecU32V V4U32Sel(const BoolV c, const VecU32V a, const VecU32V b) -{ - return internalWindowsSimd::m128_I2F( - _mm_or_si128(_mm_andnot_si128(internalWindowsSimd::m128_F2I(c), internalWindowsSimd::m128_F2I(b)), - _mm_and_si128(internalWindowsSimd::m128_F2I(c), internalWindowsSimd::m128_F2I(a)))); -} - -PX_FORCE_INLINE VecU32V V4U32or(VecU32V a, VecU32V b) -{ - return internalWindowsSimd::m128_I2F(_mm_or_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE VecU32V V4U32xor(VecU32V a, VecU32V b) -{ - return internalWindowsSimd::m128_I2F( - _mm_xor_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE VecU32V V4U32and(VecU32V a, VecU32V b) -{ - return internalWindowsSimd::m128_I2F( - _mm_and_si128(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE VecU32V V4U32Andc(VecU32V a, VecU32V b) -{ - return internalWindowsSimd::m128_I2F( - _mm_andnot_si128(internalWindowsSimd::m128_F2I(b), internalWindowsSimd::m128_F2I(a))); -} - -PX_FORCE_INLINE VecI32V U4Load(const PxU32 i) -{ - return _mm_load1_ps((PxF32*)&i); -} - -PX_FORCE_INLINE VecU32V U4LoadU(const PxU32* i) -{ - return _mm_loadu_ps((PxF32*)i); -} - -PX_FORCE_INLINE VecU32V U4LoadA(const PxU32* i) -{ - ASSERT_ISALIGNED16(i); - return _mm_load_ps((PxF32*)i); -} - -PX_FORCE_INLINE VecI32V I4Load(const PxI32 i) -{ - return _mm_load1_ps((PxF32*)&i); -} - -PX_FORCE_INLINE VecI32V I4LoadU(const PxI32* i) -{ - return _mm_loadu_ps((PxF32*)i); -} - -PX_FORCE_INLINE VecI32V I4LoadA(const PxI32* i) -{ - ASSERT_ISALIGNED16(i); - return _mm_load_ps((PxF32*)i); -} - -PX_FORCE_INLINE VecI32V VecI32V_Add(const VecI32VArg a, const VecI32VArg b) -{ - return internalWindowsSimd::m128_I2F( - _mm_add_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sub(const VecI32VArg a, const VecI32VArg b) -{ - return internalWindowsSimd::m128_I2F( - _mm_sub_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE BoolV VecI32V_IsGrtr(const VecI32VArg a, const VecI32VArg b) -{ - return internalWindowsSimd::m128_I2F( - _mm_cmpgt_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE BoolV VecI32V_IsEq(const VecI32VArg a, const VecI32VArg b) -{ - return internalWindowsSimd::m128_I2F( - _mm_cmpeq_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE VecI32V V4I32Sel(const BoolV c, const VecI32V a, const VecI32V b) -{ - return V4U32Sel(c, a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Zero() -{ - return V4Zero(); -} - -PX_FORCE_INLINE VecI32V VecI32V_One() -{ - return I4Load(1); -} - -PX_FORCE_INLINE VecI32V VecI32V_Two() -{ - return I4Load(2); -} - -PX_FORCE_INLINE VecI32V VecI32V_MinusOne() -{ - return I4Load(-1); -} - -PX_FORCE_INLINE VecU32V U4Zero() -{ - return U4Load(0); -} - -PX_FORCE_INLINE VecU32V U4One() -{ - return U4Load(1); -} - -PX_FORCE_INLINE VecU32V U4Two() -{ - return U4Load(2); -} - -PX_FORCE_INLINE VecI32V VecI32V_Sel(const BoolV c, const VecI32VArg a, const VecI32VArg b) -{ - PX_ASSERT(_VecMathTests::allElementsEqualBoolV(c, BTTTT()) || - _VecMathTests::allElementsEqualBoolV(c, BFFFF())); - return _mm_or_ps(_mm_andnot_ps(c, b), _mm_and_ps(c, a)); -} - -PX_FORCE_INLINE VecShiftV VecI32V_PrepareShift(const VecI32VArg shift) -{ - VecShiftV preparedShift; - preparedShift.shift = _mm_or_ps(_mm_andnot_ps(BTFFF(), VecI32V_Zero()), _mm_and_ps(BTFFF(), shift)); - return preparedShift; -} - -PX_FORCE_INLINE VecI32V VecI32V_LeftShift(const VecI32VArg a, const VecShiftVArg count) -{ - return internalWindowsSimd::m128_I2F( - _mm_sll_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(count.shift))); -} - -PX_FORCE_INLINE VecI32V VecI32V_RightShift(const VecI32VArg a, const VecShiftVArg count) -{ - return internalWindowsSimd::m128_I2F( - _mm_srl_epi32(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(count.shift))); -} - -PX_FORCE_INLINE VecI32V VecI32V_And(const VecI32VArg a, const VecI32VArg b) -{ - return _mm_and_ps(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_Or(const VecI32VArg a, const VecI32VArg b) -{ - return _mm_or_ps(a, b); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetX(const VecI32VArg a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 0, 0, 0)); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetY(const VecI32VArg a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetZ(const VecI32VArg a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(2, 2, 2, 2)); -} - -PX_FORCE_INLINE VecI32V VecI32V_GetW(const VecI32VArg a) -{ - return _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 3, 3, 3)); -} - -PX_FORCE_INLINE void PxI32_From_VecI32V(const VecI32VArg a, PxI32* i) -{ - _mm_store_ss((PxF32*)i, a); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_BoolV(const BoolVArg a) -{ - return a; -} - -PX_FORCE_INLINE VecU32V VecU32V_From_BoolV(const BoolVArg a) -{ - return a; -} - -PX_FORCE_INLINE VecI32V VecI32V_Merge(const VecI32VArg a, const VecI32VArg b, const VecI32VArg c, const VecI32VArg d) -{ - const __m128 xw = _mm_move_ss(b, a); // y, y, y, x - const __m128 yz = _mm_move_ss(c, d); // z, z, z, w - return _mm_shuffle_ps(xw, yz, _MM_SHUFFLE(0, 2, 1, 0)); -} - -PX_FORCE_INLINE void V4U32StoreAligned(VecU32V val, VecU32V* address) -{ - *address = val; -} - -PX_FORCE_INLINE Vec4V V4Andc(const Vec4V a, const VecU32V b) -{ - VecU32V result32(a); - result32 = V4U32Andc(result32, b); - return Vec4V(result32); -} - -PX_FORCE_INLINE VecU32V V4IsGrtrV32u(const Vec4V a, const Vec4V b) -{ - return V4IsGrtr(a, b); -} - -PX_FORCE_INLINE VecU16V V4U16LoadAligned(VecU16V* addr) -{ - return *addr; -} - -PX_FORCE_INLINE VecU16V V4U16LoadUnaligned(VecU16V* addr) -{ - return *addr; -} - -// unsigned compares are not supported on x86 -PX_FORCE_INLINE VecU16V V4U16CompareGt(VecU16V a, VecU16V b) -{ - // _mm_cmpgt_epi16 doesn't work for unsigned values unfortunately - // return m128_I2F(_mm_cmpgt_epi16(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); - VecU16V result; - result.m128_u16[0] = PxU16((a).m128_u16[0] > (b).m128_u16[0]); - result.m128_u16[1] = PxU16((a).m128_u16[1] > (b).m128_u16[1]); - result.m128_u16[2] = PxU16((a).m128_u16[2] > (b).m128_u16[2]); - result.m128_u16[3] = PxU16((a).m128_u16[3] > (b).m128_u16[3]); - result.m128_u16[4] = PxU16((a).m128_u16[4] > (b).m128_u16[4]); - result.m128_u16[5] = PxU16((a).m128_u16[5] > (b).m128_u16[5]); - result.m128_u16[6] = PxU16((a).m128_u16[6] > (b).m128_u16[6]); - result.m128_u16[7] = PxU16((a).m128_u16[7] > (b).m128_u16[7]); - return result; -} - -PX_FORCE_INLINE VecU16V V4I16CompareGt(VecU16V a, VecU16V b) -{ - return internalWindowsSimd::m128_I2F( - _mm_cmpgt_epi16(internalWindowsSimd::m128_F2I(a), internalWindowsSimd::m128_F2I(b))); -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecU32V(VecU32V a) -{ - Vec4V result = V4LoadXYZW(PxF32(a.m128_u32[0]), PxF32(a.m128_u32[1]), PxF32(a.m128_u32[2]), PxF32(a.m128_u32[3])); - return result; -} - -PX_FORCE_INLINE Vec4V Vec4V_From_VecI32V(VecI32V a) -{ - return _mm_cvtepi32_ps(internalWindowsSimd::m128_F2I(a)); -} - -PX_FORCE_INLINE VecI32V VecI32V_From_Vec4V(Vec4V a) -{ - return internalWindowsSimd::m128_I2F(_mm_cvttps_epi32(a)); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecU32V(VecU32V a) -{ - return Vec4V(a); -} - -PX_FORCE_INLINE Vec4V Vec4V_ReinterpretFrom_VecI32V(VecI32V a) -{ - return Vec4V(a); -} - -PX_FORCE_INLINE VecU32V VecU32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - return VecU32V(a); -} - -PX_FORCE_INLINE VecI32V VecI32V_ReinterpretFrom_Vec4V(Vec4V a) -{ - return VecI32V(a); -} - -template <int index> -PX_FORCE_INLINE VecU32V V4U32SplatElement(VecU32V a) -{ - return internalWindowsSimd::m128_I2F( - _mm_shuffle_epi32(internalWindowsSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); -} - -template <int index> -PX_FORCE_INLINE Vec4V V4SplatElement(Vec4V a) -{ - return internalWindowsSimd::m128_I2F( - _mm_shuffle_epi32(internalWindowsSimd::m128_F2I(a), _MM_SHUFFLE(index, index, index, index))); -} - -PX_FORCE_INLINE VecU32V U4LoadXYZW(PxU32 x, PxU32 y, PxU32 z, PxU32 w) -{ - VecU32V result; - result.m128_u32[0] = x; - result.m128_u32[1] = y; - result.m128_u32[2] = z; - result.m128_u32[3] = w; - return result; -} - -PX_FORCE_INLINE Vec4V V4ConvertFromI32V(const VecI32V in) -{ - return _mm_cvtepi32_ps(internalWindowsSimd::m128_F2I(in)); -} - -#endif // PSFOUNDATION_PSWINDOWSINLINEAOS_H diff --git a/PxShared/src/foundation/include/windows/PsWindowsLoadLibrary.h b/PxShared/src/foundation/include/windows/PsWindowsLoadLibrary.h deleted file mode 100644 index adfd8e4..0000000 --- a/PxShared/src/foundation/include/windows/PsWindowsLoadLibrary.h +++ /dev/null @@ -1,72 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PS_WINDOWS_FOUNDATION_LOADLIBRARY_H -#define PS_WINDOWS_FOUNDATION_LOADLIBRARY_H - -#include "foundation/PxPreprocessor.h" -#include "windows/PsWindowsInclude.h" -#include "foundation/windows/PxWindowsFoundationDelayLoadHook.h" - -namespace physx -{ -namespace shdfnd -{ - EXTERN_C IMAGE_DOS_HEADER __ImageBase; - - PX_INLINE FARPROC WINAPI foundationDliNotePreLoadLibrary(const char* libraryName, const physx::PxFoundationDelayLoadHook* delayLoadHook) - { - if(!delayLoadHook) - { - return (FARPROC)::LoadLibraryA(libraryName); - } - else - { - if(strstr(libraryName, "PxFoundation")) - { - if(strstr(libraryName, "DEBUG")) - return (FARPROC)::LoadLibraryA(delayLoadHook->getPxFoundationDEBUGDllName()); - - if(strstr(libraryName, "CHECKED")) - return (FARPROC)::LoadLibraryA(delayLoadHook->getPxFoundationCHECKEDDllName()); - - if(strstr(libraryName, "PROFILE")) - return (FARPROC)::LoadLibraryA(delayLoadHook->getPxFoundationPROFILEDllName()); - - return (FARPROC)::LoadLibraryA(delayLoadHook->getPxFoundationDllName()); - } - } - return NULL; - } -} // namespace shdfnd -} // namespace physx - - -#endif // PS_WINDOWS_FOUNDATION_LOADLIBRARY_H diff --git a/PxShared/src/foundation/include/windows/PsWindowsTrigConstants.h b/PxShared/src/foundation/include/windows/PsWindowsTrigConstants.h deleted file mode 100644 index dda3e3b..0000000 --- a/PxShared/src/foundation/include/windows/PsWindowsTrigConstants.h +++ /dev/null @@ -1,87 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PSFOUNDATION_PSWINDOWSTRIGCONSTANTS_H -#define PSFOUNDATION_PSWINDOWSTRIGCONSTANTS_H - -#define PX_GLOBALCONST extern const __declspec(selectany) - -__declspec(align(16)) struct PX_VECTORF32 -{ - float f[4]; -}; - -//#define PX_PI 3.141592654f -//#define PX_2PI 6.283185307f -//#define PX_1DIVPI 0.318309886f -//#define PX_1DIV2PI 0.159154943f -//#define PX_PIDIV2 1.570796327f -//#define PX_PIDIV4 0.785398163f - -PX_GLOBALCONST PX_VECTORF32 g_PXSinCoefficients0 = { { 1.0f, -0.166666667f, 8.333333333e-3f, -1.984126984e-4f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXSinCoefficients1 = { { 2.755731922e-6f, -2.505210839e-8f, 1.605904384e-10f, -7.647163732e-13f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXSinCoefficients2 = { { 2.811457254e-15f, -8.220635247e-18f, 1.957294106e-20f, -3.868170171e-23f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXCosCoefficients0 = { { 1.0f, -0.5f, 4.166666667e-2f, -1.388888889e-3f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXCosCoefficients1 = { { 2.480158730e-5f, -2.755731922e-7f, 2.087675699e-9f, -1.147074560e-11f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXCosCoefficients2 = { { 4.779477332e-14f, -1.561920697e-16f, 4.110317623e-19f, -8.896791392e-22f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXTanCoefficients0 = { { 1.0f, 0.333333333f, 0.133333333f, 5.396825397e-2f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXTanCoefficients1 = { { 2.186948854e-2f, 8.863235530e-3f, 3.592128167e-3f, 1.455834485e-3f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXTanCoefficients2 = { { 5.900274264e-4f, 2.391290764e-4f, 9.691537707e-5f, 3.927832950e-5f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinCoefficients0 = { { -0.05806367563904f, -0.41861972469416f, 0.22480114791621f, 2.17337241360606f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinCoefficients1 = { { 0.61657275907170f, 4.29696498283455f, -1.18942822255452f, -6.53784832094831f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinCoefficients2 = { { -1.36926553863413f, -4.48179294237210f, 1.41810672941833f, 5.48179257935713f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXATanCoefficients0 = { { 1.0f, 0.333333334f, 0.2f, 0.142857143f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXATanCoefficients1 = { { 1.111111111e-1f, 9.090909091e-2f, 7.692307692e-2f, 6.666666667e-2f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXATanCoefficients2 = { { 5.882352941e-2f, 5.263157895e-2f, 4.761904762e-2f, 4.347826087e-2f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXSinEstCoefficients = { { 1.0f, -1.66521856991541e-1f, 8.199913018755e-3f, -1.61475937228e-4f } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXCosEstCoefficients = { { 1.0f, -4.95348008918096e-1f, 3.878259962881e-2f, -9.24587976263e-4f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXTanEstCoefficients = { { 2.484f, -1.954923183e-1f, 2.467401101f, PxInvPi } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXATanEstCoefficients = { { 7.689891418951e-1f, 1.104742493348f, 8.661844266006e-1f, PxPiDivTwo } }; -PX_GLOBALCONST PX_VECTORF32 -g_PXASinEstCoefficients = { { -1.36178272886711f, 2.37949493464538f, -8.08228565650486e-1f, 2.78440142746736e-1f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXASinEstConstants = { { 1.00000011921f, PxPiDivTwo, 0.0f, 0.0f } }; -PX_GLOBALCONST PX_VECTORF32 g_PXPiConstants0 = { { PxPi, PxTwoPi, PxInvPi, PxInvTwoPi } }; -PX_GLOBALCONST PX_VECTORF32 g_PXReciprocalTwoPi = { { PxInvTwoPi, PxInvTwoPi, PxInvTwoPi, PxInvTwoPi } }; -PX_GLOBALCONST PX_VECTORF32 g_PXTwoPi = { { PxTwoPi, PxTwoPi, PxTwoPi, PxTwoPi } }; - -#endif diff --git a/PxShared/src/foundation/src/PsAllocator.cpp b/PxShared/src/foundation/src/PsAllocator.cpp deleted file mode 100644 index 3952b27..0000000 --- a/PxShared/src/foundation/src/PsAllocator.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PsFoundation.h" -#include "PsAllocator.h" -#include "PsHashMap.h" -#include "PsArray.h" -#include "PsMutex.h" - -namespace physx -{ -namespace shdfnd -{ - -#if PX_USE_NAMED_ALLOCATOR -namespace -{ -typedef HashMap<const NamedAllocator*, const char*, Hash<const NamedAllocator*>, NonTrackingAllocator> AllocNameMap; -PX_INLINE AllocNameMap& getMap() -{ - return getFoundation().getNamedAllocMap(); -} -PX_INLINE Foundation::Mutex& getMutex() -{ - return getFoundation().getNamedAllocMutex(); -} -} - -NamedAllocator::NamedAllocator(const PxEMPTY) -{ - Foundation::Mutex::ScopedLock lock(getMutex()); - getMap().insert(this, 0); -} - -NamedAllocator::NamedAllocator(const char* name) -{ - Foundation::Mutex::ScopedLock lock(getMutex()); - getMap().insert(this, name); -} - -NamedAllocator::NamedAllocator(const NamedAllocator& other) -{ - Foundation::Mutex::ScopedLock lock(getMutex()); - const AllocNameMap::Entry* e = getMap().find(&other); - PX_ASSERT(e); - const char* name = e->second; // The copy is important because insert might invalidate the referenced hash entry - getMap().insert(this, name); -} - -NamedAllocator::~NamedAllocator() -{ - Foundation::Mutex::ScopedLock lock(getMutex()); - bool erased = getMap().erase(this); - PX_UNUSED(erased); - PX_ASSERT(erased); -} - -NamedAllocator& NamedAllocator::operator=(const NamedAllocator& other) -{ - Foundation::Mutex::ScopedLock lock(getMutex()); - const AllocNameMap::Entry* e = getMap().find(&other); - PX_ASSERT(e); - getMap()[this] = e->second; - return *this; -} - -void* NamedAllocator::allocate(size_t size, const char* filename, int line) -{ - if(!size) - return 0; - Foundation::Mutex::ScopedLock lock(getMutex()); - const AllocNameMap::Entry* e = getMap().find(this); - PX_ASSERT(e); - return getAllocator().allocate(size, e->second, filename, line); -} - -void NamedAllocator::deallocate(void* ptr) -{ - if(ptr) - getAllocator().deallocate(ptr); -} - -#endif // PX_DEBUG - -void* Allocator::allocate(size_t size, const char* file, int line) -{ - if(!size) - return 0; - return getAllocator().allocate(size, "", file, line); -} -void Allocator::deallocate(void* ptr) -{ - if(ptr) - getAllocator().deallocate(ptr); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/PsAssert.cpp b/PxShared/src/foundation/src/PsAssert.cpp deleted file mode 100644 index 295a81e..0000000 --- a/PxShared/src/foundation/src/PsAssert.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxAssert.h" - -#include <stdio.h> -#include "PsString.h" - -#if PX_WINDOWS_FAMILY -#include <crtdbg.h> -#elif PX_SWITCH -#include "switch/PsSwitchAbort.h" -#endif - -namespace -{ -class DefaultAssertHandler : public physx::PxAssertHandler -{ - virtual void operator()(const char* expr, const char* file, int line, bool& ignore) - { - PX_UNUSED(ignore); // is used only in debug windows config - char buffer[1024]; -#if PX_WINDOWS_FAMILY - sprintf_s(buffer, "%s(%d) : Assertion failed: %s\n", file, line, expr); -#else - sprintf(buffer, "%s(%d) : Assertion failed: %s\n", file, line, expr); -#endif - physx::shdfnd::printString(buffer); -#if PX_WINDOWS_FAMILY&& PX_DEBUG - // _CrtDbgReport returns -1 on error, 1 on 'retry', 0 otherwise including 'ignore'. - // Hitting 'abort' will terminate the process immediately. - int result = _CrtDbgReport(_CRT_ASSERT, file, line, NULL, "%s", buffer); - int mode = _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_REPORT_MODE); - ignore = _CRTDBG_MODE_WNDW == mode && result == 0; - if(ignore) - return; - __debugbreak(); -#elif PX_WINDOWS_FAMILY&& PX_CHECKED - __debugbreak(); -#elif PX_SWITCH - abort(buffer); -#else - abort(); -#endif - } -}; - -DefaultAssertHandler sAssertHandler; -physx::PxAssertHandler* sAssertHandlerPtr = &sAssertHandler; -} - -namespace physx -{ - -PxAssertHandler& PxGetAssertHandler() -{ - return *sAssertHandlerPtr; -} - -void PxSetAssertHandler(PxAssertHandler& handler) -{ - sAssertHandlerPtr = &handler; -} -} // end of physx namespace diff --git a/PxShared/src/foundation/src/PsFoundation.cpp b/PxShared/src/foundation/src/PsFoundation.cpp deleted file mode 100644 index e559b57..0000000 --- a/PxShared/src/foundation/src/PsFoundation.cpp +++ /dev/null @@ -1,278 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxProfiler.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxFoundationVersion.h" -#include "PsFoundation.h" -#include "PsString.h" -#include "PsAllocator.h" - -namespace physx -{ -namespace shdfnd -{ - -Foundation::Foundation(PxErrorCallback& errc, PxAllocatorCallback& alloc) -: mAllocatorCallback(alloc) -, mErrorCallback(errc) -, mBroadcastingAllocator(alloc, errc) -, mBroadcastingError(errc) -, -#if PX_CHECKED - mReportAllocationNames(true) -, -#else - mReportAllocationNames(false) -, -#endif - mErrorMask(PxErrorCode::Enum(~0)) -, mErrorMutex(PX_DEBUG_EXP("Foundation::mErrorMutex")) -, mNamedAllocMutex(PX_DEBUG_EXP("Foundation::mNamedAllocMutex")) -, mTempAllocMutex(PX_DEBUG_EXP("Foundation::mTempAllocMutex")) -{ -} - -Foundation::~Foundation() -{ - // deallocate temp buffer allocations - Allocator alloc; - for(PxU32 i = 0; i < mTempAllocFreeTable.size(); ++i) - { - for(TempAllocatorChunk* ptr = mTempAllocFreeTable[i]; ptr;) - { - TempAllocatorChunk* next = ptr->mNext; - alloc.deallocate(ptr); - ptr = next; - } - } - mTempAllocFreeTable.reset(); -} - -Foundation& Foundation::getInstance() -{ - PX_ASSERT(mInstance); - return *mInstance; -} - -PxU32 Foundation::getWarnOnceTimestamp() -{ - PX_ASSERT(mInstance != NULL); - return mWarnOnceTimestap; -} - -void Foundation::error(PxErrorCode::Enum c, const char* file, int line, const char* messageFmt, ...) -{ - va_list va; - va_start(va, messageFmt); - errorImpl(c, file, line, messageFmt, va); - va_end(va); -} - -void Foundation::errorImpl(PxErrorCode::Enum e, const char* file, int line, const char* messageFmt, va_list va) -{ - PX_ASSERT(messageFmt); - if(e & mErrorMask) - { - // this function is reentrant but user's error callback may not be, so... - Mutex::ScopedLock lock(mErrorMutex); - - // using a static fixed size buffer here because: - // 1. vsnprintf return values differ between platforms - // 2. va_start is only usable in functions with ellipses - // 3. ellipses (...) cannot be passed to called function - // which would be necessary to dynamically grow the buffer here - - static const size_t bufSize = 1024; - char stringBuffer[bufSize]; - shdfnd::vsnprintf(stringBuffer, bufSize, messageFmt, va); - - mBroadcastingError.reportError(e, stringBuffer, file, line); - } -} - -Foundation* Foundation::createInstance(PxU32 version, PxErrorCallback& errc, PxAllocatorCallback& alloc) -{ - if(version != PX_FOUNDATION_VERSION) - { - char* buffer = new char[256]; - physx::shdfnd::snprintf(buffer, 256, "Wrong version: foundation version is 0x%08x, tried to create 0x%08x", - PX_FOUNDATION_VERSION, version); - errc.reportError(PxErrorCode::eINVALID_PARAMETER, buffer, __FILE__, __LINE__); - return 0; - } - - if(!mInstance) - { - // if we don't assign this here, the Foundation object can't create member - // subobjects which require the allocator - - mInstance = reinterpret_cast<Foundation*>(alloc.allocate(sizeof(Foundation), "Foundation", __FILE__, __LINE__)); - - if(mInstance) - { - PX_PLACEMENT_NEW(mInstance, Foundation)(errc, alloc); - - PX_ASSERT(mRefCount == 0); - mRefCount = 1; - - // skip 0 which marks uninitialized timestaps in PX_WARN_ONCE - mWarnOnceTimestap = (mWarnOnceTimestap == PX_MAX_U32) ? 1 : mWarnOnceTimestap + 1; - - return mInstance; - } - else - { - errc.reportError(PxErrorCode::eINTERNAL_ERROR, "Memory allocation for foundation object failed.", __FILE__, - __LINE__); - } - } - else - { - errc.reportError(PxErrorCode::eINVALID_OPERATION, - "Foundation object exists already. Only one instance per process can be created.", __FILE__, - __LINE__); - } - - return 0; -} - -void Foundation::destroyInstance() -{ - PX_ASSERT(mInstance != NULL); - - if(mRefCount == 1) - { - PxAllocatorCallback& alloc = mInstance->getAllocatorCallback(); - mInstance->~Foundation(); - alloc.deallocate(mInstance); - mInstance = 0; - mRefCount = 0; - } - else - { - mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, - "Foundation destruction failed due to pending module references. Close/release all depending " - "modules first."); - } -} - -void Foundation::incRefCount() -{ - PX_ASSERT(mInstance != NULL); - - if(mRefCount > 0) - { - mRefCount++; - } - else - { - mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, - "Foundation: Invalid registration detected."); - } -} - -void Foundation::decRefCount() -{ - PX_ASSERT(mInstance != NULL); - - if(mRefCount > 0) - { - mRefCount--; - } - else - { - mInstance->error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, - "Foundation: Invalid deregistration detected."); - } -} - -void Foundation::release() -{ - Foundation::destroyInstance(); -} - -PxAllocatorCallback& getAllocator() -{ - return getFoundation().getAllocator(); -} - -Foundation* Foundation::mInstance = NULL; -PxU32 Foundation::mRefCount = 0; -PxU32 Foundation::mWarnOnceTimestap = 0; - -void Foundation::registerAllocationListener(physx::shdfnd::AllocationListener& listener) -{ - Mutex::ScopedLock lock(mListenerMutex); - mBroadcastingAllocator.registerListener(listener); -} - -void Foundation::deregisterAllocationListener(physx::shdfnd::AllocationListener& listener) -{ - Mutex::ScopedLock lock(mListenerMutex); - mBroadcastingAllocator.deregisterListener(listener); -} - -void Foundation::registerErrorCallback(PxErrorCallback& callback) -{ - Mutex::ScopedLock lock(mListenerMutex); - mBroadcastingError.registerListener(callback); -} - -void Foundation::deregisterErrorCallback(PxErrorCallback& callback) -{ - Mutex::ScopedLock lock(mListenerMutex); - mBroadcastingError.deregisterListener(callback); -} - -physx::PxProfilerCallback* gProfilerCallback = NULL; - -} // namespace shdfnd -} // namespace physx - -physx::PxFoundation* PxCreateFoundation(physx::PxU32 version, physx::PxAllocatorCallback& allocator, - physx::PxErrorCallback& errorCallback) -{ - return physx::shdfnd::Foundation::createInstance(version, errorCallback, allocator); -} - -physx::PxFoundation& PxGetFoundation() -{ - return physx::shdfnd::Foundation::getInstance(); -} - -physx::PxProfilerCallback* PxGetProfilerCallback() -{ - return physx::shdfnd::gProfilerCallback; -} - -void PxSetProfilerCallback(physx::PxProfilerCallback* profiler) -{ - physx::shdfnd::gProfilerCallback = profiler; -} diff --git a/PxShared/src/foundation/src/PsMathUtils.cpp b/PxShared/src/foundation/src/PsMathUtils.cpp deleted file mode 100644 index b900fdd..0000000 --- a/PxShared/src/foundation/src/PsMathUtils.cpp +++ /dev/null @@ -1,212 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxMat33.h" -#include "foundation/PxMathUtils.h" -#include "foundation/PxVec4.h" -#include "foundation/PxAssert.h" -#include "PsMathUtils.h" -#include "PsUtilities.h" -#include "PsBasicTemplates.h" - -using namespace physx; -using namespace physx::shdfnd; -using namespace physx::intrinsics; - -PX_FOUNDATION_API PxQuat physx::PxShortestRotation(const PxVec3& v0, const PxVec3& v1) -{ - const PxReal d = v0.dot(v1); - const PxVec3 cross = v0.cross(v1); - - PxQuat q = d > -1 ? PxQuat(cross.x, cross.y, cross.z, 1 + d) : PxAbs(v0.x) < 0.1f ? PxQuat(0.0f, v0.z, -v0.y, 0.0f) - : PxQuat(v0.y, -v0.x, 0.0f, 0.0f); - - return q.getNormalized(); -} - -namespace -{ -// indexed rotation around axis, with sine and cosine of half-angle -PxQuat indexedRotation(PxU32 axis, PxReal s, PxReal c) -{ - PxReal v[3] = { 0, 0, 0 }; - v[axis] = s; - return PxQuat(v[0], v[1], v[2], c); -} -} - -PX_FOUNDATION_API PxVec3 physx::PxDiagonalize(const PxMat33& m, PxQuat& massFrame) -{ - // jacobi rotation using quaternions (from an idea of Stan Melax, with fix for precision issues) - - const PxU32 MAX_ITERS = 24; - - PxQuat q = PxQuat(PxIdentity); - - PxMat33 d; - for(PxU32 i = 0; i < MAX_ITERS; i++) - { - PxMat33 axes(q); - d = axes.getTranspose() * m * axes; - - PxReal d0 = PxAbs(d[1][2]), d1 = PxAbs(d[0][2]), d2 = PxAbs(d[0][1]); - PxU32 a = PxU32(d0 > d1 && d0 > d2 ? 0 : d1 > d2 ? 1 : 2); // rotation axis index, from largest off-diagonal - // element - - PxU32 a1 = shdfnd::getNextIndex3(a), a2 = shdfnd::getNextIndex3(a1); - if(d[a1][a2] == 0.0f || PxAbs(d[a1][a1] - d[a2][a2]) > 2e6f * PxAbs(2.0f * d[a1][a2])) - break; - - PxReal w = (d[a1][a1] - d[a2][a2]) / (2.0f * d[a1][a2]); // cot(2 * phi), where phi is the rotation angle - PxReal absw = PxAbs(w); - - PxQuat r; - if(absw > 1000) - r = indexedRotation(a, 1 / (4 * w), 1.f); // h will be very close to 1, so use small angle approx instead - else - { - PxReal t = 1 / (absw + PxSqrt(w * w + 1)); // absolute value of tan phi - PxReal h = 1 / PxSqrt(t * t + 1); // absolute value of cos phi - - PX_ASSERT(h != 1); // |w|<1000 guarantees this with typical IEEE754 machine eps (approx 6e-8) - r = indexedRotation(a, PxSqrt((1 - h) / 2) * PxSign(w), PxSqrt((1 + h) / 2)); - } - - q = (q * r).getNormalized(); - } - - massFrame = q; - return PxVec3(d.column0.x, d.column1.y, d.column2.z); -} - -/** -\brief computes a oriented bounding box around the scaled basis. -\param basis Input = skewed basis, Output = (normalized) orthogonal basis. -\return Bounding box extent. -*/ -PxVec3 physx::shdfnd::optimizeBoundingBox(PxMat33& basis) -{ - PxVec3* PX_RESTRICT vec = &basis[0]; // PT: don't copy vectors if not needed... - - // PT: since we store the magnitudes to memory, we can avoid the FCMPs afterwards - PxVec3 magnitude(vec[0].magnitudeSquared(), vec[1].magnitudeSquared(), vec[2].magnitudeSquared()); - - // find indices sorted by magnitude - unsigned int i = magnitude[1] > magnitude[0] ? 1 : 0u; - unsigned int j = magnitude[2] > magnitude[1 - i] ? 2 : 1 - i; - const unsigned int k = 3 - i - j; - - if(magnitude[i] < magnitude[j]) - swap(i, j); - - PX_ASSERT(magnitude[i] >= magnitude[j] && magnitude[i] >= magnitude[k] && magnitude[j] >= magnitude[k]); - - // ortho-normalize basis - - PxReal invSqrt = PxRecipSqrt(magnitude[i]); - magnitude[i] *= invSqrt; - vec[i] *= invSqrt; // normalize the first axis - PxReal dotij = vec[i].dot(vec[j]); - PxReal dotik = vec[i].dot(vec[k]); - magnitude[i] += PxAbs(dotij) + PxAbs(dotik); // elongate the axis by projection of the other two - vec[j] -= vec[i] * dotij; // orthogonize the two remaining axii relative to vec[i] - vec[k] -= vec[i] * dotik; - - magnitude[j] = vec[j].normalize(); - PxReal dotjk = vec[j].dot(vec[k]); - magnitude[j] += PxAbs(dotjk); // elongate the axis by projection of the other one - vec[k] -= vec[j] * dotjk; // orthogonize vec[k] relative to vec[j] - - magnitude[k] = vec[k].normalize(); - - return magnitude; -} - -PxQuat physx::shdfnd::slerp(const PxReal t, const PxQuat& left, const PxQuat& right) -{ - const PxReal quatEpsilon = (PxReal(1.0e-8f)); - - PxReal cosine = left.dot(right); - PxReal sign = PxReal(1); - if(cosine < 0) - { - cosine = -cosine; - sign = PxReal(-1); - } - - PxReal sine = PxReal(1) - cosine * cosine; - - if(sine >= quatEpsilon * quatEpsilon) - { - sine = PxSqrt(sine); - const PxReal angle = PxAtan2(sine, cosine); - const PxReal i_sin_angle = PxReal(1) / sine; - - const PxReal leftw = PxSin(angle * (PxReal(1) - t)) * i_sin_angle; - const PxReal rightw = PxSin(angle * t) * i_sin_angle * sign; - - return left * leftw + right * rightw; - } - - return left; -} - -void physx::shdfnd::integrateTransform(const PxTransform& curTrans, const PxVec3& linvel, const PxVec3& angvel, - PxReal timeStep, PxTransform& result) -{ - result.p = curTrans.p + linvel * timeStep; - - // from void DynamicsContext::integrateAtomPose(PxsRigidBody* atom, Cm::BitMap &shapeChangedMap) const: - // Integrate the rotation using closed form quaternion integrator - PxReal w = angvel.magnitudeSquared(); - - if(w != 0.0f) - { - w = PxSqrt(w); - if(w != 0.0f) - { - const PxReal v = timeStep * w * 0.5f; - const PxReal q = PxCos(v); - const PxReal s = PxSin(v) / w; - - const PxVec3 pqr = angvel * s; - const PxQuat quatVel(pqr.x, pqr.y, pqr.z, 0); - PxQuat out; // need to have temporary, otherwise we may overwrite input if &curTrans == &result. - out = quatVel * curTrans.q; - out.x += curTrans.q.x * q; - out.y += curTrans.q.y * q; - out.z += curTrans.q.z * q; - out.w += curTrans.q.w * q; - result.q = out; - return; - } - } - // orientation stays the same - convert from quat to matrix: - result.q = curTrans.q; -} diff --git a/PxShared/src/foundation/src/PsString.cpp b/PxShared/src/foundation/src/PsString.cpp deleted file mode 100644 index 8204051..0000000 --- a/PxShared/src/foundation/src/PsString.cpp +++ /dev/null @@ -1,185 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PsString.h" -#include <stdarg.h> -#include <stdio.h> -#include <string.h> - -#if PX_WINDOWS_FAMILY -#pragma warning(push) -#pragma warning(disable : 4996) // unsafe string functions -#endif - -#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" -#endif - -namespace physx -{ -namespace shdfnd -{ -// cross-platform implementations - -int32_t strcmp(const char* str1, const char* str2) -{ - return ::strcmp(str1, str2); -} - -int32_t strncmp(const char* str1, const char* str2, size_t count) -{ - return ::strncmp(str1, str2, count); -} - -int32_t snprintf(char* dst, size_t dstSize, const char* format, ...) -{ - va_list arg; - va_start(arg, format); - int32_t r = shdfnd::vsnprintf(dst, dstSize, format, arg); - va_end(arg); - return r; -} - -int32_t sscanf(const char* buffer, const char* format, ...) -{ - va_list arg; - va_start(arg, format); -#if (PX_VC < 12) && !PX_LINUX - int32_t r = ::sscanf(buffer, format, arg); -#else - int32_t r = ::vsscanf(buffer, format, arg); -#endif - va_end(arg); - - return r; -} - -size_t strlcpy(char* dst, size_t dstSize, const char* src) -{ - size_t i = 0; - if(dst && dstSize) - { - for(; i + 1 < dstSize && src[i]; i++) // copy up to dstSize-1 bytes - dst[i] = src[i]; - dst[i] = 0; // always null-terminate - } - - while(src[i]) // read any remaining characters in the src string to get the length - i++; - - return i; -} - -size_t strlcat(char* dst, size_t dstSize, const char* src) -{ - size_t i = 0, s = 0; - if(dst && dstSize) - { - s = strlen(dst); - for(; i + s + 1 < dstSize && src[i]; i++) // copy until total is at most dstSize-1 - dst[i + s] = src[i]; - dst[i + s] = 0; // always null-terminate - } - - while(src[i]) // read any remaining characters in the src string to get the length - i++; - - return i + s; -} - -void strlwr(char* str) -{ - for(; *str; str++) - if(*str >= 'A' && *str <= 'Z') - *str += 32; -} - -void strupr(char* str) -{ - for(; *str; str++) - if(*str >= 'a' && *str <= 'z') - *str -= 32; -} - -int32_t vsnprintf(char* dst, size_t dstSize, const char* src, va_list arg) -{ - -#if PX_VC // MSVC is not C99-compliant... - int32_t result = dst ? ::vsnprintf(dst, dstSize, src, arg) : -1; - if(dst && (result == int32_t(dstSize) || result < 0)) - dst[dstSize - 1] = 0; // string was truncated or there wasn't room for the NULL - if(result < 0) - result = _vscprintf(src, arg); // work out how long the answer would have been. -#else - int32_t result = ::vsnprintf(dst, dstSize, src, arg); -#endif - return result; -} - -int32_t stricmp(const char* str, const char* str1) -{ -#if PX_VC - return (::_stricmp(str, str1)); -#else - return (::strcasecmp(str, str1)); -#endif -} - -int32_t strnicmp(const char* str, const char* str1, size_t n) -{ -#if PX_VC - return (::_strnicmp(str, str1, n)); -#else - return (::strncasecmp(str, str1, n)); -#endif -} - -void printFormatted(const char* format, ...) -{ - char buf[MAX_PRINTFORMATTED_LENGTH]; - - va_list arg; - va_start(arg, format); - vsnprintf(buf, MAX_PRINTFORMATTED_LENGTH, format, arg); - va_end(arg); - - printString(buf); -} -} -} - -#if PX_PS4 || PX_APPLE_FAMILY || (PX_LINUX && PX_X86 && PX_CLANG) -#pragma clang diagnostic pop -#endif - -#if PX_WINDOWS_FAMILY -#pragma warning(pop) -#endif diff --git a/PxShared/src/foundation/src/PsTempAllocator.cpp b/PxShared/src/foundation/src/PsTempAllocator.cpp deleted file mode 100644 index c917a65..0000000 --- a/PxShared/src/foundation/src/PsTempAllocator.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxMath.h" - -#include "PsFoundation.h" -#include "PsTempAllocator.h" -#include "PsArray.h" -#include "PsMutex.h" -#include "PsAtomic.h" -#include "PsIntrinsics.h" -#include "PsBitUtils.h" - -#if PX_VC -#pragma warning(disable : 4706) // assignment within conditional expression -#endif - -namespace physx -{ -namespace shdfnd -{ -namespace -{ -typedef TempAllocatorChunk Chunk; -typedef Array<Chunk*, NonTrackingAllocator> AllocFreeTable; - -PX_INLINE Foundation::AllocFreeTable& getFreeTable() -{ - return getFoundation().getTempAllocFreeTable(); -} -PX_INLINE Foundation::Mutex& getMutex() -{ - return getFoundation().getTempAllocMutex(); -} - -const PxU32 sMinIndex = 8; // 256B min -const PxU32 sMaxIndex = 17; // 128kB max -} - -void* TempAllocator::allocate(size_t size, const char* filename, int line) -{ - if(!size) - return 0; - - uint32_t index = PxMax(highestSetBit(uint32_t(size) + sizeof(Chunk) - 1), sMinIndex); - - Chunk* chunk = 0; - if(index < sMaxIndex) - { - Foundation::Mutex::ScopedLock lock(getMutex()); - - // find chunk up to 16x bigger than necessary - Chunk** it = getFreeTable().begin() + index - sMinIndex; - Chunk** end = PxMin(it + 3, getFreeTable().end()); - while(it < end && !(*it)) - ++it; - - if(it < end) - { - // pop top off freelist - chunk = *it; - *it = chunk->mNext; - index = uint32_t(it - getFreeTable().begin() + sMinIndex); - } - else - // create new chunk - chunk = reinterpret_cast<Chunk*>(NonTrackingAllocator().allocate(size_t(2 << index), filename, line)); - } - else - { - // too big for temp allocation, forward to base allocator - chunk = reinterpret_cast<Chunk*>(NonTrackingAllocator().allocate(size + sizeof(Chunk), filename, line)); - } - - chunk->mIndex = index; - void* ret = chunk + 1; - PX_ASSERT((size_t(ret) & 0xf) == 0); // SDK types require at minimum 16 byte allignment. - return ret; -} - -void TempAllocator::deallocate(void* ptr) -{ - if(!ptr) - return; - - Chunk* chunk = reinterpret_cast<Chunk*>(ptr) - 1; - uint32_t index = chunk->mIndex; - - if(index >= sMaxIndex) - return NonTrackingAllocator().deallocate(chunk); - - Foundation::Mutex::ScopedLock lock(getMutex()); - - index -= sMinIndex; - if(getFreeTable().size() <= index) - getFreeTable().resize(index + 1); - - chunk->mNext = getFreeTable()[index]; - getFreeTable()[index] = chunk; -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/PsUtilities.cpp b/PxShared/src/foundation/src/PsUtilities.cpp deleted file mode 100644 index c6a6dc4..0000000 --- a/PxShared/src/foundation/src/PsUtilities.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxMat33.h" -#include "foundation/PxQuat.h" -#include "foundation/PxTransform.h" -#include "PsUtilities.h" -#include "PsUserAllocated.h" -#include "PsFPU.h" - -namespace physx -{ -namespace shdfnd -{ - -bool checkValid(const float& f) -{ - return PxIsFinite(f); -} -bool checkValid(const PxVec3& v) -{ - return PxIsFinite(v.x) && PxIsFinite(v.y) && PxIsFinite(v.z); -} - -bool checkValid(const PxTransform& t) -{ - return checkValid(t.p) && checkValid(t.q); -} - -bool checkValid(const PxQuat& q) -{ - return PxIsFinite(q.x) && PxIsFinite(q.y) && PxIsFinite(q.z) && PxIsFinite(q.w); -} -bool checkValid(const PxMat33& m) -{ - return PxIsFinite(m(0, 0)) && PxIsFinite(m(1, 0)) && PxIsFinite(m(2, 0)) && PxIsFinite(m(0, 1)) && - PxIsFinite(m(1, 1)) && PxIsFinite(m(2, 1)) && PxIsFinite(m(0, 3)) && PxIsFinite(m(1, 3)) && - PxIsFinite(m(2, 3)); -} -bool checkValid(const char* string) -{ - static const PxU32 maxLength = 4096; - return strnlen(string, maxLength) != maxLength; -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/unix/PsUnixCpu.cpp b/PxShared/src/foundation/src/unix/PsUnixCpu.cpp deleted file mode 100644 index 0139fe4..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixCpu.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxSimpleTypes.h" -#include "PsCpu.h" - -#if PX_X86 && !defined(__EMSCRIPTEN__) -#define cpuid(op, reg) \ - __asm__ __volatile__("pushl %%ebx \n\t" /* save %ebx */ \ - "cpuid \n\t" \ - "movl %%ebx, %1 \n\t" /* save what cpuid just put in %ebx */ \ - "popl %%ebx \n\t" /* restore the old %ebx */ \ - : "=a"(reg[0]), "=r"(reg[1]), "=c"(reg[2]), "=d"(reg[3]) \ - : "a"(op) \ - : "cc") -#else -#define cpuid(op, reg) reg[0] = reg[1] = reg[2] = reg[3] = 0; -#endif - -namespace physx -{ -namespace shdfnd -{ - -uint8_t Cpu::getCpuId() -{ - uint32_t cpuInfo[4]; - cpuid(1, cpuInfo); - return static_cast<uint8_t>(cpuInfo[1] >> 24); // APIC Physical ID -} -} -} diff --git a/PxShared/src/foundation/src/unix/PsUnixFPU.cpp b/PxShared/src/foundation/src/unix/PsUnixFPU.cpp deleted file mode 100644 index e12fa5f..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixFPU.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. -#include "PsFPU.h" - -#if !(defined(__CYGWIN__) || PX_ANDROID || PX_PS4) -#include <fenv.h> -PX_COMPILE_TIME_ASSERT(8 * sizeof(uint32_t) >= sizeof(fenv_t)); -#endif - -#if PX_OSX -// osx defines SIMD as standard for floating point operations. -#include <xmmintrin.h> -#endif - -physx::shdfnd::FPUGuard::FPUGuard() -{ -#if defined(__CYGWIN__) -#pragma message "FPUGuard::FPUGuard() is not implemented" -#elif PX_ANDROID -// not supported unless ARM_HARD_FLOAT is enabled. -#elif PX_PS4 - // not supported - PX_UNUSED(mControlWords); -#elif PX_OSX - mControlWords[0] = _mm_getcsr(); - // set default (disable exceptions: _MM_MASK_MASK) and FTZ (_MM_FLUSH_ZERO_ON), DAZ (_MM_DENORMALS_ZERO_ON: (1<<6)) - _mm_setcsr(_MM_MASK_MASK | _MM_FLUSH_ZERO_ON | (1 << 6)); -#elif defined(__EMSCRIPTEN__) -// not supported -#else - PX_COMPILE_TIME_ASSERT(sizeof(fenv_t) <= sizeof(mControlWords)); - - fegetenv(reinterpret_cast<fenv_t*>(mControlWords)); - fesetenv(FE_DFL_ENV); - -#if PX_LINUX - // need to explicitly disable exceptions because fesetenv does not modify - // the sse control word on 32bit linux (64bit is fine, but do it here just be sure) - fedisableexcept(FE_ALL_EXCEPT); -#endif - -#endif -} - -physx::shdfnd::FPUGuard::~FPUGuard() -{ -#if defined(__CYGWIN__) -#pragma message "FPUGuard::~FPUGuard() is not implemented" -#elif PX_ANDROID -// not supported unless ARM_HARD_FLOAT is enabled. -#elif PX_PS4 -// not supported -#elif PX_OSX - // restore control word and clear exception flags - // (setting exception state flags cause exceptions on the first following fp operation) - _mm_setcsr(mControlWords[0] & ~_MM_EXCEPT_MASK); -#elif defined(__EMSCRIPTEN__) -// not supported -#else - fesetenv(reinterpret_cast<fenv_t*>(mControlWords)); -#endif -} - -PX_FOUNDATION_API void physx::shdfnd::enableFPExceptions() -{ -#if PX_LINUX && !defined(__EMSCRIPTEN__) - feclearexcept(FE_ALL_EXCEPT); - feenableexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW); -#elif PX_OSX - // clear any pending exceptions - // (setting exception state flags cause exceptions on the first following fp operation) - uint32_t control = _mm_getcsr() & ~_MM_EXCEPT_MASK; - - // enable all fp exceptions except inexact and underflow (common, benign) - // note: denorm has to be disabled as well because underflow can create denorms - _mm_setcsr((control & ~_MM_MASK_MASK) | _MM_MASK_INEXACT | _MM_MASK_UNDERFLOW | _MM_MASK_DENORM); - -#endif -} - -PX_FOUNDATION_API void physx::shdfnd::disableFPExceptions() -{ -#if PX_LINUX && !defined(__EMSCRIPTEN__) - fedisableexcept(FE_ALL_EXCEPT); -#elif PX_OSX - // clear any pending exceptions - // (setting exception state flags cause exceptions on the first following fp operation) - uint32_t control = _mm_getcsr() & ~_MM_EXCEPT_MASK; - _mm_setcsr(control | _MM_MASK_MASK); -#endif -} diff --git a/PxShared/src/foundation/src/unix/PsUnixSList.cpp b/PxShared/src/foundation/src/unix/PsUnixSList.cpp deleted file mode 100644 index c2da1bb..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixSList.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PsAllocator.h" -#include "PsAtomic.h" -#include "PsSList.h" -#include "PsThread.h" -#include <pthread.h> - -#if PX_IOS || PX_EMSCRIPTEN -#define USE_MUTEX -#endif - -namespace physx -{ -namespace shdfnd -{ -namespace -{ -#if defined(USE_MUTEX) -class ScopedMutexLock -{ - pthread_mutex_t& mMutex; - - public: - PX_INLINE ScopedMutexLock(pthread_mutex_t& mutex) : mMutex(mutex) - { - pthread_mutex_lock(&mMutex); - } - - PX_INLINE ~ScopedMutexLock() - { - pthread_mutex_unlock(&mMutex); - } -}; - -typedef ScopedMutexLock ScopedLock; -#else -struct ScopedSpinLock -{ - PX_FORCE_INLINE ScopedSpinLock(volatile int32_t& lock) : mLock(lock) - { - while(__sync_lock_test_and_set(&mLock, 1)) - { - // spinning without atomics is usually - // causing less bus traffic. -> only one - // CPU is modifying the cache line. - while(lock) - PxSpinLockPause(); - } - } - - PX_FORCE_INLINE ~ScopedSpinLock() - { - __sync_lock_release(&mLock); - } - - private: - volatile int32_t& mLock; -}; - -typedef ScopedSpinLock ScopedLock; -#endif - -struct SListDetail -{ - SListEntry* head; -#if defined(USE_MUTEX) - pthread_mutex_t lock; -#else - volatile int32_t lock; -#endif -}; - -template <typename T> -SListDetail* getDetail(T* impl) -{ - return reinterpret_cast<SListDetail*>(impl); -} -} - -SListImpl::SListImpl() -{ - getDetail(this)->head = NULL; - -#if defined(USE_MUTEX) - pthread_mutex_init(&getDetail(this)->lock, NULL); -#else - getDetail(this)->lock = 0; // 0 == unlocked -#endif -} - -SListImpl::~SListImpl() -{ -#if defined(USE_MUTEX) - pthread_mutex_destroy(&getDetail(this)->lock); -#endif -} - -void SListImpl::push(SListEntry* entry) -{ - ScopedLock lock(getDetail(this)->lock); - entry->mNext = getDetail(this)->head; - getDetail(this)->head = entry; -} - -SListEntry* SListImpl::pop() -{ - ScopedLock lock(getDetail(this)->lock); - SListEntry* result = getDetail(this)->head; - if(result != NULL) - getDetail(this)->head = result->mNext; - return result; -} - -SListEntry* SListImpl::flush() -{ - ScopedLock lock(getDetail(this)->lock); - SListEntry* result = getDetail(this)->head; - getDetail(this)->head = NULL; - return result; -} - -uint32_t SListImpl::getSize() -{ - return sizeof(SListDetail); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/unix/PsUnixSocket.cpp b/PxShared/src/foundation/src/unix/PsUnixSocket.cpp deleted file mode 100644 index bc4cb5c..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixSocket.cpp +++ /dev/null @@ -1,483 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxIntrinsics.h" - -#include "PsSocket.h" - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/select.h> -#include <sys/time.h> -#if !PX_PS4 -#include <netdb.h> -#include <arpa/inet.h> -#else -#include <ps4/PsPS4Socket.h> -#endif -#include <fcntl.h> -#include <errno.h> -#include <unistd.h> - -#define INVALID_SOCKET -1 - -#ifndef SOMAXCONN -#define SOMAXCONN 5 -#endif - -namespace physx -{ -namespace shdfnd -{ - -const uint32_t Socket::DEFAULT_BUFFER_SIZE = 32768; - -class SocketImpl -{ - public: - SocketImpl(bool isBlocking); - virtual ~SocketImpl(); - - bool connect(const char* host, uint16_t port, uint32_t timeout); - bool listen(uint16_t port); - bool accept(bool block); - void disconnect(); - - void setBlocking(bool blocking); - - virtual uint32_t write(const uint8_t* data, uint32_t length); - virtual bool flush(); - uint32_t read(uint8_t* data, uint32_t length); - - PX_FORCE_INLINE bool isBlocking() const - { - return mIsBlocking; - } - PX_FORCE_INLINE bool isConnected() const - { - return mIsConnected; - } - PX_FORCE_INLINE const char* getHost() const - { - return mHost; - } - PX_FORCE_INLINE uint16_t getPort() const - { - return mPort; - } - - protected: - bool nonBlockingTimeout() const; - - int32_t mSocket; - int32_t mListenSocket; - const char* mHost; - uint16_t mPort; - bool mIsConnected; - bool mIsBlocking; - bool mListenMode; -}; - -void socketSetBlockingInternal(int32_t socket, bool blocking); - -SocketImpl::SocketImpl(bool isBlocking) -: mSocket(INVALID_SOCKET) -, mListenSocket(INVALID_SOCKET) -, mHost(NULL) -, mPort(0) -, mIsConnected(false) -, mIsBlocking(isBlocking) -, mListenMode(false) -{ -} - -SocketImpl::~SocketImpl() -{ -} - -bool SocketImpl::connect(const char* host, uint16_t port, uint32_t timeout) -{ - sockaddr_in socketAddress; - intrinsics::memSet(&socketAddress, 0, sizeof(sockaddr_in)); - socketAddress.sin_family = AF_INET; - socketAddress.sin_port = htons(port); - -#if PX_PS4 - socketAddress.sin_addr.s_addr = resolveName(host, timeout); -#else - // get host - hostent* hp = gethostbyname(host); - if(!hp) - { - in_addr a; - a.s_addr = inet_addr(host); - hp = gethostbyaddr(reinterpret_cast<const char*>(&a), sizeof(in_addr), AF_INET); - if(!hp) - return false; - } - intrinsics::memCopy(&socketAddress.sin_addr, hp->h_addr_list[0], hp->h_length); -#endif - // connect - mSocket = socket(AF_INET, SOCK_STREAM, 0); - if(mSocket == INVALID_SOCKET) - return false; - - socketSetBlockingInternal(mSocket, false); - - int connectRet = ::connect(mSocket, reinterpret_cast<sockaddr*>(&socketAddress), sizeof(socketAddress)); - if(connectRet < 0) - { - if(errno != EINPROGRESS) - { - disconnect(); - return false; - } - - // Setup select function call to monitor the connect call. - fd_set writefs; - fd_set exceptfs; - FD_ZERO(&writefs); - FD_ZERO(&exceptfs); - FD_SET(mSocket, &writefs); - FD_SET(mSocket, &exceptfs); - timeval timeout_; - timeout_.tv_sec = timeout / 1000; - timeout_.tv_usec = (timeout % 1000) * 1000; - int selret = ::select(mSocket + 1, NULL, &writefs, &exceptfs, &timeout_); - int excepted = FD_ISSET(mSocket, &exceptfs); - int canWrite = FD_ISSET(mSocket, &writefs); - if(selret != 1 || excepted || !canWrite) - { - disconnect(); - return false; - } - - // check if we are really connected, above code seems to return - // true if host is a unix machine even if the connection was - // not accepted. - char buffer; - if(recv(mSocket, &buffer, 0, 0) < 0) - { - if(errno != EWOULDBLOCK) - { - disconnect(); - return false; - } - } - } - - socketSetBlockingInternal(mSocket, mIsBlocking); - -#if PX_APPLE_FAMILY - int noSigPipe = 1; - setsockopt(mSocket, SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(int)); -#endif - - mIsConnected = true; - mPort = port; - mHost = host; - return true; -} - -bool SocketImpl::listen(uint16_t port) -{ - mListenSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - if(mListenSocket == INVALID_SOCKET) - return false; - - // enable address reuse: "Address already in use" error message - int yes = 1; - if(setsockopt(mListenSocket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1) - return false; - - mListenMode = true; - - sockaddr_in addr; - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - addr.sin_addr.s_addr = INADDR_ANY; - intrinsics::memSet(addr.sin_zero, '\0', sizeof addr.sin_zero); - - return bind(mListenSocket, reinterpret_cast<sockaddr*>(&addr), sizeof(addr)) != -1 && - ::listen(mListenSocket, SOMAXCONN) != -1; -} - -bool SocketImpl::accept(bool block) -{ - if(mIsConnected || !mListenMode) - return false; - - // set the listen socket to be non-blocking. - socketSetBlockingInternal(mListenSocket, block); - int32_t clientSocket = ::accept(mListenSocket, 0, 0); - if(clientSocket == INVALID_SOCKET) - return false; - - mSocket = clientSocket; - mIsConnected = true; - socketSetBlockingInternal(mSocket, mIsBlocking); // force the mode to whatever the user set - - return mIsConnected; -} - -void SocketImpl::disconnect() -{ - if(mListenSocket != INVALID_SOCKET) - { - close(mListenSocket); - mListenSocket = INVALID_SOCKET; - } - if(mSocket != INVALID_SOCKET) - { - if(mIsConnected) - { - socketSetBlockingInternal(mSocket, true); - shutdown(mSocket, SHUT_RDWR); - } - close(mSocket); - mSocket = INVALID_SOCKET; - } - mIsConnected = false; - mListenMode = false; - mPort = 0; - mHost = NULL; -} - -bool SocketImpl::nonBlockingTimeout() const -{ - return !mIsBlocking && errno == EWOULDBLOCK; -} - -#if !PX_PS4 -void socketSetBlockingInternal(int32_t socket, bool blocking) -{ - int mode = fcntl(socket, F_GETFL, 0); - if(!blocking) - mode |= O_NONBLOCK; - else - mode &= ~O_NONBLOCK; - fcntl(socket, F_SETFL, mode); -} -#endif - -// should be cross-platform from here down - -void SocketImpl::setBlocking(bool blocking) -{ - if(blocking != mIsBlocking) - { - mIsBlocking = blocking; - if(isConnected()) - socketSetBlockingInternal(mSocket, blocking); - } -} - -bool SocketImpl::flush() -{ - return true; -} - -uint32_t SocketImpl::write(const uint8_t* data, uint32_t length) -{ - if(length == 0) - return 0; - - int sent = send(mSocket, reinterpret_cast<const char*>(data), int32_t(length), 0); - - if(sent <= 0 && !nonBlockingTimeout()) - disconnect(); - - return uint32_t(sent > 0 ? sent : 0); -} - -uint32_t SocketImpl::read(uint8_t* data, uint32_t length) -{ - if(length == 0) - return 0; - - int32_t received = recv(mSocket, reinterpret_cast<char*>(data), int32_t(length), 0); - - if(received <= 0 && !nonBlockingTimeout()) - disconnect(); - - return uint32_t(received > 0 ? received : 0); -} - -class BufferedSocketImpl : public SocketImpl -{ - public: - BufferedSocketImpl(bool isBlocking) : SocketImpl(isBlocking), mBufferPos(0) - { - } - virtual ~BufferedSocketImpl() - { - } - bool flush(); - uint32_t write(const uint8_t* data, uint32_t length); - - private: - uint32_t mBufferPos; - uint8_t mBuffer[Socket::DEFAULT_BUFFER_SIZE]; -}; - -bool BufferedSocketImpl::flush() -{ - uint32_t totalBytesWritten = 0; - - while(totalBytesWritten < mBufferPos && mIsConnected) - totalBytesWritten += int32_t(SocketImpl::write(mBuffer + totalBytesWritten, mBufferPos - totalBytesWritten)); - - bool ret = (totalBytesWritten == mBufferPos); - mBufferPos = 0; - return ret; -} - -uint32_t BufferedSocketImpl::write(const uint8_t* data, uint32_t length) -{ - uint32_t bytesWritten = 0; - while(mBufferPos + length >= Socket::DEFAULT_BUFFER_SIZE) - { - uint32_t currentChunk = Socket::DEFAULT_BUFFER_SIZE - mBufferPos; - intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, currentChunk); - bytesWritten += uint32_t(currentChunk); // for the user, this is consumed even if we fail to shove it down a - // non-blocking socket - - uint32_t sent = SocketImpl::write(mBuffer, Socket::DEFAULT_BUFFER_SIZE); - mBufferPos = Socket::DEFAULT_BUFFER_SIZE - sent; - - if(sent < Socket::DEFAULT_BUFFER_SIZE) // non-blocking or error - { - if(sent) // we can reasonably hope this is rare - intrinsics::memMove(mBuffer, mBuffer + sent, mBufferPos); - - return bytesWritten; - } - length -= currentChunk; - } - - if(length > 0) - { - intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, length); - bytesWritten += length; - mBufferPos += length; - } - - return bytesWritten; -} - -Socket::Socket(bool inIsBuffering, bool isBlocking) -{ - if(inIsBuffering) - { - void* mem = PX_ALLOC(sizeof(BufferedSocketImpl), "BufferedSocketImpl"); - mImpl = PX_PLACEMENT_NEW(mem, BufferedSocketImpl)(isBlocking); - } - else - { - void* mem = PX_ALLOC(sizeof(SocketImpl), "SocketImpl"); - mImpl = PX_PLACEMENT_NEW(mem, SocketImpl)(isBlocking); - } -} - -Socket::~Socket() -{ - mImpl->flush(); - mImpl->disconnect(); - mImpl->~SocketImpl(); - PX_FREE(mImpl); -} - -bool Socket::connect(const char* host, uint16_t port, uint32_t timeout) -{ - return mImpl->connect(host, port, timeout); -} - -bool Socket::listen(uint16_t port) -{ - return mImpl->listen(port); -} - -bool Socket::accept(bool block) -{ - return mImpl->accept(block); -} - -void Socket::disconnect() -{ - mImpl->disconnect(); -} - -bool Socket::isConnected() const -{ - return mImpl->isConnected(); -} - -const char* Socket::getHost() const -{ - return mImpl->getHost(); -} - -uint16_t Socket::getPort() const -{ - return mImpl->getPort(); -} - -bool Socket::flush() -{ - if(!mImpl->isConnected()) - return false; - return mImpl->flush(); -} - -uint32_t Socket::write(const uint8_t* data, uint32_t length) -{ - if(!mImpl->isConnected()) - return 0; - return mImpl->write(data, length); -} - -uint32_t Socket::read(uint8_t* data, uint32_t length) -{ - if(!mImpl->isConnected()) - return 0; - return mImpl->read(data, length); -} - -void Socket::setBlocking(bool blocking) -{ - mImpl->setBlocking(blocking); -} - -bool Socket::isBlocking() const -{ - return mImpl->isBlocking(); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/unix/PsUnixSync.cpp b/PxShared/src/foundation/src/unix/PsUnixSync.cpp deleted file mode 100644 index a488743..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixSync.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxAssert.h" - -#include "Ps.h" -#include "PsUserAllocated.h" -#include "PsSync.h" - -#include <errno.h> -#include <stdio.h> -#include <pthread.h> -#include <time.h> -#include <sys/time.h> - -namespace physx -{ -namespace shdfnd -{ - -namespace -{ -class _SyncImpl -{ - public: - pthread_mutex_t mutex; - pthread_cond_t cond; - volatile int setCounter; - volatile bool is_set; -}; - -_SyncImpl* getSync(SyncImpl* impl) -{ - return reinterpret_cast<_SyncImpl*>(impl); -} -} - -uint32_t SyncImpl::getSize() -{ - return sizeof(_SyncImpl); -} - -struct PxUnixScopeLock -{ - PxUnixScopeLock(pthread_mutex_t& m) : mMutex(m) - { - pthread_mutex_lock(&mMutex); - } - - ~PxUnixScopeLock() - { - pthread_mutex_unlock(&mMutex); - } - - private: - pthread_mutex_t& mMutex; -}; - -SyncImpl::SyncImpl() -{ - int status = pthread_mutex_init(&getSync(this)->mutex, 0); - PX_ASSERT(!status); - status = pthread_cond_init(&getSync(this)->cond, 0); - PX_ASSERT(!status); - PX_UNUSED(status); - getSync(this)->is_set = false; - getSync(this)->setCounter = 0; -} - -SyncImpl::~SyncImpl() -{ - pthread_cond_destroy(&getSync(this)->cond); - pthread_mutex_destroy(&getSync(this)->mutex); -} - -void SyncImpl::reset() -{ - PxUnixScopeLock lock(getSync(this)->mutex); - getSync(this)->is_set = false; -} - -void SyncImpl::set() -{ - PxUnixScopeLock lock(getSync(this)->mutex); - if(!getSync(this)->is_set) - { - getSync(this)->is_set = true; - getSync(this)->setCounter++; - pthread_cond_broadcast(&getSync(this)->cond); - } -} - -bool SyncImpl::wait(uint32_t ms) -{ - PxUnixScopeLock lock(getSync(this)->mutex); - int lastSetCounter = getSync(this)->setCounter; - if(!getSync(this)->is_set) - { - if(ms == uint32_t(-1)) - { - // have to loop here and check is_set since pthread_cond_wait can return successfully - // even if it was not signaled by pthread_cond_broadcast (OS efficiency design decision) - int status = 0; - while(!status && !getSync(this)->is_set && (lastSetCounter == getSync(this)->setCounter)) - status = pthread_cond_wait(&getSync(this)->cond, &getSync(this)->mutex); - PX_ASSERT((!status && getSync(this)->is_set) || (lastSetCounter != getSync(this)->setCounter)); - } - else - { - timespec ts; - timeval tp; - gettimeofday(&tp, NULL); - uint32_t sec = ms / 1000; - uint32_t usec = (ms - 1000 * sec) * 1000; - - // sschirm: taking into account that us might accumulate to a second - // otherwise the pthread_cond_timedwait complains on osx. - usec = tp.tv_usec + usec; - uint32_t div_sec = usec / 1000000; - uint32_t rem_usec = usec - div_sec * 1000000; - - ts.tv_sec = tp.tv_sec + sec + div_sec; - ts.tv_nsec = rem_usec * 1000; - - // have to loop here and check is_set since pthread_cond_timedwait can return successfully - // even if it was not signaled by pthread_cond_broadcast (OS efficiency design decision) - int status = 0; - while(!status && !getSync(this)->is_set && (lastSetCounter == getSync(this)->setCounter)) - status = pthread_cond_timedwait(&getSync(this)->cond, &getSync(this)->mutex, &ts); - PX_ASSERT((!status && getSync(this)->is_set) || (status == ETIMEDOUT) || - (lastSetCounter != getSync(this)->setCounter)); - } - } - return getSync(this)->is_set || (lastSetCounter != getSync(this)->setCounter); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/unix/PsUnixThread.cpp b/PxShared/src/foundation/src/unix/PsUnixThread.cpp deleted file mode 100644 index 749ae1d..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixThread.cpp +++ /dev/null @@ -1,477 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxAssert.h" -#include "foundation/PxErrorCallback.h" - -#include "Ps.h" -#include "PsFoundation.h" -#include "PsAtomic.h" -#include "PsThread.h" - -#include <math.h> -#if !PX_APPLE_FAMILY && !defined(ANDROID) && !defined(__CYGWIN__) && !PX_PS4 && !PX_EMSCRIPTEN -#include <bits/local_lim.h> // PTHREAD_STACK_MIN -#endif -#include <stdio.h> -#include <pthread.h> -#include <unistd.h> -#if !PX_PS4 -#include <sys/syscall.h> -#if !PX_APPLE_FAMILY && !PX_EMSCRIPTEN -#include <asm/unistd.h> -#include <sys/resource.h> -#endif -#endif - -#if PX_APPLE_FAMILY -#include <sys/types.h> -#include <sys/sysctl.h> -#include <TargetConditionals.h> -#include <pthread.h> -#endif - -// fwd -#if defined(ANDROID) -extern "C" { -int android_getCpuCount(void); -} -#endif - -#define PxSpinLockPause() asm("nop") - -namespace physx -{ -namespace shdfnd -{ - -namespace -{ - -typedef enum -{ - _PxThreadNotStarted, - _PxThreadStarted, - _PxThreadStopped -} PxThreadState; - -class _ThreadImpl -{ - public: - ThreadImpl::ExecuteFn fn; - void* arg; - volatile int32_t quitNow; - volatile int32_t threadStarted; - volatile int32_t state; - - pthread_t thread; - pid_t tid; - - uint32_t affinityMask; -}; - -_ThreadImpl* getThread(ThreadImpl* impl) -{ - return reinterpret_cast<_ThreadImpl*>(impl); -} - -static void setTid(_ThreadImpl& threadImpl) -{ -// query TID -#if PX_PS4 || (defined (TARGET_OS_TV) && TARGET_OS_TV) -// AM: TODO: neither of the below are implemented -#elif PX_APPLE_FAMILY - threadImpl.tid = syscall(SYS_gettid); -#elif PX_EMSCRIPTEN - threadImpl.tid = pthread_self(); -#else - threadImpl.tid = syscall(__NR_gettid); -#endif - - // notify/unblock parent thread - atomicCompareExchange(&(threadImpl.threadStarted), 1, 0); -} - -void* PxThreadStart(void* arg) -{ - _ThreadImpl* impl = getThread(reinterpret_cast<ThreadImpl*>(arg)); - impl->state = _PxThreadStarted; - - // run setTid in thread's context - setTid(*impl); - - // then run either the passed in function or execute from the derived class (Runnable). - if(impl->fn) - (*impl->fn)(impl->arg); - else if(impl->arg) - (reinterpret_cast<Runnable*>(impl->arg))->execute(); - return 0; -} -} - -uint32_t ThreadImpl::getSize() -{ - return sizeof(_ThreadImpl); -} - -ThreadImpl::Id ThreadImpl::getId() -{ - return Id(pthread_self()); -} - -ThreadImpl::ThreadImpl() -{ - getThread(this)->thread = 0; - getThread(this)->tid = 0; - getThread(this)->state = _PxThreadNotStarted; - getThread(this)->quitNow = 0; - getThread(this)->threadStarted = 0; - getThread(this)->fn = NULL; - getThread(this)->arg = NULL; - getThread(this)->affinityMask = 0; -} - -ThreadImpl::ThreadImpl(ThreadImpl::ExecuteFn fn, void* arg) -{ - getThread(this)->thread = 0; - getThread(this)->tid = 0; - getThread(this)->state = _PxThreadNotStarted; - getThread(this)->quitNow = 0; - getThread(this)->threadStarted = 0; - getThread(this)->fn = fn; - getThread(this)->arg = arg; - getThread(this)->affinityMask = 0; - - start(0, NULL); -} - -ThreadImpl::~ThreadImpl() -{ - if(getThread(this)->state == _PxThreadStarted) - kill(); -} - -void ThreadImpl::start(uint32_t stackSize, Runnable* runnable) -{ - if(getThread(this)->state != _PxThreadNotStarted) - return; - - if(stackSize == 0) - stackSize = getDefaultStackSize(); - -#if defined(PTHREAD_STACK_MIN) && !defined(ANDROID) - if(stackSize < PTHREAD_STACK_MIN) - { - shdfnd::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, - "ThreadImpl::start(): stack size was set below PTHREAD_STACK_MIN"); - stackSize = PTHREAD_STACK_MIN; - } -#endif - - if(runnable && !getThread(this)->arg && !getThread(this)->fn) - getThread(this)->arg = runnable; - - pthread_attr_t attr; - int status = pthread_attr_init(&attr); - PX_ASSERT(!status); - PX_UNUSED(status); - - status = pthread_attr_setstacksize(&attr, stackSize); - PX_ASSERT(!status); - status = pthread_create(&getThread(this)->thread, &attr, PxThreadStart, this); - PX_ASSERT(!status); - - // wait for thread to startup and write out TID - // otherwise TID dependent calls like setAffinity will fail. - while(atomicCompareExchange(&(getThread(this)->threadStarted), 1, 1) == 0) - yield(); - - // here we are sure that getThread(this)->state >= _PxThreadStarted - - status = pthread_attr_destroy(&attr); - PX_ASSERT(!status); - - // apply stored affinity mask - if(getThread(this)->affinityMask) - setAffinityMask(getThread(this)->affinityMask); -} - -void ThreadImpl::signalQuit() -{ - atomicIncrement(&(getThread(this)->quitNow)); -} - -bool ThreadImpl::waitForQuit() -{ - if(getThread(this)->state == _PxThreadNotStarted) - return false; - - // works also with a stopped/exited thread if the handle is still valid - pthread_join(getThread(this)->thread, NULL); - return true; -} - -bool ThreadImpl::quitIsSignalled() -{ - return atomicCompareExchange(&(getThread(this)->quitNow), 0, 0) != 0; -} - -#if defined(PX_GCC_FAMILY) -__attribute__((noreturn)) -#endif - void ThreadImpl::quit() -{ - getThread(this)->state = _PxThreadStopped; - pthread_exit(0); -} - -void ThreadImpl::kill() -{ -#ifndef ANDROID - if(getThread(this)->state == _PxThreadStarted) - pthread_cancel(getThread(this)->thread); - getThread(this)->state = _PxThreadStopped; -#else - shdfnd::getFoundation().error(PxErrorCode::eDEBUG_WARNING, __FILE__, __LINE__, - "ThreadImpl::kill() called, but is not implemented"); -#endif -} - -void ThreadImpl::sleep(uint32_t ms) -{ - timespec sleepTime; - uint32_t remainder = ms % 1000; - sleepTime.tv_sec = ms - remainder; - sleepTime.tv_nsec = remainder * 1000000L; - - while(nanosleep(&sleepTime, &sleepTime) == -1) - continue; -} - -void ThreadImpl::yield() -{ - sched_yield(); -} - -#if PX_PS4 -uint32_t setAffinityMaskPS4(pthread_t, uint32_t); -#endif - -uint32_t ThreadImpl::setAffinityMask(uint32_t mask) -{ - // Same as windows impl if mask is zero - if(!mask) - return 0; - - getThread(this)->affinityMask = mask; - - uint64_t prevMask = 0; - - if(getThread(this)->state == _PxThreadStarted) - { -#if PX_PS4 - prevMask = setAffinityMaskPS4(getThread(this)->thread, mask); -#elif PX_EMSCRIPTEN - // not supported -#elif !PX_APPLE_FAMILY // Apple doesn't support syscall with getaffinity and setaffinity - int32_t errGet = syscall(__NR_sched_getaffinity, getThread(this)->tid, sizeof(prevMask), &prevMask); - if(errGet < 0) - return 0; - - int32_t errSet = syscall(__NR_sched_setaffinity, getThread(this)->tid, sizeof(mask), &mask); - if(errSet != 0) - return 0; -#endif - } - - 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)) - 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: - - // this works only with the current thread and can rename - // the main process if used in the wrong context: - // prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(name) ,0,0,0); - PX_UNUSED(name); -#endif -} - -#if !PX_APPLE_FAMILY -static ThreadPriority::Enum convertPriorityFromLinux(uint32_t inPrio, int policy) -{ - PX_COMPILE_TIME_ASSERT(ThreadPriority::eLOW > ThreadPriority::eHIGH); - PX_COMPILE_TIME_ASSERT(ThreadPriority::eHIGH == 0); - - int maxL = sched_get_priority_max(policy); - int minL = sched_get_priority_min(policy); - int rangeL = maxL - minL; - int rangeNv = ThreadPriority::eLOW - ThreadPriority::eHIGH; - - // case for default scheduler policy - if(rangeL == 0) - return ThreadPriority::eNORMAL; - - float floatPrio = (float(maxL - inPrio) * float(rangeNv)) / float(rangeL); - - return ThreadPriority::Enum(int(roundf(floatPrio))); -} - -static int convertPriorityToLinux(ThreadPriority::Enum inPrio, int policy) -{ - int maxL = sched_get_priority_max(policy); - int minL = sched_get_priority_min(policy); - int rangeL = maxL - minL; - int rangeNv = ThreadPriority::eLOW - ThreadPriority::eHIGH; - - // case for default scheduler policy - if(rangeL == 0) - return 0; - - float floatPrio = (float(ThreadPriority::eLOW - inPrio) * float(rangeL)) / float(rangeNv); - - return minL + int(roundf(floatPrio)); -} -#endif - -void ThreadImpl::setPriority(ThreadPriority::Enum val) -{ - PX_UNUSED(val); -#if !PX_APPLE_FAMILY - int policy; - sched_param s_param; - pthread_getschedparam(getThread(this)->thread, &policy, &s_param); - s_param.sched_priority = convertPriorityToLinux(val, policy); - pthread_setschedparam(getThread(this)->thread, policy, &s_param); -#endif -} - -ThreadPriority::Enum ThreadImpl::getPriority(Id pthread) -{ - PX_UNUSED(pthread); -#if !PX_APPLE_FAMILY - int policy; - sched_param s_param; - int ret = pthread_getschedparam(pthread_t(pthread), &policy, &s_param); - if(ret == 0) - return convertPriorityFromLinux(s_param.sched_priority, policy); - else - return ThreadPriority::eNORMAL; -#else - return ThreadPriority::eNORMAL; -#endif -} - -uint32_t ThreadImpl::getNbPhysicalCores() -{ -#if PX_APPLE_FAMILY - int count; - size_t size = sizeof(count); - return sysctlbyname("hw.physicalcpu", &count, &size, NULL, 0) ? 0 : count; -#elif defined(ANDROID) - return android_getCpuCount(); -#else - // Linux exposes CPU topology using /sys/devices/system/cpu - // https://www.kernel.org/doc/Documentation/cputopology.txt - if(FILE* f = fopen("/sys/devices/system/cpu/possible", "r")) - { - int minIndex, maxIndex; - int n = fscanf(f, "%d-%d", &minIndex, &maxIndex); - fclose(f); - - if(n == 2) - return (maxIndex - minIndex) + 1; - else if(n == 1) - return minIndex + 1; - } - -#if PX_PS4 - // Reducing to 6 to take into account that the OS appears to use 2 cores at peak currently. - return 6; -#else - // For non-Linux kernels this fallback is possibly the best we can do - // but will report logical (hyper-threaded) counts - int n = sysconf(_SC_NPROCESSORS_CONF); - if(n < 0) - return 0; - else - return n; -#endif -#endif -} - -uint32_t TlsAlloc() -{ - pthread_key_t key; - int status = pthread_key_create(&key, NULL); - PX_ASSERT(!status); - PX_UNUSED(status); - return uint32_t(key); -} - -void TlsFree(uint32_t index) -{ - int status = pthread_key_delete(pthread_key_t(index)); - PX_ASSERT(!status); - PX_UNUSED(status); -} - -void* TlsGet(uint32_t index) -{ - return reinterpret_cast<void*>(pthread_getspecific(pthread_key_t(index))); -} - -uint32_t TlsSet(uint32_t index, void* value) -{ - int status = pthread_setspecific(pthread_key_t(index), value); - PX_ASSERT(!status); - return !status; -} - -// DM: On Linux x86-32, without implementation-specific restrictions -// the default stack size for a new thread should be 2 megabytes (kernel.org). -// NOTE: take care of this value on other architecutres! -uint32_t ThreadImpl::getDefaultStackSize() -{ - return 1 << 21; -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/unix/PsUnixTime.cpp b/PxShared/src/foundation/src/unix/PsUnixTime.cpp deleted file mode 100644 index 43b94f5..0000000 --- a/PxShared/src/foundation/src/unix/PsUnixTime.cpp +++ /dev/null @@ -1,120 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "Ps.h" -#include "PsTime.h" - -#include <time.h> -#include <sys/time.h> - -#if PX_APPLE_FAMILY -#include <mach/mach_time.h> -#endif - -// Use real-time high-precision timer. -#if !PX_APPLE_FAMILY -#define CLOCKID CLOCK_REALTIME -#endif - -namespace physx -{ -namespace shdfnd -{ - -static const CounterFrequencyToTensOfNanos gCounterFreq = Time::getCounterFrequency(); - -const CounterFrequencyToTensOfNanos& Time::getBootCounterFrequency() -{ - return gCounterFreq; -} - -static Time::Second getTimeSeconds() -{ - static struct timeval _tv; - gettimeofday(&_tv, NULL); - return double(_tv.tv_sec) + double(_tv.tv_usec) * 0.000001; -} - -Time::Time() -{ - mLastTime = getTimeSeconds(); -} - -Time::Second Time::getElapsedSeconds() -{ - Time::Second curTime = getTimeSeconds(); - Time::Second diff = curTime - mLastTime; - mLastTime = curTime; - return diff; -} - -Time::Second Time::peekElapsedSeconds() -{ - Time::Second curTime = getTimeSeconds(); - Time::Second diff = curTime - mLastTime; - return diff; -} - -Time::Second Time::getLastTime() const -{ - return mLastTime; -} - -#if PX_APPLE_FAMILY -CounterFrequencyToTensOfNanos Time::getCounterFrequency() -{ - mach_timebase_info_data_t info; - mach_timebase_info(&info); - // mach_absolute_time * (info.numer/info.denom) is in units of nano seconds - return CounterFrequencyToTensOfNanos(info.numer, info.denom * 10); -} - -uint64_t Time::getCurrentCounterValue() -{ - return mach_absolute_time(); -} - -#else - -CounterFrequencyToTensOfNanos Time::getCounterFrequency() -{ - return CounterFrequencyToTensOfNanos(1, 10); -} - -uint64_t Time::getCurrentCounterValue() -{ - struct timespec mCurrTimeInt; - clock_gettime(CLOCKID, &mCurrTimeInt); - // Convert to nanos as this doesn't cause a large divide here - return (static_cast<uint64_t>(mCurrTimeInt.tv_sec) * 1000000000) + (static_cast<uint64_t>(mCurrTimeInt.tv_nsec)); -} -#endif - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsUWPThread.cpp b/PxShared/src/foundation/src/windows/PsUWPThread.cpp deleted file mode 100644 index 4e0d43c..0000000 --- a/PxShared/src/foundation/src/windows/PsUWPThread.cpp +++ /dev/null @@ -1,339 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2014 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxPreprocessor.h" - -#if PX_UWP - -#include "foundation/PxAssert.h" - -#include "windows/PsWindowsInclude.h" -#include "PsThread.h" - -using namespace Platform; -using namespace Windows::Foundation; -using namespace Windows::System::Threading; - -// an exception for setting the thread name in microsoft debuggers -#define NS_MS_VC_EXCEPTION 0x406D1388 - -namespace physx -{ -namespace shdfnd -{ - -#define PX_TLS_MAX_SLOTS 64 - -namespace -{ - -// struct for naming a thread in the debugger -#pragma pack(push, 8) - -typedef struct tagTHREADNAME_INFO -{ - DWORD dwType; // Must be 0x1000. - LPCSTR szName; // Pointer to name (in user addr space). - DWORD dwThreadID; // Thread ID (-1=caller thread). - DWORD dwFlags; // Reserved for future use, must be zero. -} THREADNAME_INFO; - -#pragma pack(pop) - -// Used to keep track of which TLS slots have been used -volatile DWORD gTlsSlots[PX_TLS_MAX_SLOTS] = { 0 }; - -// Actual TLS storage, unique per thread -__declspec(thread) void* tlsData[PX_TLS_MAX_SLOTS]; - -// Sets all the slot values to zero. This method will be called every time a new Px thread is created -void PxClearTlsData() -{ - for(unsigned int i = 0; i < PX_TLS_MAX_SLOTS; i++) - { - tlsData[i] = NULL; - } -} - -class _ThreadImpl -{ - public: - enum State - { - NotStarted, - Started, - Stopped - }; - - PX_FORCE_INLINE _ThreadImpl(ThreadImpl::ExecuteFn fn_, void* arg_); - - IAsyncAction ^ asyncAction; - HANDLE signal; - LONG quitNow; // Should be 32bit aligned on SMP systems. - State state; - DWORD threadID; - - ThreadImpl::ExecuteFn fn; - void* arg; -}; - -PX_FORCE_INLINE _ThreadImpl::_ThreadImpl(ThreadImpl::ExecuteFn fn_, void* arg_) -: asyncAction(nullptr), quitNow(0), state(_ThreadImpl::NotStarted), threadID(0xffffFFFF), fn(fn_), arg(arg_) -{ - signal = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); -} - -_ThreadImpl* getThread(ThreadImpl* impl) -{ - return reinterpret_cast<_ThreadImpl*>(impl); -} - -DWORD WINAPI PxThreadStart(LPVOID arg) -{ - PxClearTlsData(); - _ThreadImpl* impl = getThread((ThreadImpl*)arg); - - // run either the passed in function or execute from the derived class (Runnable). - if(impl->fn) - (*impl->fn)(impl->arg); - else if(impl->arg) - ((Runnable*)impl->arg)->execute(); - return 0; -} -} - -static const uint32_t gSize = sizeof(_ThreadImpl); -uint32_t ThreadImpl::getSize() -{ - return gSize; -} - -ThreadImpl::Id ThreadImpl::getId() -{ - return static_cast<Id>(GetCurrentThreadId()); -} - -ThreadImpl::ThreadImpl() -{ - PX_PLACEMENT_NEW(getThread(this), _ThreadImpl)(NULL, NULL); -} - -ThreadImpl::ThreadImpl(ExecuteFn fn, void* arg, const char*) -{ - PX_PLACEMENT_NEW(getThread(this), _ThreadImpl)(fn, arg); - start(0, NULL); -} - -ThreadImpl::~ThreadImpl() -{ - if(getThread(this)->state == _ThreadImpl::Started) - kill(); - if(getThread(this)->asyncAction) - getThread(this)->asyncAction->Close(); - CloseHandle(getThread(this)->signal); -} - -void ThreadImpl::start(uint32_t /*stackSize*/, Runnable* runnable) -{ - if(getThread(this)->state != _ThreadImpl::NotStarted) - return; - getThread(this)->state = _ThreadImpl::Started; - - if(runnable && !getThread(this)->arg && !getThread(this)->fn) - getThread(this)->arg = runnable; - - // run lambda - auto workItemDelegate = [this](IAsyncAction ^ workItem) - { - PxThreadStart((LPVOID) this); // function to run async - }; - - // onComplete lambda - auto completionDelegate = [this](IAsyncAction ^ action, AsyncStatus /*status*/) - { - switch(action->Status) - { - case AsyncStatus::Started: - break; - case AsyncStatus::Completed: - case AsyncStatus::Canceled: - case AsyncStatus::Error: - SetEvent(getThread(this)->signal); - break; - } - }; - - // thread pool work item, can run on any thread - auto workItemHandler = ref new WorkItemHandler(workItemDelegate, CallbackContext::Any); - // thread status handler (signal complete), can run on any thread - auto completionHandler = ref new AsyncActionCompletedHandler(completionDelegate, Platform::CallbackContext::Any); - - // run with normal priority, time sliced - getThread(this)->asyncAction = - ThreadPool::RunAsync(workItemHandler, WorkItemPriority::Normal, WorkItemOptions::TimeSliced); - getThread(this)->asyncAction->Completed = completionHandler; -} - -void ThreadImpl::signalQuit() -{ - InterlockedIncrement(&(getThread(this)->quitNow)); -} - -bool ThreadImpl::waitForQuit() -{ - if(getThread(this)->state == _ThreadImpl::NotStarted) - return false; - - WaitForSingleObjectEx(getThread(this)->signal, INFINITE, false); - - return true; -} - -bool ThreadImpl::quitIsSignalled() -{ - return InterlockedCompareExchange(&(getThread(this)->quitNow), 0, 0) != 0; -} - -void ThreadImpl::quit() -{ - getThread(this)->state = _ThreadImpl::Stopped; -} - -void ThreadImpl::kill() -{ - if(getThread(this)->state == _ThreadImpl::Started && getThread(this)->asyncAction) - { - getThread(this)->asyncAction->Cancel(); - InterlockedIncrement(&(getThread(this)->quitNow)); - } - getThread(this)->state = _ThreadImpl::Stopped; -} - -void ThreadImpl::sleep(uint32_t ms) -{ - // find something better than this: - if(ms == 0) - yield(); - else - { - HANDLE handle = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, EVENT_ALL_ACCESS); - WaitForSingleObjectEx(handle, ms, false); - CloseHandle(handle); - } -} - -void ThreadImpl::yield() -{ - YieldProcessor(); -} - -uint32_t ThreadImpl::setAffinityMask(uint32_t /*mask*/) -{ - return 0; -} - -void ThreadImpl::setName(const char* name) -{ - THREADNAME_INFO info; - info.dwType = 0x1000; - info.szName = name; - info.dwThreadID = getThread(this)->threadID; - info.dwFlags = 0; - - // C++ Exceptions are disabled for this project, but SEH is not (and cannot be) - // http://stackoverflow.com/questions/943087/what-exactly-will-happen-if-i-disable-c-exceptions-in-a-project - __try - { - RaiseException(NS_MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - // this runs if not attached to a debugger (thus not really naming the thread) - } -} - -void ThreadImpl::setPriority(ThreadPriority::Enum /*prio*/) -{ - // AFAIK this can only be done at creation in Metro Apps -} - -ThreadPriority::Enum ThreadImpl::getPriority(Id /*threadId*/) -{ - // see setPriority - return ThreadPriority::eNORMAL; -} - -uint32_t TlsAlloc() -{ - for(unsigned int i = 0; i < PX_TLS_MAX_SLOTS; i++) - if(InterlockedCompareExchange(&gTlsSlots[i], TRUE, FALSE) == FALSE) - return i; - PX_ASSERT(!"Cannot find a free tls slot, increase PX_TLS_MAX_SLOTS"); - return (uint32_t) - 1; -} - -void TlsFree(uint32_t index) -{ - PX_ASSERT(index < PX_TLS_MAX_SLOTS); - InterlockedExchange(&gTlsSlots[index], 0); - // Clear the value for this slot.. This is a bit iffy as it clears only the value for the thread - // that calls PxTlsFree() - tlsData[index] = NULL; -} - -void* TlsGet(uint32_t index) -{ - PX_ASSERT(index < PX_TLS_MAX_SLOTS); - void* value = tlsData[index]; - return value; -} - -uint32_t TlsSet(uint32_t index, void* value) -{ - PX_ASSERT(index < PX_TLS_MAX_SLOTS); - tlsData[index] = value; - return 1; -} - -uint32_t ThreadImpl::getDefaultStackSize() -{ - return 1048576; -}; - -uint32_t ThreadImpl::getNbPhysicalCores() -{ - SYSTEM_INFO info; - GetNativeSystemInfo(&info); - return info.dwNumberOfProcessors; -} - -} // namespace shdfnd -} // namespace physx - -#endif // PX_UWP diff --git a/PxShared/src/foundation/src/windows/PsWindowsCpu.cpp b/PxShared/src/foundation/src/windows/PsWindowsCpu.cpp deleted file mode 100644 index 14c78fb..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsCpu.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PsCpu.h" -#pragma warning(push) -//'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' -#pragma warning(disable : 4668) -#if PX_VC == 10 -#pragma warning(disable : 4987) // nonstandard extension used: 'throw (...)' -#endif -#include <intrin.h> -#pragma warning(pop) - -namespace physx -{ -namespace shdfnd -{ - -#if PX_ARM -#define cpuid(reg) reg[0] = reg[1] = reg[2] = reg[3] = 0; - -uint8_t Cpu::getCpuId() -{ - uint32_t cpuInfo[4]; - cpuid(cpuInfo); - return static_cast<uint8_t>(cpuInfo[1] >> 24); // APIC Physical ID -} -#else -uint8_t Cpu::getCpuId() -{ - int CPUInfo[4]; - int InfoType = 1; - __cpuid(CPUInfo, InfoType); - return static_cast<uint8_t>(CPUInfo[1] >> 24); // APIC Physical ID -} -#endif -} -} diff --git a/PxShared/src/foundation/src/windows/PsWindowsFPU.cpp b/PxShared/src/foundation/src/windows/PsWindowsFPU.cpp deleted file mode 100644 index e83cccf..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsFPU.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. -#include "PsFPU.h" -#include "float.h" -#include "PsIntrinsics.h" - -#if PX_X64 -#define _MCW_ALL _MCW_DN | _MCW_EM | _MCW_RC -#else -#define _MCW_ALL _MCW_DN | _MCW_EM | _MCW_IC | _MCW_RC | _MCW_PC -#endif - -physx::shdfnd::FPUGuard::FPUGuard() -{ -// default plus FTZ and DAZ -#if PX_X64 - // query current control word state - _controlfp_s(mControlWords, 0, 0); - - // set both x87 and sse units to default + DAZ - unsigned int cw; - _controlfp_s(&cw, _CW_DEFAULT | _DN_FLUSH, _MCW_ALL); -#else - // query current control word state - __control87_2(0, 0, mControlWords, mControlWords + 1); - - // set both x87 and sse units to default + DAZ - unsigned int x87, sse; - __control87_2(_CW_DEFAULT | _DN_FLUSH, _MCW_ALL, &x87, &sse); -#endif -} - -physx::shdfnd::FPUGuard::~FPUGuard() -{ - _clearfp(); - -#if PX_X64 - // reset FP state - unsigned int cw; - _controlfp_s(&cw, *mControlWords, _MCW_ALL); -#else - - // reset FP state - unsigned int x87, sse; - __control87_2(mControlWords[0], _MCW_ALL, &x87, 0); - __control87_2(mControlWords[1], _MCW_ALL, 0, &sse); -#endif -} - -void physx::shdfnd::enableFPExceptions() -{ - // clear any pending exceptions - _clearfp(); - - // enable all fp exceptions except inexact and underflow (common, benign) - _controlfp_s(NULL, uint32_t(~_MCW_EM) | _EM_INEXACT | _EM_UNDERFLOW, _MCW_EM); -} - -void physx::shdfnd::disableFPExceptions() -{ - _controlfp_s(NULL, _MCW_EM, _MCW_EM); -} diff --git a/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp b/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp deleted file mode 100644 index e62de47..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsMutex.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "windows/PsWindowsInclude.h" -#include "PsFoundation.h" -#include "PsUserAllocated.h" -#include "PsMutex.h" -#include "PsThread.h" -#include "foundation/PxErrorCallback.h" - -namespace physx -{ -namespace shdfnd -{ - -namespace -{ -struct MutexWinImpl -{ - CRITICAL_SECTION mLock; - Thread::Id mOwner; -}; - -MutexWinImpl* getMutex(MutexImpl* impl) -{ - return reinterpret_cast<MutexWinImpl*>(impl); -} -} - -MutexImpl::MutexImpl() -{ - InitializeCriticalSection(&getMutex(this)->mLock); - getMutex(this)->mOwner = 0; -} - -MutexImpl::~MutexImpl() -{ - DeleteCriticalSection(&getMutex(this)->mLock); -} - -void MutexImpl::lock() -{ - EnterCriticalSection(&getMutex(this)->mLock); - -#if PX_DEBUG - getMutex(this)->mOwner = Thread::getId(); -#endif -} - -bool MutexImpl::trylock() -{ - bool success = TryEnterCriticalSection(&getMutex(this)->mLock) != 0; -#if PX_DEBUG - if(success) - getMutex(this)->mOwner = Thread::getId(); -#endif - return success; -} - -void MutexImpl::unlock() -{ -#if PX_DEBUG - // ensure we are already holding the lock - if(getMutex(this)->mOwner != Thread::getId()) - { - shdfnd::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, - "Mutex must be unlocked only by thread that has already acquired lock"); - return; - } - -#endif - - LeaveCriticalSection(&getMutex(this)->mLock); -} - -uint32_t MutexImpl::getSize() -{ - return sizeof(MutexWinImpl); -} - -class ReadWriteLockImpl -{ - PX_NOCOPY(ReadWriteLockImpl) - public: - ReadWriteLockImpl() - { - } - Mutex mutex; - volatile LONG readerCount; // handle recursive writer locking -}; - -ReadWriteLock::ReadWriteLock() -{ - mImpl = reinterpret_cast<ReadWriteLockImpl*>(PX_ALLOC(sizeof(ReadWriteLockImpl), "ReadWriteLockImpl")); - PX_PLACEMENT_NEW(mImpl, ReadWriteLockImpl); - - mImpl->readerCount = 0; -} - -ReadWriteLock::~ReadWriteLock() -{ - mImpl->~ReadWriteLockImpl(); - PX_FREE(mImpl); -} - -void ReadWriteLock::lockReader() -{ - mImpl->mutex.lock(); - - InterlockedIncrement(&mImpl->readerCount); - - mImpl->mutex.unlock(); -} - -void ReadWriteLock::lockWriter() -{ - mImpl->mutex.lock(); - - // spin lock until no readers - while(mImpl->readerCount) - ; -} - -void ReadWriteLock::unlockReader() -{ - InterlockedDecrement(&mImpl->readerCount); -} - -void ReadWriteLock::unlockWriter() -{ - mImpl->mutex.unlock(); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsWindowsPrintString.cpp b/PxShared/src/foundation/src/windows/PsWindowsPrintString.cpp deleted file mode 100644 index ee72037..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsPrintString.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PsString.h" -#include <stdio.h> -#pragma warning(push) -#pragma warning(disable : 4668) //'symbol' is not defined as a preprocessor macro, replacing with '0' for 'directives' -#include <windows.h> -#pragma warning(pop) - -#include <stdio.h> -#include <string.h> -#include <stdarg.h> - -namespace physx -{ -namespace shdfnd -{ - -void printString(const char* str) -{ - puts(str); // do not use printf here, since str can contain multiple % signs that will not be printed - OutputDebugStringA(str); - OutputDebugStringA("\n"); -} -} - -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsWindowsSList.cpp b/PxShared/src/foundation/src/windows/PsWindowsSList.cpp deleted file mode 100644 index 5e57b8f..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsSList.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "windows/PsWindowsInclude.h" -#include "PsAllocator.h" -#include "PsSList.h" - -namespace physx -{ -namespace shdfnd -{ -namespace -{ -template <typename T> -SLIST_HEADER* getDetail(T* impl) -{ - return reinterpret_cast<SLIST_HEADER*>(impl); -} -} - -SListImpl::SListImpl() -{ - InitializeSListHead(getDetail(this)); -} - -SListImpl::~SListImpl() -{ -} - -void SListImpl::push(SListEntry* entry) -{ - InterlockedPushEntrySList(getDetail(this), reinterpret_cast<SLIST_ENTRY*>(entry)); -} - -SListEntry* SListImpl::pop() -{ - return reinterpret_cast<SListEntry*>(InterlockedPopEntrySList(getDetail(this))); -} - -SListEntry* SListImpl::flush() -{ - return reinterpret_cast<SListEntry*>(InterlockedFlushSList(getDetail(this))); -} - -uint32_t SListImpl::getSize() -{ - return sizeof(SLIST_HEADER); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp b/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp deleted file mode 100644 index 8654a7e..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsSocket.cpp +++ /dev/null @@ -1,446 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "foundation/PxIntrinsics.h" - -#include "windows/PsWindowsInclude.h" -#include "PsSocket.h" -#include "PsThread.h" -#include "PsArray.h" - -#include <Winsock2.h> -#pragma comment(lib, "Ws2_32") - -namespace physx -{ -namespace shdfnd -{ - -const uint32_t Socket::DEFAULT_BUFFER_SIZE = 32768; - -class SocketImpl -{ - public: - SocketImpl(bool isBlocking); - virtual ~SocketImpl(); - - bool connect(const char* host, uint16_t port, uint32_t timeout); - bool listen(uint16_t port); - bool accept(bool block); - void disconnect(); - - void setBlocking(bool blocking); - - virtual uint32_t write(const uint8_t* data, uint32_t length); - virtual bool flush(); - uint32_t read(uint8_t* data, uint32_t length); - - PX_FORCE_INLINE bool isBlocking() const - { - return mIsBlocking; - } - PX_FORCE_INLINE bool isConnected() const - { - return mIsConnected; - } - PX_FORCE_INLINE const char* getHost() const - { - return mHost; - } - PX_FORCE_INLINE uint16_t getPort() const - { - return mPort; - } - - protected: - bool nonBlockingTimeout() const; - void setBlockingInternal(SOCKET socket, bool blocking); - - mutable SOCKET mSocket; - SOCKET mListenSocket; - const char* mHost; - uint16_t mPort; - mutable bool mIsConnected; - bool mIsBlocking; - bool mListenMode; - bool mSocketLayerIntialized; -}; - -SocketImpl::SocketImpl(bool isBlocking) -: mSocket(INVALID_SOCKET) -, mListenSocket(INVALID_SOCKET) -, mHost(NULL) -, mPort(0) -, mIsConnected(false) -, mIsBlocking(isBlocking) -, mListenMode(false) -, mSocketLayerIntialized(false) -{ - WORD vreq; - WSADATA wsaData; - vreq = MAKEWORD(2, 2); - mSocketLayerIntialized = (WSAStartup(vreq, &wsaData) == 0); -} - -SocketImpl::~SocketImpl() -{ - if(mSocketLayerIntialized) - WSACleanup(); -} - -void SocketImpl::setBlockingInternal(SOCKET socket, bool blocking) -{ - uint32_t mode = uint32_t(blocking ? 0 : 1); - ioctlsocket(socket, FIONBIO, (u_long*)&mode); -} - -#ifdef PX_VC11 -#pragma warning(push) -#pragma warning(disable : 4548) // for FD_SET on vc11 only -#endif -bool SocketImpl::connect(const char* host, uint16_t port, uint32_t timeout) -{ - if(!mSocketLayerIntialized) - return false; - - sockaddr_in socketAddress; - hostent* hp; - - intrinsics::memSet(&socketAddress, 0, sizeof(sockaddr_in)); - socketAddress.sin_family = AF_INET; - socketAddress.sin_port = htons(port); - - // get host - hp = gethostbyname(host); - if(!hp) - { - in_addr a; - a.s_addr = inet_addr(host); - hp = gethostbyaddr((const char*)&a, sizeof(in_addr), AF_INET); - if(!hp) - return false; - } - intrinsics::memCopy(&socketAddress.sin_addr, hp->h_addr_list[0], (uint32_t)hp->h_length); - - // connect - mSocket = socket(PF_INET, SOCK_STREAM, 0); - if(mSocket == INVALID_SOCKET) - return false; - - setBlockingInternal(mSocket, false); - - ::connect(mSocket, (sockaddr*)&socketAddress, sizeof(socketAddress)); - // Setup select function call to monitor the connect call. - fd_set writefs; - fd_set exceptfs; - FD_ZERO(&writefs); - FD_ZERO(&exceptfs); -#pragma warning(push) -#pragma warning(disable : 4127 4548) - FD_SET(mSocket, &writefs); - FD_SET(mSocket, &exceptfs); -#pragma warning(pop) - timeval timeout_; - timeout_.tv_sec = long(timeout / 1000); - timeout_.tv_usec = long(((timeout % 1000) * 1000)); - int selret = ::select(1, NULL, &writefs, &exceptfs, &timeout_); - int excepted = FD_ISSET(mSocket, &exceptfs); - int canWrite = FD_ISSET(mSocket, &writefs); - if(selret != 1 || excepted || !canWrite) - { - disconnect(); - return false; - } - - setBlockingInternal(mSocket, mIsBlocking); - - mIsConnected = true; - mPort = port; - mHost = host; - return true; -} -#ifdef PX_VC11 -#pragma warning(pop) -#endif - -bool SocketImpl::listen(uint16_t port) -{ - if(!mSocketLayerIntialized) - return false; - - mListenSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); - if(mListenSocket == INVALID_SOCKET) - return false; - - mListenMode = true; - - sockaddr_in addr = { 0 }; - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - addr.sin_addr.s_addr = htonl(INADDR_ANY); - return bind(mListenSocket, (sockaddr*)&addr, sizeof(addr)) == 0 && ::listen(mListenSocket, SOMAXCONN) == 0; -} - -bool SocketImpl::accept(bool block) -{ - if(mIsConnected || !mListenMode) - return false; - - // set the listen socket to be non-blocking. - setBlockingInternal(mListenSocket, block); - SOCKET clientSocket = ::accept(mListenSocket, 0, 0); - if(clientSocket == INVALID_SOCKET) - return false; - - mSocket = clientSocket; - mIsConnected = true; - setBlockingInternal(mSocket, mIsBlocking); // force the mode to whatever the user set - - return mIsConnected; -} - -void SocketImpl::disconnect() -{ - if(mListenSocket != INVALID_SOCKET) - { - closesocket(mListenSocket); - mListenSocket = INVALID_SOCKET; - } - if(mSocket != INVALID_SOCKET) - { - WSASendDisconnect(mSocket, NULL); - closesocket(mSocket); - mSocket = INVALID_SOCKET; - } - mIsConnected = false; - mListenMode = false; - mPort = 0; - mHost = NULL; -} - -bool SocketImpl::nonBlockingTimeout() const -{ - return !mIsBlocking && WSAGetLastError() == WSAEWOULDBLOCK; -} - -// should be cross-platform from here down - -void SocketImpl::setBlocking(bool blocking) -{ - if(blocking != mIsBlocking) - { - mIsBlocking = blocking; - if(isConnected()) - setBlockingInternal(mSocket, blocking); - } -} - -bool SocketImpl::flush() -{ - return true; -} - -uint32_t SocketImpl::write(const uint8_t* data, uint32_t length) -{ - if(length == 0) - return 0; - - int sent = send(mSocket, (const char*)data, (int32_t)length, 0); - - if(sent <= 0 && !nonBlockingTimeout()) - disconnect(); - - return uint32_t(sent > 0 ? sent : 0); -} - -uint32_t SocketImpl::read(uint8_t* data, uint32_t length) -{ - if(length == 0) - return 0; - - int32_t received = recv(mSocket, (char*)data, (int32_t)length, 0); - - if(received <= 0 && !nonBlockingTimeout()) - disconnect(); - - return uint32_t(received > 0 ? received : 0); -} - -class BufferedSocketImpl : public SocketImpl -{ - public: - BufferedSocketImpl(bool isBlocking) : SocketImpl(isBlocking), mBufferPos(0) - { - } - virtual ~BufferedSocketImpl() - { - } - bool flush(); - uint32_t write(const uint8_t* data, uint32_t length); - - private: - uint32_t mBufferPos; - uint8_t mBuffer[Socket::DEFAULT_BUFFER_SIZE]; -}; - -bool BufferedSocketImpl::flush() -{ - uint32_t totalBytesWritten = 0; - - while(totalBytesWritten < mBufferPos && mIsConnected) - totalBytesWritten += (int32_t)SocketImpl::write(mBuffer + totalBytesWritten, mBufferPos - totalBytesWritten); - - bool ret = (totalBytesWritten == mBufferPos); - mBufferPos = 0; - return ret; -} - -uint32_t BufferedSocketImpl::write(const uint8_t* data, uint32_t length) -{ - uint32_t bytesWritten = 0; - while(mBufferPos + length >= Socket::DEFAULT_BUFFER_SIZE) - { - uint32_t currentChunk = Socket::DEFAULT_BUFFER_SIZE - mBufferPos; - intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, currentChunk); - bytesWritten += (uint32_t)currentChunk; // for the user, this is consumed even if we fail to shove it down a - // non-blocking socket - - uint32_t sent = SocketImpl::write(mBuffer, Socket::DEFAULT_BUFFER_SIZE); - mBufferPos = Socket::DEFAULT_BUFFER_SIZE - sent; - - if(sent < Socket::DEFAULT_BUFFER_SIZE) // non-blocking or error - { - if(sent) // we can reasonably hope this is rare - intrinsics::memMove(mBuffer, mBuffer + sent, mBufferPos); - - return bytesWritten; - } - length -= currentChunk; - } - - if(length > 0) - { - intrinsics::memCopy(mBuffer + mBufferPos, data + bytesWritten, length); - bytesWritten += length; - mBufferPos += length; - } - - return bytesWritten; -} - -Socket::Socket(bool inIsBuffering, bool isBlocking) -{ - if(inIsBuffering) - { - void* mem = PX_ALLOC(sizeof(BufferedSocketImpl), "BufferedSocketImpl"); - mImpl = PX_PLACEMENT_NEW(mem, BufferedSocketImpl)(isBlocking); - } - else - { - void* mem = PX_ALLOC(sizeof(SocketImpl), "SocketImpl"); - mImpl = PX_PLACEMENT_NEW(mem, SocketImpl)(isBlocking); - } -} - -Socket::~Socket() -{ - mImpl->flush(); - mImpl->disconnect(); - mImpl->~SocketImpl(); - PX_FREE(mImpl); -} - -bool Socket::connect(const char* host, uint16_t port, uint32_t timeout) -{ - return mImpl->connect(host, port, timeout); -} - -bool Socket::listen(uint16_t port) -{ - return mImpl->listen(port); -} - -bool Socket::accept(bool block) -{ - return mImpl->accept(block); -} - -void Socket::disconnect() -{ - mImpl->disconnect(); -} - -bool Socket::isConnected() const -{ - return mImpl->isConnected(); -} - -const char* Socket::getHost() const -{ - return mImpl->getHost(); -} - -uint16_t Socket::getPort() const -{ - return mImpl->getPort(); -} - -bool Socket::flush() -{ - if(!mImpl->isConnected()) - return false; - return mImpl->flush(); -} - -uint32_t Socket::write(const uint8_t* data, uint32_t length) -{ - if(!mImpl->isConnected()) - return 0; - return mImpl->write(data, length); -} - -uint32_t Socket::read(uint8_t* data, uint32_t length) -{ - if(!mImpl->isConnected()) - return 0; - return mImpl->read(data, length); -} - -void Socket::setBlocking(bool blocking) -{ - mImpl->setBlocking(blocking); -} - -bool Socket::isBlocking() const -{ - return mImpl->isBlocking(); -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsWindowsSync.cpp b/PxShared/src/foundation/src/windows/PsWindowsSync.cpp deleted file mode 100644 index 81ae0e5..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsSync.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "windows/PsWindowsInclude.h" -#include "PsUserAllocated.h" -#include "PsSync.h" - -namespace physx -{ -namespace shdfnd -{ - -namespace -{ -HANDLE& getSync(SyncImpl* impl) -{ - return *reinterpret_cast<HANDLE*>(impl); -} -} - -uint32_t SyncImpl::getSize() -{ - return sizeof(HANDLE); -} - -SyncImpl::SyncImpl() -{ - getSync(this) = CreateEvent(0, true, false, 0); -} - -SyncImpl::~SyncImpl() -{ - CloseHandle(getSync(this)); -} - -void SyncImpl::reset() -{ - ResetEvent(getSync(this)); -} - -void SyncImpl::set() -{ - SetEvent(getSync(this)); -} - -bool SyncImpl::wait(uint32_t milliseconds) -{ - if(milliseconds == -1) - milliseconds = INFINITE; - - return WaitForSingleObject(getSync(this), milliseconds) == WAIT_OBJECT_0 ? true : false; -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsWindowsThread.cpp b/PxShared/src/foundation/src/windows/PsWindowsThread.cpp deleted file mode 100644 index 9c5728a..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsThread.cpp +++ /dev/null @@ -1,404 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "windows/PsWindowsInclude.h" -#include "PsFoundation.h" -#include "PsThread.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxAssert.h" - -// an exception for setting the thread name in Microsoft debuggers -#define NS_MS_VC_EXCEPTION 0x406D1388 - -namespace physx -{ -namespace shdfnd -{ - -namespace -{ - -#if PX_VC -#pragma warning(disable : 4061) // enumerator 'identifier' in switch of enum 'enumeration' is not handled -#pragma warning(disable : 4191) //'operator/operation' : unsafe conversion from 'type of expression' to 'type required' -#endif - -// struct for naming a thread in the debugger -#pragma pack(push, 8) - -typedef struct tagTHREADNAME_INFO -{ - DWORD dwType; // Must be 0x1000. - LPCSTR szName; // Pointer to name (in user addr space). - DWORD dwThreadID; // Thread ID (-1=caller thread). - DWORD dwFlags; // Reserved for future use, must be zero. -} THREADNAME_INFO; - -#pragma pack(pop) - -class _ThreadImpl -{ - public: - enum State - { - NotStarted, - Started, - Stopped - }; - - HANDLE thread; - LONG quitNow; // Should be 32bit aligned on SMP systems. - State state; - DWORD threadID; - - ThreadImpl::ExecuteFn fn; - void* arg; - - uint32_t affinityMask; -}; - -_ThreadImpl* getThread(ThreadImpl* impl) -{ - return reinterpret_cast<_ThreadImpl*>(impl); -} - -DWORD WINAPI PxThreadStart(LPVOID arg) -{ - _ThreadImpl* impl = getThread((ThreadImpl*)arg); - - // run either the passed in function or execute from the derived class (Runnable). - if(impl->fn) - (*impl->fn)(impl->arg); - else if(impl->arg) - ((Runnable*)impl->arg)->execute(); - return 0; -} - -// cache physical thread count -uint32_t gPhysicalCoreCount = 0; -} - -uint32_t ThreadImpl::getSize() -{ - return sizeof(_ThreadImpl); -} - -ThreadImpl::Id ThreadImpl::getId() -{ - return static_cast<Id>(GetCurrentThreadId()); -} - -// fwd GetLogicalProcessorInformation() -typedef BOOL(WINAPI* LPFN_GLPI)(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION, PDWORD); - -uint32_t ThreadImpl::getNbPhysicalCores() -{ - if(!gPhysicalCoreCount) - { - // modified example code from: http://msdn.microsoft.com/en-us/library/ms683194 - LPFN_GLPI glpi; - PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL; - PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = NULL; - DWORD returnLength = 0; - DWORD processorCoreCount = 0; - DWORD byteOffset = 0; - - glpi = (LPFN_GLPI)GetProcAddress(GetModuleHandle(TEXT("kernel32")), "GetLogicalProcessorInformation"); - - if(NULL == glpi) - { - // GetLogicalProcessorInformation not supported on OS < XP Service Pack 3 - return 0; - } - - DWORD rc = (DWORD)glpi(NULL, &returnLength); - PX_ASSERT(rc == FALSE); - PX_UNUSED(rc); - - // first query reports required buffer space - if(GetLastError() == ERROR_INSUFFICIENT_BUFFER) - { - buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)PxAlloca(returnLength); - } - else - { - physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, - "Error querying buffer size for number of physical processors"); - return 0; - } - - // retrieve data - rc = (DWORD)glpi(buffer, &returnLength); - if(rc != TRUE) - { - physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, - "Error querying number of physical processors"); - return 0; - } - - ptr = buffer; - - while(byteOffset + sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION) <= returnLength) - { - switch(ptr->Relationship) - { - case RelationProcessorCore: - processorCoreCount++; - break; - default: - break; - } - - byteOffset += sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION); - ptr++; - } - - gPhysicalCoreCount = processorCoreCount; - } - - return gPhysicalCoreCount; -} - -ThreadImpl::ThreadImpl() -{ - getThread(this)->thread = NULL; - getThread(this)->state = _ThreadImpl::NotStarted; - getThread(this)->quitNow = 0; - getThread(this)->fn = NULL; - getThread(this)->arg = NULL; - getThread(this)->affinityMask = 0; -} - -ThreadImpl::ThreadImpl(ExecuteFn fn, void* arg) -{ - getThread(this)->thread = NULL; - getThread(this)->state = _ThreadImpl::NotStarted; - getThread(this)->quitNow = 0; - getThread(this)->fn = fn; - getThread(this)->arg = arg; - getThread(this)->affinityMask = 0; - - start(0, NULL); -} - -ThreadImpl::~ThreadImpl() -{ - if(getThread(this)->state == _ThreadImpl::Started) - kill(); - CloseHandle(getThread(this)->thread); -} - -void ThreadImpl::start(uint32_t stackSize, Runnable* runnable) -{ - if(getThread(this)->state != _ThreadImpl::NotStarted) - return; - getThread(this)->state = _ThreadImpl::Started; - - if(runnable && !getThread(this)->arg && !getThread(this)->fn) - getThread(this)->arg = runnable; - - getThread(this)->thread = - CreateThread(NULL, stackSize, PxThreadStart, (LPVOID) this, CREATE_SUSPENDED, &getThread(this)->threadID); - if(!getThread(this)->thread) - { - physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, - "PsWindowsThread::start: Failed to create thread."); - getThread(this)->state = _ThreadImpl::NotStarted; - return; - } - - // set affinity and resume - if(getThread(this)->affinityMask) - setAffinityMask(getThread(this)->affinityMask); - - DWORD rc = ResumeThread(getThread(this)->thread); - if(rc == DWORD(-1)) - { - physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, - "PsWindowsThread::start: Failed to resume thread."); - getThread(this)->state = _ThreadImpl::NotStarted; - return; - } -} - -void ThreadImpl::signalQuit() -{ - InterlockedIncrement(&(getThread(this)->quitNow)); -} - -bool ThreadImpl::waitForQuit() -{ - if(getThread(this)->state == _ThreadImpl::NotStarted) - return false; - - WaitForSingleObject(getThread(this)->thread, INFINITE); - return true; -} - -bool ThreadImpl::quitIsSignalled() -{ - return InterlockedCompareExchange(&(getThread(this)->quitNow), 0, 0) != 0; -} - -void ThreadImpl::quit() -{ - getThread(this)->state = _ThreadImpl::Stopped; - ExitThread(0); -} - -void ThreadImpl::kill() -{ - if(getThread(this)->state == _ThreadImpl::Started) - TerminateThread(getThread(this)->thread, 0); - getThread(this)->state = _ThreadImpl::Stopped; -} - -void ThreadImpl::sleep(uint32_t ms) -{ - Sleep(ms); -} - -void ThreadImpl::yield() -{ - SwitchToThread(); -} - -uint32_t ThreadImpl::setAffinityMask(uint32_t mask) -{ - if(mask) - { - // store affinity - getThread(this)->affinityMask = mask; - - // if thread already started apply immediately - if(getThread(this)->state == _ThreadImpl::Started) - { - uint32_t err = uint32_t(SetThreadAffinityMask(getThread(this)->thread, mask)); - return err; - } - } - - return 0; -} - -void ThreadImpl::setName(const char* name) -{ - THREADNAME_INFO info; - info.dwType = 0x1000; - info.szName = name; - info.dwThreadID = getThread(this)->threadID; - info.dwFlags = 0; - - // C++ Exceptions are disabled for this project, but SEH is not (and cannot be) - // http://stackoverflow.com/questions/943087/what-exactly-will-happen-if-i-disable-c-exceptions-in-a-project - __try - { - RaiseException(NS_MS_VC_EXCEPTION, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); - } - __except(EXCEPTION_EXECUTE_HANDLER) - { - // this runs if not attached to a debugger (thus not really naming the thread) - } -} - -void ThreadImpl::setPriority(ThreadPriority::Enum prio) -{ - BOOL rc = false; - switch(prio) - { - case ThreadPriority::eHIGH: - rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_HIGHEST); - break; - case ThreadPriority::eABOVE_NORMAL: - rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_ABOVE_NORMAL); - break; - case ThreadPriority::eNORMAL: - rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_NORMAL); - break; - case ThreadPriority::eBELOW_NORMAL: - rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_BELOW_NORMAL); - break; - case ThreadPriority::eLOW: - rc = SetThreadPriority(getThread(this)->thread, THREAD_PRIORITY_LOWEST); - break; - default: - break; - } - if(!rc) - { - physx::shdfnd::getFoundation().error(PxErrorCode::eINTERNAL_ERROR, __FILE__, __LINE__, - "PsWindowsThread::setPriority: Failed to set thread priority."); - } -} - -ThreadPriority::Enum ThreadImpl::getPriority(Id threadId) -{ - ThreadPriority::Enum retval = ThreadPriority::eLOW; - int priority = GetThreadPriority((HANDLE)threadId); - PX_COMPILE_TIME_ASSERT(THREAD_PRIORITY_HIGHEST > THREAD_PRIORITY_ABOVE_NORMAL); - if(priority >= THREAD_PRIORITY_HIGHEST) - retval = ThreadPriority::eHIGH; - else if(priority >= THREAD_PRIORITY_ABOVE_NORMAL) - retval = ThreadPriority::eABOVE_NORMAL; - else if(priority >= THREAD_PRIORITY_NORMAL) - retval = ThreadPriority::eNORMAL; - else if(priority >= THREAD_PRIORITY_BELOW_NORMAL) - retval = ThreadPriority::eBELOW_NORMAL; - return retval; -} - -uint32_t TlsAlloc() -{ - DWORD rv = ::TlsAlloc(); - PX_ASSERT(rv != TLS_OUT_OF_INDEXES); - return (uint32_t)rv; -} - -void TlsFree(uint32_t index) -{ - ::TlsFree(index); -} - -void* TlsGet(uint32_t index) -{ - return ::TlsGetValue(index); -} - -uint32_t TlsSet(uint32_t index, void* value) -{ - return (uint32_t)::TlsSetValue(index, value); -} - -uint32_t ThreadImpl::getDefaultStackSize() -{ - return 1048576; -}; - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/foundation/src/windows/PsWindowsTime.cpp b/PxShared/src/foundation/src/windows/PsWindowsTime.cpp deleted file mode 100644 index 2c1e435..0000000 --- a/PxShared/src/foundation/src/windows/PsWindowsTime.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PsTime.h" -#include "windows/PsWindowsInclude.h" - -namespace -{ -int64_t getTimeTicks() -{ - LARGE_INTEGER a; - QueryPerformanceCounter(&a); - return a.QuadPart; -} - -double getTickDuration() -{ - LARGE_INTEGER a; - QueryPerformanceFrequency(&a); - return 1.0f / double(a.QuadPart); -} - -double sTickDuration = getTickDuration(); -} // namespace - -namespace physx -{ -namespace shdfnd -{ - -static const CounterFrequencyToTensOfNanos gCounterFreq = Time::getCounterFrequency(); - -const CounterFrequencyToTensOfNanos& Time::getBootCounterFrequency() -{ - return gCounterFreq; -} - -CounterFrequencyToTensOfNanos Time::getCounterFrequency() -{ - LARGE_INTEGER freq; - QueryPerformanceFrequency(&freq); - return CounterFrequencyToTensOfNanos(Time::sNumTensOfNanoSecondsInASecond, (uint64_t)freq.QuadPart); -} - -uint64_t Time::getCurrentCounterValue() -{ - LARGE_INTEGER ticks; - QueryPerformanceCounter(&ticks); - return (uint64_t)ticks.QuadPart; -} - -Time::Time() : mTickCount(0) -{ - getElapsedSeconds(); -} - -Time::Second Time::getElapsedSeconds() -{ - int64_t lastTickCount = mTickCount; - mTickCount = getTimeTicks(); - return (mTickCount - lastTickCount) * sTickDuration; -} - -Time::Second Time::peekElapsedSeconds() -{ - return (getTimeTicks() - mTickCount) * sTickDuration; -} - -Time::Second Time::getLastTime() const -{ - return mTickCount * sTickDuration; -} - -} // namespace shdfnd -} // namespace physx diff --git a/PxShared/src/pvd/include/PsPvd.h b/PxShared/src/pvd/include/PsPvd.h deleted file mode 100644 index 1f0ae79..0000000 --- a/PxShared/src/pvd/include/PsPvd.h +++ /dev/null @@ -1,85 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PSPVD_H -#define PXPVDSDK_PSPVD_H - -/** \addtogroup pvd -@{ -*/ -#include "pvd/PxPvd.h" -#include "PsBroadcast.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -class PxPvdTransport; - -#if !PX_DOXYGEN -namespace pvdsdk -{ -#endif - -class PvdDataStream; -class PvdClient; -class PvdOMMetaDataProvider; - -// PsPvd is used for advanced user, it support custom pvd client API -class PsPvd : public physx::PxPvd, public shdfnd::AllocationListener -{ - public: - virtual void addClient(PvdClient* client) = 0; - virtual void removeClient(PvdClient* client) = 0; - - virtual bool registerObject(const void* inItem) = 0; - virtual bool unRegisterObject(const void* inItem) = 0; - - //AllocationListener - void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory) = 0; - void onDeallocation(void* addr) = 0; - - virtual PvdOMMetaDataProvider& getMetaDataProvider() = 0; - - virtual uint64_t getNextStreamId() = 0; - // Call to flush events to PVD - virtual void flush() = 0; - -}; - -PX_PVDSDK_API void PX_CALL_CONV SetPvdAllocatorCallback(PxAllocatorCallback* inAllocatorCallback); - -#if !PX_DOXYGEN -} // namespace pvdsdk -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PSPVD_H diff --git a/PxShared/src/pvd/include/PxProfileAllocatorWrapper.h b/PxShared/src/pvd/include/PxProfileAllocatorWrapper.h deleted file mode 100644 index abac561..0000000 --- a/PxShared/src/pvd/include/PxProfileAllocatorWrapper.h +++ /dev/null @@ -1,231 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEALLOCATORWRAPPER_H -#define PXPVDSDK_PXPROFILEALLOCATORWRAPPER_H - -#include "foundation/PxPreprocessor.h" -#include "foundation/PxAllocatorCallback.h" -#include "foundation/PxErrorCallback.h" -#include "foundation/PxAssert.h" - -#include "PsArray.h" -#include "PsHashMap.h" - -namespace physx { namespace profile { - - /** - \brief Helper struct to encapsulate the user allocator callback - Useful for array and hash templates - */ - struct PxProfileAllocatorWrapper - { - PxAllocatorCallback* mUserAllocator; - - PxProfileAllocatorWrapper( PxAllocatorCallback& inUserAllocator ) - : mUserAllocator( &inUserAllocator ) - { - } - - PxProfileAllocatorWrapper( PxAllocatorCallback* inUserAllocator ) - : mUserAllocator( inUserAllocator ) - { - } - - PxAllocatorCallback& getAllocator() const - { - PX_ASSERT( NULL != mUserAllocator ); - return *mUserAllocator; - } - }; - - /** - \brief Helper class to encapsulate the reflection allocator - */ - template <typename T> - class PxProfileWrapperReflectionAllocator - { - static const char* getName() - { -#if PX_LINUX || PX_ANDROID || PX_PS4 || PX_IOS || PX_OSX || PX_EMSCRIPTEN || PX_SWITCH - return __PRETTY_FUNCTION__; -#else - return typeid(T).name(); -#endif - } - PxProfileAllocatorWrapper* mWrapper; - - public: - PxProfileWrapperReflectionAllocator(PxProfileAllocatorWrapper& inWrapper) : mWrapper( &inWrapper ) {} - PxProfileWrapperReflectionAllocator( const PxProfileWrapperReflectionAllocator& inOther ) - : mWrapper( inOther.mWrapper ) - { - } - PxProfileWrapperReflectionAllocator& operator=( const PxProfileWrapperReflectionAllocator& inOther ) - { - mWrapper = inOther.mWrapper; - return *this; - } - PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); } - void* allocate(size_t size, const char* filename, int line) - { -#if PX_CHECKED // checked and debug builds - if(!size) - return 0; - return getAllocator().allocate(size, getName(), filename, line); -#else - return getAllocator().allocate(size, "<no allocation names in this config>", filename, line); -#endif - } - void deallocate(void* ptr) - { - if(ptr) - getAllocator().deallocate(ptr); - } - }; - - /** - \brief Helper class to encapsulate the named allocator - */ - struct PxProfileWrapperNamedAllocator - { - PxProfileAllocatorWrapper* mWrapper; - const char* mAllocationName; - PxProfileWrapperNamedAllocator(PxProfileAllocatorWrapper& inWrapper, const char* inAllocationName) - : mWrapper( &inWrapper ) - , mAllocationName( inAllocationName ) - {} - PxProfileWrapperNamedAllocator( const PxProfileWrapperNamedAllocator& inOther ) - : mWrapper( inOther.mWrapper ) - , mAllocationName( inOther.mAllocationName ) - { - } - PxProfileWrapperNamedAllocator& operator=( const PxProfileWrapperNamedAllocator& inOther ) - { - mWrapper = inOther.mWrapper; - mAllocationName = inOther.mAllocationName; - return *this; - } - PxAllocatorCallback& getAllocator() { return mWrapper->getAllocator(); } - void* allocate(size_t size, const char* filename, int line) - { - if(!size) - return 0; - return getAllocator().allocate(size, mAllocationName, filename, line); - } - void deallocate(void* ptr) - { - if(ptr) - getAllocator().deallocate(ptr); - } - }; - - /** - \brief Helper struct to encapsulate the array - */ - template<class T> - struct PxProfileArray : public shdfnd::Array<T, PxProfileWrapperReflectionAllocator<T> > - { - typedef PxProfileWrapperReflectionAllocator<T> TAllocatorType; - - PxProfileArray( PxProfileAllocatorWrapper& inWrapper ) - : shdfnd::Array<T, TAllocatorType >( TAllocatorType( inWrapper ) ) - { - } - - PxProfileArray( const PxProfileArray< T >& inOther ) - : shdfnd::Array<T, TAllocatorType >( inOther, inOther ) - { - } - }; - - /** - \brief Helper struct to encapsulate the array - */ - template<typename TKeyType, typename TValueType, typename THashType=shdfnd::Hash<TKeyType> > - struct PxProfileHashMap : public shdfnd::HashMap<TKeyType, TValueType, THashType, PxProfileWrapperReflectionAllocator< TValueType > > - { - typedef shdfnd::HashMap<TKeyType, TValueType, THashType, PxProfileWrapperReflectionAllocator< TValueType > > THashMapType; - typedef PxProfileWrapperReflectionAllocator<TValueType> TAllocatorType; - PxProfileHashMap( PxProfileAllocatorWrapper& inWrapper ) - : THashMapType( TAllocatorType( inWrapper ) ) - { - } - }; - - /** - \brief Helper function to encapsulate the profile allocation - */ - template<typename TDataType> - inline TDataType* PxProfileAllocate( PxAllocatorCallback* inAllocator, const char* file, int inLine ) - { - PxProfileAllocatorWrapper wrapper( inAllocator ); - typedef PxProfileWrapperReflectionAllocator< TDataType > TAllocator; - TAllocator theAllocator( wrapper ); - return reinterpret_cast<TDataType*>( theAllocator.allocate( sizeof( TDataType ), file, inLine ) ); - } - - /** - \brief Helper function to encapsulate the profile allocation - */ - template<typename TDataType> - inline TDataType* PxProfileAllocate( PxAllocatorCallback& inAllocator, const char* file, int inLine ) - { - return PxProfileAllocate<TDataType>( &inAllocator, file, inLine ); - } - - /** - \brief Helper function to encapsulate the profile deallocation - */ - template<typename TDataType> - inline void PxProfileDeleteAndDeallocate( PxProfileAllocatorWrapper& inAllocator, TDataType* inDType ) - { - PX_ASSERT(inDType); - PxAllocatorCallback& allocator( inAllocator.getAllocator() ); - inDType->~TDataType(); - allocator.deallocate( inDType ); - } - - /** - \brief Helper function to encapsulate the profile deallocation - */ - template<typename TDataType> - inline void PxProfileDeleteAndDeallocate( PxAllocatorCallback& inAllocator, TDataType* inDType ) - { - PxProfileAllocatorWrapper wrapper( &inAllocator ); - PxProfileDeleteAndDeallocate( wrapper, inDType ); - } - -} } - -#define PX_PROFILE_NEW( allocator, dtype ) new (physx::profile::PxProfileAllocate<dtype>( allocator, __FILE__, __LINE__ )) dtype -#define PX_PROFILE_DELETE( allocator, obj ) physx::profile::PxProfileDeleteAndDeallocate( allocator, obj ); - -#endif // PXPVDSDK_PXPROFILEALLOCATORWRAPPER_H diff --git a/PxShared/src/pvd/include/PxPvdClient.h b/PxShared/src/pvd/include/PxPvdClient.h deleted file mode 100644 index fccf76d..0000000 --- a/PxShared/src/pvd/include/PxPvdClient.h +++ /dev/null @@ -1,77 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDCLIENT_H -#define PXPVDSDK_PXPVDCLIENT_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxFlags.h" -#include "foundation/PxVec3.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif - -class PvdDataStream; -class PvdUserRenderer; - -/** -\brief PvdClient is the per-client connection to PVD. -It provides callback when PVD is connected/disconnted. -It provides access to the internal object so that advanced users can create extension client. -*/ -class PvdClient -{ - public: - virtual PvdDataStream* getDataStream() = 0; - virtual PvdUserRenderer* getUserRender() = 0; - - virtual bool isConnected() const = 0; - virtual void onPvdConnected() = 0; - virtual void onPvdDisconnected() = 0; - virtual void flush() = 0; - - protected: - virtual ~PvdClient() - { - } -}; - -#if !PX_DOXYGEN -} // namespace pvdsdk -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDCLIENT_H diff --git a/PxShared/src/pvd/include/PxPvdDataStream.h b/PxShared/src/pvd/include/PxPvdDataStream.h deleted file mode 100644 index c47ef12..0000000 --- a/PxShared/src/pvd/include/PxPvdDataStream.h +++ /dev/null @@ -1,272 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#ifndef PXPVDSDK_PXPVDDATASTREAM_H -#define PXPVDSDK_PXPVDDATASTREAM_H - -/** \addtogroup pvd -@{ -*/ -#include "pvd/PxPvd.h" -#include "PxPvdErrorCodes.h" -#include "PxPvdObjectModelBaseTypes.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif - -class PvdPropertyDefinitionHelper; - -class PvdMetaDataStream -{ - protected: - virtual ~PvdMetaDataStream() - { - } - - public: - virtual PvdError createClass(const NamespacedName& nm) = 0; - template <typename TDataType> - PvdError createClass() - { - return createClass(getPvdNamespacedNameForType<TDataType>()); - } - - virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0; - template <typename TParentType, typename TChildType> - PvdError deriveClass() - { - return deriveClass(getPvdNamespacedNameForType<TParentType>(), getPvdNamespacedNameForType<TChildType>()); - } - - virtual bool isClassExist(const NamespacedName& nm) = 0; - template <typename TDataType> - bool isClassExist() - { - return isClassExist(getPvdNamespacedNameForType<TDataType>()); - } - - virtual PvdError createProperty(const NamespacedName& clsName, const char* name, const char* semantic, - const NamespacedName& dtypeName, PropertyType::Enum propertyType, - DataRef<NamedValue> values = DataRef<NamedValue>()) = 0; - template <typename TClsType, typename TDataType> - PvdError createProperty(String name, String semantic = "", PropertyType::Enum propertyType = PropertyType::Scalar, - DataRef<NamedValue> values = DataRef<NamedValue>()) - { - return createProperty(getPvdNamespacedNameForType<TClsType>(), name, semantic, - getPvdNamespacedNameForType<TDataType>(), propertyType, values); - } - - virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName, - DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes) = 0; - - template <typename TClsType, typename TMsgType> - PvdError createPropertyMessage(DataRef<PropertyMessageArg> entries) - { - return createPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(), - entries, sizeof(TMsgType)); - } -}; - -class PvdInstanceDataStream -{ - protected: - virtual ~PvdInstanceDataStream() - { - } - - public: - virtual PvdError createInstance(const NamespacedName& cls, const void* instance) = 0; - - template <typename TDataType> - PvdError createInstance(const TDataType* inst) - { - return createInstance(getPvdNamespacedNameForType<TDataType>(), inst); - } - virtual bool isInstanceValid(const void* instance) = 0; - - // If the property will fit or is already completely in memory - virtual PvdError setPropertyValue(const void* instance, String name, DataRef<const uint8_t> data, - const NamespacedName& incomingTypeName) = 0; - template <typename TDataType> - PvdError setPropertyValue(const void* instance, String name, const TDataType& value) - { - const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value); - return setPropertyValue(instance, name, DataRef<const uint8_t>(dataStart, dataStart + sizeof(TDataType)), - getPvdNamespacedNameForType<TDataType>()); - } - - template <typename TDataType> - PvdError setPropertyValue(const void* instance, String name, const TDataType* value, uint32_t numItems) - { - const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(value); - return setPropertyValue(instance, name, - DataRef<const uint8_t>(dataStart, dataStart + sizeof(TDataType) * numItems), - getPvdNamespacedNameForType<TDataType>()); - } - - // Else if the property is very large (contact reports) you can send it in chunks. - virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName) = 0; - - template <typename TDataType> - PvdError beginSetPropertyValue(const void* instance, String name) - { - return beginSetPropertyValue(instance, name, getPvdNamespacedNameForType<TDataType>()); - } - virtual PvdError appendPropertyValueData(DataRef<const uint8_t> data) = 0; - - template <typename TDataType> - PvdError appendPropertyValueData(const TDataType* value, uint32_t numItems) - { - const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(value); - return appendPropertyValueData(DataRef<const uint8_t>(dataStart, dataStart + numItems * sizeof(TDataType))); - } - - virtual PvdError endSetPropertyValue() = 0; - - // Set a set of properties to various values on an object. - - virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName, - DataRef<const uint8_t> data) = 0; - - template <typename TDataType> - PvdError setPropertyMessage(const void* instance, const TDataType& value) - { - const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value); - return setPropertyMessage(instance, getPvdNamespacedNameForType<TDataType>(), - DataRef<const uint8_t>(dataStart, sizeof(TDataType))); - } - // If you need to send of lot of identical messages, this avoids a hashtable lookup per message. - virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName) = 0; - - template <typename TDataType> - PvdError beginPropertyMessageGroup() - { - return beginPropertyMessageGroup(getPvdNamespacedNameForType<TDataType>()); - } - virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef<const uint8_t> data) = 0; - - template <typename TDataType> - PvdError sendPropertyMessageFromGroup(const void* instance, const TDataType& value) - { - const uint8_t* dataStart = reinterpret_cast<const uint8_t*>(&value); - return sendPropertyMessageFromGroup(instance, DataRef<const uint8_t>(dataStart, sizeof(TDataType))); - } - - virtual PvdError endPropertyMessageGroup() = 0; - - // These functions ensure the target array doesn't contain duplicates - virtual PvdError pushBackObjectRef(const void* instId, String propName, const void* objRef) = 0; - virtual PvdError removeObjectRef(const void* instId, String propName, const void* objRef) = 0; - - // Instance elimination. - virtual PvdError destroyInstance(const void* key) = 0; - - // Profiling hooks - virtual PvdError beginSection(const void* instance, String name) = 0; - virtual PvdError endSection(const void* instance, String name) = 0; - - // Origin Shift - virtual PvdError originShift(const void* scene, PxVec3 shift) = 0; - - public: - /*For some cases, pvd command cannot be run immediately. For example, when create joints, while the actors may still - *pending for insert, the joints update commands can be run deffered. - */ - class PvdCommand - { - public: - // Assigned is needed for copying - PvdCommand(const PvdCommand&) - { - } - PvdCommand& operator=(const PvdCommand&) - { - return *this; - } - - public: - PvdCommand() - { - } - virtual ~PvdCommand() - { - } - - // Not pure virtual so can have default PvdCommand obj - virtual bool canRun(PvdInstanceDataStream&) - { - return false; - } - virtual void run(PvdInstanceDataStream&) - { - } - }; - - // PVD SDK provide this helper function to allocate cmd's memory and release them at after flush the command queue - virtual void* allocateMemForCmd(uint32_t length) = 0; - - // PVD will call the destructor of PvdCommand object at the end fo flushPvdCommand - virtual void pushPvdCommand(PvdCommand& cmd) = 0; - virtual void flushPvdCommand() = 0; -}; - -class PvdDataStream : public PvdInstanceDataStream, public PvdMetaDataStream -{ - protected: - virtual ~PvdDataStream() - { - } - - public: - virtual void release() = 0; - virtual bool isConnected() = 0; - - virtual void addProfileZone(void* zone, const char* name) = 0; - virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled) = 0; - - virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper() = 0; - - virtual void setIsTopLevelUIElement(const void* instance, bool topLevel) = 0; - virtual void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line) = 0; - virtual void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) = 0; - -/** - \brief Create a new PvdDataStream. - \param pvd A pointer to a valid PxPvd instance. This must be non-null. -*/ - PX_PVDSDK_API static PvdDataStream* create(PxPvd* pvd); -}; -#if !PX_DOXYGEN -} // pvdsdk -} // physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDDATASTREAM_H diff --git a/PxShared/src/pvd/include/PxPvdDataStreamHelpers.h b/PxShared/src/pvd/include/PxPvdDataStreamHelpers.h deleted file mode 100644 index 7b47db5..0000000 --- a/PxShared/src/pvd/include/PxPvdDataStreamHelpers.h +++ /dev/null @@ -1,120 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#ifndef PXPVDSDK_PXPVDDATASTREAMHELPERS_H -#define PXPVDSDK_PXPVDDATASTREAMHELPERS_H - -/** \addtogroup pvd -@{ -*/ -#include "PxPvdObjectModelBaseTypes.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif - -class PvdPropertyDefinitionHelper -{ - protected: - virtual ~PvdPropertyDefinitionHelper() - { - } - - public: - /** - Push a name c such that it appends such as a.b.c. - */ - virtual void pushName(const char* inName, const char* inAppendStr = ".") = 0; - /** - Push a name c such that it appends like a.b[c] - */ - virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") = 0; - /** - * Pop the current name - */ - virtual void popName() = 0; - - virtual void clearNameStack() = 0; - /** - * Get the current name at the top of the name stack. - * Would return "a.b.c" or "a.b[c]" in the above examples. - */ - virtual const char* getTopName() = 0; - - virtual void addNamedValue(const char* name, uint32_t value) = 0; - virtual void clearNamedValues() = 0; - virtual DataRef<NamedValue> getNamedValues() = 0; - - /** - * Define a property using the top of the name stack and the passed-in semantic - */ - virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName, - PropertyType::Enum propType = PropertyType::Scalar) = 0; - - template <typename TClsType, typename TDataType> - void createProperty(const char* inSemantic = "", PropertyType::Enum propType = PropertyType::Scalar) - { - createProperty(getPvdNamespacedNameForType<TClsType>(), inSemantic, getPvdNamespacedNameForType<TDataType>(), - propType); - } - - // The datatype used for instances needs to be pointer unless you actually have pvdsdk::InstanceId members on your - // value structs. - virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) = 0; - - template <typename TDataType> - void addPropertyMessageArg(uint32_t offset) - { - addPropertyMessageArg(getPvdNamespacedNameForType<TDataType>(), offset, static_cast<uint32_t>(sizeof(TDataType))); - } - virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName, - uint32_t inStructSizeInBytes) = 0; - template <typename TClsType, typename TMsgType> - void addPropertyMessage() - { - addPropertyMessage(getPvdNamespacedNameForType<TClsType>(), getPvdNamespacedNameForType<TMsgType>(), - static_cast<uint32_t>(sizeof(TMsgType))); - } - virtual void clearPropertyMessageArgs() = 0; - - void clearBufferedData() - { - clearNameStack(); - clearPropertyMessageArgs(); - clearNamedValues(); - } -}; - -#if !PX_DOXYGEN -} // pvdsdk -} // physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDDATASTREAMHELPERS_H diff --git a/PxShared/src/pvd/include/PxPvdErrorCodes.h b/PxShared/src/pvd/include/PxPvdErrorCodes.h deleted file mode 100644 index ae17a6f..0000000 --- a/PxShared/src/pvd/include/PxPvdErrorCodes.h +++ /dev/null @@ -1,62 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#ifndef PXPVDSDK_PXPVDERRORCODES_H -#define PXPVDSDK_PXPVDERRORCODES_H - -/** \addtogroup pvd -@{ -*/ - -#include "foundation/Px.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif - -struct PvdErrorType -{ - enum Enum - { - Success = 0, - NetworkError, - ArgumentError, - Disconnect, - InternalProblem - }; -}; - -typedef PvdErrorType::Enum PvdError; - -#if !PX_DOXYGEN -} -} -#endif -/** @} */ -#endif // PXPVDSDK_PXPVDERRORCODES_H diff --git a/PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h b/PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h deleted file mode 100644 index f65e581..0000000 --- a/PxShared/src/pvd/include/PxPvdObjectModelBaseTypes.h +++ /dev/null @@ -1,428 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDOBJECTMODELBASETYPES_H -#define PXPVDSDK_PXPVDOBJECTMODELBASETYPES_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxAssert.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif - -using namespace physx; - -inline const char* nonNull(const char* str) -{ - return str ? str : ""; -} -// strcmp will crash if passed a null string, however, -// so we need to make sure that doesn't happen. We do that -// by equating NULL and the empty string, "". -inline bool safeStrEq(const char* lhs, const char* rhs) -{ - return ::strcmp(nonNull(lhs), nonNull(rhs)) == 0; -} - -// Does this string have useful information in it. -inline bool isMeaningful(const char* str) -{ - return *(nonNull(str)) > 0; -} - -inline uint32_t safeStrLen(const char* str) -{ - str = nonNull(str); - return static_cast<uint32_t>(strlen(str)); -} - -struct ObjectRef -{ - int32_t mInstanceId; - - ObjectRef(int32_t iid = -1) : mInstanceId(iid) - { - } - operator int32_t() const - { - return mInstanceId; - } - bool hasValue() const - { - return mInstanceId > 0; - } -}; - -struct U32Array4 -{ - uint32_t mD0; - uint32_t mD1; - uint32_t mD2; - uint32_t mD3; - U32Array4(uint32_t d0, uint32_t d1, uint32_t d2, uint32_t d3) : mD0(d0), mD1(d1), mD2(d2), mD3(d3) - { - } - U32Array4() : mD0(0), mD1(0), mD2(0), mD3(0) - { - } -}; - -typedef bool PvdBool; -typedef const char* String; -typedef void* VoidPtr; -typedef double PvdF64; -typedef float PvdF32; -typedef int64_t PvdI64; -typedef uint64_t PvdU64; -typedef int32_t PvdI32; -typedef uint32_t PvdU32; -typedef int16_t PvdI16; -typedef uint16_t PvdU16; -typedef int8_t PvdI8; -typedef uint8_t PvdU8; - -struct PvdColor -{ - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; - PvdColor(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a = 255) : r(_r), g(_g), b(_b), a(_a) - { - } - PvdColor() : r(0), g(0), b(0), a(255) - { - } - PvdColor(uint32_t abgr) - { - uint8_t* valPtr = reinterpret_cast<uint8_t*>(&abgr); - r = valPtr[0]; - g = valPtr[1]; - b = valPtr[2]; - a = valPtr[3]; - } -}; - -struct StringHandle -{ - uint32_t mHandle; - StringHandle(uint32_t val = 0) : mHandle(val) - { - } - operator uint32_t() const - { - return mHandle; - } -}; - -#define DECLARE_TYPES \ -DECLARE_BASE_PVD_TYPE(PvdI8) \ -DECLARE_BASE_PVD_TYPE(PvdU8) \ -DECLARE_BASE_PVD_TYPE(PvdI16) \ -DECLARE_BASE_PVD_TYPE(PvdU16) \ -DECLARE_BASE_PVD_TYPE(PvdI32) \ -DECLARE_BASE_PVD_TYPE(PvdU32) \ -DECLARE_BASE_PVD_TYPE(PvdI64) \ -DECLARE_BASE_PVD_TYPE(PvdU64) \ -DECLARE_BASE_PVD_TYPE(PvdF32) \ -DECLARE_BASE_PVD_TYPE(PvdF64) \ -DECLARE_BASE_PVD_TYPE(PvdBool) \ -DECLARE_BASE_PVD_TYPE(PvdColor) \ -DECLARE_BASE_PVD_TYPE(String) \ -DECLARE_BASE_PVD_TYPE(StringHandle) \ -DECLARE_BASE_PVD_TYPE(ObjectRef) \ -DECLARE_BASE_PVD_TYPE(VoidPtr) \ -DECLARE_BASE_PVD_TYPE(PxVec2) \ -DECLARE_BASE_PVD_TYPE(PxVec3) \ -DECLARE_BASE_PVD_TYPE(PxVec4) \ -DECLARE_BASE_PVD_TYPE(PxBounds3) \ -DECLARE_BASE_PVD_TYPE(PxQuat) \ -DECLARE_BASE_PVD_TYPE(PxTransform) \ -DECLARE_BASE_PVD_TYPE(PxMat33) \ -DECLARE_BASE_PVD_TYPE(PxMat44) \ -DECLARE_BASE_PVD_TYPE(U32Array4) - -struct PvdBaseType -{ - enum Enum - { - None = 0, - InternalStart = 1, - InternalStop = 64, -#define DECLARE_BASE_PVD_TYPE(type) type, - DECLARE_TYPES - Last -#undef DECLARE_BASE_PVD_TYPE - }; -}; -struct NamespacedName -{ - String mNamespace; - String mName; - NamespacedName(String ns, String nm) : mNamespace(ns), mName(nm) - { - } - NamespacedName(String nm = "") : mNamespace(""), mName(nm) - { - } - bool operator==(const NamespacedName& other) const - { - return safeStrEq(mNamespace, other.mNamespace) && safeStrEq(mName, other.mName); - } -}; - -struct NamedValue -{ - String mName; - uint32_t mValue; - NamedValue(String nm = "", uint32_t val = 0) : mName(nm), mValue(val) - { - } -}; - -template <typename T> -struct BaseDataTypeToTypeMap -{ - bool compile_error; -}; -template <PvdBaseType::Enum> -struct BaseTypeToDataTypeMap -{ - bool compile_error; -}; - -// Users can extend this mapping with new datatypes. -template <typename T> -struct PvdDataTypeToNamespacedNameMap -{ - bool Name; -}; -// This mapping tells you the what class id to use for the base datatypes -// -#define DECLARE_BASE_PVD_TYPE(type) \ - template <> \ - struct BaseDataTypeToTypeMap<type> \ - { \ - enum Enum \ - { \ - BaseTypeEnum = PvdBaseType::type \ - }; \ - }; \ - template <> \ - struct BaseDataTypeToTypeMap<const type&> \ - { \ - enum Enum \ - { \ - BaseTypeEnum = PvdBaseType::type \ - }; \ - }; \ - template <> \ - struct BaseTypeToDataTypeMap<PvdBaseType::type> \ - { \ - typedef type TDataType; \ - }; \ - template <> \ - struct PvdDataTypeToNamespacedNameMap<type> \ - { \ - NamespacedName Name; \ - PvdDataTypeToNamespacedNameMap<type>() : Name("physx3", #type) \ - { \ - } \ - }; \ - template <> \ - struct PvdDataTypeToNamespacedNameMap<const type&> \ - { \ - NamespacedName Name; \ - PvdDataTypeToNamespacedNameMap<const type&>() : Name("physx3", #type) \ - { \ - } \ - }; - -DECLARE_TYPES -#undef DECLARE_BASE_PVD_TYPE - -template <typename TDataType> -inline int32_t getPvdTypeForType() -{ - return static_cast<PvdBaseType::Enum>(BaseDataTypeToTypeMap<TDataType>::BaseTypeEnum); -} -template <typename TDataType> -inline NamespacedName getPvdNamespacedNameForType() -{ - return PvdDataTypeToNamespacedNameMap<TDataType>().Name; -} - -#define DEFINE_PVD_TYPE_NAME_MAP(type, ns, name) \ - template <> \ - struct PvdDataTypeToNamespacedNameMap<type> \ - { \ - NamespacedName Name; \ - PvdDataTypeToNamespacedNameMap<type>() : Name(ns, name) \ - { \ - } \ - }; - -#define DEFINE_PVD_TYPE_ALIAS(newType, oldType) \ - template <> \ - struct PvdDataTypeToNamespacedNameMap<newType> \ - { \ - NamespacedName Name; \ - PvdDataTypeToNamespacedNameMap<newType>() : Name(PvdDataTypeToNamespacedNameMap<oldType>().Name) \ - { \ - } \ - }; - -DEFINE_PVD_TYPE_ALIAS(const void*, void*) - -struct ArrayData -{ - uint8_t* mBegin; - uint8_t* mEnd; - uint8_t* mCapacity; //>= stop - ArrayData(uint8_t* beg = NULL, uint8_t* end = NULL, uint8_t* cap = NULL) : mBegin(beg), mEnd(end), mCapacity(cap) - { - } - uint8_t* begin() - { - return mBegin; - } - uint8_t* end() - { - return mEnd; - } - uint32_t byteCapacity() - { - return static_cast<uint32_t>(mCapacity - mBegin); - } - uint32_t byteSize() const - { - return static_cast<uint32_t>(mEnd - mBegin); - } // in bytes - uint32_t numberOfItems(uint32_t objectByteSize) - { - if(objectByteSize) - return byteSize() / objectByteSize; - return 0; - } - - void forgetData() - { - mBegin = mEnd = mCapacity = 0; - } -}; - -template <typename T> -class DataRef -{ - const T* mBegin; - const T* mEnd; - - public: - DataRef(const T* b, uint32_t count) : mBegin(b), mEnd(b + count) - { - } - DataRef(const T* b = NULL, const T* e = NULL) : mBegin(b), mEnd(e) - { - } - DataRef(const DataRef& o) : mBegin(o.mBegin), mEnd(o.mEnd) - { - } - DataRef& operator=(const DataRef& o) - { - mBegin = o.mBegin; - mEnd = o.mEnd; - return *this; - } - uint32_t size() const - { - return static_cast<uint32_t>(mEnd - mBegin); - } - const T* begin() const - { - return mBegin; - } - const T* end() const - { - return mEnd; - } - const T& operator[](uint32_t idx) const - { - PX_ASSERT(idx < size()); - return mBegin[idx]; - } - const T& back() const - { - PX_ASSERT(mEnd > mBegin); - return *(mEnd - 1); - } -}; - -struct PropertyType -{ - enum Enum - { - Unknown = 0, - Scalar, - Array - }; -}; - -// argument to the create property message function -struct PropertyMessageArg -{ - String mPropertyName; - NamespacedName mDatatypeName; - // where in the message this property starts. - uint32_t mMessageOffset; - // size of this entry object - uint32_t mByteSize; - - PropertyMessageArg(String propName, NamespacedName dtype, uint32_t msgOffset, uint32_t byteSize) - : mPropertyName(propName), mDatatypeName(dtype), mMessageOffset(msgOffset), mByteSize(byteSize) - { - } - PropertyMessageArg() : mPropertyName(""), mMessageOffset(0), mByteSize(0) - { - } -}; - -class PvdUserRenderer; -DEFINE_PVD_TYPE_NAME_MAP(PvdUserRenderer, "_debugger_", "PvdUserRenderer") - -#if !PX_DOXYGEN -} -} -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDOBJECTMODELBASETYPES_H diff --git a/PxShared/src/pvd/include/PxPvdRenderBuffer.h b/PxShared/src/pvd/include/PxPvdRenderBuffer.h deleted file mode 100644 index 58c8d51..0000000 --- a/PxShared/src/pvd/include/PxPvdRenderBuffer.h +++ /dev/null @@ -1,140 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDRENDERBUFFER_H -#define PXPVDSDK_PXPVDRENDERBUFFER_H - -/** \addtogroup pvd -@{ -*/ - -#include "foundation/PxVec3.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif - -/** -\brief Default color values used for debug rendering. -*/ -struct PvdDebugColor -{ - enum Enum - { - eARGB_BLACK = 0xff000000, - eARGB_RED = 0xffff0000, - eARGB_GREEN = 0xff00ff00, - eARGB_BLUE = 0xff0000ff, - eARGB_YELLOW = 0xffffff00, - eARGB_MAGENTA = 0xffff00ff, - eARGB_CYAN = 0xff00ffff, - eARGB_WHITE = 0xffffffff, - eARGB_GREY = 0xff808080, - eARGB_DARKRED = 0x88880000, - eARGB_DARKGREEN = 0x88008800, - eARGB_DARKBLUE = 0x88000088 - }; -}; - -/** -\brief Used to store a single point and colour for debug rendering. -*/ -struct PvdDebugPoint -{ - PvdDebugPoint(const PxVec3& p, const uint32_t& c) : pos(p), color(c) - { - } - - PxVec3 pos; - uint32_t color; -}; - -/** -\brief Used to store a single line and colour for debug rendering. -*/ -struct PvdDebugLine -{ - PvdDebugLine(const PxVec3& p0, const PxVec3& p1, const uint32_t& c) : pos0(p0), color0(c), pos1(p1), color1(c) - { - } - - PxVec3 pos0; - uint32_t color0; - PxVec3 pos1; - uint32_t color1; -}; - -/** -\brief Used to store a single triangle and colour for debug rendering. -*/ -struct PvdDebugTriangle -{ - PvdDebugTriangle(const PxVec3& p0, const PxVec3& p1, const PxVec3& p2, const uint32_t& c) - : pos0(p0), color0(c), pos1(p1), color1(c), pos2(p2), color2(c) - { - } - - PxVec3 pos0; - uint32_t color0; - PxVec3 pos1; - uint32_t color1; - PxVec3 pos2; - uint32_t color2; -}; - -/** -\brief Used to store a text for debug rendering. Doesn't own 'string' array. -*/ -struct PvdDebugText -{ - PvdDebugText() : string(0) - { - } - - PvdDebugText(const PxVec3& p, const float& s, const uint32_t& c, const char* str) - : position(p), size(s), color(c), string(str) - { - } - - PxVec3 position; - float size; - uint32_t color; - const char* string; -}; - -#if !PX_DOXYGEN -} -} // namespace physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDRENDERBUFFER_H diff --git a/PxShared/src/pvd/include/PxPvdUserRenderer.h b/PxShared/src/pvd/include/PxPvdUserRenderer.h deleted file mode 100644 index ac6f26d..0000000 --- a/PxShared/src/pvd/include/PxPvdUserRenderer.h +++ /dev/null @@ -1,107 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#ifndef PXPVDSDK_PXPVDUSERRENDERER_H -#define PXPVDSDK_PXPVDUSERRENDERER_H - -/** \addtogroup pvd -@{ -*/ -#include "foundation/PxVec3.h" -#include "foundation/PxTransform.h" -#include "pvd/PxPvd.h" - -#include "PxPvdDataStream.h" -#include "PxPvdRenderBuffer.h" -#include "PsUserAllocated.h" - -#if !PX_DOXYGEN -namespace physx -{ -#endif - -class PxPvd; - -#if !PX_DOXYGEN -namespace pvdsdk -{ -#endif - -class RendererEventClient; - -class PvdUserRenderer : public shdfnd::UserAllocated -{ - protected: - virtual ~PvdUserRenderer() - { - } - - public: - virtual void release() = 0; - virtual void setClient(RendererEventClient* client) = 0; - - // Instance to associate the further rendering with. - virtual void setInstanceId(const void* instanceId) = 0; - // Draw these points associated with this instance - virtual void drawPoints(const PvdDebugPoint* points, uint32_t count) = 0; - // Draw these lines associated with this instance - virtual void drawLines(const PvdDebugLine* lines, uint32_t count) = 0; - // Draw these triangles associated with this instance - virtual void drawTriangles(const PvdDebugTriangle* triangles, uint32_t count) = 0; - // Draw this text associated with this instance - virtual void drawText(const PvdDebugText& text) = 0; - - // Draw SDK debug render - virtual void drawRenderbuffer(const PvdDebugPoint* pointData, uint32_t pointCount, const PvdDebugLine* lineData, - uint32_t lineCount, const PvdDebugTriangle* triangleData, uint32_t triangleCount) = 0; - - // Constraint visualization routines - virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) = 0; - virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value, bool active) = 0; - virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper, bool active) = 0; - virtual void visualizeLimitCone(const PxTransform& t, float ySwing, float zSwing, bool active) = 0; - virtual void visualizeDoubleCone(const PxTransform& t, float angle, bool active) = 0; - - // Clear the immedate buffer. - virtual void flushRenderEvents() = 0; - - PX_PVDSDK_API static PvdUserRenderer* create(uint32_t bufferSize = 0x2000); -}; - -class RendererEventClient -{ - public: - virtual ~RendererEventClient(){} - - virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) = 0; -}; - -#if !PX_DOXYGEN -} -} -#endif -/** @} */ -#endif // PXPVDSDK_PXPVDUSERRENDERER_H diff --git a/PxShared/src/pvd/src/PxProfileBase.h b/PxShared/src/pvd/src/PxProfileBase.h deleted file mode 100644 index 52918a1..0000000 --- a/PxShared/src/pvd/src/PxProfileBase.h +++ /dev/null @@ -1,35 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEBASE_H -#define PXPVDSDK_PXPROFILEBASE_H - -#include "foundation/PxSimpleTypes.h" - -#define PX_PROFILE_POINTER_TO_U64( pointer ) static_cast<uint64_t>(reinterpret_cast<size_t>(pointer)) - -#endif // PXPVDSDK_PXPROFILEBASE_H diff --git a/PxShared/src/pvd/src/PxProfileCompileTimeEventFilter.h b/PxShared/src/pvd/src/PxProfileCompileTimeEventFilter.h deleted file mode 100644 index 428374e..0000000 --- a/PxShared/src/pvd/src/PxProfileCompileTimeEventFilter.h +++ /dev/null @@ -1,75 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILECOMPILETIMEEVENTFILTER_H -#define PXPVDSDK_PXPROFILECOMPILETIMEEVENTFILTER_H - -#include "PxProfileBase.h" -#include "PxProfileEventId.h" - -//Define before including header in order to enable a different -//compile time event profile threshold. -#ifndef PX_PROFILE_EVENT_PROFILE_THRESHOLD -#define PX_PROFILE_EVENT_PROFILE_THRESHOLD EventPriorities::Medium -#endif - -namespace physx { namespace profile { - - /** - \brief Profile event priorities. Used to filter out events. - */ - struct EventPriorities - { - enum Enum - { - None, // the filter setting to kill all events - Coarse, - Medium, - Detail, - Never // the priority to set for an event if it should never fire. - }; - }; - - /** - \brief Gets the priority for a given event. - Specialize this object in order to get the priorities setup correctly. - */ - template<uint16_t TEventId> - struct EventPriority { static const uint32_t val = EventPriorities::Medium; }; - - /** - \brief Filter events by given event priority and set threshold. - */ - template<uint16_t TEventId> - struct EventFilter - { - static const bool val = EventPriority<TEventId>::val <= PX_PROFILE_EVENT_PROFILE_THRESHOLD; - }; - -}} - -#endif // PXPVDSDK_PXPROFILECOMPILETIMEEVENTFILTER_H diff --git a/PxShared/src/pvd/src/PxProfileContextProvider.h b/PxShared/src/pvd/src/PxProfileContextProvider.h deleted file mode 100644 index 44f6b94..0000000 --- a/PxShared/src/pvd/src/PxProfileContextProvider.h +++ /dev/null @@ -1,98 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILECONTEXTPROVIDER_H -#define PXPVDSDK_PXPROFILECONTEXTPROVIDER_H - -#include "PxProfileBase.h" - -namespace physx { namespace profile { - - struct PxProfileEventExecutionContext - { - uint32_t mThreadId; - uint8_t mCpuId; - uint8_t mThreadPriority; - - PxProfileEventExecutionContext( uint32_t inThreadId = 0, uint8_t inThreadPriority = 2 /*eThreadPriorityNormal*/, uint8_t inCpuId = 0 ) - : mThreadId( inThreadId ) - , mCpuId( inCpuId ) - , mThreadPriority( inThreadPriority ) - { - } - - bool operator==( const PxProfileEventExecutionContext& inOther ) const - { - return mThreadId == inOther.mThreadId - && mCpuId == inOther.mCpuId - && mThreadPriority == inOther.mThreadPriority; - } - }; - - //Provides the context in which the event is happening. - class PxProfileContextProvider - { - protected: - virtual ~PxProfileContextProvider(){} - public: - virtual PxProfileEventExecutionContext getExecutionContext() = 0; - virtual uint32_t getThreadId() = 0; - }; - //Provides pre-packaged context. - struct PxProfileTrivialContextProvider - { - PxProfileEventExecutionContext mContext; - PxProfileTrivialContextProvider( PxProfileEventExecutionContext inContext = PxProfileEventExecutionContext() ) - : mContext( inContext ) - { - } - PxProfileEventExecutionContext getExecutionContext() { return mContext; } - uint32_t getThreadId() { return mContext.mThreadId; } - }; - - //Forwards the get context calls to another (perhaps shared) context. - template<typename TProviderType> - struct PxProfileContextProviderForward - { - TProviderType* mProvider; - PxProfileContextProviderForward( TProviderType* inProvider ) : mProvider( inProvider ) {} - PxProfileEventExecutionContext getExecutionContext() { return mProvider->getExecutionContext(); } - uint32_t getThreadId() { return mProvider->getThreadId(); } - }; - - template<typename TProviderType> - struct PxProfileContextProviderImpl : public PxProfileContextProvider - { - PxProfileContextProviderForward<TProviderType> mContext; - PxProfileContextProviderImpl( TProviderType* inP ) : mContext( inP ) {} - PxProfileEventExecutionContext getExecutionContext() { return mContext.getExecutionContext(); } - uint32_t getThreadId() { return mContext.getThreadId(); } - }; - -} } - -#endif // PXPVDSDK_PXPROFILECONTEXTPROVIDER_H diff --git a/PxShared/src/pvd/src/PxProfileContextProviderImpl.h b/PxShared/src/pvd/src/PxProfileContextProviderImpl.h deleted file mode 100644 index bc5f09f..0000000 --- a/PxShared/src/pvd/src/PxProfileContextProviderImpl.h +++ /dev/null @@ -1,52 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILECONTEXTPROVIDERIMPL_H -#define PXPVDSDK_PXPROFILECONTEXTPROVIDERIMPL_H - -#include "PxProfileContextProvider.h" - -#include "PsThread.h" - -namespace physx { namespace profile { - - struct PxDefaultContextProvider - { - PxProfileEventExecutionContext getExecutionContext() - { - shdfnd::Thread::Id theId( shdfnd::Thread::getId() ); - return PxProfileEventExecutionContext( static_cast<uint32_t>( theId ), static_cast<uint8_t>( shdfnd::ThreadPriority::eNORMAL ), 0 ); - } - - uint32_t getThreadId() - { - return static_cast<uint32_t>( shdfnd::Thread::getId() ); - } - }; -} } - -#endif // PXPVDSDK_PXPROFILECONTEXTPROVIDERIMPL_H diff --git a/PxShared/src/pvd/src/PxProfileDataBuffer.h b/PxShared/src/pvd/src/PxProfileDataBuffer.h deleted file mode 100644 index 2191519..0000000 --- a/PxShared/src/pvd/src/PxProfileDataBuffer.h +++ /dev/null @@ -1,167 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEDATABUFFER_H -#define PXPVDSDK_PXPROFILEDATABUFFER_H - -#include "PxProfileAllocatorWrapper.h" -#include "PxProfileMemoryBuffer.h" -#include "PxProfileEventBufferClient.h" - -namespace physx { namespace profile { - - template<typename TMutex - , typename TScopedLock> - class DataBuffer //base class for buffers that cache data and then dump the data to clients. - { - public: - typedef TMutex TMutexType; - typedef TScopedLock TScopedLockType; - typedef PxProfileWrapperNamedAllocator TU8AllocatorType; - - typedef MemoryBuffer<TU8AllocatorType > TMemoryBufferType; - typedef PxProfileArray<PxProfileEventBufferClient*> TBufferClientArray; - - protected: - - PxProfileAllocatorWrapper mWrapper; - TMemoryBufferType mDataArray; - TBufferClientArray mClients; - uint32_t mBufferFullAmount; - EventContextInformation mEventContextInformation; - TMutexType* mBufferMutex; - volatile bool mHasClients; - EventSerializer<TMemoryBufferType > mSerializer; - - public: - - DataBuffer( PxAllocatorCallback* inFoundation - , uint32_t inBufferFullAmount - , TMutexType* inBufferMutex - , const char* inAllocationName ) - : mWrapper( inFoundation ) - , mDataArray( TU8AllocatorType( mWrapper, inAllocationName ) ) - , mClients( mWrapper ) - , mBufferFullAmount( inBufferFullAmount ) - , mBufferMutex( inBufferMutex ) - , mHasClients( false ) - , mSerializer( &mDataArray ) - { - //The data array is never resized really. We ensure - //it is bigger than it will ever need to be. - mDataArray.reserve( inBufferFullAmount + 68 ); - } - - virtual ~DataBuffer() - { - while( mClients.size() ) - { - removeClient( *mClients[0] ); - } - } - - PxProfileAllocatorWrapper& getWrapper() { return mWrapper; } - TMutexType* getBufferMutex() { return mBufferMutex; } - void setBufferMutex(TMutexType* mutex) { mBufferMutex = mutex; } - - void addClient( PxProfileEventBufferClient& inClient ) - { - TScopedLockType lock( mBufferMutex ); - mClients.pushBack( &inClient ); - mHasClients = true; - } - - void removeClient( PxProfileEventBufferClient& inClient ) - { - TScopedLockType lock( mBufferMutex ); - for ( uint32_t idx =0; idx < mClients.size(); ++idx ) - { - if ( mClients[idx] == &inClient ) - { - inClient.handleClientRemoved(); - mClients.replaceWithLast( idx ); - break; - } - } - mHasClients = mClients.size() != 0; - } - - - bool hasClients() const - { - return mHasClients; - } - - virtual void flushEvents() - { - TScopedLockType lock(mBufferMutex); - const uint8_t* theData = mDataArray.begin(); - uint32_t theDataSize = mDataArray.size(); - sendDataToClients(theData, theDataSize); - mDataArray.clear(); - clearCachedData(); - } - - //Used for chaining together event buffers. - virtual void handleBufferFlush( const uint8_t* inData, uint32_t inDataSize ) - { - TScopedLockType lock( mBufferMutex ); - if ( inData && inDataSize ) - { - clearCachedData(); - if ( mDataArray.size() + inDataSize >= mBufferFullAmount ) - flushEvents(); - if ( inDataSize >= mBufferFullAmount ) - sendDataToClients( inData, inDataSize ); - else - mDataArray.write( inData, inDataSize ); - } - } - - protected: - virtual void clearCachedData() - { - } - - private: - - void sendDataToClients( const uint8_t* inData, uint32_t inDataSize ) - { - uint32_t clientCount = mClients.size(); - for( uint32_t idx =0; idx < clientCount; ++idx ) - mClients[idx]->handleBufferFlush( inData, inDataSize ); - } - - }; - -}} - - -#endif // PXPVDSDK_PXPROFILEDATABUFFER_H diff --git a/PxShared/src/pvd/src/PxProfileDataParsing.h b/PxShared/src/pvd/src/PxProfileDataParsing.h deleted file mode 100644 index e7fa0df..0000000 --- a/PxShared/src/pvd/src/PxProfileDataParsing.h +++ /dev/null @@ -1,218 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEDATAPARSING_H -#define PXPVDSDK_PXPROFILEDATAPARSING_H - -#include "PxProfileBase.h" - -namespace physx { namespace profile { - - //Converts datatypes without using type punning. - struct BlockParserDataConverter - { - union - { - uint8_t mU8[8]; - uint16_t mU16[4]; - uint32_t mU32[2]; - uint64_t mU64[1]; - - int8_t mI8[8]; - int16_t mI16[4]; - int32_t mI32[2]; - int64_t mI64[1]; - - - float mF32[2]; - double mF64[1]; - }; - - template<typename TDataType> inline TDataType convert() { PX_ASSERT( false ); return TDataType(); } - - template<typename TDataType> - inline void convert( const TDataType& ) {} - }; - - template<> inline uint8_t BlockParserDataConverter::convert<uint8_t>() { return mU8[0]; } - template<> inline uint16_t BlockParserDataConverter::convert<uint16_t>() { return mU16[0]; } - template<> inline uint32_t BlockParserDataConverter::convert<uint32_t>() { return mU32[0]; } - template<> inline uint64_t BlockParserDataConverter::convert<uint64_t>() { return mU64[0]; } - template<> inline int8_t BlockParserDataConverter::convert<int8_t>() { return mI8[0]; } - template<> inline int16_t BlockParserDataConverter::convert<int16_t>() { return mI16[0]; } - template<> inline int32_t BlockParserDataConverter::convert<int32_t>() { return mI32[0]; } - template<> inline int64_t BlockParserDataConverter::convert<int64_t>() { return mI64[0]; } - template<> inline float BlockParserDataConverter::convert<float>() { return mF32[0]; } - template<> inline double BlockParserDataConverter::convert<double>() { return mF64[0]; } - - template<> inline void BlockParserDataConverter::convert<uint8_t>( const uint8_t& inData ) { mU8[0] = inData; } - template<> inline void BlockParserDataConverter::convert<uint16_t>( const uint16_t& inData ) { mU16[0] = inData; } - template<> inline void BlockParserDataConverter::convert<uint32_t>( const uint32_t& inData ) { mU32[0] = inData; } - template<> inline void BlockParserDataConverter::convert<uint64_t>( const uint64_t& inData ) { mU64[0] = inData; } - template<> inline void BlockParserDataConverter::convert<int8_t>( const int8_t& inData ) { mI8[0] = inData; } - template<> inline void BlockParserDataConverter::convert<int16_t>( const int16_t& inData ) { mI16[0] = inData; } - template<> inline void BlockParserDataConverter::convert<int32_t>( const int32_t& inData ) { mI32[0] = inData; } - template<> inline void BlockParserDataConverter::convert<int64_t>( const int64_t& inData ) { mI64[0] = inData; } - template<> inline void BlockParserDataConverter::convert<float>( const float& inData ) { mF32[0] = inData; } - template<> inline void BlockParserDataConverter::convert<double>( const double& inData ) { mF64[0] = inData; } - - - //Handles various details around parsing blocks of uint8_t data. - struct BlockParseFunctions - { - template<uint8_t ByteCount> - static inline void swapBytes( uint8_t* inData ) - { - for ( uint32_t idx = 0; idx < ByteCount/2; ++idx ) - { - uint32_t endIdx = ByteCount-idx-1; - uint8_t theTemp = inData[idx]; - inData[idx] = inData[endIdx]; - inData[endIdx] = theTemp; - } - } - - static inline bool checkLength( const uint8_t* inStart, const uint8_t* inStop, uint32_t inLength ) - { - return static_cast<uint32_t>(inStop - inStart) >= inLength; - } - //warning work-around - template<typename T> - static inline T val(T v) {return v;} - - template<bool DoSwapBytes, typename TDataType> - static inline bool parse( const uint8_t*& inStart, const uint8_t* inStop, TDataType& outData ) - { - if ( checkLength( inStart, inStop, sizeof( TDataType ) ) ) - { - BlockParserDataConverter theConverter; - for ( uint32_t idx =0; idx < sizeof( TDataType ); ++idx ) - theConverter.mU8[idx] = inStart[idx]; - if ( val(DoSwapBytes)) - swapBytes<sizeof(TDataType)>( theConverter.mU8 ); - outData = theConverter.convert<TDataType>(); - inStart += sizeof( TDataType ); - return true; - } - return false; - } - - template<bool DoSwapBytes, typename TDataType> - static inline bool parseBlock( const uint8_t*& inStart, const uint8_t* inStop, TDataType* outData, uint32_t inNumItems ) - { - uint32_t desired = sizeof(TDataType)*inNumItems; - if ( checkLength( inStart, inStop, desired ) ) - { - if ( val(DoSwapBytes) ) - { - for ( uint32_t item = 0; item < inNumItems; ++item ) - { - BlockParserDataConverter theConverter; - for ( uint32_t idx =0; idx < sizeof( TDataType ); ++idx ) - theConverter.mU8[idx] = inStart[idx]; - swapBytes<sizeof(TDataType)>( theConverter.mU8 ); - outData[item] = theConverter.convert<TDataType>(); - inStart += sizeof(TDataType); - } - } - else - { - uint8_t* target = reinterpret_cast<uint8_t*>(outData); - memmove( target, inStart, desired ); - inStart += desired; - } - return true; - } - return false; - } - - //In-place byte swapping block - template<bool DoSwapBytes, typename TDataType> - static inline bool parseBlock( uint8_t*& inStart, const uint8_t* inStop, uint32_t inNumItems ) - { - uint32_t desired = sizeof(TDataType)*inNumItems; - if ( checkLength( inStart, inStop, desired ) ) - { - if ( val(DoSwapBytes) ) - { - for ( uint32_t item = 0; item < inNumItems; ++item, inStart += sizeof( TDataType ) ) - swapBytes<sizeof(TDataType)>( inStart ); //In-place swap. - } - else - inStart += sizeof( TDataType ) * inNumItems; - return true; - } - return false; - } - }; - - //Wraps the begin/end keeping track of them. - template<bool DoSwapBytes> - struct BlockParser - { - const uint8_t* mBegin; - const uint8_t* mEnd; - BlockParser( const uint8_t* inBegin=NULL, const uint8_t* inEnd=NULL ) - : mBegin( inBegin ) - , mEnd( inEnd ) - { - } - inline bool hasMoreData() const { return mBegin != mEnd; } - inline bool checkLength( uint32_t inLength ) { return BlockParseFunctions::checkLength( mBegin, mEnd, inLength ); } - - template<typename TDataType> - inline bool read( TDataType& outDatatype ) { return BlockParseFunctions::parse<DoSwapBytes>( mBegin, mEnd, outDatatype ); } - - template<typename TDataType> - inline bool readBlock( TDataType* outDataPtr, uint32_t inNumItems ) { return BlockParseFunctions::parseBlock<DoSwapBytes>( mBegin, mEnd, outDataPtr, inNumItems ); } - - template<typename TDataType> - inline bool readBlock( uint32_t inNumItems ) - { - uint8_t* theTempPtr = const_cast<uint8_t*>(mBegin); - bool retval = BlockParseFunctions::parseBlock<DoSwapBytes, TDataType>( theTempPtr, mEnd, inNumItems ); - mBegin = theTempPtr; - return retval; - } - - uint32_t amountLeft() const { return static_cast<uint32_t>( mEnd - mBegin ); } - }; - - //Reads the data without checking for error conditions - template<typename TDataType, typename TBlockParserType> - inline TDataType blockParserRead( TBlockParserType& inType ) - { - TDataType retval; - inType.read( retval ); - return retval; - } -}} - -#endif // PXPVDSDK_PXPROFILEDATAPARSING_H diff --git a/PxShared/src/pvd/src/PxProfileEventBuffer.h b/PxShared/src/pvd/src/PxProfileEventBuffer.h deleted file mode 100644 index 213d980..0000000 --- a/PxShared/src/pvd/src/PxProfileEventBuffer.h +++ /dev/null @@ -1,270 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEEVENTBUFFER_H -#define PXPVDSDK_PXPROFILEEVENTBUFFER_H - -#include "PxProfileEvents.h" -#include "PxProfileEventSerialization.h" -#include "PxProfileEventSystem.h" -#include "PxProfileDataBuffer.h" -#include "PxProfileContextProvider.h" - -#include "PsArray.h" -#include "PsTime.h" -#include "PsCpu.h" - -namespace physx { namespace profile { - - /** - * An event buffer maintains an in-memory buffer of events. When this buffer is full - * it sends to buffer to all handlers registered and resets the buffer. - * - * It is parameterized in four ways. The first is a context provider that provides - * both thread id and context id. - * - * The second is the mutex (which may be null) and a scoped locking mechanism. Thus the buffer - * may be used in a multithreaded context but clients of the buffer don't pay for this if they - * don't intend to use it this way. - * - * Finally the buffer may use an event filtering mechanism. This mechanism needs one function, - * namely isEventEnabled( uint8_t subsystem, uint8_t eventId ). - * - * All of these systems can be parameterized at compile time leading to an event buffer - * that should be as fast as possible given the constraints. - * - * Buffers may be chained together as this buffer has a handleBufferFlush method that - * will grab the mutex and add the data to this event buffer. - * - * Overall, lets look at the PhysX SDK an how all the pieces fit together. - * The SDK should have a mutex-protected event buffer where actual devs or users of PhysX - * can register handlers. This buffer has slow but correct implementations of the - * context provider interface. - * - * The SDK object should also have a concrete event filter which was used in the - * construction of the event buffer and which it exposes through opaque interfaces. - * - * The SDK should protect its event buffer and its event filter from multithreaded - * access and thus this provides the safest and slowest way to log events and to - * enable/disable events. - * - * Each scene should also have a concrete event filter. This filter is updated from - * the SDK event filter (in a mutex protected way) every frame. Thus scenes can change - * their event filtering on a frame-by-frame basis. It means that tasks running - * under the scene don't need a mutex when accessing the filter. - * - * Furthermore the scene should have an event buffer that always sets the context id - * on each event to the scene. This allows PVD and other systems to correlate events - * to scenes. Scenes should provide access only to a relative event sending system - * that looks up thread id upon each event but uses the scene id. - * - * The SDK's event buffer should be setup as an EventBufferClient for each scene's - * event buffer. Thus the SDK should expose an EventBufferClient interface that - * any client can use. - * - * For extremely *extremely* performance sensitive areas we should create a specialized - * per-scene, per-thread event buffer that is set on the task for these occasions. This buffer - * uses a trivial event context setup with the scene's context id and the thread id. It should - * share the scene's concrete event filter and it should have absolutely no locking. It should - * empty into the scene's event buffer which in some cases should empty into the SDK's event buffer - * which when full will push events all the way out of the system. The task should *always* flush - * the event buffer (if it has one) when it is finished; nothing else will work reliably. - * - * If the per-scene,per-thread event buffer is correctly parameterized and fully defined adding - * a new event should be an inline operation requiring no mutex grabs in the common case. I don't - * believe you can get faster event production than this; the events are as small as possible (all - * relative events) and they are all produced inline resulting in one 4 byte header and one - * 8 byte timestamp per event. Reducing the memory pressure in this way reduces the communication - * overhead, the mutex grabs, basically everything that makes profiling expensive at the cost - * of a per-scene,per-thread event buffer (which could easily be reduced to a per-thread event - * buffer. - */ - template<typename TContextProvider, - typename TMutex, - typename TScopedLock, - typename TEventFilter> - class EventBuffer : public DataBuffer<TMutex, TScopedLock> - { - public: - typedef DataBuffer<TMutex, TScopedLock> TBaseType; - typedef TContextProvider TContextProviderType; - typedef TEventFilter TEventFilterType; - typedef typename TBaseType::TMutexType TMutexType; - typedef typename TBaseType::TScopedLockType TScopedLockType; - typedef typename TBaseType::TU8AllocatorType TU8AllocatorType; - typedef typename TBaseType::TMemoryBufferType TMemoryBufferType; - typedef typename TBaseType::TBufferClientArray TBufferClientArray; - - private: - EventContextInformation mEventContextInformation; - uint64_t mLastTimestamp; - TContextProvider mContextProvider; - TEventFilterType mEventFilter; - - public: - EventBuffer(PxAllocatorCallback* inFoundation - , uint32_t inBufferFullAmount - , const TContextProvider& inProvider - , TMutexType* inBufferMutex - , const TEventFilterType& inEventFilter ) - : TBaseType( inFoundation, inBufferFullAmount, inBufferMutex, "struct physx::profile::ProfileEvent" ) - , mLastTimestamp( 0 ) - , mContextProvider( inProvider ) - , mEventFilter( inEventFilter ) - { - memset(&mEventContextInformation,0,sizeof(EventContextInformation)); - } - - TContextProvider& getContextProvider() { return mContextProvider; } - - PX_FORCE_INLINE void startEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) - { - TScopedLockType lock(TBaseType::mBufferMutex); - if ( mEventFilter.isEventEnabled( inId ) ) - { - StartEvent theEvent; - theEvent.init( threadId, contextId, cpuId, threadPriority, inTimestamp ); - doAddProfileEvent( inId, theEvent ); - } - } - - PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId) - { - PxProfileEventExecutionContext ctx( mContextProvider.getExecutionContext() ); - startEvent( inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast<uint8_t>(ctx.mThreadPriority), shdfnd::Time::getCurrentCounterValue() ); - } - - PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) - { - startEvent( inId, threadId, contextId, 0, 0, shdfnd::Time::getCurrentCounterValue() ); - } - - PX_FORCE_INLINE void stopEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) - { - TScopedLockType lock(TBaseType::mBufferMutex); - if ( mEventFilter.isEventEnabled( inId ) ) - { - StopEvent theEvent; - theEvent.init( threadId, contextId, cpuId, threadPriority, inTimestamp ); - doAddProfileEvent( inId, theEvent ); - } - } - - PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId) - { - PxProfileEventExecutionContext ctx( mContextProvider.getExecutionContext() ); - stopEvent( inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast<uint8_t>(ctx.mThreadPriority), shdfnd::Time::getCurrentCounterValue() ); - } - - PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) - { - stopEvent( inId, threadId, contextId, 0, 0, shdfnd::Time::getCurrentCounterValue() ); - } - - inline void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) - { - eventValue( inId, mContextProvider.getThreadId(), contextId, inValue ); - } - - inline void eventValue( uint16_t inId, uint32_t threadId, uint64_t contextId, int64_t inValue ) - { - TScopedLockType lock( TBaseType::mBufferMutex ); - EventValue theEvent; - theEvent.init( inValue, contextId, threadId ); - EventHeader theHeader( static_cast<uint8_t>( getEventType<EventValue>() ), inId ); - //set the header relative timestamp; - EventValue& theType( theEvent ); - theType.setupHeader( theHeader ); - sendEvent( theHeader, theType ); - } - - void flushProfileEvents() - { - TBaseType::flushEvents(); - } - - void release() - { - PX_PROFILE_DELETE( TBaseType::mWrapper.mUserFoundation, this ); - } - protected: - //Clears the cache meaning event compression - //starts over again. - //only called when the buffer mutex is held - void clearCachedData() - { - mEventContextInformation.setToDefault(); - mLastTimestamp = 0; - } - - template<typename TProfileEventType> - PX_FORCE_INLINE void doAddProfileEvent(uint16_t eventId, const TProfileEventType& inType) - { - TScopedLockType lock(TBaseType::mBufferMutex); - if (mEventContextInformation == inType.mContextInformation) - doAddEvent(static_cast<uint8_t>(inType.getRelativeEventType()), eventId, inType.getRelativeEvent()); - else - { - mEventContextInformation = inType.mContextInformation; - doAddEvent( static_cast<uint8_t>( getEventType<TProfileEventType>() ), eventId, inType ); - } - } - - template<typename TDataType> - PX_FORCE_INLINE void doAddEvent(uint8_t inEventType, uint16_t eventId, const TDataType& inType) - { - EventHeader theHeader( inEventType, eventId ); - //set the header relative timestamp; - TDataType& theType( const_cast<TDataType&>( inType ) ); - uint64_t currentTs = inType.getTimestamp(); - theType.setupHeader(theHeader, mLastTimestamp); - mLastTimestamp = currentTs; - sendEvent( theHeader, theType ); - } - - template<typename TDataType> - PX_FORCE_INLINE void sendEvent( EventHeader& inHeader, TDataType& inType ) - { - uint32_t sizeToWrite = sizeof(inHeader) + inType.getEventSize(inHeader); - PX_UNUSED(sizeToWrite); - - uint32_t writtenSize = inHeader.streamify( TBaseType::mSerializer ); - writtenSize += inType.streamify(TBaseType::mSerializer, inHeader); - - PX_ASSERT(writtenSize == sizeToWrite); - - if ( TBaseType::mDataArray.size() >= TBaseType::mBufferFullAmount ) - flushProfileEvents(); - - } - - }; -}} -#endif // PXPVDSDK_PXPROFILEEVENTBUFFER_H diff --git a/PxShared/src/pvd/src/PxProfileEventBufferAtomic.h b/PxShared/src/pvd/src/PxProfileEventBufferAtomic.h deleted file mode 100644 index f87839f..0000000 --- a/PxShared/src/pvd/src/PxProfileEventBufferAtomic.h +++ /dev/null @@ -1,320 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEEVENTBUFFERATOMIC_H -#define PXPVDSDK_PXPROFILEEVENTBUFFERATOMIC_H - -#include "PxProfileEvents.h" -#include "PxProfileEventSerialization.h" -#include "PxProfileEventSystem.h" -#include "PxProfileDataBuffer.h" -#include "PxProfileContextProvider.h" - -#include "PsArray.h" -#include "PsAlloca.h" -#include "PsTime.h" -#include "PsCpu.h" -#include "PsAtomic.h" -#include "PsAllocator.h" - - -namespace physx { - namespace profile { - - static const uint32_t LOCAL_BUFFER_SIZE = 512; - - /** - * An event buffer maintains an in-memory buffer of events. When this buffer is full - * it sends to buffer to all handlers registered and resets the buffer. - * - * It is parameterized in four ways. The first is a context provider that provides - * both thread id and context id. - * - * The second is the mutex (which may be null) and a scoped locking mechanism. Thus the buffer - * may be used in a multithreaded context but clients of the buffer don't pay for this if they - * don't intend to use it this way. - * - * Finally the buffer may use an event filtering mechanism. This mechanism needs one function, - * namely isEventEnabled( uint8_t subsystem, uint8_t eventId ). - * - * All of these systems can be parameterized at compile time leading to an event buffer - * that should be as fast as possible given the constraints. - * - * Buffers may be chained together as this buffer has a handleBufferFlush method that - * will grab the mutex and add the data to this event buffer. - * - * Overall, lets look at the PhysX SDK an how all the pieces fit together. - * The SDK should have a mutex-protected event buffer where actual devs or users of PhysX - * can register handlers. This buffer has slow but correct implementations of the - * context provider interface. - * - * The SDK object should also have a concrete event filter which was used in the - * construction of the event buffer and which it exposes through opaque interfaces. - * - * The SDK should protect its event buffer and its event filter from multithreaded - * access and thus this provides the safest and slowest way to log events and to - * enable/disable events. - * - * Each scene should also have a concrete event filter. This filter is updated from - * the SDK event filter (in a mutex protected way) every frame. Thus scenes can change - * their event filtering on a frame-by-frame basis. It means that tasks running - * under the scene don't need a mutex when accessing the filter. - * - * Furthermore the scene should have an event buffer that always sets the context id - * on each event to the scene. This allows PVD and other systems to correlate events - * to scenes. Scenes should provide access only to a relative event sending system - * that looks up thread id upon each event but uses the scene id. - * - * The SDK's event buffer should be setup as an EventBufferClient for each scene's - * event buffer. Thus the SDK should expose an EventBufferClient interface that - * any client can use. - * - * For extremely *extremely* performance sensitive areas we should create a specialized - * per-scene, per-thread event buffer that is set on the task for these occasions. This buffer - * uses a trivial event context setup with the scene's context id and the thread id. It should - * share the scene's concrete event filter and it should have absolutely no locking. It should - * empty into the scene's event buffer which in some cases should empty into the SDK's event buffer - * which when full will push events all the way out of the system. The task should *always* flush - * the event buffer (if it has one) when it is finished; nothing else will work reliably. - * - * If the per-scene,per-thread event buffer is correctly parameterized and fully defined adding - * a new event should be an inline operation requiring no mutex grabs in the common case. I don't - * believe you can get faster event production than this; the events are as small as possible (all - * relative events) and they are all produced inline resulting in one 4 byte header and one - * 8 byte timestamp per event. Reducing the memory pressure in this way reduces the communication - * overhead, the mutex grabs, basically everything that makes profiling expensive at the cost - * of a per-scene,per-thread event buffer (which could easily be reduced to a per-thread event - * buffer. - */ - template<typename TContextProvider, - typename TMutex, - typename TScopedLock, - typename TEventFilter> - class EventBufferAtomic : public DataBuffer < TMutex, TScopedLock > - { - public: - typedef DataBuffer<TMutex, TScopedLock> TBaseType; - typedef TContextProvider TContextProviderType; - typedef TEventFilter TEventFilterType; - typedef typename TBaseType::TMutexType TMutexType; - typedef typename TBaseType::TScopedLockType TScopedLockType; - typedef typename TBaseType::TU8AllocatorType TU8AllocatorType; - typedef typename TBaseType::TMemoryBufferType TMemoryBufferType; - typedef typename TBaseType::TBufferClientArray TBufferClientArray; - - private: - TContextProvider mContextProvider; - TEventFilterType mEventFilter; - volatile int32_t mReserved; - volatile int32_t mWritten; - - public: - EventBufferAtomic(PxAllocatorCallback* inFoundation - , uint32_t inBufferFullAmount - , const TContextProvider& inProvider - , TMutexType* inBufferMutex - , const TEventFilterType& inEventFilter) - : TBaseType(inFoundation, inBufferFullAmount, inBufferMutex, "struct physx::profile::ProfileEvent") - , mContextProvider(inProvider) - , mEventFilter(inEventFilter) - , mReserved(0) - , mWritten(0) - { - } - - TContextProvider& getContextProvider() { return mContextProvider; } - - PX_FORCE_INLINE void startEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) - { - if (mEventFilter.isEventEnabled(inId)) - { - StartEvent theEvent; - theEvent.init(threadId, contextId, cpuId, threadPriority, inTimestamp); - doAddProfileEvent(inId, theEvent); - } - } - - PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId) - { - PxProfileEventExecutionContext ctx(mContextProvider.getExecutionContext()); - startEvent(inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast<uint8_t>(ctx.mThreadPriority), shdfnd::Time::getCurrentCounterValue()); - } - - PX_FORCE_INLINE void startEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) - { - startEvent(inId, threadId, contextId, 0, 0, shdfnd::Time::getCurrentCounterValue()); - } - - PX_FORCE_INLINE void stopEvent(uint16_t inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t inTimestamp) - { - if (mEventFilter.isEventEnabled(inId)) - { - StopEvent theEvent; - theEvent.init(threadId, contextId, cpuId, threadPriority, inTimestamp); - doAddProfileEvent(inId, theEvent); - } - } - - PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId) - { - PxProfileEventExecutionContext ctx(mContextProvider.getExecutionContext()); - stopEvent(inId, ctx.mThreadId, contextId, ctx.mCpuId, static_cast<uint8_t>(ctx.mThreadPriority), shdfnd::Time::getCurrentCounterValue()); - } - - PX_FORCE_INLINE void stopEvent(uint16_t inId, uint64_t contextId, uint32_t threadId) - { - stopEvent(inId, threadId, contextId, 0, 0, shdfnd::Time::getCurrentCounterValue()); - } - - inline void eventValue(uint16_t inId, uint64_t contextId, int64_t inValue) - { - eventValue(inId, mContextProvider.getThreadId(), contextId, inValue); - } - - inline void eventValue(uint16_t inId, uint32_t threadId, uint64_t contextId, int64_t inValue) - { - EventValue theEvent; - theEvent.init(inValue, contextId, threadId); - EventHeader theHeader(static_cast<uint8_t>(getEventType<EventValue>()), inId); - //set the header relative timestamp; - EventValue& theType(theEvent); - theType.setupHeader(theHeader); - - int32_t sizeToWrite = int32_t(sizeof(theHeader) + theType.getEventSize(theHeader)); - int32_t reserved = shdfnd::atomicAdd(&mReserved, sizeToWrite); - sendEvent(theHeader, theType, reserved, sizeToWrite); - } - - void flushProfileEvents(int32_t reserved = -1) - { - TScopedLockType lock(TBaseType::mBufferMutex); - - // set the buffer full to lock additional writes - int32_t reservedOld = shdfnd::atomicExchange(&mReserved, int32_t(TBaseType::mBufferFullAmount + 1)); - if (reserved == -1) - reserved = reservedOld; - - // spin till we have written all the data - while (reserved > mWritten) - { - } - - // check if we have written all data - PX_ASSERT(reserved == mWritten); - - // set the correct size of the serialization data buffer - TBaseType::mSerializer.mArray->setEnd(TBaseType::mSerializer.mArray->begin() + mWritten); - - // flush events - TBaseType::flushEvents(); - - // write master timestamp and set reserved/written to start writing to buffer again - mWritten = 0; - mReserved = 0; - } - - void release() - { - PX_PROFILE_DELETE(TBaseType::mWrapper.mUserFoundation, this); - } - protected: - //Clears the cache meaning event compression - //starts over again. - //only called when the buffer mutex is held - void clearCachedData() - { - } - - template<typename TProfileEventType> - PX_FORCE_INLINE void doAddProfileEvent(uint16_t eventId, const TProfileEventType& inType) - { - doAddEvent(static_cast<uint8_t>(getEventType<TProfileEventType>()), eventId, inType); - } - - template<typename TDataType> - PX_FORCE_INLINE void doAddEvent(uint8_t inEventType, uint16_t eventId, const TDataType& inType) - { - EventHeader theHeader(inEventType, eventId); - TDataType& theType(const_cast<TDataType&>(inType)); - theType.setupHeader(theHeader, 0); - - const int32_t sizeToWrite = int32_t(sizeof(theHeader) + theType.getEventSize(theHeader)); - - int32_t reserved = shdfnd::atomicAdd(&mReserved, sizeToWrite); - sendEvent(theHeader, theType, reserved, sizeToWrite); - } - - template<typename TDataType> - PX_FORCE_INLINE void sendEvent(EventHeader& inHeader, TDataType& inType, int32_t reserved, int32_t sizeToWrite) - { - // if we don't fit to the buffer, we wait till it is flushed - if (reserved - sizeToWrite >= int32_t(TBaseType::mBufferFullAmount)) - { - while (reserved - sizeToWrite >= int32_t(TBaseType::mBufferFullAmount)) - { - // I32 overflow - if (mReserved < int32_t(TBaseType::mBufferFullAmount)) - { - reserved = shdfnd::atomicAdd(&mReserved, sizeToWrite); - } - } - } - - int32_t writeIndex = reserved - sizeToWrite; - uint32_t writtenSize = 0; - - PX_ASSERT(writeIndex >= 0); - - PX_ALLOCA(tempBuffer, uint8_t, sizeToWrite); - TempMemoryBuffer memoryBuffer(tempBuffer, sizeToWrite); - EventSerializer<TempMemoryBuffer> eventSerializer(&memoryBuffer); - - writtenSize = inHeader.streamify(eventSerializer); - writtenSize += inType.streamify(eventSerializer, inHeader); - - TBaseType::mSerializer.mArray->reserve(writeIndex + writtenSize); - TBaseType::mSerializer.mArray->write(&tempBuffer[0], writtenSize, writeIndex); - - PX_ASSERT(writtenSize == uint32_t(sizeToWrite)); - shdfnd::atomicAdd(&mWritten, sizeToWrite); - - if (reserved >= int32_t(TBaseType::mBufferFullAmount)) - { - TScopedLockType lock(TBaseType::mBufferMutex); - // we flush the buffer if its full and we did not flushed him in the meantime - if(mReserved >= reserved) - flushProfileEvents(reserved); - } - } - - }; - } -} -#endif // PXPVDSDK_PXPROFILEEVENTBUFFERATOMIC_H diff --git a/PxShared/src/pvd/src/PxProfileEventBufferClient.h b/PxShared/src/pvd/src/PxProfileEventBufferClient.h deleted file mode 100644 index d8a1ff2..0000000 --- a/PxShared/src/pvd/src/PxProfileEventBufferClient.h +++ /dev/null @@ -1,81 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTBUFFERCLIENT_H -#define PXPVDSDK_PXPROFILEEVENTBUFFERCLIENT_H - -#include "PxProfileBase.h" -#include "PxProfileEventNames.h" - -namespace physx { namespace profile { - - /** - \brief Client handles the data when an event buffer flushes. This data - can be parsed (PxProfileEventHandler.h) as a binary set of events. - */ - class PxProfileEventBufferClient - { - protected: - virtual ~PxProfileEventBufferClient(){} - public: - /** - \brief Callback when the event buffer is full. This data is serialized profile events - and can be read back using: PxProfileEventHandler::parseEventBuffer. - - \param inData Provided buffer data. - \param inLength Data length. - - @see PxProfileEventHandler::parseEventBuffer. - */ - virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength ) = 0; - - /** - \brief Happens if something removes all the clients from the manager. - */ - virtual void handleClientRemoved() = 0; - }; - - /** - \brief Client handles new profile event add. - */ - class PxProfileZoneClient : public PxProfileEventBufferClient - { - protected: - virtual ~PxProfileZoneClient(){} - public: - /** - \brief Callback when new profile event is added. - - \param inName Added profile event name. - */ - virtual void handleEventAdded( const PxProfileEventName& inName ) = 0; - }; - -} } - - -#endif // PXPVDSDK_PXPROFILEEVENTBUFFERCLIENT_H diff --git a/PxShared/src/pvd/src/PxProfileEventBufferClientManager.h b/PxShared/src/pvd/src/PxProfileEventBufferClientManager.h deleted file mode 100644 index 1402183..0000000 --- a/PxShared/src/pvd/src/PxProfileEventBufferClientManager.h +++ /dev/null @@ -1,94 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTBUFFERCLIENTMANAGER_H -#define PXPVDSDK_PXPROFILEEVENTBUFFERCLIENTMANAGER_H - -#include "PxProfileEventBufferClient.h" - -namespace physx { namespace profile { - - /** - \brief Manager keep collections of PxProfileEventBufferClient clients. - - @see PxProfileEventBufferClient - */ - class PxProfileEventBufferClientManager - { - protected: - virtual ~PxProfileEventBufferClientManager(){} - public: - /** - \brief Adds new client. - \param inClient Client to add. - */ - virtual void addClient( PxProfileEventBufferClient& inClient ) = 0; - - /** - \brief Removes a client. - \param inClient Client to remove. - */ - virtual void removeClient( PxProfileEventBufferClient& inClient ) = 0; - - /** - \brief Check if manager has clients. - \return True if manager has added clients. - */ - virtual bool hasClients() const = 0; - }; - - /** - \brief Manager keep collections of PxProfileZoneClient clients. - - @see PxProfileZoneClient - */ - class PxProfileZoneClientManager - { - protected: - virtual ~PxProfileZoneClientManager(){} - public: - /** - \brief Adds new client. - \param inClient Client to add. - */ - virtual void addClient( PxProfileZoneClient& inClient ) = 0; - - /** - \brief Removes a client. - \param inClient Client to remove. - */ - virtual void removeClient( PxProfileZoneClient& inClient ) = 0; - - /** - \brief Check if manager has clients. - \return True if manager has added clients. - */ - virtual bool hasClients() const = 0; - }; -} } - -#endif // PXPVDSDK_PXPROFILEEVENTBUFFERCLIENTMANAGER_H diff --git a/PxShared/src/pvd/src/PxProfileEventFilter.h b/PxShared/src/pvd/src/PxProfileEventFilter.h deleted file mode 100644 index 0f38d65..0000000 --- a/PxShared/src/pvd/src/PxProfileEventFilter.h +++ /dev/null @@ -1,93 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTFILTER_H -#define PXPVDSDK_PXPROFILEEVENTFILTER_H - -#include "foundation/PxAssert.h" -#include "PxProfileBase.h" -#include "PxProfileEventId.h" - -namespace physx { namespace profile { - - /** - \brief Called upon every event to give a quick-out before adding the event - to the event buffer. - - \note: not thread safe, can be called from different threads at the same time - */ - class PxProfileEventFilter - { - protected: - virtual ~PxProfileEventFilter(){} - public: - /** - \brief Disabled events will not go into the event buffer and will not be - transmitted to clients. - \param inId Profile event id. - \param isEnabled True if event should be enabled. - */ - virtual void setEventEnabled( const PxProfileEventId& inId, bool isEnabled ) = 0; - - /** - \brief Returns the current state of the profile event. - \return True if profile event is enabled. - */ - virtual bool isEventEnabled( const PxProfileEventId& inId ) const = 0; - }; - - /** - \brief Forwards the filter requests to another event filter. - */ - template<typename TFilterType> - struct PxProfileEventFilterForward - { - /** - \brief Default constructor. - */ - PxProfileEventFilterForward( TFilterType* inFilter ) : filter( inFilter ) {} - - /** - \brief Disabled events will not go into the event buffer and will not be - transmitted to clients. - \param inId Profile event id. - \param isEnabled True if event should be enabled. - */ - void setEventEnabled( const PxProfileEventId& inId, bool isEnabled ) { filter->setEventEnabled( inId, isEnabled ); } - - /** - \brief Returns the current state of the profile event. - \return True if profile event is enabled. - */ - bool isEventEnabled( const PxProfileEventId& inId ) const { return filter->isEventEnabled( inId ); } - - TFilterType* filter; - }; - -} } - -#endif // PXPVDSDK_PXPROFILEEVENTFILTER_H diff --git a/PxShared/src/pvd/src/PxProfileEventHandler.h b/PxShared/src/pvd/src/PxProfileEventHandler.h deleted file mode 100644 index 0e0f0f9..0000000 --- a/PxShared/src/pvd/src/PxProfileEventHandler.h +++ /dev/null @@ -1,99 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTHANDLER_H -#define PXPVDSDK_PXPROFILEEVENTHANDLER_H - -#include "PxProfileBase.h" -#include "PxProfileEventId.h" - -namespace physx { namespace profile { - - /** - \brief A client of the event system can expect to find these events in the event buffer. - */ - class PxProfileEventHandler - { - protected: - virtual ~PxProfileEventHandler(){} - public: - /** - \brief Event start - onStartEvent. - - \param[in] inId Profile event id. - \param[in] threadId Thread id. - \param[in] contextId Context id. - \param[in] cpuId CPU id. - \param[in] threadPriority Thread priority. - \param[in] timestamp Timestamp in cycles. - */ - virtual void onStartEvent( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t timestamp ) = 0; - - /** - \brief Event stop - onStopEvent. - - \param[in] inId Profile event id. - \param[in] threadId Thread id. - \param[in] contextId Context id. - \param[in] cpuId CPU id. - \param[in] threadPriority Thread priority. - \param[in] timestamp Timestamp in cycles. - */ - virtual void onStopEvent( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t timestamp ) = 0; - - /** - \brief Event value - onEventValue. - - \param[in] inId Profile event id. - \param[in] threadId Thread id. - \param[in] contextId Context id. - \param[in] inValue Value. - */ - virtual void onEventValue( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, int64_t inValue ) = 0; - - /** - \brief Parse the flushed profile buffer which contains the profile events. - - \param[in] inBuffer The profile buffer with profile events. - \param[in] inBufferSize Buffer size. - \param[in] inHandler The profile event callback to receive the parsed events. - \param[in] inSwapBytes Swap bytes possibility. - */ - static void parseEventBuffer( const uint8_t* inBuffer, uint32_t inBufferSize, PxProfileEventHandler& inHandler, bool inSwapBytes ); - - /** - \brief Translates event duration in timestamp (cycles) into nanoseconds. - - \param[in] duration Timestamp duration of the event. - - \return event duration in nanoseconds. - */ - static uint64_t durationToNanoseconds(uint64_t duration); - }; -} } - -#endif // PXPVDSDK_PXPROFILEEVENTHANDLER_H diff --git a/PxShared/src/pvd/src/PxProfileEventId.h b/PxShared/src/pvd/src/PxProfileEventId.h deleted file mode 100644 index dd98cd5..0000000 --- a/PxShared/src/pvd/src/PxProfileEventId.h +++ /dev/null @@ -1,80 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTID_H -#define PXPVDSDK_PXPROFILEEVENTID_H - -#include "PxProfileBase.h" - -namespace physx { namespace profile { - /** - \brief A event id structure. Optionally includes information about - if the event was enabled at compile time. - */ - struct PxProfileEventId - { - uint16_t eventId; - mutable bool compileTimeEnabled; - - /** - \brief Profile event id constructor. - \param inId Profile event id. - \param inCompileTimeEnabled Compile time enabled. - */ - PxProfileEventId( uint16_t inId = 0, bool inCompileTimeEnabled = true ) - : eventId( inId ) - , compileTimeEnabled( inCompileTimeEnabled ) - { - } - - operator uint16_t () const { return eventId; } - - bool operator==( const PxProfileEventId& inOther ) const - { - return eventId == inOther.eventId; - } - }; - - /** - \brief Template event id structure. - */ - template<bool TEnabled> - struct PxProfileCompileTimeFilteredEventId : public PxProfileEventId - { - /** - \brief Constructor. - \param inId Profile event id. - */ - PxProfileCompileTimeFilteredEventId( uint16_t inId = 0 ) - : PxProfileEventId( inId, TEnabled ) - { - } - }; - -} } - -#endif // PXPVDSDK_PXPROFILEEVENTID_H diff --git a/PxShared/src/pvd/src/PxProfileEventImpl.cpp b/PxShared/src/pvd/src/PxProfileEventImpl.cpp deleted file mode 100644 index a519f92..0000000 --- a/PxShared/src/pvd/src/PxProfileEventImpl.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "foundation/PxErrorCallback.h" -#include "foundation/PxAllocatorCallback.h" - -#include "PxProfileEvents.h" -#include "PxProfileEventSerialization.h" -#include "PxProfileEventBuffer.h" -#include "PxProfileZoneImpl.h" -#include "PxProfileZoneManagerImpl.h" -#include "PxProfileEventParser.h" -#include "PxProfileEventHandler.h" -#include "PxProfileScopedMutexLock.h" -#include "PxProfileEventFilter.h" -#include "PxProfileContextProvider.h" -#include "PxProfileEventMutex.h" -#include "PxProfileMemoryEventTypes.h" -#include "PxProfileMemoryEventRecorder.h" -#include "PxProfileMemoryEventBuffer.h" -#include "PxProfileMemoryEventParser.h" -#include "PxProfileContextProviderImpl.h" - -#include "PsUserAllocated.h" -#include "PsTime.h" - -#include <stdio.h> - -namespace physx { namespace profile { - - - uint64_t PxProfileEventHandler::durationToNanoseconds(uint64_t duration) - { - return shdfnd::Time::getBootCounterFrequency().toTensOfNanos(duration) * 10; - } - - void PxProfileEventHandler::parseEventBuffer( const uint8_t* inBuffer, uint32_t inBufferSize, PxProfileEventHandler& inHandler, bool inSwapBytes ) - { - if ( inSwapBytes == false ) - parseEventData<false>( inBuffer, inBufferSize, &inHandler ); - else - parseEventData<true>( inBuffer, inBufferSize, &inHandler ); - } - - template<uint32_t TNumEvents> - struct ProfileBulkEventHandlerBuffer - { - Event mEvents[TNumEvents]; - uint32_t mEventCount; - PxProfileBulkEventHandler* mHandler; - ProfileBulkEventHandlerBuffer( PxProfileBulkEventHandler* inHdl ) - : mEventCount( 0 ) - , mHandler( inHdl ) - { - } - void onEvent( const Event& inEvent ) - { - mEvents[mEventCount] = inEvent; - ++mEventCount; - if ( mEventCount == TNumEvents ) - flush(); - } - void onEvent( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t timestamp, EventTypes::Enum inType ) - { - StartEvent theEvent; - theEvent.init( threadId, contextId, cpuId, static_cast<uint8_t>( threadPriority ), timestamp ); - onEvent( Event( EventHeader( static_cast<uint8_t>( inType ), inId.eventId ), theEvent ) ); - } - void onStartEvent( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t timestamp ) - { - onEvent( inId, threadId, contextId, cpuId, threadPriority, timestamp, EventTypes::StartEvent ); - } - void onStopEvent( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, uint8_t cpuId, uint8_t threadPriority, uint64_t timestamp ) - { - onEvent( inId, threadId, contextId, cpuId, threadPriority, timestamp, EventTypes::StopEvent ); - } - void onEventValue( const PxProfileEventId& inId, uint32_t threadId, uint64_t contextId, int64_t value ) - { - EventValue theEvent; - theEvent.init( value, contextId, threadId ); - onEvent( Event( inId.eventId, theEvent ) ); - } - void flush() - { - if ( mEventCount ) - mHandler->handleEvents( mEvents, mEventCount ); - mEventCount = 0; - } - }; - - - void PxProfileBulkEventHandler::parseEventBuffer( const uint8_t* inBuffer, uint32_t inBufferSize, PxProfileBulkEventHandler& inHandler, bool inSwapBytes ) - { - ProfileBulkEventHandlerBuffer<256> hdler( &inHandler ); - if ( inSwapBytes ) - parseEventData<true>( inBuffer, inBufferSize, &hdler ); - else - parseEventData<false>( inBuffer, inBufferSize, &hdler ); - hdler.flush(); - } - - struct PxProfileNameProviderImpl - { - PxProfileNameProvider* mImpl; - PxProfileNameProviderImpl( PxProfileNameProvider* inImpl ) - : mImpl( inImpl ) - { - } - PxProfileNames getProfileNames() const { return mImpl->getProfileNames(); } - }; - - - struct PxProfileNameProviderForward - { - PxProfileNames mNames; - PxProfileNameProviderForward( PxProfileNames inNames ) - : mNames( inNames ) - { - } - PxProfileNames getProfileNames() const { return mNames; } - }; - - - PX_FOUNDATION_API PxProfileZone& PxProfileZone::createProfileZone( PxAllocatorCallback* inAllocator, const char* inSDKName, PxProfileNames inNames, uint32_t inEventBufferByteSize ) - { - typedef ZoneImpl<PxProfileNameProviderForward> TSDKType; - return *PX_PROFILE_NEW( inAllocator, TSDKType ) ( inAllocator, inSDKName, inEventBufferByteSize, PxProfileNameProviderForward( inNames ) ); - } - - PxProfileZoneManager& PxProfileZoneManager::createProfileZoneManager(PxAllocatorCallback* inAllocator ) - { - return *PX_PROFILE_NEW( inAllocator, ZoneManagerImpl ) ( inAllocator ); - } - - PxProfileMemoryEventRecorder& PxProfileMemoryEventRecorder::createRecorder( PxAllocatorCallback* inAllocator ) - { - return *PX_PROFILE_NEW( inAllocator, PxProfileMemoryEventRecorderImpl )( inAllocator ); - } - - PxProfileMemoryEventBuffer& PxProfileMemoryEventBuffer::createMemoryEventBuffer( PxAllocatorCallback& inAllocator, uint32_t inBufferSize ) - { - return *PX_PROFILE_NEW( &inAllocator, PxProfileMemoryEventBufferImpl )( inAllocator, inBufferSize ); - } - template<uint32_t TNumEvents> - struct ProfileBulkMemoryEventHandlerBuffer - { - PxProfileBulkMemoryEvent mEvents[TNumEvents]; - uint32_t mEventCount; - PxProfileBulkMemoryEventHandler* mHandler; - ProfileBulkMemoryEventHandlerBuffer( PxProfileBulkMemoryEventHandler* inHdl ) - : mEventCount( 0 ) - , mHandler( inHdl ) - { - } - void onEvent( const PxProfileBulkMemoryEvent& evt ) - { - mEvents[mEventCount] = evt; - ++mEventCount; - if ( mEventCount == TNumEvents ) - flush(); - } - - template<typename TDataType> - void operator()( const MemoryEventHeader&, const TDataType& ) {} - - void operator()( const MemoryEventHeader&, const AllocationEvent& evt ) - { - onEvent( PxProfileBulkMemoryEvent( evt.mSize, evt.mType, evt.mFile, evt.mLine, evt.mAddress ) ); - } - - void operator()( const MemoryEventHeader&, const DeallocationEvent& evt ) - { - onEvent( PxProfileBulkMemoryEvent( evt.mAddress ) ); - } - - void flush() - { - if ( mEventCount ) - mHandler->handleEvents( mEvents, mEventCount ); - mEventCount = 0; - } - }; - - void PxProfileBulkMemoryEventHandler::parseEventBuffer( const uint8_t* inBuffer, uint32_t inBufferSize, PxProfileBulkMemoryEventHandler& inHandler, bool inSwapBytes, PxAllocatorCallback* inAlloc ) - { - PX_ASSERT(inAlloc); - - ProfileBulkMemoryEventHandlerBuffer<0x1000>* theBuffer = PX_PROFILE_NEW(inAlloc, ProfileBulkMemoryEventHandlerBuffer<0x1000>)(&inHandler); - - if ( inSwapBytes ) - { - MemoryEventParser<true> theParser( *inAlloc ); - theParser.parseEventData( inBuffer, inBufferSize, theBuffer ); - } - else - { - MemoryEventParser<false> theParser( *inAlloc ); - theParser.parseEventData( inBuffer, inBufferSize, theBuffer ); - } - theBuffer->flush(); - - PX_PROFILE_DELETE(*inAlloc, theBuffer); - } - -} } - diff --git a/PxShared/src/pvd/src/PxProfileEventMutex.h b/PxShared/src/pvd/src/PxProfileEventMutex.h deleted file mode 100644 index 5ec837b..0000000 --- a/PxShared/src/pvd/src/PxProfileEventMutex.h +++ /dev/null @@ -1,63 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEEVENTMUTEX_H -#define PXPVDSDK_PXPROFILEEVENTMUTEX_H - -#include "PxProfileBase.h" - -namespace physx { namespace profile { - - /** - * Mutex interface that hides implementation around lock and unlock. - * The event system locks the mutex for every interaction. - */ - class PxProfileEventMutex - { - protected: - virtual ~PxProfileEventMutex(){} - public: - virtual void lock() = 0; - virtual void unlock() = 0; - }; - - /** - * Take any mutex type that implements lock and unlock and make an EventMutex out of it. - */ - template<typename TMutexType> - struct PxProfileEventMutexImpl : public PxProfileEventMutex - { - TMutexType* mMutex; - PxProfileEventMutexImpl( TMutexType* inMtx ) : mMutex( inMtx ) {} - virtual void lock() { mMutex->lock(); } - virtual void unlock() { mMutex->unlock(); } - }; - -} } - -#endif // PXPVDSDK_PXPROFILEEVENTMUTEX_H diff --git a/PxShared/src/pvd/src/PxProfileEventNames.h b/PxShared/src/pvd/src/PxProfileEventNames.h deleted file mode 100644 index 831da20..0000000 --- a/PxShared/src/pvd/src/PxProfileEventNames.h +++ /dev/null @@ -1,90 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTNAMES_H -#define PXPVDSDK_PXPROFILEEVENTNAMES_H - -#include "PxProfileBase.h" -#include "PxProfileEventId.h" - -namespace physx { namespace profile { - - /** - \brief Mapping from event id to name. - */ - struct PxProfileEventName - { - const char* name; - PxProfileEventId eventId; - - /** - \brief Default constructor. - \param inName Profile event name. - \param inId Profile event id. - */ - PxProfileEventName( const char* inName, PxProfileEventId inId ) : name( inName ), eventId( inId ) {} - }; - - /** - \brief Aggregator of event id -> name mappings - */ - struct PxProfileNames - { - /** - \brief Default constructor that doesn't point to any names. - \param inEventCount Number of provided events. - \param inSubsystems Event names array. - */ - PxProfileNames( uint32_t inEventCount = 0, const PxProfileEventName* inSubsystems = NULL ) - : eventCount( inEventCount ) - , events( inSubsystems ) - { - } - - uint32_t eventCount; - const PxProfileEventName* events; - }; - - /** - \brief Provides a mapping from event ID -> name. - */ - class PxProfileNameProvider - { - public: - /** - \brief Returns profile event names. - \return Profile event names. - */ - virtual PxProfileNames getProfileNames() const = 0; - - protected: - virtual ~PxProfileNameProvider(){} - PxProfileNameProvider& operator=(const PxProfileNameProvider&) { return *this; } - }; -} } - -#endif // PXPVDSDK_PXPROFILEEVENTNAMES_H diff --git a/PxShared/src/pvd/src/PxProfileEventParser.h b/PxShared/src/pvd/src/PxProfileEventParser.h deleted file mode 100644 index 60aebdc..0000000 --- a/PxShared/src/pvd/src/PxProfileEventParser.h +++ /dev/null @@ -1,193 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEEVENTPARSER_H -#define PXPVDSDK_PXPROFILEEVENTPARSER_H - -#include "PxProfileEvents.h" -#include "PxProfileEventSerialization.h" - -namespace physx { namespace profile { - - struct EventParserData - { - EventContextInformation mContextInformation; - uint64_t mLastTimestamp; - - EventParserData() : mLastTimestamp(0) - { - } - }; - - //This object will be copied a lot so all of its important - //data must be pointers. - template<typename THandlerType, bool TSwapBytes> - struct EventParseOperator - { - typedef EventDeserializer<TSwapBytes> TDeserializerType; - - EventParserData* mData; - TDeserializerType* mDeserializer; - EventHeader* mHeader; - THandlerType* mHandler; - - EventParseOperator( EventParserData* inData, TDeserializerType* inDeserializer, EventHeader* inHeader, THandlerType* inHandler ) - : mData( inData ) - , mDeserializer( inDeserializer ) - , mHeader( inHeader ) - , mHandler( inHandler ) - {} - - template<typename TEventType> - bool parse( TEventType& ioEvent ) - { - ioEvent.streamify( *mDeserializer, *mHeader ); - bool success = mDeserializer->mFail == false; - PX_ASSERT( success ); - return success; - } - - bool parseHeader( EventHeader& ioEvent ) - { - ioEvent.streamify( *mDeserializer ); - bool success = mDeserializer->mFail == false; - PX_ASSERT( success ); - return success; - } - - template<typename TEventType> - bool handleProfileEvent( TEventType& evt ) - { - bool retval = parse( evt ); - if ( retval ) - { - mData->mContextInformation = evt.mContextInformation; - handle( evt.getRelativeEvent(), evt.mContextInformation ); - } - return retval; - } - - template<typename TEventType> - bool handleRelativeProfileEvent( TEventType& evt ) - { - bool retval = parse( evt ); - if ( retval ) - handle( evt, mData->mContextInformation ); - return retval; - } - - template<typename TRelativeEventType> - void handle( const TRelativeEventType& evt, const EventContextInformation& inInfo ) - { - mData->mLastTimestamp = mHeader->uncompressTimestamp( mData->mLastTimestamp, evt.getTimestamp()); - const_cast<TRelativeEventType&>(evt).setTimestamp( mData->mLastTimestamp ); - evt.handle( mHandler, mHeader->mEventId - , inInfo.mThreadId - , inInfo.mContextId - , inInfo.mCpuId - , inInfo.mThreadPriority ); - } - - bool operator()( const StartEvent& ) - { - StartEvent evt; - return handleProfileEvent( evt ); - } - bool operator()( const StopEvent& ) - { - StopEvent evt; - return handleProfileEvent( evt ); - } - bool operator()( const RelativeStartEvent& ) - { - RelativeStartEvent evt; - return handleRelativeProfileEvent( evt ); - - } - bool operator()( const RelativeStopEvent& ) - { - RelativeStopEvent evt; - return handleRelativeProfileEvent( evt ); - } - bool operator()( const EventValue& ) - { - EventValue evt; - bool retval = parse( evt ); - if ( retval ) - { - evt.mValue = mHeader->uncompressTimestamp( 0, evt.mValue ); - evt.handle( mHandler, mHeader->mEventId ); - } - return retval; - } - - //obsolete, placeholder to skip data from PhysX SDKs < 3.4 - bool operator()( const CUDAProfileBuffer& ) - { - CUDAProfileBuffer evt; - bool retval = parse( evt ); - return retval; - } - - //Unknown event type. - bool operator()(uint8_t ) - { - PX_ASSERT( false ); - return false; - } - }; - - template<bool TSwapBytes, typename THandlerType> - inline bool parseEventData( const uint8_t* inData, uint32_t inLength, THandlerType* inHandler ) - { - EventDeserializer<TSwapBytes> deserializer( inData, inLength ); - Event::EventData crapData; - EventHeader theHeader; - EventParserData theData; - EventParseOperator<THandlerType,TSwapBytes> theOp( &theData, &deserializer, &theHeader, inHandler ); - while( deserializer.mLength && deserializer.mFail == false) - { - if ( theOp.parseHeader( theHeader ) ) - visit<bool>( static_cast<EventTypes::Enum>( theHeader.mEventType ), crapData, theOp ); - } - return deserializer.mFail == false; - } - - class PxProfileBulkEventHandler - { - protected: - virtual ~PxProfileBulkEventHandler(){} - public: - virtual void handleEvents(const physx::profile::Event* inEvents, uint32_t inBufferSize) = 0; - static void parseEventBuffer(const uint8_t* inBuffer, uint32_t inBufferSize, PxProfileBulkEventHandler& inHandler, bool inSwapBytes); - }; -}} - -#endif // PXPVDSDK_PXPROFILEEVENTPARSER_H diff --git a/PxShared/src/pvd/src/PxProfileEventSender.h b/PxShared/src/pvd/src/PxProfileEventSender.h deleted file mode 100644 index 3c1cf5e..0000000 --- a/PxShared/src/pvd/src/PxProfileEventSender.h +++ /dev/null @@ -1,129 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTSENDER_H -#define PXPVDSDK_PXPROFILEEVENTSENDER_H - -#include "PxProfileBase.h" - -namespace physx { namespace profile { - - /** - \brief Tagging interface to indicate an object that is capable of flushing a profile - event stream at a certain point. - */ - class PxProfileEventFlusher - { - protected: - virtual ~PxProfileEventFlusher(){} - public: - /** - \brief Flush profile events. Sends the profile event buffer to hooked clients. - */ - virtual void flushProfileEvents() = 0; - }; - - /** - \brief Sends the full events where the caller must provide the context and thread id. - */ - class PxProfileEventSender - { - protected: - virtual ~PxProfileEventSender(){} - public: - - /** - \brief Use this as a thread id for events that start on one thread and end on another - */ - static const uint32_t CrossThreadId = 99999789; - - /** - \brief Send a start profile event, optionally with a context. Events are sorted by thread - and context in the client side. - \param inId Profile event id. - \param contextId Context id. - */ - virtual void startEvent( uint16_t inId, uint64_t contextId) = 0; - /** - \brief Send a stop profile event, optionally with a context. Events are sorted by thread - and context in the client side. - \param inId Profile event id. - \param contextId Context id. - */ - virtual void stopEvent( uint16_t inId, uint64_t contextId) = 0; - - /** - \brief Send a start profile event, optionally with a context. Events are sorted by thread - and context in the client side. - \param inId Profile event id. - \param contextId Context id. - \param threadId Thread id. - */ - virtual void startEvent( uint16_t inId, uint64_t contextId, uint32_t threadId) = 0; - /** - \brief Send a stop profile event, optionally with a context. Events are sorted by thread - and context in the client side. - \param inId Profile event id. - \param contextId Context id. - \param threadId Thread id. - */ - virtual void stopEvent( uint16_t inId, uint64_t contextId, uint32_t threadId ) = 0; - - virtual void atEvent(uint16_t inId, uint64_t contextId, uint32_t threadId, uint64_t start, uint64_t stop) = 0; - - /** - \brief Set an specific events value. This is different than the profiling value - for the event; it is a value recorded and kept around without a timestamp associated - with it. This value is displayed when the event itself is processed. - \param inId Profile event id. - \param contextId Context id. - \param inValue Value to set for the event. - */ - virtual void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) = 0; - }; - - /** - \brief Tagging interface to indicate an object that may or may not return - an object capable of adding profile events to a buffer. - */ - class PxProfileEventSenderProvider - { - protected: - virtual ~PxProfileEventSenderProvider(){} - public: - /** - \brief This method can *always* return NULL. - Thus need to always check that what you are getting is what - you think it is. - - \return Perhaps a profile event sender. - */ - virtual PxProfileEventSender* getProfileEventSender() = 0; - }; -} } - -#endif // PXPVDSDK_PXPROFILEEVENTSENDER_H diff --git a/PxShared/src/pvd/src/PxProfileEventSerialization.h b/PxShared/src/pvd/src/PxProfileEventSerialization.h deleted file mode 100644 index 07c0563..0000000 --- a/PxShared/src/pvd/src/PxProfileEventSerialization.h +++ /dev/null @@ -1,258 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEEVENTSERIALIZATION_H -#define PXPVDSDK_PXPROFILEEVENTSERIALIZATION_H - -#include "PxProfileBase.h" -#include "PxProfileDataParsing.h" -#include "PxProfileEvents.h" - -namespace physx { namespace profile { - - /** - * Array type must be a pxu8 container. Templated so that this object can write - * to different collections. - */ - - template<typename TArrayType> - struct EventSerializer - { - TArrayType* mArray; - EventSerializer( TArrayType* inA ) : mArray( inA ) {} - - template<typename TDataType> - uint32_t streamify( const char*, const TDataType& inType ) - { - return mArray->write( inType ); - } - - uint32_t streamify( const char*, const char*& inType ) - { - PX_ASSERT( inType != NULL ); - uint32_t len( static_cast<uint32_t>( strlen( inType ) ) ); - ++len; //include the null terminator - uint32_t writtenSize = 0; - writtenSize = mArray->write(len); - writtenSize += mArray->write(inType, len); - return writtenSize; - } - - uint32_t streamify( const char*, const uint8_t* inData, uint32_t len ) - { - uint32_t writtenSize = mArray->write(len); - if ( len ) - writtenSize += mArray->write(inData, len); - return writtenSize; - } - - uint32_t streamify( const char* nm, const uint64_t& inType, EventStreamCompressionFlags::Enum inFlags ) - { - uint32_t writtenSize = 0; - switch( inFlags ) - { - case EventStreamCompressionFlags::U8: - writtenSize = streamify(nm, static_cast<uint8_t>(inType)); - break; - case EventStreamCompressionFlags::U16: - writtenSize = streamify(nm, static_cast<uint16_t>(inType)); - break; - case EventStreamCompressionFlags::U32: - writtenSize = streamify(nm, static_cast<uint32_t>(inType)); - break; - case EventStreamCompressionFlags::U64: - writtenSize = streamify(nm, inType); - break; - } - return writtenSize; - } - - uint32_t streamify( const char* nm, const uint32_t& inType, EventStreamCompressionFlags::Enum inFlags ) - { - uint32_t writtenSize = 0; - switch( inFlags ) - { - case EventStreamCompressionFlags::U8: - writtenSize = streamify(nm, static_cast<uint8_t>(inType)); - break; - case EventStreamCompressionFlags::U16: - writtenSize = streamify(nm, static_cast<uint16_t>(inType)); - break; - case EventStreamCompressionFlags::U32: - case EventStreamCompressionFlags::U64: - writtenSize = streamify(nm, inType); - break; - } - return writtenSize; - } - }; - - /** - * The event deserializes takes a buffer implements the streamify functions - * by setting the passed in data to the data in the buffer. - */ - template<bool TSwapBytes> - struct EventDeserializer - { - const uint8_t* mData; - uint32_t mLength; - bool mFail; - - EventDeserializer( const uint8_t* inData, uint32_t inLength ) - : mData( inData ) - , mLength( inLength ) - , mFail( false ) - { - if ( mData == NULL ) - mLength = 0; - } - - bool val() { return TSwapBytes; } - - uint32_t streamify( const char* , uint8_t& inType ) - { - uint8_t* theData = reinterpret_cast<uint8_t*>( &inType ); //type punned pointer... - if ( mFail || sizeof( inType ) > mLength ) - { - PX_ASSERT( false ); - mFail = true; - } - else - { - for( uint32_t idx = 0; idx < sizeof( uint8_t ); ++idx, ++mData, --mLength ) - theData[idx] = *mData; - } - return 0; - } - - //default streamify reads things natively as bytes. - template<typename TDataType> - uint32_t streamify( const char* , TDataType& inType ) - { - uint8_t* theData = reinterpret_cast<uint8_t*>( &inType ); //type punned pointer... - if ( mFail || sizeof( inType ) > mLength ) - { - PX_ASSERT( false ); - mFail = true; - } - else - { - for( uint32_t idx = 0; idx < sizeof( TDataType ); ++idx, ++mData, --mLength ) - theData[idx] = *mData; - bool temp = val(); - if ( temp ) - BlockParseFunctions::swapBytes<sizeof(TDataType)>( theData ); - } - return 0; - } - - uint32_t streamify( const char*, const char*& inType ) - { - uint32_t theLen; - streamify( "", theLen ); - theLen = PxMin( theLen, mLength ); - inType = reinterpret_cast<const char*>( mData ); - mData += theLen; - mLength -= theLen; - return 0; - } - - uint32_t streamify( const char*, const uint8_t*& inData, uint32_t& len ) - { - uint32_t theLen; - streamify( "", theLen ); - theLen = PxMin( theLen, mLength ); - len = theLen; - inData = reinterpret_cast<const uint8_t*>( mData ); - mData += theLen; - mLength -= theLen; - return 0; - } - - uint32_t streamify( const char* nm, uint64_t& inType, EventStreamCompressionFlags::Enum inFlags ) - { - switch( inFlags ) - { - case EventStreamCompressionFlags::U8: - { - uint8_t val=0; - streamify( nm, val ); - inType = val; - } - break; - case EventStreamCompressionFlags::U16: - { - uint16_t val; - streamify( nm, val ); - inType = val; - } - break; - case EventStreamCompressionFlags::U32: - { - uint32_t val; - streamify( nm, val ); - inType = val; - } - break; - case EventStreamCompressionFlags::U64: - streamify( nm, inType ); - break; - } - return 0; - } - - uint32_t streamify( const char* nm, uint32_t& inType, EventStreamCompressionFlags::Enum inFlags ) - { - switch( inFlags ) - { - case EventStreamCompressionFlags::U8: - { - uint8_t val=0; - streamify( nm, val ); - inType = val; - } - break; - case EventStreamCompressionFlags::U16: - { - uint16_t val=0; - streamify( nm, val ); - inType = val; - } - break; - case EventStreamCompressionFlags::U32: - case EventStreamCompressionFlags::U64: - streamify( nm, inType ); - break; - } - return 0; - } - }; -}} -#endif // PXPVDSDK_PXPROFILEEVENTSERIALIZATION_H diff --git a/PxShared/src/pvd/src/PxProfileEventSystem.h b/PxShared/src/pvd/src/PxProfileEventSystem.h deleted file mode 100644 index 7411824..0000000 --- a/PxShared/src/pvd/src/PxProfileEventSystem.h +++ /dev/null @@ -1,56 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTSYSTEM_H -#define PXPVDSDK_PXPROFILEEVENTSYSTEM_H - -#include "PxProfileBase.h" -#include "PxProfileEventSender.h" -#include "PxProfileEventBufferClient.h" -#include "PxProfileEventBufferClientManager.h" - -namespace physx { namespace profile { - class PxProfileContextProvider; - class PxProfileEventMutex; - class PxProfileEventFilter; - - /** - * Wraps the different interfaces into one object. - */ - class PxProfileEventSystem : public PxProfileEventSender - , public PxProfileEventBufferClient - , public PxProfileEventBufferClientManager - , public PxProfileEventFlusher - { - protected: - ~PxProfileEventSystem(){} - public: - virtual void release() = 0; - }; -} } - -#endif // PXPVDSDK_PXPROFILEEVENTSYSTEM_H diff --git a/PxShared/src/pvd/src/PxProfileEvents.h b/PxShared/src/pvd/src/PxProfileEvents.h deleted file mode 100644 index c8a9989..0000000 --- a/PxShared/src/pvd/src/PxProfileEvents.h +++ /dev/null @@ -1,706 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEEVENTS_H -#define PXPVDSDK_PXPROFILEEVENTS_H - -#include "foundation/PxMath.h" -#include "foundation/PxAssert.h" - -#include "PxProfileBase.h" -#include "PxProfileEventId.h" - - -#define PX_PROFILE_UNION_1(a) physx::profile::TUnion<a, physx::profile::Empty> -#define PX_PROFILE_UNION_2(a,b) physx::profile::TUnion<a, PX_PROFILE_UNION_1(b)> -#define PX_PROFILE_UNION_3(a,b,c) physx::profile::TUnion<a, PX_PROFILE_UNION_2(b,c)> -#define PX_PROFILE_UNION_4(a,b,c,d) physx::profile::TUnion<a, PX_PROFILE_UNION_3(b,c,d)> -#define PX_PROFILE_UNION_5(a,b,c,d,e) physx::profile::TUnion<a, PX_PROFILE_UNION_4(b,c,d,e)> -#define PX_PROFILE_UNION_6(a,b,c,d,e,f) physx::profile::TUnion<a, PX_PROFILE_UNION_5(b,c,d,e,f)> -#define PX_PROFILE_UNION_7(a,b,c,d,e,f,g) physx::profile::TUnion<a, PX_PROFILE_UNION_6(b,c,d,e,f,g)> -#define PX_PROFILE_UNION_8(a,b,c,d,e,f,g,h) physx::profile::TUnion<a, PX_PROFILE_UNION_7(b,c,d,e,f,g,h)> -#define PX_PROFILE_UNION_9(a,b,c,d,e,f,g,h,i) physx::profile::TUnion<a, PX_PROFILE_UNION_8(b,c,d,e,f,g,h,i)> - -namespace physx { namespace profile { - - struct Empty {}; - - template <typename T> struct Type2Type {}; - - template <typename U, typename V> - union TUnion - { - typedef U Head; - typedef V Tail; - - Head head; - Tail tail; - - template <typename TDataType> - void init(const TDataType& inData) - { - toType(Type2Type<TDataType>()).init(inData); - } - - template <typename TDataType> - PX_FORCE_INLINE TDataType& toType(const Type2Type<TDataType>& outData) { return tail.toType(outData); } - - PX_FORCE_INLINE Head& toType(const Type2Type<Head>&) { return head; } - - template <typename TDataType> - PX_FORCE_INLINE const TDataType& toType(const Type2Type<TDataType>& outData) const { return tail.toType(outData); } - - PX_FORCE_INLINE const Head& toType(const Type2Type<Head>&) const { return head; } - }; - - struct EventTypes - { - enum Enum - { - Unknown = 0, - StartEvent, - StopEvent, - RelativeStartEvent, //reuses context,id from the earlier event. - RelativeStopEvent, //reuses context,id from the earlier event. - EventValue, - CUDAProfileBuffer //obsolete, placeholder to skip data from PhysX SDKs < 3.4 - }; - }; - - struct EventStreamCompressionFlags - { - enum Enum - { - U8 = 0, - U16 = 1, - U32 = 2, - U64 = 3, - CompressionMask = 3 - }; - }; - -#if (PX_PS4) || (PX_APPLE_FAMILY) || (PX_LINUX && PX_X86 && PX_CLANG) -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wimplicit-fallthrough" -#endif - - //Find the smallest value that will represent the incoming value without loss. - //We can enlarge the current compression value, but we can't make is smaller. - //In this way, we can use this function to find the smallest compression setting - //that will work for a set of values. - inline EventStreamCompressionFlags::Enum findCompressionValue( uint64_t inValue, EventStreamCompressionFlags::Enum inCurrentCompressionValue = EventStreamCompressionFlags::U8 ) - { - PX_ASSERT_WITH_MESSAGE( (inCurrentCompressionValue >= EventStreamCompressionFlags::U8) && - (inCurrentCompressionValue <= EventStreamCompressionFlags::U64), - "Invalid inCurrentCompressionValue in profile::findCompressionValue"); - - //Fallthrough is intentional - switch( inCurrentCompressionValue ) - { - case EventStreamCompressionFlags::U8: - if ( inValue <= UINT8_MAX ) - return EventStreamCompressionFlags::U8; - case EventStreamCompressionFlags::U16: - if ( inValue <= UINT16_MAX ) - return EventStreamCompressionFlags::U16; - case EventStreamCompressionFlags::U32: - if ( inValue <= UINT32_MAX ) - return EventStreamCompressionFlags::U32; - case EventStreamCompressionFlags::U64: - break; - } - return EventStreamCompressionFlags::U64; - } - - //Find the smallest value that will represent the incoming value without loss. - //We can enlarge the current compression value, but we can't make is smaller. - //In this way, we can use this function to find the smallest compression setting - //that will work for a set of values. - inline EventStreamCompressionFlags::Enum findCompressionValue( uint32_t inValue, EventStreamCompressionFlags::Enum inCurrentCompressionValue = EventStreamCompressionFlags::U8 ) - { - PX_ASSERT_WITH_MESSAGE( (inCurrentCompressionValue >= EventStreamCompressionFlags::U8) && - (inCurrentCompressionValue <= EventStreamCompressionFlags::U64), - "Invalid inCurrentCompressionValue in profile::findCompressionValue"); - - //Fallthrough is intentional - switch( inCurrentCompressionValue ) - { - case EventStreamCompressionFlags::U8: - if ( inValue <= UINT8_MAX ) - return EventStreamCompressionFlags::U8; - case EventStreamCompressionFlags::U16: - if ( inValue <= UINT16_MAX ) - return EventStreamCompressionFlags::U16; - case EventStreamCompressionFlags::U32: - case EventStreamCompressionFlags::U64: - break; - } - return EventStreamCompressionFlags::U32; - } - -#if (PX_PS4) || (PX_APPLE_FAMILY) || (PX_LINUX && PX_X86 && PX_CLANG) -#pragma clang diagnostic pop -#endif - - //Event header is 32 bytes and precedes all events. - struct EventHeader - { - uint8_t mEventType; //Used to parse the correct event out of the stream - uint8_t mStreamOptions; //Timestamp compression, etc. - uint16_t mEventId; //16 bit per-event-system event id - EventHeader( uint8_t type = 0, uint16_t id = 0 ) - : mEventType( type ) - , mStreamOptions( uint8_t(-1) ) - , mEventId( id ) - { - } - - EventHeader( EventTypes::Enum type, uint16_t id ) - : mEventType( static_cast<uint8_t>( type ) ) - , mStreamOptions( uint8_t(-1) ) - , mEventId( id ) - { - } - - EventStreamCompressionFlags::Enum getTimestampCompressionFlags() const - { - return static_cast<EventStreamCompressionFlags::Enum> ( mStreamOptions & EventStreamCompressionFlags::CompressionMask ); - } - - uint64_t compressTimestamp( uint64_t inLastTimestamp, uint64_t inCurrentTimestamp ) - { - mStreamOptions = EventStreamCompressionFlags::U64; - uint64_t retval = inCurrentTimestamp; - if ( inLastTimestamp ) - { - retval = inCurrentTimestamp - inLastTimestamp; - EventStreamCompressionFlags::Enum compressionValue = findCompressionValue( retval ); - mStreamOptions = static_cast<uint8_t>( compressionValue ); - if ( compressionValue == EventStreamCompressionFlags::U64 ) - retval = inCurrentTimestamp; //just send the timestamp as is. - } - return retval; - } - - uint64_t uncompressTimestamp( uint64_t inLastTimestamp, uint64_t inCurrentTimestamp ) const - { - if ( getTimestampCompressionFlags() != EventStreamCompressionFlags::U64 ) - return inLastTimestamp + inCurrentTimestamp; - return inCurrentTimestamp; - } - - void setContextIdCompressionFlags( uint64_t inContextId ) - { - uint8_t options = static_cast<uint8_t>( findCompressionValue( inContextId ) ); - mStreamOptions = uint8_t(mStreamOptions | options << 2); - } - - EventStreamCompressionFlags::Enum getContextIdCompressionFlags() const - { - return static_cast< EventStreamCompressionFlags::Enum >( ( mStreamOptions >> 2 ) & EventStreamCompressionFlags::CompressionMask ); - } - - bool operator==( const EventHeader& inOther ) const - { - return mEventType == inOther.mEventType - && mStreamOptions == inOther.mStreamOptions - && mEventId == inOther.mEventId; - } - - template<typename TStreamType> - inline uint32_t streamify( TStreamType& inStream ) - { - uint32_t writtenSize = inStream.streamify( "EventType", mEventType ); - writtenSize += inStream.streamify("StreamOptions", mStreamOptions); //Timestamp compression, etc. - writtenSize += inStream.streamify("EventId", mEventId); //16 bit per-event-system event id - return writtenSize; - } - - - }; - - //Declaration of type level getEventType function that maps enumeration event types to datatypes - template<typename TDataType> - inline EventTypes::Enum getEventType() { PX_ASSERT( false ); return EventTypes::Unknown; } - - //Relative profile event means this event is sharing the context and thread id - //with the event before it. - struct RelativeProfileEvent - { - uint64_t mTensOfNanoSeconds; //timestamp is in tensOfNanonseconds - void init( uint64_t inTs ) { mTensOfNanoSeconds = inTs; } - void init( const RelativeProfileEvent& inData ) { mTensOfNanoSeconds = inData.mTensOfNanoSeconds; } - bool operator==( const RelativeProfileEvent& other ) const - { - return mTensOfNanoSeconds == other.mTensOfNanoSeconds; - } - template<typename TStreamType> - uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader ) - { - return inStream.streamify( "TensOfNanoSeconds", mTensOfNanoSeconds, inHeader.getTimestampCompressionFlags() ); - } - uint64_t getTimestamp() const { return mTensOfNanoSeconds; } - void setTimestamp( uint64_t inTs ) { mTensOfNanoSeconds = inTs; } - void setupHeader( EventHeader& inHeader, uint64_t inLastTimestamp ) - { - mTensOfNanoSeconds = inHeader.compressTimestamp( inLastTimestamp, mTensOfNanoSeconds ); - } - - uint32_t getEventSize(const EventHeader& inHeader) - { - uint32_t size = 0; - switch (inHeader.getTimestampCompressionFlags()) - { - case EventStreamCompressionFlags::U8: - size = 1; - break; - case EventStreamCompressionFlags::U16: - size = 2; - break; - case EventStreamCompressionFlags::U32: - size = 4; - break; - case EventStreamCompressionFlags::U64: - size = 8; - break; - } - return size; - } - }; - - //Start version of the relative event. - struct RelativeStartEvent : public RelativeProfileEvent - { - void init( uint64_t inTs = 0 ) { RelativeProfileEvent::init( inTs ); } - void init( const RelativeStartEvent& inData ) { RelativeProfileEvent::init( inData ); } - template<typename THandlerType> - void handle( THandlerType* inHdlr, uint16_t eventId, uint32_t thread, uint64_t context, uint8_t inCpuId, uint8_t threadPriority ) const - { - inHdlr->onStartEvent( PxProfileEventId( eventId ), thread, context, inCpuId, threadPriority, mTensOfNanoSeconds ); - } - }; - - template<> inline EventTypes::Enum getEventType<RelativeStartEvent>() { return EventTypes::RelativeStartEvent; } - - //Stop version of relative event. - struct RelativeStopEvent : public RelativeProfileEvent - { - void init( uint64_t inTs = 0 ) { RelativeProfileEvent::init( inTs ); } - void init( const RelativeStopEvent& inData ) { RelativeProfileEvent::init( inData ); } - template<typename THandlerType> - void handle( THandlerType* inHdlr, uint16_t eventId, uint32_t thread, uint64_t context, uint8_t inCpuId, uint8_t threadPriority ) const - { - inHdlr->onStopEvent( PxProfileEventId( eventId ), thread, context, inCpuId, threadPriority, mTensOfNanoSeconds ); - } - }; - - template<> inline EventTypes::Enum getEventType<RelativeStopEvent>() { return EventTypes::RelativeStopEvent; } - - struct EventContextInformation - { - uint64_t mContextId; - uint32_t mThreadId; //Thread this event was taken from - uint8_t mThreadPriority; - uint8_t mCpuId; - - void init( uint32_t inThreadId = UINT32_MAX - , uint64_t inContextId = (uint64_t(-1)) - , uint8_t inPriority = UINT8_MAX - , uint8_t inCpuId = UINT8_MAX ) - { - mContextId = inContextId; - mThreadId = inThreadId; - mThreadPriority = inPriority; - mCpuId = inCpuId; - } - - void init( const EventContextInformation& inData ) - { - mContextId = inData.mContextId; - mThreadId = inData.mThreadId; - mThreadPriority = inData.mThreadPriority; - mCpuId = inData.mCpuId; - } - - template<typename TStreamType> - uint32_t streamify( TStreamType& inStream, EventStreamCompressionFlags::Enum inContextIdFlags ) - { - uint32_t writtenSize = inStream.streamify( "ThreadId", mThreadId ); - writtenSize += inStream.streamify("ContextId", mContextId, inContextIdFlags); - writtenSize += inStream.streamify("ThreadPriority", mThreadPriority); - writtenSize += inStream.streamify("CpuId", mCpuId); - return writtenSize; - } - - bool operator==( const EventContextInformation& other ) const - { - return mThreadId == other.mThreadId - && mContextId == other.mContextId - && mThreadPriority == other.mThreadPriority - && mCpuId == other.mCpuId; - } - - void setToDefault() - { - *this = EventContextInformation(); - } - }; - - //Profile event contains all the data required to tell the profile what is going - //on. - struct ProfileEvent - { - EventContextInformation mContextInformation; - RelativeProfileEvent mTimeData; //timestamp in seconds. - void init( uint32_t inThreadId, uint64_t inContextId, uint8_t inCpuId, uint8_t inPriority, uint64_t inTs ) - { - mContextInformation.init( inThreadId, inContextId, inPriority, inCpuId ); - mTimeData.init( inTs ); - } - - void init( const ProfileEvent& inData ) - { - mContextInformation.init( inData.mContextInformation ); - mTimeData.init( inData.mTimeData ); - } - - bool operator==( const ProfileEvent& other ) const - { - return mContextInformation == other.mContextInformation - && mTimeData == other.mTimeData; - } - - template<typename TStreamType> - uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader ) - { - uint32_t writtenSize = mContextInformation.streamify(inStream, inHeader.getContextIdCompressionFlags()); - writtenSize += mTimeData.streamify(inStream, inHeader); - return writtenSize; - } - - uint32_t getEventSize(const EventHeader& inHeader) - { - uint32_t eventSize = 0; - // time is stored depending on the conpress flag mTimeData.streamify(inStream, inHeader); - switch (inHeader.getTimestampCompressionFlags()) - { - case EventStreamCompressionFlags::U8: - eventSize++; - break; - case EventStreamCompressionFlags::U16: - eventSize += 2; - break; - case EventStreamCompressionFlags::U32: - eventSize += 4; - break; - case EventStreamCompressionFlags::U64: - eventSize += 8; - break; - } - - // context information - // mContextInformation.streamify( inStream, inHeader.getContextIdCompressionFlags() ); - eventSize += 6; // uint32_t mThreadId; uint8_t mThreadPriority; uint8_t mCpuId; - switch (inHeader.getContextIdCompressionFlags()) - { - case EventStreamCompressionFlags::U8: - eventSize++; - break; - case EventStreamCompressionFlags::U16: - eventSize += 2; - break; - case EventStreamCompressionFlags::U32: - eventSize += 4; - break; - case EventStreamCompressionFlags::U64: - eventSize += 8; - break; - } - - return eventSize; - } - - uint64_t getTimestamp() const { return mTimeData.getTimestamp(); } - void setTimestamp( uint64_t inTs ) { mTimeData.setTimestamp( inTs ); } - - void setupHeader( EventHeader& inHeader, uint64_t inLastTimestamp ) - { - mTimeData.setupHeader( inHeader, inLastTimestamp ); - inHeader.setContextIdCompressionFlags( mContextInformation.mContextId ); - } - }; - - //profile start event starts the profile session. - struct StartEvent : public ProfileEvent - { - void init( uint32_t inThreadId = 0, uint64_t inContextId = 0, uint8_t inCpuId = 0, uint8_t inPriority = 0, uint64_t inTensOfNanoSeconds = 0 ) - { - ProfileEvent::init( inThreadId, inContextId, inCpuId, inPriority, inTensOfNanoSeconds ); - } - void init( const StartEvent& inData ) - { - ProfileEvent::init( inData ); - } - - RelativeStartEvent getRelativeEvent() const { RelativeStartEvent theEvent; theEvent.init( mTimeData.mTensOfNanoSeconds ); return theEvent; } - EventTypes::Enum getRelativeEventType() const { return getEventType<RelativeStartEvent>(); } - }; - - template<> inline EventTypes::Enum getEventType<StartEvent>() { return EventTypes::StartEvent; } - - //Profile stop event stops the profile session. - struct StopEvent : public ProfileEvent - { - void init( uint32_t inThreadId = 0, uint64_t inContextId = 0, uint8_t inCpuId = 0, uint8_t inPriority = 0, uint64_t inTensOfNanoSeconds = 0 ) - { - ProfileEvent::init( inThreadId, inContextId, inCpuId, inPriority, inTensOfNanoSeconds ); - } - void init( const StopEvent& inData ) - { - ProfileEvent::init( inData ); - } - RelativeStopEvent getRelativeEvent() const { RelativeStopEvent theEvent; theEvent.init( mTimeData.mTensOfNanoSeconds ); return theEvent; } - EventTypes::Enum getRelativeEventType() const { return getEventType<RelativeStopEvent>(); } - }; - - template<> inline EventTypes::Enum getEventType<StopEvent>() { return EventTypes::StopEvent; } - - struct EventValue - { - uint64_t mValue; - uint64_t mContextId; - uint32_t mThreadId; - void init( int64_t inValue = 0, uint64_t inContextId = 0, uint32_t inThreadId = 0 ) - { - mValue = static_cast<uint64_t>( inValue ); - mContextId = inContextId; - mThreadId = inThreadId; - } - - void init( const EventValue& inData ) - { - mValue = inData.mValue; - mContextId = inData.mContextId; - mThreadId = inData.mThreadId; - } - - int64_t getValue() const { return static_cast<int16_t>( mValue ); } - - void setupHeader( EventHeader& inHeader ) - { - mValue = inHeader.compressTimestamp( 0, mValue ); - inHeader.setContextIdCompressionFlags( mContextId ); - } - - template<typename TStreamType> - uint32_t streamify( TStreamType& inStream, const EventHeader& inHeader ) - { - uint32_t writtenSize = inStream.streamify("Value", mValue, inHeader.getTimestampCompressionFlags()); - writtenSize += inStream.streamify("ContextId", mContextId, inHeader.getContextIdCompressionFlags()); - writtenSize += inStream.streamify("ThreadId", mThreadId); - return writtenSize; - } - - uint32_t getEventSize(const EventHeader& inHeader) - { - uint32_t eventSize = 0; - // value - switch (inHeader.getTimestampCompressionFlags()) - { - case EventStreamCompressionFlags::U8: - eventSize++; - break; - case EventStreamCompressionFlags::U16: - eventSize += 2; - break; - case EventStreamCompressionFlags::U32: - eventSize += 4; - break; - case EventStreamCompressionFlags::U64: - eventSize += 8; - break; - } - - // context information - switch (inHeader.getContextIdCompressionFlags()) - { - case EventStreamCompressionFlags::U8: - eventSize++; - break; - case EventStreamCompressionFlags::U16: - eventSize += 2; - break; - case EventStreamCompressionFlags::U32: - eventSize += 4; - break; - case EventStreamCompressionFlags::U64: - eventSize += 8; - break; - } - - eventSize += 4; // uint32_t mThreadId; - - return eventSize; - } - - bool operator==( const EventValue& other ) const - { - return mValue == other.mValue - && mContextId == other.mContextId - && mThreadId == other.mThreadId; - } - - template<typename THandlerType> - void handle( THandlerType* inHdlr, uint16_t eventId ) const - { - inHdlr->onEventValue( PxProfileEventId( eventId ), mThreadId, mContextId, getValue() ); - } - - }; - template<> inline EventTypes::Enum getEventType<EventValue>() { return EventTypes::EventValue; } - - //obsolete, placeholder to skip data from PhysX SDKs < 3.4 - struct CUDAProfileBuffer - { - uint64_t mTimestamp; - float mTimespan; - const uint8_t* mCudaData; - uint32_t mBufLen; - uint32_t mVersion; - - template<typename TStreamType> - uint32_t streamify( TStreamType& inStream, const EventHeader& ) - { - uint32_t writtenSize = inStream.streamify("Timestamp", mTimestamp); - writtenSize += inStream.streamify("Timespan", mTimespan); - writtenSize += inStream.streamify("CudaData", mCudaData, mBufLen); - writtenSize += inStream.streamify("BufLen", mBufLen); - writtenSize += inStream.streamify("Version", mVersion); - return writtenSize; - } - - bool operator==( const CUDAProfileBuffer& other ) const - { - return mTimestamp == other.mTimestamp - && mTimespan == other.mTimespan - && mBufLen == other.mBufLen - && memcmp( mCudaData, other.mCudaData, mBufLen ) == 0 - && mVersion == other.mVersion; - } - }; - - template<> inline EventTypes::Enum getEventType<CUDAProfileBuffer>() { return EventTypes::CUDAProfileBuffer; } - - //Provides a generic equal operation for event data objects. - template <typename TEventData> - struct EventDataEqualOperator - { - TEventData mData; - EventDataEqualOperator( const TEventData& inD ) : mData( inD ) {} - template<typename TDataType> bool operator()( const TDataType& inRhs ) const { return mData.toType( Type2Type<TDataType>() ) == inRhs; } - bool operator()() const { return false; } - }; - - /** - * Generic event container that combines and even header with the generic event data type. - * Provides unsafe and typesafe access to the event data. - */ - class Event - { - public: - typedef PX_PROFILE_UNION_7(StartEvent, StopEvent, RelativeStartEvent, RelativeStopEvent, EventValue, CUDAProfileBuffer, uint8_t) EventData; - - private: - EventHeader mHeader; - EventData mData; - public: - Event() {} - - template <typename TDataType> - Event( EventHeader inHeader, const TDataType& inData ) - : mHeader( inHeader ) - { - mData.init<TDataType>(inData); - } - - template<typename TDataType> - Event( uint16_t eventId, const TDataType& inData ) - : mHeader( getEventType<TDataType>(), eventId ) - { - mData.init<TDataType>(inData); - } - const EventHeader& getHeader() const { return mHeader; } - const EventData& getData() const { return mData; } - - template<typename TDataType> - const TDataType& getValue() const { PX_ASSERT( mHeader.mEventType == getEventType<TDataType>() ); return mData.toType<TDataType>(); } - - template<typename TDataType> - TDataType& getValue() { PX_ASSERT( mHeader.mEventType == getEventType<TDataType>() ); return mData.toType<TDataType>(); } - - template<typename TRetVal, typename TOperator> - inline TRetVal visit( TOperator inOp ) const; - - bool operator==( const Event& inOther ) const - { - if ( !(mHeader == inOther.mHeader ) ) return false; - if ( mHeader.mEventType ) - return inOther.visit<bool>( EventDataEqualOperator<EventData>( mData ) ); - return true; - } - }; - - //Combining the above union type with an event type means that an object can get the exact - //data out of the union. Using this function means that all callsites will be forced to - //deal with the newer datatypes and that the switch statement only exists in once place. - //Implements conversion from enum -> datatype - template<typename TRetVal, typename TOperator> - TRetVal visit( EventTypes::Enum inEventType, const Event::EventData& inData, TOperator inOperator ) - { - switch( inEventType ) - { - case EventTypes::StartEvent: return inOperator( inData.toType( Type2Type<StartEvent>() ) ); - case EventTypes::StopEvent: return inOperator( inData.toType( Type2Type<StopEvent>() ) ); - case EventTypes::RelativeStartEvent: return inOperator( inData.toType( Type2Type<RelativeStartEvent>() ) ); - case EventTypes::RelativeStopEvent: return inOperator( inData.toType( Type2Type<RelativeStopEvent>() ) ); - case EventTypes::EventValue: return inOperator( inData.toType( Type2Type<EventValue>() ) ); - //obsolete, placeholder to skip data from PhysX SDKs < 3.4 - case EventTypes::CUDAProfileBuffer: return inOperator( inData.toType( Type2Type<CUDAProfileBuffer>() ) ); - case EventTypes::Unknown: break; - } - uint8_t type = static_cast<uint8_t>( inEventType ); - return inOperator( type ); - } - - template<typename TRetVal, typename TOperator> - inline TRetVal Event::visit( TOperator inOp ) const - { - return physx::profile::visit<TRetVal>( static_cast<EventTypes::Enum>(mHeader.mEventType), mData, inOp ); - } -} } - -#endif // PXPVDSDK_PXPROFILEEVENTS_H diff --git a/PxShared/src/pvd/src/PxProfileMemory.h b/PxShared/src/pvd/src/PxProfileMemory.h deleted file mode 100644 index 30e8bdc..0000000 --- a/PxShared/src/pvd/src/PxProfileMemory.h +++ /dev/null @@ -1,99 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORY_H -#define PXPVDSDK_PXPROFILEMEMORY_H - -#include "PxProfileBase.h" -#include "PxProfileEventBufferClientManager.h" -#include "PxProfileEventSender.h" -#include "PsBroadcast.h" - -namespace physx { namespace profile { - - /** - \brief Record events so a late-connecting client knows about - all outstanding allocations - */ - class PxProfileMemoryEventRecorder : public shdfnd::AllocationListener - { - protected: - virtual ~PxProfileMemoryEventRecorder(){} - public: - /** - \brief Set the allocation listener - \param inListener Allocation listener. - */ - virtual void setListener(AllocationListener* inListener) = 0; - /** - \brief Release the instance. - */ - virtual void release() = 0; - - /** - \brief Create the profile memory event recorder. - \param inAllocator Allocation callback. - */ - static PxProfileMemoryEventRecorder& createRecorder(PxAllocatorCallback* inAllocator); - }; - - /** - \brief Stores memory events into the memory buffer. - */ - class PxProfileMemoryEventBuffer - : public shdfnd::AllocationListener //add a new event to the buffer - , public PxProfileEventBufferClientManager //add clients to handle the serialized memory events - , public PxProfileEventFlusher //flush the buffer - { - protected: - virtual ~PxProfileMemoryEventBuffer(){} - public: - - /** - \brief Release the instance. - */ - virtual void release() = 0; - - /** - \brief Create a non-mutex-protected event buffer. - \param inAllocator Allocation callback. - \param inBufferSize Internal buffer size. - */ - static PxProfileMemoryEventBuffer& createMemoryEventBuffer(PxAllocatorCallback& inAllocator, uint32_t inBufferSize = 0x1000); - }; - - - -} } // namespace physx - - -#endif // PXPVDSDK_PXPROFILEMEMORY_H - - diff --git a/PxShared/src/pvd/src/PxProfileMemoryBuffer.h b/PxShared/src/pvd/src/PxProfileMemoryBuffer.h deleted file mode 100644 index ae957ce..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryBuffer.h +++ /dev/null @@ -1,193 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORYBUFFER_H -#define PXPVDSDK_PXPROFILEMEMORYBUFFER_H - -#include "PxProfileBase.h" -#include "PsAllocator.h" -#include "foundation/PxMemory.h" - -namespace physx { namespace profile { - - template<typename TAllocator = typename shdfnd::AllocatorTraits<uint8_t>::Type > - class MemoryBuffer : public TAllocator - { - uint8_t* mBegin; - uint8_t* mEnd; - uint8_t* mCapacityEnd; - - public: - MemoryBuffer( const TAllocator& inAlloc = TAllocator() ) : TAllocator( inAlloc ), mBegin( 0 ), mEnd( 0 ), mCapacityEnd( 0 ) {} - ~MemoryBuffer() - { - if ( mBegin ) TAllocator::deallocate( mBegin ); - } - uint32_t size() const { return static_cast<uint32_t>( mEnd - mBegin ); } - uint32_t capacity() const { return static_cast<uint32_t>( mCapacityEnd - mBegin ); } - uint8_t* begin() { return mBegin; } - uint8_t* end() { return mEnd; } - void setEnd(uint8_t* nEnd) { mEnd = nEnd; } - const uint8_t* begin() const { return mBegin; } - const uint8_t* end() const { return mEnd; } - void clear() { mEnd = mBegin; } - uint32_t write( uint8_t inValue ) - { - growBuf( 1 ); - *mEnd = inValue; - ++mEnd; - return 1; - } - - template<typename TDataType> - uint32_t write( const TDataType& inValue ) - { - uint32_t writtenSize = sizeof(TDataType); - growBuf(writtenSize); - const uint8_t* __restrict readPtr = reinterpret_cast< const uint8_t* >( &inValue ); - uint8_t* __restrict writePtr = mEnd; - for ( uint32_t idx = 0; idx < sizeof(TDataType); ++idx ) writePtr[idx] = readPtr[idx]; - mEnd += writtenSize; - return writtenSize; - } - - template<typename TDataType> - uint32_t write( const TDataType* inValue, uint32_t inLength ) - { - if ( inValue && inLength ) - { - uint32_t writeSize = inLength * sizeof( TDataType ); - growBuf( writeSize ); - PxMemCopy( mBegin + size(), inValue, writeSize ); - mEnd += writeSize; - return writeSize; - } - return 0; - } - - // used by atomic write. Store the data and write the end afterwards - // we dont check the buffer size, it should not resize on the fly - template<typename TDataType> - uint32_t write(const TDataType* inValue, uint32_t inLength, int32_t index) - { - if (inValue && inLength) - { - uint32_t writeSize = inLength * sizeof(TDataType); - PX_ASSERT(mBegin + index + writeSize < mCapacityEnd); - PxMemCopy(mBegin + index, inValue, writeSize); - return writeSize; - } - return 0; - } - - void growBuf( uint32_t inAmount ) - { - uint32_t newSize = size() + inAmount; - reserve( newSize ); - } - void resize( uint32_t inAmount ) - { - reserve( inAmount ); - mEnd = mBegin + inAmount; - } - void reserve( uint32_t newSize ) - { - uint32_t currentSize = size(); - if ( newSize >= capacity() ) - { - const uint32_t allocSize = mBegin ? newSize * 2 : newSize; - - uint8_t* newData = static_cast<uint8_t*>(TAllocator::allocate(allocSize, __FILE__, __LINE__)); - memset(newData, 0xf,allocSize); - if ( mBegin ) - { - PxMemCopy( newData, mBegin, currentSize ); - TAllocator::deallocate( mBegin ); - } - mBegin = newData; - mEnd = mBegin + currentSize; - mCapacityEnd = mBegin + allocSize; - } - } - }; - - - class TempMemoryBuffer - { - uint8_t* mBegin; - uint8_t* mEnd; - uint8_t* mCapacityEnd; - - public: - TempMemoryBuffer(uint8_t* data, int32_t size) : mBegin(data), mEnd(data), mCapacityEnd(data + size) {} - ~TempMemoryBuffer() - { - } - uint32_t size() const { return static_cast<uint32_t>(mEnd - mBegin); } - uint32_t capacity() const { return static_cast<uint32_t>(mCapacityEnd - mBegin); } - const uint8_t* begin() { return mBegin; } - uint8_t* end() { return mEnd; } - const uint8_t* begin() const { return mBegin; } - const uint8_t* end() const { return mEnd; } - uint32_t write(uint8_t inValue) - { - *mEnd = inValue; - ++mEnd; - return 1; - } - - template<typename TDataType> - uint32_t write(const TDataType& inValue) - { - uint32_t writtenSize = sizeof(TDataType); - const uint8_t* __restrict readPtr = reinterpret_cast<const uint8_t*>(&inValue); - uint8_t* __restrict writePtr = mEnd; - for (uint32_t idx = 0; idx < sizeof(TDataType); ++idx) writePtr[idx] = readPtr[idx]; - mEnd += writtenSize; - return writtenSize; - } - - template<typename TDataType> - uint32_t write(const TDataType* inValue, uint32_t inLength) - { - if (inValue && inLength) - { - uint32_t writeSize = inLength * sizeof(TDataType); - PxMemCopy(mBegin + size(), inValue, writeSize); - mEnd += writeSize; - return writeSize; - } - return 0; - } - }; - -}} - -#endif // PXPVDSDK_PXPROFILEMEMORYBUFFER_H diff --git a/PxShared/src/pvd/src/PxProfileMemoryEventBuffer.h b/PxShared/src/pvd/src/PxProfileMemoryEventBuffer.h deleted file mode 100644 index 7cc50b6..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEventBuffer.h +++ /dev/null @@ -1,156 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTBUFFER_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTBUFFER_H - -#include "PxProfileDataBuffer.h" -#include "PxProfileMemoryEvents.h" -#include "PxProfileMemoryEventTypes.h" -#include "PxProfileScopedMutexLock.h" -#include "PxProfileAllocatorWrapper.h" - -#include "PsHash.h" -#include "PsHashMap.h" -#include "PsUserAllocated.h" - -namespace physx { namespace profile { - - template<typename TMutex, - typename TScopedLock> - class MemoryEventBuffer : public DataBuffer<TMutex, TScopedLock> - { - public: - typedef DataBuffer<TMutex, TScopedLock> TBaseType; - typedef typename TBaseType::TMutexType TMutexType; - typedef typename TBaseType::TScopedLockType TScopedLockType; - typedef typename TBaseType::TU8AllocatorType TU8AllocatorType; - typedef typename TBaseType::TMemoryBufferType TMemoryBufferType; - typedef typename TBaseType::TBufferClientArray TBufferClientArray; - typedef shdfnd::HashMap<const char*, uint32_t, shdfnd::Hash<const char*>, TU8AllocatorType> TCharPtrToHandleMap; - - protected: - TCharPtrToHandleMap mStringTable; - - public: - - MemoryEventBuffer( PxAllocatorCallback& cback - , uint32_t inBufferFullAmount - , TMutexType* inBufferMutex ) - : TBaseType( &cback, inBufferFullAmount, inBufferMutex, "struct physx::profile::MemoryEvent" ) - , mStringTable( TU8AllocatorType( TBaseType::getWrapper(), "MemoryEventStringBuffer" ) ) - { - } - - uint32_t getHandle( const char* inData ) - { - if ( inData == NULL ) inData = ""; - const typename TCharPtrToHandleMap::Entry* result( mStringTable.find( inData ) ); - if ( result ) - return result->second; - uint32_t hdl = mStringTable.size() + 1; - mStringTable.insert( inData, hdl ); - StringTableEvent theEvent; - theEvent.init( inData, hdl ); - sendEvent( theEvent ); - return hdl; - } - - void onAllocation( size_t inSize, const char* inType, const char* inFile, uint32_t inLine, uint64_t addr ) - { - if ( addr == 0 ) - return; - uint32_t typeHdl( getHandle( inType ) ); - uint32_t fileHdl( getHandle( inFile ) ); - AllocationEvent theEvent; - theEvent.init( inSize, typeHdl, fileHdl, inLine, addr ); - sendEvent( theEvent ); - } - - void onDeallocation( uint64_t addr ) - { - if ( addr == 0 ) - return; - DeallocationEvent theEvent; - theEvent.init( addr ); - sendEvent( theEvent ); - } - - void flushProfileEvents() - { - TBaseType::flushEvents(); - } - - protected: - - template<typename TDataType> - void sendEvent( TDataType inType ) - { - MemoryEventHeader theHeader( getMemoryEventType<TDataType>() ); - inType.setup( theHeader ); - theHeader.streamify( TBaseType::mSerializer ); - inType.streamify( TBaseType::mSerializer, theHeader ); - if ( TBaseType::mDataArray.size() >= TBaseType::mBufferFullAmount ) - flushProfileEvents(); - } - }; - - class PxProfileMemoryEventBufferImpl : public shdfnd::UserAllocated - , public PxProfileMemoryEventBuffer - { - typedef MemoryEventBuffer<PxProfileEventMutex, NullLock> TMemoryBufferType; - TMemoryBufferType mBuffer; - - public: - PxProfileMemoryEventBufferImpl( PxAllocatorCallback& alloc, uint32_t inBufferFullAmount ) - : mBuffer( alloc, inBufferFullAmount, NULL ) - { - } - - virtual void onAllocation( size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory ) - { - mBuffer.onAllocation( size, typeName, filename, uint32_t(line), PX_PROFILE_POINTER_TO_U64( allocatedMemory ) ); - } - virtual void onDeallocation( void* allocatedMemory ) - { - mBuffer.onDeallocation( PX_PROFILE_POINTER_TO_U64( allocatedMemory ) ); - } - - virtual void addClient( PxProfileEventBufferClient& inClient ) { mBuffer.addClient( inClient ); } - virtual void removeClient( PxProfileEventBufferClient& inClient ) { mBuffer.removeClient( inClient ); } - virtual bool hasClients() const { return mBuffer.hasClients(); } - - virtual void flushProfileEvents() { mBuffer.flushProfileEvents(); } - - virtual void release(){ PX_PROFILE_DELETE( mBuffer.getWrapper().getAllocator(), this ); } - }; -}} - -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTBUFFER_H diff --git a/PxShared/src/pvd/src/PxProfileMemoryEventParser.h b/PxShared/src/pvd/src/PxProfileMemoryEventParser.h deleted file mode 100644 index feb8063..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEventParser.h +++ /dev/null @@ -1,185 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTPARSER_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTPARSER_H - -#include "PxProfileMemoryEvents.h" -#include "PxProfileAllocatorWrapper.h" -#include "PxProfileEventSerialization.h" - -#include "PsHashMap.h" -#include "PsString.h" - -namespace physx { namespace profile { - - template<bool TSwapBytes, typename TParserType, typename THandlerType> - bool parseEventData( TParserType& inParser, const uint8_t* inData, uint32_t inLength, THandlerType* inHandler ); - - template<bool TSwapBytes> - struct MemoryEventParser - { - typedef PxProfileWrapperReflectionAllocator<uint8_t> TAllocatorType; - typedef shdfnd::HashMap<uint32_t, char*, shdfnd::Hash<uint32_t>, TAllocatorType > THdlToStringMap; - typedef EventDeserializer<TSwapBytes> TDeserializerType; - - PxProfileAllocatorWrapper mWrapper; - THdlToStringMap mHdlToStringMap; - TDeserializerType mDeserializer; - - MemoryEventParser( PxAllocatorCallback& inAllocator ) - : mWrapper( inAllocator ) - , mHdlToStringMap( TAllocatorType( mWrapper ) ) - , mDeserializer ( 0, 0 ) - { - } - - ~MemoryEventParser() - { - for ( THdlToStringMap::Iterator iter( mHdlToStringMap.getIterator() ); iter.done() == false; ++iter ) - mWrapper.getAllocator().deallocate( reinterpret_cast<void*>(iter->second) ); - } - - template<typename TOperator> - void parse(const StringTableEvent&, const MemoryEventHeader& inHeader, TOperator& inOperator) - { - StringTableEvent evt; - evt.init(); - evt.streamify( mDeserializer, inHeader ); - uint32_t len = static_cast<uint32_t>( strlen( evt.mString ) ); - char* newStr = static_cast<char*>( mWrapper.getAllocator().allocate( len + 1, "const char*", __FILE__, __LINE__ ) ); - shdfnd::strlcpy( newStr, len+1, evt.mString ); - mHdlToStringMap[evt.mHandle] = newStr; - inOperator( inHeader, evt ); - } - - const char* getString( uint32_t inHdl ) - { - const THdlToStringMap::Entry* entry = mHdlToStringMap.find( inHdl ); - if ( entry ) return entry->second; - return ""; - } - - //Slow reverse lookup used only for testing. - uint32_t getHandle( const char* inStr ) - { - for ( THdlToStringMap::Iterator iter = mHdlToStringMap.getIterator(); - !iter.done(); - ++iter ) - { - if ( safeStrEq( iter->second, inStr ) ) - return iter->first; - } - return 0; - } - - template<typename TOperator> - void parse(const AllocationEvent&, const MemoryEventHeader& inHeader, TOperator& inOperator) - { - AllocationEvent evt; - evt.streamify( mDeserializer, inHeader ); - inOperator( inHeader, evt ); - } - - template<typename TOperator> - void parse(const DeallocationEvent&, const MemoryEventHeader& inHeader, TOperator& inOperator) - { - DeallocationEvent evt; - evt.streamify( mDeserializer, inHeader ); - inOperator( inHeader, evt ); - } - - template<typename TOperator> - void parse(const FullAllocationEvent&, const MemoryEventHeader&, TOperator& ) - { - PX_ASSERT( false ); //will never happen. - } - - template<typename THandlerType> - void parseEventData( const uint8_t* inData, uint32_t inLength, THandlerType* inOperator ) - { - physx::profile::parseEventData<TSwapBytes>( *this, inData, inLength, inOperator ); - } - }; - - - template<typename THandlerType, bool TSwapBytes> - struct MemoryEventParseOperator - { - MemoryEventParser<TSwapBytes>* mParser; - THandlerType* mOperator; - MemoryEventHeader* mHeader; - MemoryEventParseOperator( MemoryEventParser<TSwapBytes>* inParser, THandlerType* inOperator, MemoryEventHeader* inHeader ) - : mParser( inParser ) - , mOperator( inOperator ) - , mHeader( inHeader ) - { - } - - bool wasSuccessful() { return mParser->mDeserializer.mFail == false; } - - bool parseHeader() - { - mHeader->streamify( mParser->mDeserializer ); - return wasSuccessful(); - } - - template<typename TDataType> - bool operator()( const TDataType& inType ) - { - mParser->parse( inType, *mHeader, *mOperator ); - return wasSuccessful(); - } - - bool operator()( uint8_t ) { PX_ASSERT( false ); return false;} - }; - - template<bool TSwapBytes, typename TParserType, typename THandlerType> - inline bool parseEventData( TParserType& inParser, const uint8_t* inData, uint32_t inLength, THandlerType* inHandler ) - { - inParser.mDeserializer = EventDeserializer<TSwapBytes>( inData, inLength ); - MemoryEvent::EventData crapData; - uint32_t eventCount = 0; - MemoryEventHeader theHeader; - MemoryEventParseOperator<THandlerType, TSwapBytes> theOp( &inParser, inHandler, &theHeader ); - while( inParser.mDeserializer.mLength && inParser.mDeserializer.mFail == false) - { - if ( theOp.parseHeader() ) - { - if( visit<bool>( theHeader.getType(), crapData, theOp ) == false ) - inParser.mDeserializer.mFail = true; - } - ++eventCount; - } - return inParser.mDeserializer.mFail == false; - } -}} - -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTPARSER_H diff --git a/PxShared/src/pvd/src/PxProfileMemoryEventRecorder.h b/PxShared/src/pvd/src/PxProfileMemoryEventRecorder.h deleted file mode 100644 index a3d1ed8..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEventRecorder.h +++ /dev/null @@ -1,147 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTRECORDER_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTRECORDER_H - - -#include "PxProfileBase.h" -#include "PxProfileAllocatorWrapper.h" -#include "PxProfileMemoryEvents.h" -#include "PxProfileMemoryEventTypes.h" - -#include "PsHashMap.h" -#include "PsUserAllocated.h" -#include "PsBroadcast.h" -#include "PxProfileMemory.h" - -namespace physx { namespace profile { - - //Remember outstanding events. - //Remembers allocations, forwards them to a listener if one is attached - //and will forward all outstanding allocations to a listener when one is - //attached. - struct MemoryEventRecorder : public shdfnd::AllocationListener - { - typedef PxProfileWrapperReflectionAllocator<uint8_t> TAllocatorType; - typedef shdfnd::HashMap<uint64_t,FullAllocationEvent,shdfnd::Hash<uint64_t>,TAllocatorType> THashMapType; - - PxProfileAllocatorWrapper mWrapper; - THashMapType mOutstandingAllocations; - AllocationListener* mListener; - - MemoryEventRecorder( PxAllocatorCallback* inFoundation ) - : mWrapper( inFoundation ) - , mOutstandingAllocations( TAllocatorType( mWrapper ) ) - , mListener( NULL ) - { - } - - static uint64_t ToU64( void* inData ) { return PX_PROFILE_POINTER_TO_U64( inData ); } - static void* ToVoidPtr( uint64_t inData ) { return reinterpret_cast<void*>(size_t(inData)); } - virtual void onAllocation( size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory ) - { - onAllocation( size, typeName, filename, uint32_t(line), ToU64( allocatedMemory ) ); - } - - void onAllocation( size_t size, const char* typeName, const char* filename, uint32_t line, uint64_t allocatedMemory ) - { - if ( allocatedMemory == 0 ) - return; - FullAllocationEvent theEvent; - theEvent.init( size, typeName, filename, line, allocatedMemory ); - mOutstandingAllocations.insert( allocatedMemory, theEvent ); - if ( mListener != NULL ) mListener->onAllocation( size, typeName, filename, int(line), ToVoidPtr(allocatedMemory) ); - } - - virtual void onDeallocation( void* allocatedMemory ) - { - onDeallocation( ToU64( allocatedMemory ) ); - } - - void onDeallocation( uint64_t allocatedMemory ) - { - if ( allocatedMemory == 0 ) - return; - mOutstandingAllocations.erase( allocatedMemory ); - if ( mListener != NULL ) mListener->onDeallocation( ToVoidPtr( allocatedMemory ) ); - } - - void flushProfileEvents() {} - - void setListener( AllocationListener* inListener ) - { - mListener = inListener; - if ( mListener ) - { - for ( THashMapType::Iterator iter = mOutstandingAllocations.getIterator(); - !iter.done(); - ++iter ) - { - const FullAllocationEvent& evt( iter->second ); - mListener->onAllocation( evt.mSize, evt.mType, evt.mFile, int(evt.mLine), ToVoidPtr( evt.mAddress ) ); - } - } - } - }; - - class PxProfileMemoryEventRecorderImpl : public shdfnd::UserAllocated - , public physx::profile::PxProfileMemoryEventRecorder - { - MemoryEventRecorder mRecorder; - public: - PxProfileMemoryEventRecorderImpl( PxAllocatorCallback* inFnd ) - : mRecorder( inFnd ) - { - } - - virtual void onAllocation( size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory ) - { - mRecorder.onAllocation( size, typeName, filename, line, allocatedMemory ); - } - - virtual void onDeallocation( void* allocatedMemory ) - { - mRecorder.onDeallocation( allocatedMemory ); - } - - virtual void setListener( AllocationListener* inListener ) - { - mRecorder.setListener( inListener ); - } - - virtual void release() - { - PX_PROFILE_DELETE( mRecorder.mWrapper.getAllocator(), this ); - } - }; - -}} -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTRECORDER_H diff --git a/PxShared/src/pvd/src/PxProfileMemoryEventReflexiveWriter.h b/PxShared/src/pvd/src/PxProfileMemoryEventReflexiveWriter.h deleted file mode 100644 index 75fbd03..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEventReflexiveWriter.h +++ /dev/null @@ -1,71 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTREFLEXIVEWRITER_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTREFLEXIVEWRITER_H - -#include "PxProfileMemoryBuffer.h" -#include "PxProfileFoundationWrapper.h" -#include "PxProfileMemoryEvents.h" - -namespace physx { namespace profile { - - struct MemoryEventReflexiveWriter - { - typedef PxProfileWrapperReflectionAllocator<uint8_t> TAllocatorType; - typedef MemoryBuffer<TAllocatorType> TMemoryBufferType; - typedef EventSerializer<TMemoryBufferType> TSerializerType; - - - PxProfileAllocatorWrapper mWrapper; - TMemoryBufferType mBuffer; - TSerializerType mSerializer; - - MemoryEventReflexiveWriter( PxAllocatorCallback* inFoundation ) - : mWrapper( inFoundation ) - , mBuffer( TAllocatorType( mWrapper ) ) - , mSerializer( &mBuffer ) - { - } - - template<typename TDataType> - void operator()( const MemoryEventHeader& inHeader, const TDataType& inType ) - { - //copy to get rid of const. - MemoryEventHeader theHeader( inHeader ); - TDataType theData( inType ); - - //write them out. - theHeader.streamify( mSerializer ); - theData.streamify( mSerializer, theHeader ); - } - }; -}} - -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTREFLEXIVEWRITER_H
\ No newline at end of file diff --git a/PxShared/src/pvd/src/PxProfileMemoryEventSummarizer.h b/PxShared/src/pvd/src/PxProfileMemoryEventSummarizer.h deleted file mode 100644 index 788636e..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEventSummarizer.h +++ /dev/null @@ -1,304 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTSUMMARIZER_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTSUMMARIZER_H - -#include "PxProfileBase.h" -#include "PxProfileAllocatorWrapper.h" -#include "PxProfileMemoryEvents.h" -#include "PxProfileMemoryEventRecorder.h" -#include "PxProfileMemoryEventParser.h" - -#include "PsHashMap.h" - -namespace physx { namespace profile { - - struct MemoryEventSummarizerEntry - { - uint32_t mType; - uint32_t mFile; - uint32_t mLine; - - MemoryEventSummarizerEntry( const AllocationEvent& evt ) - : mType( evt.mType ) - , mFile( evt.mFile ) - , mLine( evt.mLine ) - { - } - - MemoryEventSummarizerEntry( uint32_t tp, uint32_t f, uint32_t line ) - : mType( tp ) - , mFile( f ) - , mLine( line ) - { - } - }; -}} - - -namespace physx { namespace shdfnd { - - template <> - struct Hash<physx::profile::MemoryEventSummarizerEntry> - { - public: - uint32_t operator()(const physx::profile::MemoryEventSummarizerEntry& entry) const - { - //Combine hash values in a semi-reasonable way. - return Hash<uint32_t>()( entry.mType ) - ^ Hash<uint32_t>()( entry.mFile ) - ^ Hash<uint32_t>()( entry.mLine ); - } - - bool operator()(const physx::profile::MemoryEventSummarizerEntry& lhs, const physx::profile::MemoryEventSummarizerEntry& rhs) const - { - return lhs.mType == rhs.mType - && lhs.mFile == rhs.mFile - && lhs.mLine == rhs.mLine; - } - - bool equal(const physx::profile::MemoryEventSummarizerEntry& lhs, const physx::profile::MemoryEventSummarizerEntry& rhs) const - { - return lhs.mType == rhs.mType - && lhs.mFile == rhs.mFile - && lhs.mLine == rhs.mLine; - } - }; -}} - -namespace physx { namespace profile { - - struct MemoryEventSummarizerAllocatedValue - { - MemoryEventSummarizerEntry mEntry; - uint32_t mSize; - MemoryEventSummarizerAllocatedValue( MemoryEventSummarizerEntry en, uint32_t sz ) - : mEntry( en ) - , mSize( sz ) - { - } - }; - - template<typename TSummarizerType> - struct SummarizerParseHandler - { - TSummarizerType* mSummarizer; - SummarizerParseHandler( TSummarizerType* inType ) - : mSummarizer( inType ) - { - } - template<typename TDataType> - void operator()( const MemoryEventHeader& inHeader, const TDataType& inType ) - { - mSummarizer->handleParsedData( inHeader, inType ); - } - }; - - template<typename TForwardType> - struct MemoryEventForward - { - TForwardType* mForward; - MemoryEventForward( TForwardType& inForward ) - : mForward( &inForward ) - { - } - template<typename TDataType> - void operator()( const MemoryEventHeader& inHeader, const TDataType& inType ) - { - TForwardType& theForward( *mForward ); - theForward( inHeader, inType ); - } - }; - - struct NullMemoryEventHandler - { - template<typename TDataType> - void operator()( const MemoryEventHeader&, const TDataType&) - { - } - }; - - template<typename TForwardType> - struct NewEntryOperatorForward - { - TForwardType* mForward; - NewEntryOperatorForward( TForwardType& inForward ) - : mForward( &inForward ) - { - } - void operator()( const MemoryEventSummarizerEntry& inEntry, const char* inTypeStr, const char* inFileStr, uint32_t inTotalsArrayIndex ) - { - TForwardType& theType( *mForward ); - theType( inEntry, inTypeStr, inFileStr, inTotalsArrayIndex ); - } - }; - - struct NullNewEntryOperator - { - void operator()( const MemoryEventSummarizerEntry&, const char*, const char*, uint32_t) - { - } - }; - - //Very specialized class meant to take a stream of memory events - //endian-convert it. - //Produce a new stream - //And keep track of the events in a meaningful way. - //It collapses the allocations into groupings keyed - //by file, line, and type. - template<bool TSwapBytes - , typename TNewEntryOperator - , typename MemoryEventHandler> - struct MemoryEventSummarizer : public PxProfileEventBufferClient - { - typedef MemoryEventSummarizer< TSwapBytes, TNewEntryOperator, MemoryEventHandler > TThisType; - typedef PxProfileWrapperReflectionAllocator<MemoryEventSummarizerEntry> TAllocatorType; - typedef shdfnd::HashMap<MemoryEventSummarizerEntry, uint32_t, shdfnd::Hash<MemoryEventSummarizerEntry>, TAllocatorType> TSummarizeEntryToU32Hash; - typedef shdfnd::HashMap<uint64_t, MemoryEventSummarizerAllocatedValue, shdfnd::Hash<uint64_t>, TAllocatorType> TU64ToSummarizerValueHash; - PxProfileAllocatorWrapper mWrapper; - TSummarizeEntryToU32Hash mEntryIndexHash; - PxProfileArray<int32_t> mTotalsArray; - MemoryEventParser<TSwapBytes> mParser; - TU64ToSummarizerValueHash mOutstandingAllocations; - TNewEntryOperator mNewEntryOperator; - MemoryEventHandler mEventHandler; - - - MemoryEventSummarizer( PxAllocatorCallback& inAllocator - , TNewEntryOperator inNewEntryOperator - , MemoryEventHandler inEventHandler) - - : mWrapper( inAllocator ) - , mEntryIndexHash( TAllocatorType( mWrapper ) ) - , mTotalsArray( mWrapper ) - , mParser( inAllocator ) - , mOutstandingAllocations( mWrapper ) - , mNewEntryOperator( inNewEntryOperator ) - , mEventHandler( inEventHandler ) - { - } - virtual ~MemoryEventSummarizer(){} - - //parse this data block. This will endian-convert the data if necessary - //and then - void handleData( const uint8_t* inData, uint32_t inLen ) - { - SummarizerParseHandler<TThisType> theHandler( this ); - parseEventData<TSwapBytes>( mParser, inData, inLen, &theHandler ); - } - - template<typename TDataType> - void handleParsedData( const MemoryEventHeader& inHeader, const TDataType& inData ) - { - //forward it to someone who might care - mEventHandler( inHeader, inData ); - //handle the parsed data. - doHandleParsedData( inData ); - } - - template<typename TDataType> - void doHandleParsedData( const TDataType& ) {} - - void doHandleParsedData( const AllocationEvent& inEvt ) - { - onAllocation( inEvt.mSize, inEvt.mType, inEvt.mFile, inEvt.mLine, inEvt.mAddress ); - } - - void doHandleParsedData( const DeallocationEvent& inEvt ) - { - onDeallocation( inEvt.mAddress ); - } - - uint32_t getOrCreateEntryIndex( const MemoryEventSummarizerEntry& inEvent ) - { - uint32_t index = 0; - const TSummarizeEntryToU32Hash::Entry* entry( mEntryIndexHash.find(inEvent ) ); - if ( !entry ) - { - index = mTotalsArray.size(); - mTotalsArray.pushBack( 0 ); - mEntryIndexHash.insert( inEvent, index ); - - //Force a string lookup and such here. - mNewEntryOperator( inEvent, mParser.getString( inEvent.mType), mParser.getString( inEvent.mFile ), index ); - } - else - index = entry->second; - return index; - } - - //Keep a running total of what is going on, letting a listener know when new events happen. - void onMemoryEvent( const MemoryEventSummarizerEntry& inEvent, int32_t inSize ) - { - MemoryEventSummarizerEntry theEntry( inEvent ); - uint32_t index = getOrCreateEntryIndex( theEntry ); - mTotalsArray[index] += inSize; - } - - void onAllocation( uint32_t inSize, uint32_t inType, uint32_t inFile, uint32_t inLine, uint64_t inAddress ) - { - MemoryEventSummarizerEntry theEntry( inType, inFile, inLine ); - onMemoryEvent( theEntry, static_cast<int32_t>( inSize ) ); - mOutstandingAllocations.insert( inAddress, MemoryEventSummarizerAllocatedValue( theEntry, inSize ) ); - } - - void onDeallocation( uint64_t inAddress ) - { - const TU64ToSummarizerValueHash::Entry* existing( mOutstandingAllocations.find( inAddress ) ); - if ( existing ) - { - const MemoryEventSummarizerAllocatedValue& data( existing->second ); - onMemoryEvent( data.mEntry, -1 * static_cast<int32_t>( data.mSize ) ); - mOutstandingAllocations.erase( inAddress ); - } - //Not much we can do with an deallocation when we didn't track the allocation. - } - - int32_t getTypeTotal( const char* inTypeName, const char* inFilename, uint32_t inLine ) - { - uint32_t theType( mParser.getHandle( inTypeName ) ); - uint32_t theFile( mParser.getHandle( inFilename ) ); - uint32_t theLine = inLine; //all test lines are 50... - uint32_t index = getOrCreateEntryIndex( MemoryEventSummarizerEntry( theType, theFile, theLine ) ); - return mTotalsArray[index]; - } - - virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength ) - { - handleData( inData, inLength ); - } - - virtual void handleClientRemoved() {} - }; - -}} - -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTSUMMARIZER_H diff --git a/PxShared/src/pvd/src/PxProfileMemoryEventTypes.h b/PxShared/src/pvd/src/PxProfileMemoryEventTypes.h deleted file mode 100644 index c737451..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEventTypes.h +++ /dev/null @@ -1,90 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTTYPES_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTTYPES_H - -#include "PxProfileBase.h" -#include "PxProfileEventBufferClientManager.h" -#include "PxProfileEventSender.h" -#include "PsBroadcast.h" - -namespace physx { namespace profile { - - struct PxProfileMemoryEventType - { - enum Enum - { - Unknown = 0, - Allocation, - Deallocation - }; - }; - - struct PxProfileBulkMemoryEvent - { - uint64_t mAddress; - uint32_t mDatatype; - uint32_t mFile; - uint32_t mLine; - uint32_t mSize; - PxProfileMemoryEventType::Enum mType; - - PxProfileBulkMemoryEvent(){} - - PxProfileBulkMemoryEvent( uint32_t size, uint32_t type, uint32_t file, uint32_t line, uint64_t addr ) - : mAddress( addr ) - , mDatatype( type ) - , mFile( file ) - , mLine( line ) - , mSize( size ) - , mType( PxProfileMemoryEventType::Allocation ) - { - } - - PxProfileBulkMemoryEvent( uint64_t addr ) - : mAddress( addr ) - , mDatatype( 0 ) - , mFile( 0 ) - , mLine( 0 ) - , mSize( 0 ) - , mType( PxProfileMemoryEventType::Deallocation ) - { - } - }; - - class PxProfileBulkMemoryEventHandler - { - protected: - virtual ~PxProfileBulkMemoryEventHandler(){} - public: - virtual void handleEvents( const PxProfileBulkMemoryEvent* inEvents, uint32_t inBufferSize ) = 0; - static void parseEventBuffer( const uint8_t* inBuffer, uint32_t inBufferSize, PxProfileBulkMemoryEventHandler& inHandler, bool inSwapBytes, PxAllocatorCallback* inAlloc ); - }; -} } - -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTTYPES_H diff --git a/PxShared/src/pvd/src/PxProfileMemoryEvents.h b/PxShared/src/pvd/src/PxProfileMemoryEvents.h deleted file mode 100644 index 6fcb032..0000000 --- a/PxShared/src/pvd/src/PxProfileMemoryEvents.h +++ /dev/null @@ -1,411 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEMEMORYEVENTS_H -#define PXPVDSDK_PXPROFILEMEMORYEVENTS_H - -#include "PxProfileEvents.h" - -//Memory events define their own event stream - -namespace physx { namespace profile { - struct MemoryEventTypes - { - enum Enum - { - Unknown = 0, - StringTableEvent, //introduce a new mapping of const char* -> integer - AllocationEvent, - DeallocationEvent, - FullAllocationEvent - }; - }; - - template<unsigned numBits, typename TDataType> - inline unsigned char convertToNBits( TDataType inType ) - { - uint8_t conversion = static_cast<uint8_t>( inType ); - PX_ASSERT( conversion < (1 << numBits) ); - return conversion; - } - - template<typename TDataType> - inline unsigned char convertToTwoBits( TDataType inType ) - { - return convertToNBits<2>( inType ); - } - - template<typename TDataType> - inline unsigned char convertToFourBits( TDataType inType ) - { - return convertToNBits<4>( inType ); - } - - inline EventStreamCompressionFlags::Enum fromNumber( uint8_t inNum ) { return static_cast<EventStreamCompressionFlags::Enum>( inNum ); } - - template<unsigned lhs, unsigned rhs> - inline void compileCheckSize() - { - PX_COMPILE_TIME_ASSERT( lhs <= rhs ); - } - - //Used for predictable bit fields. - template<typename TDataType - , uint8_t TNumBits - , uint8_t TOffset - , typename TInputType> - struct BitMaskSetter - { - //Create a mask that masks out the orginal value shift into place - static TDataType createOffsetMask() { return TDataType(createMask() << TOffset); } - //Create a mask of TNumBits number of tis - static TDataType createMask() { return static_cast<TDataType>((1 << TNumBits) - 1); } - void setValue( TDataType& inCurrent, TInputType inData ) - { - PX_ASSERT( inData < ( 1 << TNumBits ) ); - - //Create a mask to remove the current value. - TDataType theMask = TDataType(~(createOffsetMask())); - //Clear out current value. - inCurrent = TDataType(inCurrent & theMask); - //Create the new value. - TDataType theAddition = static_cast<TDataType>( inData << TOffset ); - //or it into the existing value. - inCurrent = TDataType(inCurrent | theAddition); - } - - TInputType getValue( TDataType inCurrent ) - { - return static_cast<TInputType>( ( inCurrent >> TOffset ) & createMask() ); - } - }; - - - struct MemoryEventHeader - { - uint16_t mValue; - - typedef BitMaskSetter<uint16_t, 4, 0, uint8_t> TTypeBitmask; - typedef BitMaskSetter<uint16_t, 2, 4, uint8_t> TAddrCompressBitmask; - typedef BitMaskSetter<uint16_t, 2, 6, uint8_t> TTypeCompressBitmask; - typedef BitMaskSetter<uint16_t, 2, 8, uint8_t> TFnameCompressBitmask; - typedef BitMaskSetter<uint16_t, 2, 10, uint8_t> TSizeCompressBitmask; - typedef BitMaskSetter<uint16_t, 2, 12, uint8_t> TLineCompressBitmask; - - //That leaves size as the only thing not compressed usually. - - MemoryEventHeader( MemoryEventTypes::Enum inType = MemoryEventTypes::Unknown ) - : mValue( 0 ) - { - uint8_t defaultCompression( convertToTwoBits( EventStreamCompressionFlags::U64 ) ); - TTypeBitmask().setValue( mValue, convertToFourBits( inType ) ); - TAddrCompressBitmask().setValue( mValue, defaultCompression ); - TTypeCompressBitmask().setValue( mValue, defaultCompression ); - TFnameCompressBitmask().setValue( mValue, defaultCompression ); - TSizeCompressBitmask().setValue( mValue, defaultCompression ); - TLineCompressBitmask().setValue( mValue, defaultCompression ); - } - - MemoryEventTypes::Enum getType() const { return static_cast<MemoryEventTypes::Enum>( TTypeBitmask().getValue( mValue ) ); } - -#define DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( name ) \ - void set##name( EventStreamCompressionFlags::Enum inEnum ) { T##name##Bitmask().setValue( mValue, convertToTwoBits( inEnum ) ); } \ - EventStreamCompressionFlags::Enum get##name() const { return fromNumber( T##name##Bitmask().getValue( mValue ) ); } - - DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( AddrCompress ) - DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( TypeCompress ) - DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( FnameCompress ) - DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( SizeCompress ) - DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR( LineCompress ) - -#undef DEFINE_MEMORY_HEADER_COMPRESSION_ACCESSOR - - bool operator==( const MemoryEventHeader& inOther ) const - { - return mValue == inOther.mValue; - } - template<typename TStreamType> - void streamify( TStreamType& inStream ) - { - inStream.streamify( "Header", mValue ); - } - }; - - //Declaration of type level getMemoryEventType function that maps enumeration event types to datatypes - template<typename TDataType> - inline MemoryEventTypes::Enum getMemoryEventType() { PX_ASSERT( false ); return MemoryEventTypes::Unknown; } - - inline bool safeStrEq( const char* lhs, const char* rhs ) - { - if ( lhs == rhs ) - return true; - //If they aren't equal, and one of them is null, - //then they can't be equal. - //This is assuming that the null char* is not equal to - //the empty "" char*. - if ( !lhs || !rhs ) - return false; - - return ::strcmp( lhs, rhs ) == 0; - } - - struct StringTableEvent - { - const char* mString; - uint32_t mHandle; - - void init( const char* inStr = "", uint32_t inHdl = 0 ) - { - mString = inStr; - mHandle = inHdl; - } - - void init( const StringTableEvent& inData ) - { - mString = inData.mString; - mHandle = inData.mHandle; - } - - bool operator==( const StringTableEvent& inOther ) const - { - return mHandle == inOther.mHandle - && safeStrEq( mString, inOther.mString ); - } - - void setup( MemoryEventHeader& ) const {} - - template<typename TStreamType> - void streamify( TStreamType& inStream, const MemoryEventHeader& ) - { - inStream.streamify( "String", mString ); - inStream.streamify( "Handle", mHandle ); - } - }; - template<> inline MemoryEventTypes::Enum getMemoryEventType<StringTableEvent>() { return MemoryEventTypes::StringTableEvent; } - - struct MemoryEventData - { - uint64_t mAddress; - void init( uint64_t addr ) - { - mAddress = addr; - } - - void init( const MemoryEventData& inData) - { - mAddress = inData.mAddress; - } - - bool operator==( const MemoryEventData& inOther ) const - { - return mAddress == inOther.mAddress; - } - - void setup( MemoryEventHeader& inHeader ) const - { - inHeader.setAddrCompress( findCompressionValue( mAddress ) ); - } - - template<typename TStreamType> - void streamify( TStreamType& inStream, const MemoryEventHeader& inHeader ) - { - inStream.streamify( "Address", mAddress, inHeader.getAddrCompress() ); - } - }; - - struct AllocationEvent : public MemoryEventData - { - uint32_t mSize; - uint32_t mType; - uint32_t mFile; - uint32_t mLine; - void init( size_t size = 0, uint32_t type = 0, uint32_t file = 0, uint32_t line = 0, uint64_t addr = 0 ) - { - MemoryEventData::init( addr ); - mSize = static_cast<uint32_t>( size ); - mType = type; - mFile = file; - mLine = line; - } - - void init( const AllocationEvent& inData ) - { - MemoryEventData::init( inData ); - mSize = inData.mSize; - mType = inData.mType; - mFile = inData.mFile; - mLine = inData.mLine; - } - - bool operator==( const AllocationEvent& inOther ) const - { - return MemoryEventData::operator==( inOther ) - && mSize == inOther.mSize - && mType == inOther.mType - && mFile == inOther.mFile - && mLine == inOther.mLine; - } - - void setup( MemoryEventHeader& inHeader ) const - { - inHeader.setTypeCompress( findCompressionValue( mType ) ); - inHeader.setFnameCompress( findCompressionValue( mFile ) ); - inHeader.setSizeCompress( findCompressionValue( mSize ) ); - inHeader.setLineCompress( findCompressionValue( mLine ) ); - MemoryEventData::setup( inHeader ); - } - - template<typename TStreamType> - void streamify( TStreamType& inStream, const MemoryEventHeader& inHeader ) - { - inStream.streamify( "Size", mSize, inHeader.getSizeCompress() ); - inStream.streamify( "Type", mType, inHeader.getTypeCompress() ); - inStream.streamify( "File", mFile, inHeader.getFnameCompress() ); - inStream.streamify( "Line", mLine, inHeader.getLineCompress() ); - MemoryEventData::streamify( inStream, inHeader ); - } - }; - template<> inline MemoryEventTypes::Enum getMemoryEventType<AllocationEvent>() { return MemoryEventTypes::AllocationEvent; } - - - struct FullAllocationEvent : public MemoryEventData - { - size_t mSize; - const char* mType; - const char* mFile; - uint32_t mLine; - void init( size_t size, const char* type, const char* file, uint32_t line, uint64_t addr ) - { - MemoryEventData::init( addr ); - mSize = size; - mType = type; - mFile = file; - mLine = line; - } - - void init( const FullAllocationEvent& inData ) - { - MemoryEventData::init( inData ); - mSize = inData.mSize; - mType = inData.mType; - mFile = inData.mFile; - mLine = inData.mLine; - } - - bool operator==( const FullAllocationEvent& inOther ) const - { - return MemoryEventData::operator==( inOther ) - && mSize == inOther.mSize - && safeStrEq( mType, inOther.mType ) - && safeStrEq( mFile, inOther.mFile ) - && mLine == inOther.mLine; - } - - void setup( MemoryEventHeader& ) const {} - }; - - template<> inline MemoryEventTypes::Enum getMemoryEventType<FullAllocationEvent>() { return MemoryEventTypes::FullAllocationEvent; } - - struct DeallocationEvent : public MemoryEventData - { - void init( uint64_t addr = 0 ) { MemoryEventData::init( addr ); } - void init( const DeallocationEvent& inData ) { MemoryEventData::init( inData ); } - }; - - template<> inline MemoryEventTypes::Enum getMemoryEventType<DeallocationEvent>() { return MemoryEventTypes::DeallocationEvent; } - - class MemoryEvent - { - public: - typedef PX_PROFILE_UNION_5(StringTableEvent, AllocationEvent, DeallocationEvent, FullAllocationEvent, uint8_t) EventData; - - private: - MemoryEventHeader mHeader; - EventData mData; - public: - - MemoryEvent() {} - MemoryEvent( MemoryEventHeader inHeader, const EventData& inData = EventData() ) - : mHeader( inHeader ) - , mData( inData ) - { - } - - template<typename TDataType> - MemoryEvent( const TDataType& inType ) - : mHeader( getMemoryEventType<TDataType>() ) - , mData( inType ) - { - //set the appropriate compression bits. - inType.setup( mHeader ); - } - const MemoryEventHeader& getHeader() const { return mHeader; } - const EventData& getData() const { return mData; } - - template<typename TDataType> - const TDataType& getValue() const { PX_ASSERT( mHeader.getType() == getMemoryEventType<TDataType>() ); return mData.toType<TDataType>(); } - - template<typename TDataType> - TDataType& getValue() { PX_ASSERT( mHeader.getType() == getMemoryEventType<TDataType>() ); return mData.toType<TDataType>(); } - - template<typename TRetVal, typename TOperator> - inline TRetVal visit( TOperator inOp ) const; - - bool operator==( const MemoryEvent& inOther ) const - { - if ( !(mHeader == inOther.mHeader ) ) return false; - if ( mHeader.getType() ) - return inOther.visit<bool>( EventDataEqualOperator<EventData>( mData ) ); - return true; - } - }; - - template<typename TRetVal, typename TOperator> - inline TRetVal visit( MemoryEventTypes::Enum inEventType, const MemoryEvent::EventData& inData, TOperator inOperator ) - { - switch( inEventType ) - { - case MemoryEventTypes::StringTableEvent: return inOperator( inData.toType( Type2Type<StringTableEvent>() ) ); - case MemoryEventTypes::AllocationEvent: return inOperator( inData.toType( Type2Type<AllocationEvent>() ) ); - case MemoryEventTypes::DeallocationEvent: return inOperator( inData.toType( Type2Type<DeallocationEvent>() ) ); - case MemoryEventTypes::FullAllocationEvent: return inOperator( inData.toType( Type2Type<FullAllocationEvent>() ) ); - case MemoryEventTypes::Unknown: return inOperator( static_cast<uint8_t>( inEventType ) ); - } - return TRetVal(); - } - - template<typename TRetVal, typename TOperator> - inline TRetVal MemoryEvent::visit( TOperator inOp ) const - { - return physx::profile::visit<TRetVal>( mHeader.getType(), mData, inOp ); - } -}} - -#endif // PXPVDSDK_PXPROFILEMEMORYEVENTS_H diff --git a/PxShared/src/pvd/src/PxProfileScopedEvent.h b/PxShared/src/pvd/src/PxProfileScopedEvent.h deleted file mode 100644 index 953fcf8..0000000 --- a/PxShared/src/pvd/src/PxProfileScopedEvent.h +++ /dev/null @@ -1,150 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILESCOPEDEVENT_H -#define PXPVDSDK_PXPROFILESCOPEDEVENT_H - -#include "PxProfileBase.h" -#include "PxProfileEventId.h" -#include "PxProfileCompileTimeEventFilter.h" - -namespace physx { namespace profile { - -#define TO_PXPVDSDK_PXPROFILEEVENTID( subsystem, eventId ) PxProfileEventId( SubsystemIds::subsystem, EventIds::subsystem##eventId ); - - /** - \brief Template version of startEvent, called directly on provided profile buffer. - - \param inBuffer Profile event buffer. - \param inId Profile event id. - \param inContext Profile event context. - */ - template<bool TEnabled, typename TBufferType> - inline void startEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) - { - if ( TEnabled && inBuffer ) inBuffer->startEvent( inId, inContext ); - } - - /** - \brief Template version of stopEvent, called directly on provided profile buffer. - - \param inBuffer Profile event buffer. - \param inId Profile event id. - \param inContext Profile event context. - */ - template<bool TEnabled, typename TBufferType> - inline void stopEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) - { - if ( TEnabled && inBuffer ) inBuffer->stopEvent( inId, inContext ); - } - - /** - \brief Template version of startEvent, called directly on provided profile buffer. - - \param inEnabled If profile event is enabled. - \param inBuffer Profile event buffer. - \param inId Profile event id. - \param inContext Profile event context. - */ - template<typename TBufferType> - inline void startEvent( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) - { - if ( inEnabled && inBuffer ) inBuffer->startEvent( inId, inContext ); - } - - /** - \brief Template version of stopEvent, called directly on provided profile buffer. - - \param inEnabled If profile event is enabled. - \param inBuffer Profile event buffer. - \param inId Profile event id. - \param inContext Profile event context. - */ - template<typename TBufferType> - inline void stopEvent( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext ) - { - if ( inEnabled && inBuffer ) inBuffer->stopEvent( inId, inContext ); - } - - /** - \brief Template version of eventValue, called directly on provided profile buffer. - - \param inEnabled If profile event is enabled. - \param inBuffer Profile event buffer. - \param inId Profile event id. - \param inContext Profile event context. - \param inValue Event value. - */ - template<typename TBufferType> - inline void eventValue( bool inEnabled, TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext, int64_t inValue ) - { - if ( inEnabled && inBuffer ) inBuffer->eventValue( inId, inContext, inValue ); - } - - template<bool TEnabled, typename TBufferType, uint16_t eventId> - struct ScopedEventWithContext - { - uint64_t mContext; - TBufferType* mBuffer; - ScopedEventWithContext( TBufferType* inBuffer, uint64_t inContext) - : mContext ( inContext ) - , mBuffer( inBuffer ) - { - startEvent<true>( mBuffer, PxProfileEventId(eventId), mContext ); - } - ~ScopedEventWithContext() - { - stopEvent<true>( mBuffer, PxProfileEventId(eventId), mContext ); - } - }; - - template<typename TBufferType, uint16_t eventId> - struct ScopedEventWithContext<false,TBufferType,eventId> { ScopedEventWithContext( TBufferType*, uint64_t) {} }; - - template<typename TBufferType> - struct DynamicallyEnabledScopedEvent - { - TBufferType* mBuffer; - PxProfileEventId mId; - uint64_t mContext; - DynamicallyEnabledScopedEvent( TBufferType* inBuffer, const PxProfileEventId& inId, uint64_t inContext) - : mBuffer( inBuffer ) - , mId( inId ) - , mContext( inContext ) - { - if(mBuffer) - startEvent( mId.compileTimeEnabled, mBuffer, mId, mContext ); - } - ~DynamicallyEnabledScopedEvent() - { - if(mBuffer) - stopEvent( mId.compileTimeEnabled, mBuffer, mId, mContext ); - } - }; -}} - -#endif // PXPVDSDK_PXPROFILESCOPEDEVENT_H diff --git a/PxShared/src/pvd/src/PxProfileScopedMutexLock.h b/PxShared/src/pvd/src/PxProfileScopedMutexLock.h deleted file mode 100644 index 9d21cb8..0000000 --- a/PxShared/src/pvd/src/PxProfileScopedMutexLock.h +++ /dev/null @@ -1,64 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILESCOPEDMUTEXLOCK_H -#define PXPVDSDK_PXPROFILESCOPEDMUTEXLOCK_H - -#include "PxProfileBase.h" - -namespace physx { namespace profile { - - /** - * Generic class to wrap any mutex type that has lock and unlock methods - */ - template<typename TMutexType> - struct ScopedLockImpl - { - TMutexType* mMutex; - ScopedLockImpl( TMutexType* inM ) : mMutex( inM ) - { - if ( mMutex ) mMutex->lock(); - } - ~ScopedLockImpl() - { - if ( mMutex ) mMutex->unlock(); - } - }; - - /** - * Null locking system that does nothing. - */ - struct NullLock - { - template<typename TDataType> NullLock( TDataType*) {} - }; -}} - -#endif // PXPVDSDK_PXPROFILESCOPEDMUTEXLOCK_H diff --git a/PxShared/src/pvd/src/PxProfileZone.h b/PxShared/src/pvd/src/PxProfileZone.h deleted file mode 100644 index 1573c2f..0000000 --- a/PxShared/src/pvd/src/PxProfileZone.h +++ /dev/null @@ -1,142 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEZONE_H -#define PXPVDSDK_PXPROFILEZONE_H - -#include "foundation/PxPreprocessor.h" - -#include "PxProfileEventBufferClientManager.h" -#include "PxProfileEventNames.h" -#include "PxProfileEventSender.h" - -namespace physx { - class PxAllocatorCallback; - - namespace profile { - - class PxProfileZoneManager; - - /** - \brief The profiling system was setup in the expectation that there would be several - systems that each had its own island of profile information. PhysX, client code, - and APEX would be the first examples of these. Each one of these islands is represented - by a profile zone. - - A profile zone combines a name, a place where all the events coming from its interface - can flushed, and a mapping from event number to full event name. - - It also provides a top level filtering service where profile events - can be filtered by event id. - - The profile zone implements a system where if there is no one - listening to events it doesn't provide a mechanism to send them. In this way - the event system is short circuited when there aren't any clients. - - All functions on this interface should be considered threadsafe. - - @see PxProfileZoneClientManager, PxProfileNameProvider, PxProfileEventSender, PxProfileEventFlusher - */ - class PxProfileZone : public PxProfileZoneClientManager - , public PxProfileNameProvider - , public PxProfileEventSender - , public PxProfileEventFlusher - { - protected: - virtual ~PxProfileZone(){} - public: - /** - \brief Get profile zone name. - \return Zone name. - */ - virtual const char* getName() = 0; - /** - \brief Release the profile zone. - */ - virtual void release() = 0; - - /** - \brief Set profile zone manager for the zone. - \param inMgr Profile zone manager. - */ - virtual void setProfileZoneManager(PxProfileZoneManager* inMgr) = 0; - /** - \brief Get profile zone manager for the zone. - \return Profile zone manager. - */ - virtual PxProfileZoneManager* getProfileZoneManager() = 0; - - /** - \brief Get or create a new event id for a given name. - If you pass in a previously defined event name (including one returned) - from the name provider) you will just get the same event id back. - \param inName Profile event name. - */ - virtual uint16_t getEventIdForName( const char* inName ) = 0; - - /** - \brief Specifies that it is a safe point to flush read-write name map into - read-only map. Make sure getEventIdForName is not called from a different thread. - */ - virtual void flushEventIdNameMap() = 0; - - /** - \brief Reserve a contiguous set of profile event ids for a set of names. - - This function does not do any meaningful error checking other than to ensure - that if it does generate new ids they are contiguous. If the first name is already - registered, that is the ID that will be returned regardless of what other - names are registered. Thus either use this function alone (without the above - function) or don't use it. - If you register "one","two","three" and the function returns an id of 4, then - "one" is mapped to 4, "two" is mapped to 5, and "three" is mapped to 6. - - \param inNames set of names to register. - \param inLen Length of the name list. - - \return The first id associated with the first name. The rest of the names - will be associated with monotonically incrementing uint16_t values from the first - id. - */ - virtual uint16_t getEventIdsForNames( const char** inNames, uint32_t inLen ) = 0; - - /** - \brief Create a new profile zone. - - \param inAllocator memory allocation is controlled through the foundation if one is passed in. - \param inSDKName Name of the profile zone; useful for clients to understand where events came from. - \param inNames Mapping from event id -> event name. - \param inEventBufferByteSize Size of the canonical event buffer. This does not need to be a large number - as profile events are fairly small individually. - \return a profile zone implementation. - */ - static PX_FOUNDATION_API PxProfileZone& createProfileZone(PxAllocatorCallback* inAllocator, const char* inSDKName, PxProfileNames inNames = PxProfileNames(), uint32_t inEventBufferByteSize = 0x10000 /*64k*/); - - }; -} } - -#endif // PXPVDSDK_PXPROFILEZONE_H diff --git a/PxShared/src/pvd/src/PxProfileZoneImpl.h b/PxShared/src/pvd/src/PxProfileZoneImpl.h deleted file mode 100644 index 981180f..0000000 --- a/PxShared/src/pvd/src/PxProfileZoneImpl.h +++ /dev/null @@ -1,318 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEZONEIMPL_H -#define PXPVDSDK_PXPROFILEZONEIMPL_H - -#include "PxProfileZone.h" -#include "PxProfileEventFilter.h" -#include "PxProfileZoneManager.h" -#include "PxProfileContextProviderImpl.h" -#include "PxProfileScopedMutexLock.h" -#include "PxProfileEventBufferAtomic.h" -#include "PsMutex.h" - -namespace physx { namespace profile { - - /** - \brief Simple event filter that enables all events. - */ - struct PxProfileNullEventFilter - { - void setEventEnabled( const PxProfileEventId&, bool) { PX_ASSERT(false); } - bool isEventEnabled( const PxProfileEventId&) const { return true; } - }; - - typedef shdfnd::MutexT<PxProfileWrapperReflectionAllocator<uint8_t> > TZoneMutexType; - typedef ScopedLockImpl<TZoneMutexType> TZoneLockType; - typedef EventBuffer< PxDefaultContextProvider, TZoneMutexType, TZoneLockType, PxProfileNullEventFilter > TZoneEventBufferType; - //typedef EventBufferAtomic< PxDefaultContextProvider, TZoneMutexType, TZoneLockType, PxProfileNullEventFilter > TZoneEventBufferType; - - template<typename TNameProvider> - class ZoneImpl : TZoneEventBufferType //private inheritance intended - , public PxProfileZone - , public PxProfileEventBufferClient - { - typedef shdfnd::MutexT<PxProfileWrapperReflectionAllocator<uint8_t> > TMutexType; - typedef PxProfileHashMap<const char*, uint32_t> TNameToEvtIndexMap; - //ensure we don't reuse event ids. - typedef PxProfileHashMap<uint16_t, const char*> TEvtIdToNameMap; - typedef TMutexType::ScopedLock TLockType; - - - const char* mName; - PxProfileAllocatorWrapper mWrapper; - mutable TMutexType mMutex; - PxProfileArray<PxProfileEventName> mEventNames; - // to avoid locking, read-only and read-write map exist - TNameToEvtIndexMap mNameToEvtIndexMapR; - TNameToEvtIndexMap mNameToEvtIndexMapRW; - //ensure we don't reuse event ids. - TEvtIdToNameMap mEvtIdToNameMap; - - PxProfileZoneManager* mProfileZoneManager; - - PxProfileArray<PxProfileZoneClient*> mClients; - volatile bool mEventsActive; - - PX_NOCOPY(ZoneImpl<TNameProvider>) - public: - ZoneImpl( PxAllocatorCallback* inAllocator, const char* inName, uint32_t bufferSize = 0x10000 /*64k*/, const TNameProvider& inProvider = TNameProvider() ) - : TZoneEventBufferType( inAllocator, bufferSize, PxDefaultContextProvider(), NULL, PxProfileNullEventFilter() ) - , mName( inName ) - , mWrapper( inAllocator ) - , mMutex( PxProfileWrapperReflectionAllocator<uint8_t>( mWrapper ) ) - , mEventNames( mWrapper ) - , mNameToEvtIndexMapR( mWrapper ) - , mNameToEvtIndexMapRW(mWrapper) - , mEvtIdToNameMap( mWrapper ) - , mProfileZoneManager( NULL ) - , mClients( mWrapper ) - , mEventsActive( false ) - { - TZoneEventBufferType::setBufferMutex( &mMutex ); - //Initialize the event name structure with existing names from the name provider. - PxProfileNames theNames( inProvider.getProfileNames() ); - for ( uint32_t idx = 0; idx < theNames.eventCount; ++idx ) - { - const PxProfileEventName& theName (theNames.events[idx]); - doAddName( theName.name, theName.eventId.eventId, theName.eventId.compileTimeEnabled ); - } - TZoneEventBufferType::addClient( *this ); - } - - virtual ~ZoneImpl() { - if ( mProfileZoneManager != NULL ) - mProfileZoneManager->removeProfileZone( *this ); - mProfileZoneManager = NULL; - TZoneEventBufferType::removeClient( *this ); - } - - void doAddName( const char* inName, uint16_t inEventId, bool inCompileTimeEnabled ) - { - TLockType theLocker( mMutex ); - mEvtIdToNameMap.insert( inEventId, inName ); - uint32_t idx = static_cast<uint32_t>( mEventNames.size() ); - mNameToEvtIndexMapRW.insert( inName, idx ); - mEventNames.pushBack( PxProfileEventName( inName, PxProfileEventId( inEventId, inCompileTimeEnabled ) ) ); - } - - virtual void flushEventIdNameMap() - { - // copy the RW map into R map - if (mNameToEvtIndexMapRW.size()) - { - for (TNameToEvtIndexMap::Iterator iter = mNameToEvtIndexMapRW.getIterator(); !iter.done(); ++iter) - { - mNameToEvtIndexMapR.insert(iter->first, iter->second); - } - mNameToEvtIndexMapRW.clear(); - } - } - - virtual uint16_t getEventIdForName( const char* inName ) - { - return getEventIdsForNames( &inName, 1 ); - } - - virtual uint16_t getEventIdsForNames( const char** inNames, uint32_t inLen ) - { - if ( inLen == 0 ) - return 0; - - // search the read-only map first - const TNameToEvtIndexMap::Entry* theEntry( mNameToEvtIndexMapR.find( inNames[0] ) ); - if ( theEntry ) - return mEventNames[theEntry->second].eventId; - - TLockType theLocker(mMutex); - - const TNameToEvtIndexMap::Entry* theReEntry(mNameToEvtIndexMapRW.find(inNames[0])); - if (theReEntry) - return mEventNames[theReEntry->second].eventId; - - //Else git R dun. - uint16_t nameSize = static_cast<uint16_t>( mEventNames.size() ); - //We don't allow 0 as an event id. - uint16_t eventId = nameSize; - //Find a contiguous set of unique event ids - bool foundAnEventId = false; - do - { - foundAnEventId = false; - ++eventId; - for ( uint16_t idx = 0; idx < inLen && foundAnEventId == false; ++idx ) - foundAnEventId = mEvtIdToNameMap.find( uint16_t(eventId + idx) ) != NULL; - } - while( foundAnEventId ); - - uint32_t clientCount = mClients.size(); - for ( uint16_t nameIdx = 0; nameIdx < inLen; ++nameIdx ) - { - uint16_t newId = uint16_t(eventId + nameIdx); - doAddName( inNames[nameIdx], newId, true ); - for( uint32_t clientIdx =0; clientIdx < clientCount; ++clientIdx ) - mClients[clientIdx]->handleEventAdded( PxProfileEventName( inNames[nameIdx], PxProfileEventId( newId ) ) ); - } - - return eventId; - } - - virtual void setProfileZoneManager(PxProfileZoneManager* inMgr) - { - mProfileZoneManager = inMgr; - } - - virtual PxProfileZoneManager* getProfileZoneManager() - { - return mProfileZoneManager; - } - - - - const char* getName() { return mName; } - - PxProfileEventBufferClient* getEventBufferClient() { return this; } - - //SDK implementation - - void addClient( PxProfileZoneClient& inClient ) - { - TLockType lock( mMutex ); - mClients.pushBack( &inClient ); - mEventsActive = true; - } - - void removeClient( PxProfileZoneClient& inClient ) - { - TLockType lock( mMutex ); - for ( uint32_t idx =0; idx < mClients.size(); ++idx ) - { - if ( mClients[idx] == &inClient ) - { - inClient.handleClientRemoved(); - mClients.replaceWithLast( idx ); - break; - } - } - mEventsActive = mClients.size() != 0; - } - - virtual bool hasClients() const - { - return mEventsActive; - } - - virtual PxProfileNames getProfileNames() const - { - TLockType theLocker( mMutex ); - const PxProfileEventName* theNames = mEventNames.begin(); - uint32_t theEventCount = uint32_t(mEventNames.size()); - return PxProfileNames( theEventCount, theNames ); - } - - virtual void release() - { - PX_PROFILE_DELETE( mWrapper.getAllocator(), this ); - } - - //Implementation chaining the buffer flush to our clients - virtual void handleBufferFlush( const uint8_t* inData, uint32_t inLength ) - { - TLockType theLocker( mMutex ); - - uint32_t clientCount = mClients.size(); - for( uint32_t idx =0; idx < clientCount; ++idx ) - mClients[idx]->handleBufferFlush( inData, inLength ); - } - //Happens if something removes all the clients from the manager. - virtual void handleClientRemoved() {} - - //Send a profile event, optionally with a context. Events are sorted by thread - //and context in the client side. - virtual void startEvent( uint16_t inId, uint64_t contextId) - { - if( mEventsActive ) - { - TZoneEventBufferType::startEvent( inId, contextId ); - } - } - virtual void stopEvent( uint16_t inId, uint64_t contextId) - { - if( mEventsActive ) - { - TZoneEventBufferType::stopEvent( inId, contextId ); - } - } - - virtual void startEvent( uint16_t inId, uint64_t contextId, uint32_t threadId) - { - if( mEventsActive ) - { - TZoneEventBufferType::startEvent( inId, contextId, threadId ); - } - } - virtual void stopEvent( uint16_t inId, uint64_t contextId, uint32_t threadId ) - { - if( mEventsActive ) - { - TZoneEventBufferType::stopEvent( inId, contextId, threadId ); - } - } - - virtual void atEvent(uint16_t inId, uint64_t contextId, uint32_t threadId, uint64_t start, uint64_t stop) - { - if (mEventsActive) - { - TZoneEventBufferType::startEvent(inId, threadId, contextId, 0, 0, start); - TZoneEventBufferType::stopEvent(inId, threadId, contextId, 0, 0, stop); - } - } - - /** - * Set an specific events value. This is different than the profiling value - * for the event; it is a value recorded and kept around without a timestamp associated - * with it. This value is displayed when the event itself is processed. - */ - virtual void eventValue( uint16_t inId, uint64_t contextId, int64_t inValue ) - { - if( mEventsActive ) - { - TZoneEventBufferType::eventValue( inId, contextId, inValue ); - } - } - virtual void flushProfileEvents() - { - TZoneEventBufferType::flushProfileEvents(); - } - }; - -}} -#endif // PXPVDSDK_PXPROFILEZONEIMPL_H diff --git a/PxShared/src/pvd/src/PxProfileZoneManager.h b/PxShared/src/pvd/src/PxProfileZoneManager.h deleted file mode 100644 index 9668460..0000000 --- a/PxShared/src/pvd/src/PxProfileZoneManager.h +++ /dev/null @@ -1,155 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPROFILEZONEMANAGER_H -#define PXPVDSDK_PXPROFILEZONEMANAGER_H - -#include "PxProfileEventSender.h" -#include "PxProfileEventNames.h" - -namespace physx { - - class PxAllocatorCallback; - - namespace profile { - - class PxProfileZone; - class PxProfileNameProvider; - - /** - \brief Profile zone handler for zone add/remove notification. - */ - class PxProfileZoneHandler - { - protected: - virtual ~PxProfileZoneHandler(){} - public: - /** - \brief On zone added notification - - \note Not a threadsafe call; handlers are expected to be able to handle - this from any thread. - - \param inSDK Added zone. - */ - virtual void onZoneAdded( PxProfileZone& inSDK ) = 0; - /** - \brief On zone removed notification - - \note Not a threadsafe call; handlers are expected to be able to handle - this from any thread. - - \param inSDK removed zone. - */ - virtual void onZoneRemoved( PxProfileZone& inSDK ) = 0; - }; - - /** - \brief The profiling system was setup in the expectation that there would be several - systems that each had its own island of profile information. PhysX, client code, - and APEX would be the first examples of these. Each one of these islands is represented - by a profile zone. - - The Manager is a singleton-like object where all these different systems can be registered - so that clients of the profiling system can have one point to capture *all* profiling events. - - Flushing the manager implies that you want to loop through all the profile zones and flush - each one. - - @see PxProfileEventFlusher - */ - class PxProfileZoneManager - : public PxProfileEventFlusher //Tell all SDK's to flush their queue of profile events. - { - protected: - virtual ~PxProfileZoneManager(){} - public: - /** - \brief Add new profile zone for the manager. - \note Threadsafe call, can be done from any thread. Handlers that are already connected - will get a new callback on the current thread. - - \param inSDK Profile zone to add. - */ - virtual void addProfileZone( PxProfileZone& inSDK ) = 0; - /** - \brief Removes profile zone from the manager. - \note Threadsafe call, can be done from any thread. Handlers that are already connected - will get a new callback on the current thread. - - \param inSDK Profile zone to remove. - */ - virtual void removeProfileZone( PxProfileZone& inSDK ) = 0; - - /** - \brief Add profile zone handler callback for the profile zone notifications. - - \note Threadsafe call. The new handler will immediately be notified about all - known SDKs. - - \param inHandler Profile zone handler to add. - */ - virtual void addProfileZoneHandler( PxProfileZoneHandler& inHandler ) = 0; - /** - \brief Removes profile zone handler callback for the profile zone notifications. - - \note Threadsafe call. The new handler will immediately be notified about all - known SDKs. - - \param inHandler Profile zone handler to remove. - */ - virtual void removeProfileZoneHandler( PxProfileZoneHandler& inHandler ) = 0; - - - /** - \brief Create a new profile zone. This means you don't need access to a PxFoundation to - create your profile zone object, and your object is automatically registered with - the profile zone manager. - - You still need to release your object when you are finished with it. - \param inSDKName Name of the SDK object. - \param inNames Option set of event id to name mappings. - \param inEventBufferByteSize rough maximum size of the event buffer. May exceed this size - by sizeof one event. When full an immediate call to all listeners is made. - */ - virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNames inNames = PxProfileNames(), uint32_t inEventBufferByteSize = 0x4000 /*16k*/ ) = 0; - - /** - \brief Releases the profile manager instance. - */ - virtual void release() = 0; - - /** - \brief Create the profile zone manager. - \param inAllocatorCallback Allocator callback. - */ - static PxProfileZoneManager& createProfileZoneManager(PxAllocatorCallback* inAllocatorCallback ); - }; - -} } - -#endif // PXPVDSDK_PXPROFILEZONEMANAGER_H diff --git a/PxShared/src/pvd/src/PxProfileZoneManagerImpl.h b/PxShared/src/pvd/src/PxProfileZoneManagerImpl.h deleted file mode 100644 index 6542917..0000000 --- a/PxShared/src/pvd/src/PxProfileZoneManagerImpl.h +++ /dev/null @@ -1,174 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#ifndef PXPVDSDK_PXPROFILEZONEMANAGERIMPL_H -#define PXPVDSDK_PXPROFILEZONEMANAGERIMPL_H - -#include "PxProfileZoneManager.h" -#include "PxProfileBase.h" -#include "PxProfileScopedMutexLock.h" -#include "PxProfileZone.h" -#include "PxProfileAllocatorWrapper.h" - -#include "PsArray.h" -#include "PsMutex.h" - -namespace physx { namespace profile { - - struct NullEventNameProvider : public PxProfileNameProvider - { - virtual PxProfileNames getProfileNames() const { return PxProfileNames( 0, 0 ); } - }; - - class ZoneManagerImpl : public PxProfileZoneManager - { - typedef ScopedLockImpl<shdfnd::Mutex> TScopedLockType; - PxProfileAllocatorWrapper mWrapper; - PxProfileArray<PxProfileZone*> mZones; - PxProfileArray<PxProfileZoneHandler*> mHandlers; - shdfnd::Mutex mMutex; - - ZoneManagerImpl( const ZoneManagerImpl& inOther ); - ZoneManagerImpl& operator=( const ZoneManagerImpl& inOther ); - - public: - - ZoneManagerImpl(PxAllocatorCallback* inFoundation) - : mWrapper( inFoundation ) - , mZones( mWrapper ) - , mHandlers( mWrapper ) - {} - - virtual ~ZoneManagerImpl() - { - //This assert would mean that a profile zone is outliving us. - //This will cause a crash when the profile zone is released. - PX_ASSERT( mZones.size() == 0 ); - while( mZones.size() ) - removeProfileZone( *mZones.back() ); - } - - virtual void addProfileZone( PxProfileZone& inSDK ) - { - TScopedLockType lock( &mMutex ); - - if ( inSDK.getProfileZoneManager() != NULL ) - { - if ( inSDK.getProfileZoneManager() == this ) - return; - else //there must be two managers in the system somehow. - { - PX_ASSERT( false ); - inSDK.getProfileZoneManager()->removeProfileZone( inSDK ); - } - } - mZones.pushBack( &inSDK ); - inSDK.setProfileZoneManager( this ); - for ( uint32_t idx =0; idx < mHandlers.size(); ++idx ) - mHandlers[idx]->onZoneAdded( inSDK ); - } - - virtual void removeProfileZone( PxProfileZone& inSDK ) - { - TScopedLockType lock( &mMutex ); - if ( inSDK.getProfileZoneManager() == NULL ) - return; - - else if ( inSDK.getProfileZoneManager() != this ) - { - PX_ASSERT( false ); - inSDK.getProfileZoneManager()->removeProfileZone( inSDK ); - return; - } - - inSDK.setProfileZoneManager( NULL ); - for ( uint32_t idx = 0; idx < mZones.size(); ++idx ) - { - if ( mZones[idx] == &inSDK ) - { - for ( uint32_t handler =0; handler < mHandlers.size(); ++handler ) - mHandlers[handler]->onZoneRemoved( inSDK ); - mZones.replaceWithLast( idx ); - } - } - } - - virtual void flushProfileEvents() - { - uint32_t sdkCount = mZones.size(); - for ( uint32_t idx = 0; idx < sdkCount; ++idx ) - mZones[idx]->flushProfileEvents(); - } - - virtual void addProfileZoneHandler( PxProfileZoneHandler& inHandler ) - { - TScopedLockType lock( &mMutex ); - mHandlers.pushBack( &inHandler ); - for ( uint32_t idx = 0; idx < mZones.size(); ++idx ) - inHandler.onZoneAdded( *mZones[idx] ); - } - - virtual void removeProfileZoneHandler( PxProfileZoneHandler& inHandler ) - { - TScopedLockType lock( &mMutex ); - for( uint32_t idx = 0; idx < mZones.size(); ++idx ) - inHandler.onZoneRemoved( *mZones[idx] ); - for( uint32_t idx = 0; idx < mHandlers.size(); ++idx ) - { - if ( mHandlers[idx] == &inHandler ) - mHandlers.replaceWithLast( idx ); - } - } - - virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNameProvider* inProvider, uint32_t inEventBufferByteSize ) - { - NullEventNameProvider nullProvider; - if ( inProvider == NULL ) - inProvider = &nullProvider; - return createProfileZone( inSDKName, inProvider->getProfileNames(), inEventBufferByteSize ); - } - - - virtual PxProfileZone& createProfileZone( const char* inSDKName, PxProfileNames inNames, uint32_t inEventBufferByteSize ) - { - PxProfileZone& retval( PxProfileZone::createProfileZone( &mWrapper.getAllocator(), inSDKName, inNames, inEventBufferByteSize ) ); - addProfileZone( retval ); - return retval; - } - - virtual void release() - { - PX_PROFILE_DELETE( mWrapper.getAllocator(), this ); - } - }; -} } - - -#endif // PXPVDSDK_PXPROFILEZONEMANAGERIMPL_H diff --git a/PxShared/src/pvd/src/PxPvd.cpp b/PxShared/src/pvd/src/PxPvd.cpp deleted file mode 100644 index 4e1eb09..0000000 --- a/PxShared/src/pvd/src/PxPvd.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "pvd/PxPvd.h" - -#include "PxPvdImpl.h" - -namespace physx -{ -namespace pvdsdk -{ - -ForwardingAllocator gForwardingAllocator; -PxAllocatorCallback* gPvdAllocatorCallback = &gForwardingAllocator; - -void SetPvdAllocatorCallback(PxAllocatorCallback* inAllocatorCallback) -{ - gPvdAllocatorCallback = inAllocatorCallback; -} - -} // namespace pvdsdk - -PxPvd* PxCreatePvd(PxFoundation& foundation) -{ - pvdsdk::gPvdAllocatorCallback = &foundation.getAllocatorCallback(); - pvdsdk::PvdImpl::initialize(); - return pvdsdk::PvdImpl::getInstance(); -} - -} // namespace physx diff --git a/PxShared/src/pvd/src/PxPvdBits.h b/PxShared/src/pvd/src/PxPvdBits.h deleted file mode 100644 index b763065..0000000 --- a/PxShared/src/pvd/src/PxPvdBits.h +++ /dev/null @@ -1,173 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDBITS_H -#define PXPVDSDK_PXPVDBITS_H - -#include "PxPvdObjectModelBaseTypes.h" - -namespace physx -{ -namespace pvdsdk -{ - -// Marshallers cannot assume src is aligned, but they can assume dest is aligned. -typedef void (*TSingleMarshaller)(const uint8_t* src, uint8_t* dest); -typedef void (*TBlockMarshaller)(const uint8_t* src, uint8_t* dest, uint32_t numItems); - -template <uint8_t ByteCount> -static inline void doSwapBytes(uint8_t* __restrict inData) -{ - for(uint32_t idx = 0; idx < ByteCount / 2; ++idx) - { - uint32_t endIdx = ByteCount - idx - 1; - uint8_t theTemp = inData[idx]; - inData[idx] = inData[endIdx]; - inData[endIdx] = theTemp; - } -} - -template <uint8_t ByteCount> -static inline void doSwapBytes(uint8_t* __restrict inData, uint32_t itemCount) -{ - uint8_t* end = inData + itemCount * ByteCount; - for(; inData < end; inData += ByteCount) - doSwapBytes<ByteCount>(inData); -} - -static inline void swapBytes(uint8_t* __restrict dataPtr, uint32_t numBytes, uint32_t itemWidth) -{ - uint32_t numItems = numBytes / itemWidth; - switch(itemWidth) - { - case 1: - break; - case 2: - doSwapBytes<2>(dataPtr, numItems); - break; - case 4: - doSwapBytes<4>(dataPtr, numItems); - break; - case 8: - doSwapBytes<8>(dataPtr, numItems); - break; - case 16: - doSwapBytes<16>(dataPtr, numItems); - break; - default: - PX_ASSERT(false); - break; - } -} - -template <uint8_t TByteCount, bool TShouldSwap> -struct PvdByteSwapper -{ - void swapBytes(uint8_t* __restrict inData) - { - doSwapBytes<TByteCount>(inData); - } - void swapBytes(uint8_t* __restrict inData, uint32_t itemCount) - { - doSwapBytes<TByteCount>(inData, itemCount); - } - void swapBytes(uint8_t* __restrict dataPtr, uint32_t numBytes, uint32_t itemWidth) - { - physx::pvdsdk::swapBytes(dataPtr, numBytes, itemWidth); - } -}; - -struct PvdNullSwapper -{ - - void swapBytes(uint8_t* __restrict) - { - } - void swapBytes(uint8_t* __restrict, uint32_t) - { - } - void swapBytes(uint8_t* __restrict, uint32_t, uint32_t) - { - } -}; -// Anything that doesn't need swapping gets the null swapper -template <uint8_t TByteCount> -struct PvdByteSwapper<TByteCount, false> : public PvdNullSwapper -{ -}; -// A 1 byte byte swapper can't really do anything. -template <> -struct PvdByteSwapper<1, true> : public PvdNullSwapper -{ -}; - -static inline void swapBytes(uint8_t&) -{ -} -static inline void swapBytes(int8_t&) -{ -} -static inline void swapBytes(uint16_t& inData) -{ - doSwapBytes<2>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(int16_t& inData) -{ - doSwapBytes<2>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(uint32_t& inData) -{ - doSwapBytes<4>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(int32_t& inData) -{ - doSwapBytes<4>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(float& inData) -{ - doSwapBytes<4>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(uint64_t& inData) -{ - doSwapBytes<8>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(int64_t& inData) -{ - doSwapBytes<8>(reinterpret_cast<uint8_t*>(&inData)); -} -static inline void swapBytes(double& inData) -{ - doSwapBytes<8>(reinterpret_cast<uint8_t*>(&inData)); -} - -static inline bool checkLength(const uint8_t* inStart, const uint8_t* inStop, uint32_t inLength) -{ - return static_cast<uint32_t>(inStop - inStart) >= inLength; -} -} -} -#endif // PXPVDSDK_PXPVDBITS_H diff --git a/PxShared/src/pvd/src/PxPvdByteStreams.h b/PxShared/src/pvd/src/PxPvdByteStreams.h deleted file mode 100644 index fff3c4f..0000000 --- a/PxShared/src/pvd/src/PxPvdByteStreams.h +++ /dev/null @@ -1,155 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDBYTESTREAMS_H -#define PXPVDSDK_PXPVDBYTESTREAMS_H -#include "PxPvdObjectModelBaseTypes.h" - -namespace physx -{ -namespace pvdsdk -{ - -static inline uint32_t strLen(const char* inStr) -{ - uint32_t len = 0; - if(inStr) - { - while(*inStr) - { - ++len; - ++inStr; - } - } - return len; -} - -class PvdInputStream -{ - protected: - virtual ~PvdInputStream() - { - } - - public: - // Return false if you can't write the number of bytes requested - // But make an absolute best effort to read the data... - virtual bool read(uint8_t* buffer, uint32_t& len) = 0; - - template <typename TDataType> - bool read(TDataType* buffer, uint32_t numItems) - { - uint32_t expected = numItems; - uint32_t amountToRead = numItems * sizeof(TDataType); - read(reinterpret_cast<uint8_t*>(buffer), amountToRead); - numItems = amountToRead / sizeof(TDataType); - PX_ASSERT(numItems == expected); - return expected == numItems; - } - - template <typename TDataType> - PvdInputStream& operator>>(TDataType& data) - { - uint32_t dataSize = static_cast<uint32_t>(sizeof(TDataType)); - bool success = read(reinterpret_cast<uint8_t*>(&data), dataSize); - // PX_ASSERT( success ); - // PX_ASSERT( dataSize == sizeof( data ) ); - (void)success; - return *this; - } -}; - -struct ByteSwappingPvdInputStream -{ - protected: - ByteSwappingPvdInputStream& operator=(ByteSwappingPvdInputStream& other); - - public: - PvdInputStream& mStream; - ByteSwappingPvdInputStream(PvdInputStream& stream) : mStream(stream) - { - } - - template <typename TDataType> - bool read(TDataType* buffer, uint32_t& numItems) - { - bool retval = mStream.read(buffer, numItems); - for(uint32_t idx = 0; idx < numItems; ++idx) - swapBytes(buffer[idx]); - return retval; - } - - template <typename TDataType> - ByteSwappingPvdInputStream& operator>>(TDataType& data) - { - mStream >> data; - swapBytes(data); - return *this; - } -}; - -class PvdOutputStream -{ - protected: - virtual ~PvdOutputStream() - { - } - - public: - // Return false if you can't write the number of bytes requested - // But make an absolute best effort to write the data... - virtual bool write(const uint8_t* buffer, uint32_t len) = 0; - virtual bool directCopy(PvdInputStream& inStream, uint32_t len) = 0; - - template <typename TDataType> - bool write(const TDataType* buffer, uint32_t numItems) - { - return write(reinterpret_cast<const uint8_t*>(buffer), numItems * sizeof(TDataType)); - } - - template <typename TDataType> - PvdOutputStream& operator<<(const TDataType& data) - { - bool success = write(reinterpret_cast<const uint8_t*>(&data), sizeof(data)); - PX_ASSERT(success); - (void)success; - return *this; - } - - PvdOutputStream& operator<<(const char* inString) - { - if(inString && *inString) - { - uint32_t len(strLen(inString)); - write(inString, len); - } - return *this; - } -}; -} -} -#endif // PXPVDSDK_PXPVDBYTESTREAMS_H diff --git a/PxShared/src/pvd/src/PxPvdCommStreamEventSink.h b/PxShared/src/pvd/src/PxPvdCommStreamEventSink.h deleted file mode 100644 index 57e8635..0000000 --- a/PxShared/src/pvd/src/PxPvdCommStreamEventSink.h +++ /dev/null @@ -1,55 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDCOMMSTREAMEVENTSINK_H -#define PXPVDSDK_PXPVDCOMMSTREAMEVENTSINK_H - -#include "PxPvdObjectModelBaseTypes.h" -#include "PxPvdCommStreamEvents.h" -#include "PxPvdCommStreamTypes.h" - -namespace physx -{ -namespace pvdsdk -{ - -class PvdCommStreamEventSink -{ - public: - template <typename TStreamType> - static void writeStreamEvent(const EventSerializeable& evt, PvdCommStreamEventTypes::Enum evtType, TStreamType& stream) - { - EventStreamifier<TStreamType> streamifier_concrete(stream); - PvdEventSerializer& streamifier(streamifier_concrete); - streamifier.streamify(evtType); - const_cast<EventSerializeable&>(evt).serialize(streamifier); - } -}; - -} // pvd -} // physx -#endif // PXPVDSDK_PXPVDCOMMSTREAMEVENTSINK_H diff --git a/PxShared/src/pvd/src/PxPvdCommStreamEvents.h b/PxShared/src/pvd/src/PxPvdCommStreamEvents.h deleted file mode 100644 index 81770da..0000000 --- a/PxShared/src/pvd/src/PxPvdCommStreamEvents.h +++ /dev/null @@ -1,987 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDCOMMSTREAMEVENTS_H -#define PXPVDSDK_PXPVDCOMMSTREAMEVENTS_H - -#include "foundation/PxVec3.h" -#include "foundation/PxFlags.h" - -#include "PxPvdObjectModelBaseTypes.h" -#include "PsTime.h" - -namespace physx -{ -namespace pvdsdk -{ - -struct CommStreamFlagTypes -{ - enum Enum - { - Is64BitPtr = 1 - }; -}; - -typedef PxFlags<CommStreamFlagTypes::Enum, uint32_t> CommStreamFlags; - -template <typename TDataType> -struct PvdCommVariableSizedEventCheck -{ - bool variable_size_check; -}; - -// Pick out the events that are possibly very large. -// This helps us keep our buffers close to the size the user requested. -#define DECLARE_TYPE_VARIABLE_SIZED(type) \ - template <> \ - struct PvdCommVariableSizedEventCheck<type> \ - { \ - uint32_t variable_size_check; \ - }; - -struct NameHandleValue; -struct StreamPropMessageArg; -struct StringHandleEvent; -struct CreateClass; -struct DeriveClass; -struct CreateProperty; -struct CreatePropertyMessage; -struct CreateInstance; -struct SetPropertyValue; -struct BeginSetPropertyValue; -struct AppendPropertyValueData; -struct EndSetPropertyValue; -struct SetPropertyMessage; -struct BeginPropertyMessageGroup; -struct SendPropertyMessageFromGroup; -struct EndPropertyMessageGroup; -struct CreateDestroyInstanceProperty; -struct PushBackObjectRef; -struct RemoveObjectRef; -struct BeginSection; -struct EndSection; -struct SetPickable; -struct SetColor; -struct SetIsTopLevel; -struct SetCamera; -struct AddProfileZone; -struct AddProfileZoneEvent; -struct StreamEndEvent; -struct ErrorMessage; -struct OriginShift; -struct DestroyInstance; - -#define DECLARE_COMM_STREAM_EVENTS \ - \ -DECLARE_PVD_COMM_STREAM_EVENT(StringHandleEvent) \ -DECLARE_PVD_COMM_STREAM_EVENT(CreateClass) \ -DECLARE_PVD_COMM_STREAM_EVENT(DeriveClass) \ -DECLARE_PVD_COMM_STREAM_EVENT(CreateProperty) \ -DECLARE_PVD_COMM_STREAM_EVENT(CreatePropertyMessage) \ -DECLARE_PVD_COMM_STREAM_EVENT(CreateInstance) \ -DECLARE_PVD_COMM_STREAM_EVENT(SetPropertyValue) \ -DECLARE_PVD_COMM_STREAM_EVENT(BeginSetPropertyValue) \ -DECLARE_PVD_COMM_STREAM_EVENT(AppendPropertyValueData) \ -DECLARE_PVD_COMM_STREAM_EVENT(EndSetPropertyValue) \ -DECLARE_PVD_COMM_STREAM_EVENT(SetPropertyMessage) \ -DECLARE_PVD_COMM_STREAM_EVENT(BeginPropertyMessageGroup) \ -DECLARE_PVD_COMM_STREAM_EVENT(SendPropertyMessageFromGroup) \ -DECLARE_PVD_COMM_STREAM_EVENT(EndPropertyMessageGroup) \ -DECLARE_PVD_COMM_STREAM_EVENT(DestroyInstance) \ -DECLARE_PVD_COMM_STREAM_EVENT(PushBackObjectRef) \ -DECLARE_PVD_COMM_STREAM_EVENT(RemoveObjectRef) \ -DECLARE_PVD_COMM_STREAM_EVENT(BeginSection) \ -DECLARE_PVD_COMM_STREAM_EVENT(EndSection) \ -DECLARE_PVD_COMM_STREAM_EVENT(SetPickable) \ -DECLARE_PVD_COMM_STREAM_EVENT(SetColor) \ -DECLARE_PVD_COMM_STREAM_EVENT(SetIsTopLevel) \ -DECLARE_PVD_COMM_STREAM_EVENT(SetCamera) \ -DECLARE_PVD_COMM_STREAM_EVENT(AddProfileZone) \ -DECLARE_PVD_COMM_STREAM_EVENT(AddProfileZoneEvent) \ -DECLARE_PVD_COMM_STREAM_EVENT(StreamEndEvent) \ -DECLARE_PVD_COMM_STREAM_EVENT(ErrorMessage) \ -DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(OriginShift) - -struct PvdCommStreamEventTypes -{ - enum Enum - { - Unknown = 0, -#define DECLARE_PVD_COMM_STREAM_EVENT(x) x, -#define DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(x) x - DECLARE_COMM_STREAM_EVENTS -#undef DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA -#undef DECLARE_PVD_COMM_STREAM_EVENT - , Last - }; -}; - -template <typename TDataType> -struct DatatypeToCommEventType -{ - bool compile_error; -}; -template <PvdCommStreamEventTypes::Enum TEnumType> -struct CommEventTypeToDatatype -{ - bool compile_error; -}; - -#define DECLARE_PVD_COMM_STREAM_EVENT(x) \ - template <> \ - struct DatatypeToCommEventType<x> \ - { \ - enum Enum \ - { \ - EEventTypeMap = PvdCommStreamEventTypes::x \ - }; \ - }; \ - template <> \ - struct CommEventTypeToDatatype<PvdCommStreamEventTypes::x> \ - { \ - typedef x TEventType; \ - }; -#define DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA(x) \ - \ -template<> struct DatatypeToCommEventType<x> \ - { \ - enum Enum \ - { \ - EEventTypeMap = PvdCommStreamEventTypes::x \ - }; \ - }; \ - \ -template<> struct CommEventTypeToDatatype<PvdCommStreamEventTypes::x> \ - { \ - typedef x TEventType; \ - }; - -DECLARE_COMM_STREAM_EVENTS -#undef DECLARE_PVD_COMM_STREAM_EVENT_NO_COMMA -#undef DECLARE_PVD_COMM_STREAM_EVENT - -template <typename TDataType> -PvdCommStreamEventTypes::Enum getCommStreamEventType() -{ - return static_cast<PvdCommStreamEventTypes::Enum>(DatatypeToCommEventType<TDataType>::EEventTypeMap); -} - -struct StreamNamespacedName -{ - StringHandle mNamespace; // StringHandle handles - StringHandle mName; - StreamNamespacedName(StringHandle ns = 0, StringHandle nm = 0) : mNamespace(ns), mName(nm) - { - } -}; - -class EventSerializeable; - -class PvdEventSerializer -{ - protected: - virtual ~PvdEventSerializer() - { - } - - public: - virtual void streamify(uint8_t& val) = 0; - virtual void streamify(uint16_t& val) = 0; - virtual void streamify(uint32_t& val) = 0; - virtual void streamify(float& val) = 0; - virtual void streamify(uint64_t& val) = 0; - virtual void streamify(String& val) = 0; - virtual void streamify(DataRef<const uint8_t>& data) = 0; - virtual void streamify(DataRef<NameHandleValue>& data) = 0; - virtual void streamify(DataRef<StreamPropMessageArg>& data) = 0; - virtual void streamify(DataRef<StringHandle>& data) = 0; - - void streamify(StringHandle& hdl) - { - streamify(hdl.mHandle); - } - void streamify(CommStreamFlags& flags) - { - uint32_t val(flags); - streamify(val); - flags = CommStreamFlags(val); - } - - void streamify(PvdCommStreamEventTypes::Enum& val) - { - uint8_t detyped = static_cast<uint8_t>(val); - streamify(detyped); - val = static_cast<PvdCommStreamEventTypes::Enum>(detyped); - } - void streamify(PropertyType::Enum& val) - { - uint8_t detyped = static_cast<uint8_t>(val); - streamify(detyped); - val = static_cast<PropertyType::Enum>(detyped); - } - - void streamify(bool& val) - { - uint8_t detyped = uint8_t(val ? 1 : 0); - streamify(detyped); - val = detyped ? true : false; - } - - void streamify(StreamNamespacedName& name) - { - streamify(name.mNamespace); - streamify(name.mName); - } - - void streamify(PvdColor& color) - { - streamify(color.r); - streamify(color.g); - streamify(color.b); - streamify(color.a); - } - - void streamify(PxVec3& vec) - { - streamify(vec.x); - streamify(vec.y); - streamify(vec.z); - } - - static uint32_t measure(const EventSerializeable& evt); -}; - -class EventSerializeable -{ - protected: - virtual ~EventSerializeable() - { - } - - public: - virtual void serialize(PvdEventSerializer& serializer) = 0; -}; - -/** Numbers generated from random.org -129919156 17973702 401496246 144984007 336950759 -907025328 837150850 679717896 601529147 269478202 -*/ -struct StreamInitialization : public EventSerializeable -{ - static uint32_t getStreamId() - { - return 837150850; - } - static uint32_t getStreamVersion() - { - return 1; - } - - uint32_t mStreamId; - uint32_t mStreamVersion; - uint64_t mTimestampNumerator; - uint64_t mTimestampDenominator; - CommStreamFlags mStreamFlags; - StreamInitialization() - : mStreamId(getStreamId()) - , mStreamVersion(getStreamVersion()) - , mTimestampNumerator(physx::shdfnd::Time::getCounterFrequency().mNumerator * 10) - , mTimestampDenominator(physx::shdfnd::Time::getCounterFrequency().mDenominator) - , mStreamFlags(sizeof(void*) == 4 ? 0 : 1) - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mStreamId); - s.streamify(mStreamVersion); - s.streamify(mTimestampNumerator); - s.streamify(mTimestampDenominator); - s.streamify(mStreamFlags); - } -}; - -struct EventGroup : public EventSerializeable -{ - uint32_t mDataSize; // in bytes, data directly follows this header - uint32_t mNumEvents; - uint64_t mStreamId; - uint64_t mTimestamp; - - EventGroup(uint32_t dataSize = 0, uint32_t numEvents = 0, uint64_t streamId = 0, uint64_t ts = 0) - : mDataSize(dataSize), mNumEvents(numEvents), mStreamId(streamId), mTimestamp(ts) - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mDataSize); - s.streamify(mNumEvents); - s.streamify(mStreamId); - s.streamify(mTimestamp); - } -}; - -struct StringHandleEvent : public EventSerializeable -{ - String mString; - uint32_t mHandle; - StringHandleEvent(String str, uint32_t hdl) : mString(str), mHandle(hdl) - { - } - StringHandleEvent() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mString); - s.streamify(mHandle); - } -}; - -DECLARE_TYPE_VARIABLE_SIZED(StringHandleEvent) - -typedef uint64_t Timestamp; - -struct CreateClass : public EventSerializeable -{ - StreamNamespacedName mName; - CreateClass(StreamNamespacedName nm) : mName(nm) - { - } - CreateClass() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mName); - } -}; - -struct DeriveClass : public EventSerializeable -{ - StreamNamespacedName mParent; - StreamNamespacedName mChild; - - DeriveClass(StreamNamespacedName p, StreamNamespacedName c) : mParent(p), mChild(c) - { - } - DeriveClass() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mParent); - s.streamify(mChild); - } -}; - -struct NameHandleValue : public EventSerializeable -{ - StringHandle mName; - uint32_t mValue; - NameHandleValue(StringHandle name, uint32_t val) : mName(name), mValue(val) - { - } - NameHandleValue() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mName); - s.streamify(mValue); - } -}; -/*virtual PvdError createProperty( StreamNamespacedName clsName, StringHandle name, StringHandle semantic - , StreamNamespacedName dtypeName, PropertyType::Enum propertyType - , DataRef<NamedValue> values = DataRef<NamedValue>() ) = 0; */ -struct CreateProperty : public EventSerializeable -{ - StreamNamespacedName mClass; - StringHandle mName; - StringHandle mSemantic; - StreamNamespacedName mDatatypeName; - PropertyType::Enum mPropertyType; - DataRef<NameHandleValue> mValues; - - CreateProperty(StreamNamespacedName cls, StringHandle name, StringHandle semantic, StreamNamespacedName dtypeName, - PropertyType::Enum ptype, DataRef<NameHandleValue> values) - : mClass(cls), mName(name), mSemantic(semantic), mDatatypeName(dtypeName), mPropertyType(ptype), mValues(values) - { - } - CreateProperty() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mClass); - s.streamify(mName); - s.streamify(mSemantic); - s.streamify(mDatatypeName); - s.streamify(mPropertyType); - s.streamify(mValues); - } -}; - -struct StreamPropMessageArg : public EventSerializeable -{ - StringHandle mPropertyName; - StreamNamespacedName mDatatypeName; - uint32_t mMessageOffset; - uint32_t mByteSize; - StreamPropMessageArg(StringHandle pname, StreamNamespacedName dtypeName, uint32_t offset, uint32_t byteSize) - : mPropertyName(pname), mDatatypeName(dtypeName), mMessageOffset(offset), mByteSize(byteSize) - { - } - - StreamPropMessageArg() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mPropertyName); - s.streamify(mDatatypeName); - s.streamify(mMessageOffset); - s.streamify(mByteSize); - } -}; - -/* - virtual PvdError createPropertyMessage( StreamNamespacedName cls, StreamNamespacedName msgName - , DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes ) = - 0;*/ -struct CreatePropertyMessage : public EventSerializeable -{ - StreamNamespacedName mClass; - StreamNamespacedName mMessageName; - DataRef<StreamPropMessageArg> mMessageEntries; - uint32_t mMessageByteSize; - - CreatePropertyMessage(StreamNamespacedName cls, StreamNamespacedName msgName, DataRef<StreamPropMessageArg> propArg, - uint32_t messageByteSize) - : mClass(cls), mMessageName(msgName), mMessageEntries(propArg), mMessageByteSize(messageByteSize) - { - } - CreatePropertyMessage() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mClass); - s.streamify(mMessageName); - s.streamify(mMessageEntries); - s.streamify(mMessageByteSize); - } -}; - -/**Changing immediate data on instances*/ - -// virtual PvdError createInstance( StreamNamespacedName cls, uint64_t instance ) = 0; -struct CreateInstance : public EventSerializeable -{ - StreamNamespacedName mClass; - uint64_t mInstanceId; - - CreateInstance(StreamNamespacedName cls, uint64_t streamId) : mClass(cls), mInstanceId(streamId) - { - } - CreateInstance() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mClass); - s.streamify(mInstanceId); - } -}; - -// virtual PvdError setPropertyValue( uint64_t instance, StringHandle name, DataRef<const uint8_t> data, -// StreamNamespacedName incomingTypeName ) = 0; -struct SetPropertyValue : public EventSerializeable -{ - uint64_t mInstanceId; - StringHandle mPropertyName; - DataRef<const uint8_t> mData; - StreamNamespacedName mIncomingTypeName; - uint32_t mNumItems; - - SetPropertyValue(uint64_t instance, StringHandle name, DataRef<const uint8_t> data, - StreamNamespacedName incomingTypeName, uint32_t numItems) - : mInstanceId(instance), mPropertyName(name), mData(data), mIncomingTypeName(incomingTypeName), mNumItems(numItems) - { - } - - SetPropertyValue() - { - } - - void serializeBeginning(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mPropertyName); - s.streamify(mIncomingTypeName); - s.streamify(mNumItems); - } - - void serialize(PvdEventSerializer& s) - { - serializeBeginning(s); - s.streamify(mData); - } -}; - -DECLARE_TYPE_VARIABLE_SIZED(SetPropertyValue) - -struct BeginSetPropertyValue : public EventSerializeable -{ - uint64_t mInstanceId; - StringHandle mPropertyName; - StreamNamespacedName mIncomingTypeName; - - BeginSetPropertyValue(uint64_t instance, StringHandle name, StreamNamespacedName incomingTypeName) - : mInstanceId(instance), mPropertyName(name), mIncomingTypeName(incomingTypeName) - { - } - BeginSetPropertyValue() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mPropertyName); - s.streamify(mIncomingTypeName); - } -}; - -// virtual PvdError appendPropertyValueData( DataRef<const uint8_t> data ) = 0; -struct AppendPropertyValueData : public EventSerializeable -{ - DataRef<const uint8_t> mData; - uint32_t mNumItems; - AppendPropertyValueData(DataRef<const uint8_t> data, uint32_t numItems) : mData(data), mNumItems(numItems) - { - } - AppendPropertyValueData() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mData); - s.streamify(mNumItems); - } -}; - -DECLARE_TYPE_VARIABLE_SIZED(AppendPropertyValueData) - -// virtual PvdError endSetPropertyValue() = 0; -struct EndSetPropertyValue : public EventSerializeable -{ - EndSetPropertyValue() - { - } - - void serialize(PvdEventSerializer&) - { - } -}; - -// virtual PvdError setPropertyMessage( uint64_t instance, StreamNamespacedName msgName, DataRef<const uint8_t> data ) = -// 0; -struct SetPropertyMessage : public EventSerializeable -{ - uint64_t mInstanceId; - StreamNamespacedName mMessageName; - DataRef<const uint8_t> mData; - - SetPropertyMessage(uint64_t instance, StreamNamespacedName msgName, DataRef<const uint8_t> data) - : mInstanceId(instance), mMessageName(msgName), mData(data) - { - } - - SetPropertyMessage() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mMessageName); - s.streamify(mData); - } -}; - -DECLARE_TYPE_VARIABLE_SIZED(SetPropertyMessage) - -// virtual PvdError beginPropertyMessageGroup( StreamNamespacedName msgName ) = 0; -struct BeginPropertyMessageGroup : public EventSerializeable -{ - StreamNamespacedName mMsgName; - BeginPropertyMessageGroup(StreamNamespacedName msgName) : mMsgName(msgName) - { - } - BeginPropertyMessageGroup() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mMsgName); - } -}; - -// virtual PvdError sendPropertyMessageFromGroup( uint64_t instance, DataRef<const uint8_t*> data ) = 0; -struct SendPropertyMessageFromGroup : public EventSerializeable -{ - uint64_t mInstance; - DataRef<const uint8_t> mData; - - SendPropertyMessageFromGroup(uint64_t instance, DataRef<const uint8_t> data) : mInstance(instance), mData(data) - { - } - SendPropertyMessageFromGroup() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstance); - s.streamify(mData); - } -}; - -DECLARE_TYPE_VARIABLE_SIZED(SendPropertyMessageFromGroup) - -// virtual PvdError endPropertyMessageGroup() = 0; -struct EndPropertyMessageGroup : public EventSerializeable -{ - EndPropertyMessageGroup() - { - } - - void serialize(PvdEventSerializer&) - { - } -}; - -struct PushBackObjectRef : public EventSerializeable -{ - uint64_t mInstanceId; - StringHandle mProperty; - uint64_t mObjectRef; - - PushBackObjectRef(uint64_t instId, StringHandle prop, uint64_t objRef) - : mInstanceId(instId), mProperty(prop), mObjectRef(objRef) - { - } - - PushBackObjectRef() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mProperty); - s.streamify(mObjectRef); - } -}; - -struct RemoveObjectRef : public EventSerializeable -{ - uint64_t mInstanceId; - StringHandle mProperty; - uint64_t mObjectRef; - - RemoveObjectRef(uint64_t instId, StringHandle prop, uint64_t objRef) - : mInstanceId(instId), mProperty(prop), mObjectRef(objRef) - { - } - - RemoveObjectRef() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mProperty); - s.streamify(mObjectRef); - } -}; - -// virtual PvdError destroyInstance( uint64_t key ) = 0; -struct DestroyInstance : public EventSerializeable -{ - uint64_t mInstanceId; - DestroyInstance(uint64_t instance) : mInstanceId(instance) - { - } - DestroyInstance() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - } -}; - -// virtual PvdError beginSection( uint64_t sectionId, StringHandle name ) = 0; -struct BeginSection : public EventSerializeable -{ - uint64_t mSectionId; - StringHandle mName; - Timestamp mTimestamp; - BeginSection(uint64_t sectionId, StringHandle name, uint64_t timestamp) - : mSectionId(sectionId), mName(name), mTimestamp(timestamp) - { - } - BeginSection() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mSectionId); - s.streamify(mName); - s.streamify(mTimestamp); - } -}; -// virtual PvdError endSection( uint64_t sectionId, StringHandle name ) = 0; -struct EndSection : public EventSerializeable -{ - uint64_t mSectionId; - StringHandle mName; - Timestamp mTimestamp; - EndSection(uint64_t sectionId, StringHandle name, uint64_t timestamp) - : mSectionId(sectionId), mName(name), mTimestamp(timestamp) - { - } - EndSection() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mSectionId); - s.streamify(mName); - s.streamify(mTimestamp); - } -}; - -// virtual void setPickable( void* instance, bool pickable ) = 0; -struct SetPickable : public EventSerializeable -{ - uint64_t mInstanceId; - bool mPickable; - SetPickable(uint64_t instId, bool pick) : mInstanceId(instId), mPickable(pick) - { - } - SetPickable() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mPickable); - } -}; -// virtual void setColor( void* instance, const PvdColor& color ) = 0; -struct SetColor : public EventSerializeable -{ - uint64_t mInstanceId; - PvdColor mColor; - SetColor(uint64_t instId, PvdColor color) : mInstanceId(instId), mColor(color) - { - } - SetColor() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mColor); - } -}; - -// virtual void setColor( void* instance, const PvdColor& color ) = 0; -struct SetIsTopLevel : public EventSerializeable -{ - uint64_t mInstanceId; - bool mIsTopLevel; - - SetIsTopLevel(uint64_t instId, bool topLevel) : mInstanceId(instId), mIsTopLevel(topLevel) - { - } - SetIsTopLevel() : mIsTopLevel(false) - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mIsTopLevel); - } -}; - -struct SetCamera : public EventSerializeable -{ - String mName; - PxVec3 mPosition; - PxVec3 mUp; - PxVec3 mTarget; - SetCamera(String name, const PxVec3& pos, const PxVec3& up, const PxVec3& target) - : mName(name), mPosition(pos), mUp(up), mTarget(target) - { - } - SetCamera() : mName(NULL) - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mName); - s.streamify(mPosition); - s.streamify(mUp); - s.streamify(mTarget); - } -}; - -struct ErrorMessage : public EventSerializeable -{ - uint32_t mCode; - String mMessage; - String mFile; - uint32_t mLine; - - ErrorMessage(uint32_t code, String message, String file, uint32_t line) - : mCode(code), mMessage(message), mFile(file), mLine(line) - { - } - - ErrorMessage() : mMessage(NULL), mFile(NULL) - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mCode); - s.streamify(mMessage); - s.streamify(mFile); - s.streamify(mLine); - } -}; - -struct AddProfileZone : public EventSerializeable -{ - uint64_t mInstanceId; - String mName; - AddProfileZone(uint64_t iid, String nm) : mInstanceId(iid), mName(nm) - { - } - AddProfileZone() : mName(NULL) - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mName); - } -}; - -struct AddProfileZoneEvent : public EventSerializeable -{ - uint64_t mInstanceId; - String mName; - uint16_t mEventId; - bool mCompileTimeEnabled; - AddProfileZoneEvent(uint64_t iid, String nm, uint16_t eid, bool cte) - : mInstanceId(iid), mName(nm), mEventId(eid), mCompileTimeEnabled(cte) - { - } - AddProfileZoneEvent() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mName); - s.streamify(mEventId); - s.streamify(mCompileTimeEnabled); - } -}; - -struct StreamEndEvent : public EventSerializeable -{ - String mName; - StreamEndEvent() : mName("StreamEnd") - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mName); - } -}; - -struct OriginShift : public EventSerializeable -{ - uint64_t mInstanceId; - PxVec3 mShift; - - OriginShift(uint64_t iid, const PxVec3& shift) : mInstanceId(iid), mShift(shift) - { - } - OriginShift() - { - } - - void serialize(PvdEventSerializer& s) - { - s.streamify(mInstanceId); - s.streamify(mShift); - } -}; -} // pvdsdk -} // physx - -#endif // PXPVDSDK_PXPVDCOMMSTREAMEVENTS_H diff --git a/PxShared/src/pvd/src/PxPvdCommStreamSDKEventTypes.h b/PxShared/src/pvd/src/PxPvdCommStreamSDKEventTypes.h deleted file mode 100644 index 4105730..0000000 --- a/PxShared/src/pvd/src/PxPvdCommStreamSDKEventTypes.h +++ /dev/null @@ -1,32 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#define THERE_IS_NO_INCLUDE_GUARD_FOR_A_REASON - -DECLARE_PVD_COMM_STREAM_SDK_EVENT(SetPauseState) - -#undef THERE_IS_NO_INCLUDE_GUARD_FOR_A_REASON diff --git a/PxShared/src/pvd/src/PxPvdCommStreamTypes.h b/PxShared/src/pvd/src/PxPvdCommStreamTypes.h deleted file mode 100644 index cbfda4d..0000000 --- a/PxShared/src/pvd/src/PxPvdCommStreamTypes.h +++ /dev/null @@ -1,262 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDCOMMSTREAMTYPES_H -#define PXPVDSDK_PXPVDCOMMSTREAMTYPES_H - -#include "foundation/PxErrorCallback.h" -#include "pvd/PxPvdTransport.h" - -#include "PxPvdRenderBuffer.h" -#include "PxPvdObjectModelBaseTypes.h" -#include "PxPvdCommStreamEvents.h" -#include "PxPvdDataStream.h" -#include "PsMutex.h" - -namespace physx -{ -namespace profile -{ -class PxProfileZone; -class PxProfileMemoryEventBuffer; -} -namespace pvdsdk -{ -struct PvdErrorMessage; -class PvdObjectModelMetaData; - -DEFINE_PVD_TYPE_NAME_MAP(profile::PxProfileZone, "_debugger_", "PxProfileZone") -DEFINE_PVD_TYPE_NAME_MAP(profile::PxProfileMemoryEventBuffer, "_debugger_", "PxProfileMemoryEventBuffer") -DEFINE_PVD_TYPE_NAME_MAP(PvdErrorMessage, "_debugger_", "PvdErrorMessage") -// All event streams are on the 'events' property of objects of these types -static inline NamespacedName getMemoryEventTotalsClassName() -{ - return NamespacedName("_debugger", "MemoryEventTotals"); -} - -class PvdOMMetaDataProvider -{ - protected: - virtual ~PvdOMMetaDataProvider() - { - } - - public: - virtual void addRef() = 0; - virtual void release() = 0; - virtual PvdObjectModelMetaData& lock() = 0; - virtual void unlock() = 0; - virtual bool createInstance(const NamespacedName& clsName, const void* instance) = 0; - virtual bool isInstanceValid(const void* instance) = 0; - virtual void destroyInstance(const void* instance) = 0; - virtual int32_t getInstanceClassType(const void* instance) = 0; -}; - -class PvdCommStreamInternalConnection; - -class PvdConnectionListener -{ - protected: - virtual ~PvdConnectionListener() - { - } - - public: - virtual void onDisconnect(PvdCommStreamInternalConnection& connection) = 0; - virtual void onInstanceDestroyed(const void* instance) = 0; -}; - -class PvdCommStreamEmbeddedTypes -{ - public: - static const char* getProfileEventStreamSemantic() - { - return "profile event stream"; - } - static const char* getMemoryEventStreamSemantic() - { - return "memory event stream"; - } - static const char* getRendererEventStreamSemantic() - { - return "render event stream"; - } -}; - -class PvdCommStreamEventBufferClient; - -template <typename TStreamType> -struct EventStreamifier : public PvdEventSerializer -{ - TStreamType& mBuffer; - EventStreamifier(TStreamType& buf) : mBuffer(buf) - { - } - - template <typename TDataType> - void write(const TDataType& type) - { - mBuffer.write(reinterpret_cast<const uint8_t*>(&type), sizeof(TDataType)); - } - template <typename TDataType> - void write(const TDataType* type, uint32_t count) - { - mBuffer.write(reinterpret_cast<const uint8_t*>(type), count * sizeof(TDataType)); - } - - void writeRef(DataRef<const uint8_t> data) - { - uint32_t amount = static_cast<uint32_t>(data.size()); - write(amount); - write(data.begin(), amount); - } - void writeRef(DataRef<StringHandle> data) - { - uint32_t amount = static_cast<uint32_t>(data.size()); - write(amount); - write(data.begin(), amount); - } - template <typename TDataType> - void writeRef(DataRef<TDataType> data) - { - uint32_t amount = static_cast<uint32_t>(data.size()); - write(amount); - for(uint32_t idx = 0; idx < amount; ++idx) - { - TDataType& dtype(const_cast<TDataType&>(data[idx])); - dtype.serialize(*this); - } - } - - virtual void streamify(uint16_t& val) - { - write(val); - } - virtual void streamify(uint8_t& val) - { - write(val); - } - virtual void streamify(uint32_t& val) - { - write(val); - } - virtual void streamify(float& val) - { - write(val); - } - virtual void streamify(uint64_t& val) - { - write(val); - } - virtual void streamify(PvdDebugText& val) - { - write(val.color); - write(val.position); - write(val.size); - streamify(val.string); - } - - virtual void streamify(String& val) - { - uint32_t len = 0; - String temp = nonNull(val); - if(*temp) - len = static_cast<uint32_t>(strlen(temp) + 1); - write(len); - write(val, len); - } - virtual void streamify(DataRef<const uint8_t>& val) - { - writeRef(val); - } - virtual void streamify(DataRef<NameHandleValue>& val) - { - writeRef(val); - } - virtual void streamify(DataRef<StreamPropMessageArg>& val) - { - writeRef(val); - } - virtual void streamify(DataRef<StringHandle>& val) - { - writeRef(val); - } - - private: - EventStreamifier& operator=(const EventStreamifier&); -}; - -struct MeasureStream -{ - uint32_t mSize; - MeasureStream() : mSize(0) - { - } - template <typename TDataType> - void write(const TDataType& val) - { - mSize += sizeof(val); - } - template <typename TDataType> - void write(const TDataType*, uint32_t count) - { - mSize += sizeof(TDataType) * count; - } -}; - -struct DataStreamState -{ - enum Enum - { - Open, - SetPropertyValue, - PropertyMessageGroup - }; -}; - -class ExtendedEventSerializer : public PvdEventSerializer -{ - protected: - virtual ~ExtendedEventSerializer() - { - } - - public: - virtual void setData(DataRef<const uint8_t> eventData) = 0; - // True if this serializer performs byte swapping - virtual bool performsSwap() = 0; - - virtual bool isGood() = 0; - - virtual void release() = 0; - - static ExtendedEventSerializer& createInputSerializer(bool swapBytes); -}; - -} // pvdsdk -} // physx -#endif // PXPVDSDK_PXPVDCOMMSTREAMTYPES_H diff --git a/PxShared/src/pvd/src/PxPvdDataStream.cpp b/PxShared/src/pvd/src/PxPvdDataStream.cpp deleted file mode 100644 index da13140..0000000 --- a/PxShared/src/pvd/src/PxPvdDataStream.cpp +++ /dev/null @@ -1,870 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "PxPvdDataStream.h" -#include "PxPvdFoundation.h" -#include "PxPvdCommStreamEvents.h" -#include "PxPvdCommStreamEventSink.h" -#include "PxPvdCommStreamTypes.h" -#include "PxPvdDataStreamHelpers.h" -#include "PxPvdObjectModelInternalTypes.h" -#include "PxPvdImpl.h" -#include "PsTime.h" -#include "PsFoundation.h" -#include "foundation/PxMemory.h" - -using namespace physx; -using namespace physx::pvdsdk; -using namespace physx::shdfnd; - -namespace -{ - -struct ScopedMetaData -{ - PvdOMMetaDataProvider& mProvider; - PvdObjectModelMetaData& mMeta; - ScopedMetaData(PvdOMMetaDataProvider& provider) : mProvider(provider), mMeta(provider.lock()) - { - } - ~ScopedMetaData() - { - mProvider.unlock(); - } - PvdObjectModelMetaData* operator->() - { - return &mMeta; - } - - private: - ScopedMetaData& operator=(const ScopedMetaData&); -}; - -struct PropertyDefinitionHelper : public PvdPropertyDefinitionHelper -{ - PvdDataStream* mStream; - PvdOMMetaDataProvider& mProvider; - Array<char> mNameBuffer; - Array<uint32_t> mNameStack; - Array<NamedValue> mNamedValues; - Array<PropertyMessageArg> mPropertyMessageArgs; - - PropertyDefinitionHelper(PvdOMMetaDataProvider& provider) - : mStream(NULL) - , mProvider(provider) - , mNameBuffer("PropertyDefinitionHelper::mNameBuffer") - , mNameStack("PropertyDefinitionHelper::mNameStack") - , mNamedValues("PropertyDefinitionHelper::mNamedValues") - , mPropertyMessageArgs("PropertyDefinitionHelper::mPropertyMessageArgs") - { - } - void setStream(PvdDataStream* stream) - { - mStream = stream; - } - - inline void appendStrToBuffer(const char* str) - { - if(str == NULL) - return; - size_t strLen = strlen(str); - size_t endBufOffset = mNameBuffer.size(); - size_t resizeLen = endBufOffset; - // account for null - if(mNameBuffer.empty()) - resizeLen += 1; - else - endBufOffset -= 1; - - mNameBuffer.resize(static_cast<uint32_t>(resizeLen + strLen)); - char* endPtr = mNameBuffer.begin() + endBufOffset; - PxMemCopy(endPtr, str, static_cast<uint32_t>(strLen)); - } - - virtual void pushName(const char* nm, const char* appender = ".") - { - size_t nameBufLen = mNameBuffer.size(); - mNameStack.pushBack(static_cast<uint32_t>(nameBufLen)); - if(mNameBuffer.empty() == false) - appendStrToBuffer(appender); - appendStrToBuffer(nm); - mNameBuffer.back() = 0; - } - - virtual void pushBracketedName(const char* inName, const char* leftBracket = "[", const char* rightBracket = "]") - { - size_t nameBufLen = mNameBuffer.size(); - mNameStack.pushBack(static_cast<uint32_t>(nameBufLen)); - appendStrToBuffer(leftBracket); - appendStrToBuffer(inName); - appendStrToBuffer(rightBracket); - mNameBuffer.back() = 0; - } - - virtual void popName() - { - if(mNameStack.empty()) - return; - mNameBuffer.resize(static_cast<uint32_t>(mNameStack.back())); - mNameStack.popBack(); - if(mNameBuffer.empty() == false) - mNameBuffer.back() = 0; - } - - virtual const char* getTopName() - { - if(mNameBuffer.size()) - return mNameBuffer.begin(); - return ""; - } - virtual void clearNameStack() - { - mNameBuffer.clear(); - mNameStack.clear(); - } - - virtual void addNamedValue(const char* name, uint32_t value) - { - mNamedValues.pushBack(NamedValue(name, value)); - } - virtual void clearNamedValues() - { - mNamedValues.clear(); - } - - virtual DataRef<NamedValue> getNamedValues() - { - return DataRef<NamedValue>(mNamedValues.begin(), mNamedValues.size()); - } - - virtual void createProperty(const NamespacedName& clsName, const char* inSemantic, const NamespacedName& dtypeName, - PropertyType::Enum propType) - { - mStream->createProperty(clsName, getTopName(), inSemantic, dtypeName, propType, getNamedValues()); - clearNamedValues(); - } - const char* registerStr(const char* str) - { - ScopedMetaData scopedProvider(mProvider); - return scopedProvider->getStringTable().registerStr(str); - } - virtual void addPropertyMessageArg(const NamespacedName& inDatatype, uint32_t inOffset, uint32_t inSize) - { - mPropertyMessageArgs.pushBack(PropertyMessageArg(registerStr(getTopName()), inDatatype, inOffset, inSize)); - } - virtual void addPropertyMessage(const NamespacedName& clsName, const NamespacedName& msgName, - uint32_t inStructSizeInBytes) - { - if(mPropertyMessageArgs.empty()) - { - PX_ASSERT(false); - return; - } - mStream->createPropertyMessage( - clsName, msgName, DataRef<PropertyMessageArg>(mPropertyMessageArgs.begin(), mPropertyMessageArgs.size()), - inStructSizeInBytes); - } - virtual void clearPropertyMessageArgs() - { - mPropertyMessageArgs.clear(); - } - - private: - PropertyDefinitionHelper& operator=(const PropertyDefinitionHelper&); -}; - -class PvdMemPool -{ - // Link List - Array<uint8_t*> mMemBuffer; - uint32_t mLength; - uint32_t mBufIndex; - - // 4k for one page - static const int BUFFER_LENGTH = 4096; - PX_NOCOPY(PvdMemPool) - public: - PvdMemPool(const char* bufDataName) : mMemBuffer(bufDataName), mLength(0), mBufIndex(0) - { - grow(); - } - - ~PvdMemPool() - { - for(uint32_t i = 0; i < mMemBuffer.size(); i++) - { - PX_FREE(mMemBuffer[i]); - } - } - - void grow() - { - if(mBufIndex + 1 < mMemBuffer.size()) - { - mBufIndex++; - } - else - { - uint8_t* Buf = reinterpret_cast<uint8_t*>(PX_ALLOC(BUFFER_LENGTH, "PvdMemPool::mMemBuffer.buf")); - mMemBuffer.pushBack(Buf); - mBufIndex = mMemBuffer.size() - 1; - } - mLength = 0; - } - - void* allocate(uint32_t length) - { - if(length > uint32_t(BUFFER_LENGTH)) - return NULL; - - if(length + mLength > uint32_t(BUFFER_LENGTH)) - grow(); - - void* mem = reinterpret_cast<void*>(&mMemBuffer[mBufIndex][mLength]); - mLength += length; - return mem; - } - - void clear() - { - mLength = 0; - mBufIndex = 0; - } -}; -struct PvdOutStream : public PvdDataStream, public UserAllocated -{ - HashMap<String, uint32_t> mStringHashMap; - PvdOMMetaDataProvider& mMetaDataProvider; - Array<uint8_t> mTempBuffer; - PropertyDefinitionHelper mPropertyDefinitionHelper; - DataStreamState::Enum mStreamState; - - ClassDescription mSPVClass; - PropertyMessageDescription mMessageDesc; - // Set property value and SetPropertyMessage calls require - // us to write the data out to a separate buffer - // when strings are involved. - ForwardingMemoryBuffer mSPVBuffer; - uint32_t mEventCount; - uint32_t mPropertyMessageSize; - bool mConnected; - uint64_t mStreamId; - Array<PvdCommand*> mPvdCommandArray; - PvdMemPool mPvdCommandPool; - PxPvdTransport& mTransport; - - PvdOutStream(PxPvdTransport& transport, PvdOMMetaDataProvider& provider, uint64_t streamId) - : mStringHashMap("PvdOutStream::mStringHashMap") - , mMetaDataProvider(provider) - , mTempBuffer("PvdOutStream::mTempBuffer") - , mPropertyDefinitionHelper(mMetaDataProvider) - , mStreamState(DataStreamState::Open) - , mSPVBuffer("PvdCommStreamBufferedEventSink::mSPVBuffer") - , mEventCount(0) - , mPropertyMessageSize(0) - , mConnected(true) - , mStreamId(streamId) - , mPvdCommandArray("PvdCommStreamBufferedEventSink::mPvdCommandArray") - , mPvdCommandPool("PvdCommStreamBufferedEventSink::mPvdCommandPool") - , mTransport(transport) - { - mPropertyDefinitionHelper.setStream(this); - } - virtual ~PvdOutStream() - { - } - - virtual void release() - { - PVD_DELETE(this); - } - - StringHandle toStream(String nm) - { - if(nm == NULL || *nm == 0) - return 0; - const HashMap<String, uint32_t>::Entry* entry(mStringHashMap.find(nm)); - if(entry) - return entry->second; - ScopedMetaData meta(mMetaDataProvider); - StringHandle hdl = meta->getStringTable().strToHandle(nm); - nm = meta->getStringTable().handleToStr(hdl); - handlePvdEvent(StringHandleEvent(nm, hdl)); - mStringHashMap.insert(nm, hdl); - return hdl; - } - - StreamNamespacedName toStream(const NamespacedName& nm) - { - return StreamNamespacedName(toStream(nm.mNamespace), toStream(nm.mName)); - } - - bool isClassExist(const NamespacedName& nm) - { - ScopedMetaData meta(mMetaDataProvider); - return meta->findClass(nm).hasValue(); - } - - bool createMetaClass(const NamespacedName& nm) - { - ScopedMetaData meta(mMetaDataProvider); - meta->getOrCreateClass(nm); - return true; - } - - bool deriveMetaClass(const NamespacedName& parent, const NamespacedName& child) - { - ScopedMetaData meta(mMetaDataProvider); - return meta->deriveClass(parent, child); - } - -// You will notice that some functions are #pragma'd out throughout this file. -// This is because they are only called from asserts which means they aren't -// called in release. This causes warnings when building using snc which break -// the build. -#if PX_DEBUG - - bool propertyExists(const NamespacedName& nm, String pname) - { - ScopedMetaData meta(mMetaDataProvider); - return meta->findProperty(nm, pname).hasValue(); - } - -#endif - - PvdError boolToError(bool val) - { - if(val) - return PvdErrorType::Success; - return PvdErrorType::NetworkError; - } - - // PvdMetaDataStream - virtual PvdError createClass(const NamespacedName& nm) - { - PX_ASSERT(mStreamState == DataStreamState::Open); -#if PX_DEBUG - PX_ASSERT(isClassExist(nm) == false); -#endif - createMetaClass(nm); - return boolToError(handlePvdEvent(CreateClass(toStream(nm)))); - } - - virtual PvdError deriveClass(const NamespacedName& parent, const NamespacedName& child) - { - PX_ASSERT(mStreamState == DataStreamState::Open); -#if PX_DEBUG - PX_ASSERT(isClassExist(parent)); - PX_ASSERT(isClassExist(child)); -#endif - deriveMetaClass(parent, child); - return boolToError(handlePvdEvent(DeriveClass(toStream(parent), toStream(child)))); - } - - template <typename TDataType> - TDataType* allocTemp(uint32_t numItems) - { - uint32_t desiredBytes = numItems * sizeof(TDataType); - if(desiredBytes > mTempBuffer.size()) - mTempBuffer.resize(desiredBytes); - TDataType* retval = reinterpret_cast<TDataType*>(mTempBuffer.begin()); - if(numItems) - { - PVD_FOREACH(idx, numItems) new (retval + idx) TDataType(); - } - return retval; - } - -#if PX_DEBUG - - // Property datatypes need to be uniform. - // At this point, the data stream cannot handle properties that - // A struct with a float member and a char member would work. - // A struct with a float member and a long member would work (more efficiently). - bool isValidPropertyDatatype(const NamespacedName& dtypeName) - { - ScopedMetaData meta(mMetaDataProvider); - ClassDescription clsDesc(meta->findClass(dtypeName)); - return clsDesc.mRequiresDestruction == false; - } - -#endif - - NamespacedName createMetaProperty(const NamespacedName& clsName, String name, String semantic, - const NamespacedName& dtypeName, PropertyType::Enum propertyType) - { - ScopedMetaData meta(mMetaDataProvider); - int32_t dtypeType = meta->findClass(dtypeName)->mClassId; - NamespacedName typeName = dtypeName; - if(dtypeType == getPvdTypeForType<String>()) - { - dtypeType = getPvdTypeForType<StringHandle>(); - typeName = getPvdNamespacedNameForType<StringHandle>(); - } - Option<PropertyDescription> propOpt = - meta->createProperty(meta->findClass(clsName)->mClassId, name, semantic, dtypeType, propertyType); - PX_ASSERT(propOpt.hasValue()); - PX_UNUSED(propOpt); - return typeName; - } - - virtual PvdError createProperty(const NamespacedName& clsName, String name, String semantic, - const NamespacedName& incomingDtypeName, PropertyType::Enum propertyType, - DataRef<NamedValue> values) - { - PX_ASSERT(mStreamState == DataStreamState::Open); -#if PX_DEBUG - PX_ASSERT(isClassExist(clsName)); - PX_ASSERT(propertyExists(clsName, name) == false); -#endif - NamespacedName dtypeName(incomingDtypeName); - if(safeStrEq(dtypeName.mName, "VoidPtr")) - dtypeName.mName = "ObjectRef"; -#if PX_DEBUG - PX_ASSERT(isClassExist(dtypeName)); - PX_ASSERT(isValidPropertyDatatype(dtypeName)); -#endif - NamespacedName typeName = createMetaProperty(clsName, name, semantic, dtypeName, propertyType); - // Can't have arrays of strings or arrays of string handles due to the difficulty - // of quickly dealing with them on the network receiving side. - if(propertyType == PropertyType::Array && safeStrEq(typeName.mName, "StringHandle")) - { - PX_ASSERT(false); - return PvdErrorType::ArgumentError; - } - uint32_t numItems = values.size(); - NameHandleValue* streamValues = allocTemp<NameHandleValue>(numItems); - PVD_FOREACH(idx, numItems) - streamValues[idx] = NameHandleValue(toStream(values[idx].mName), values[idx].mValue); - CreateProperty evt(toStream(clsName), toStream(name), toStream(semantic), toStream(typeName), propertyType, - DataRef<NameHandleValue>(streamValues, numItems)); - return boolToError(handlePvdEvent(evt)); - } - - bool createMetaPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName, - DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes) - { - ScopedMetaData meta(mMetaDataProvider); - return meta->createPropertyMessage(cls, msgName, entries, messageSizeInBytes).hasValue(); - } -#if PX_DEBUG - - bool messageExists(const NamespacedName& msgName) - { - ScopedMetaData meta(mMetaDataProvider); - return meta->findPropertyMessage(msgName).hasValue(); - } - -#endif - - virtual PvdError createPropertyMessage(const NamespacedName& cls, const NamespacedName& msgName, - DataRef<PropertyMessageArg> entries, uint32_t messageSizeInBytes) - { - PX_ASSERT(mStreamState == DataStreamState::Open); -#if PX_DEBUG - PX_ASSERT(isClassExist(cls)); - PX_ASSERT(messageExists(msgName) == false); -#endif - createMetaPropertyMessage(cls, msgName, entries, messageSizeInBytes); - uint32_t numItems = entries.size(); - StreamPropMessageArg* streamValues = allocTemp<StreamPropMessageArg>(numItems); - PVD_FOREACH(idx, numItems) - streamValues[idx] = - StreamPropMessageArg(toStream(entries[idx].mPropertyName), toStream(entries[idx].mDatatypeName), - entries[idx].mMessageOffset, entries[idx].mByteSize); - CreatePropertyMessage evt(toStream(cls), toStream(msgName), - DataRef<StreamPropMessageArg>(streamValues, numItems), messageSizeInBytes); - return boolToError(handlePvdEvent(evt)); - } - - uint64_t toStream(const void* instance) - { - return PVD_POINTER_TO_U64(instance); - } - virtual PvdError createInstance(const NamespacedName& cls, const void* instance) - { - PX_ASSERT(isInstanceValid(instance) == false); - PX_ASSERT(mStreamState == DataStreamState::Open); - bool success = mMetaDataProvider.createInstance(cls, instance); - PX_ASSERT(success); - (void)success; - return boolToError(handlePvdEvent(CreateInstance(toStream(cls), toStream(instance)))); - } - - virtual bool isInstanceValid(const void* instance) - { - return mMetaDataProvider.isInstanceValid(instance); - } - -#if PX_DEBUG - - // If the property will fit or is already completely in memory - bool checkPropertyType(const void* instance, String name, const NamespacedName& incomingType) - { - int32_t instType = mMetaDataProvider.getInstanceClassType(instance); - ScopedMetaData meta(mMetaDataProvider); - Option<PropertyDescription> prop = meta->findProperty(instType, name); - if(prop.hasValue() == false) - return false; - int32_t propType = prop->mDatatype; - int32_t incomingTypeId = meta->findClass(incomingType)->mClassId; - if(incomingTypeId != getPvdTypeForType<VoidPtr>()) - { - MarshalQueryResult result = meta->checkMarshalling(incomingTypeId, propType); - bool possible = result.needsMarshalling == false || result.canMarshal; - return possible; - } - else - { - if(propType != getPvdTypeForType<ObjectRef>()) - return false; - } - return true; - } - -#endif - - DataRef<const uint8_t> bufferPropertyValue(ClassDescriptionSizeInfo info, DataRef<const uint8_t> data) - { - uint32_t realSize = info.mByteSize; - uint32_t numItems = data.size() / realSize; - if(info.mPtrOffsets.size() != 0) - { - mSPVBuffer.clear(); - PVD_FOREACH(item, numItems) - { - const uint8_t* itemPtr = data.begin() + item * realSize; - mSPVBuffer.write(itemPtr, realSize); - PVD_FOREACH(stringIdx, info.mPtrOffsets.size()) - { - PtrOffset offset(info.mPtrOffsets[stringIdx]); - if(offset.mOffsetType == PtrOffsetType::VoidPtrOffset) - continue; - const char* strPtr; - physx::intrinsics::memCopy(&strPtr, itemPtr + offset.mOffset, sizeof(char*)); - strPtr = nonNull(strPtr); - uint32_t len = safeStrLen(strPtr) + 1; - mSPVBuffer.write(strPtr, len); - } - } - data = DataRef<const uint8_t>(mSPVBuffer.begin(), mSPVBuffer.size()); - } - return data; - } - - virtual PvdError setPropertyValue(const void* instance, String name, DataRef<const uint8_t> data, - const NamespacedName& incomingTypeName) - { - - PX_ASSERT(isInstanceValid(instance)); -#if PX_DEBUG - PX_ASSERT(isClassExist(incomingTypeName)); -#endif - PX_ASSERT(mStreamState == DataStreamState::Open); - ClassDescription clsDesc; - { - ScopedMetaData meta(mMetaDataProvider); - clsDesc = meta->findClass(incomingTypeName); - } - uint32_t realSize = clsDesc.getNativeSize(); - uint32_t numItems = data.size() / realSize; - data = bufferPropertyValue(clsDesc.getNativeSizeInfo(), data); - SetPropertyValue evt(toStream(instance), toStream(name), data, toStream(incomingTypeName), numItems); - return boolToError(handlePvdEvent(evt)); - } - - // Else if the property is very large (contact reports) you can send it in chunks. - virtual PvdError beginSetPropertyValue(const void* instance, String name, const NamespacedName& incomingTypeName) - { - PX_ASSERT(isInstanceValid(instance)); -#if PX_DEBUG - PX_ASSERT(isClassExist(incomingTypeName)); - PX_ASSERT(checkPropertyType(instance, name, incomingTypeName)); -#endif - PX_ASSERT(mStreamState == DataStreamState::Open); - mStreamState = DataStreamState::SetPropertyValue; - { - ScopedMetaData meta(mMetaDataProvider); - mSPVClass = meta->findClass(incomingTypeName); - } - BeginSetPropertyValue evt(toStream(instance), toStream(name), toStream(incomingTypeName)); - return boolToError(handlePvdEvent(evt)); - } - - virtual PvdError appendPropertyValueData(DataRef<const uint8_t> data) - { - uint32_t realSize = mSPVClass.getNativeSize(); - uint32_t numItems = data.size() / realSize; - data = bufferPropertyValue(mSPVClass.getNativeSizeInfo(), data); - PX_ASSERT(mStreamState == DataStreamState::SetPropertyValue); - return boolToError(handlePvdEvent(AppendPropertyValueData(data, numItems))); - } - virtual PvdError endSetPropertyValue() - { - PX_ASSERT(mStreamState == DataStreamState::SetPropertyValue); - mStreamState = DataStreamState::Open; - return boolToError(handlePvdEvent(EndSetPropertyValue())); - } - -#if PX_DEBUG - - bool checkPropertyMessage(const void* instance, const NamespacedName& msgName) - { - int32_t clsId = mMetaDataProvider.getInstanceClassType(instance); - ScopedMetaData meta(mMetaDataProvider); - PropertyMessageDescription desc(meta->findPropertyMessage(msgName)); - bool retval = meta->isDerivedFrom(clsId, desc.mClassId); - return retval; - } - -#endif - - DataRef<const uint8_t> bufferPropertyMessage(const PropertyMessageDescription& desc, DataRef<const uint8_t> data) - { - if(desc.mStringOffsets.size()) - { - mSPVBuffer.clear(); - mSPVBuffer.write(data.begin(), data.size()); - PVD_FOREACH(idx, desc.mStringOffsets.size()) - { - const char* strPtr; - physx::intrinsics::memCopy(&strPtr, data.begin() + desc.mStringOffsets[idx], sizeof(char*)); - strPtr = nonNull(strPtr); - uint32_t len = safeStrLen(strPtr) + 1; - mSPVBuffer.write(strPtr, len); - } - data = DataRef<const uint8_t>(mSPVBuffer.begin(), mSPVBuffer.end()); - } - return data; - } - - virtual PvdError setPropertyMessage(const void* instance, const NamespacedName& msgName, DataRef<const uint8_t> data) - { - ScopedMetaData meta(mMetaDataProvider); - PX_ASSERT(isInstanceValid(instance)); -#if PX_DEBUG - PX_ASSERT(messageExists(msgName)); - PX_ASSERT(checkPropertyMessage(instance, msgName)); -#endif - PropertyMessageDescription desc(meta->findPropertyMessage(msgName)); - if(data.size() < desc.mMessageByteSize) - { - PX_ASSERT(false); - return PvdErrorType::ArgumentError; - } - data = bufferPropertyMessage(desc, data); - PX_ASSERT(mStreamState == DataStreamState::Open); - return boolToError(handlePvdEvent(SetPropertyMessage(toStream(instance), toStream(msgName), data))); - } - -#if PX_DEBUG - - bool checkBeginPropertyMessageGroup(const NamespacedName& msgName) - { - ScopedMetaData meta(mMetaDataProvider); - PropertyMessageDescription desc(meta->findPropertyMessage(msgName)); - return desc.mStringOffsets.size() == 0; - } - -#endif - // If you need to send of lot of identical messages, this avoids a hashtable lookup per message. - virtual PvdError beginPropertyMessageGroup(const NamespacedName& msgName) - { -#if PX_DEBUG - PX_ASSERT(messageExists(msgName)); - PX_ASSERT(checkBeginPropertyMessageGroup(msgName)); -#endif - PX_ASSERT(mStreamState == DataStreamState::Open); - mStreamState = DataStreamState::PropertyMessageGroup; - ScopedMetaData meta(mMetaDataProvider); - mMessageDesc = meta->findPropertyMessage(msgName); - return boolToError(handlePvdEvent(BeginPropertyMessageGroup(toStream(msgName)))); - } - - virtual PvdError sendPropertyMessageFromGroup(const void* instance, DataRef<const uint8_t> data) - { - PX_ASSERT(mStreamState == DataStreamState::PropertyMessageGroup); - PX_ASSERT(isInstanceValid(instance)); -#if PX_DEBUG - PX_ASSERT(checkPropertyMessage(instance, mMessageDesc.mMessageName)); -#endif - if(mMessageDesc.mMessageByteSize != data.size()) - { - PX_ASSERT(false); - return PvdErrorType::ArgumentError; - } - if(data.size() < mMessageDesc.mMessageByteSize) - return PvdErrorType::ArgumentError; - data = bufferPropertyMessage(mMessageDesc, data); - return boolToError(handlePvdEvent(SendPropertyMessageFromGroup(toStream(instance), data))); - } - virtual PvdError endPropertyMessageGroup() - { - PX_ASSERT(mStreamState == DataStreamState::PropertyMessageGroup); - mStreamState = DataStreamState::Open; - return boolToError(handlePvdEvent(EndPropertyMessageGroup())); - } - virtual PvdError pushBackObjectRef(const void* instance, String propName, const void* data) - { - PX_ASSERT(isInstanceValid(instance)); - PX_ASSERT(isInstanceValid(data)); - PX_ASSERT(mStreamState == DataStreamState::Open); - return boolToError(handlePvdEvent(PushBackObjectRef(toStream(instance), toStream(propName), toStream(data)))); - } - virtual PvdError removeObjectRef(const void* instance, String propName, const void* data) - { - PX_ASSERT(isInstanceValid(instance)); - PX_ASSERT(isInstanceValid(data)); - PX_ASSERT(mStreamState == DataStreamState::Open); - return boolToError(handlePvdEvent(RemoveObjectRef(toStream(instance), toStream(propName), toStream(data)))); - } - // Instance elimination. - virtual PvdError destroyInstance(const void* instance) - { - PX_ASSERT(isInstanceValid(instance)); - PX_ASSERT(mStreamState == DataStreamState::Open); - mMetaDataProvider.destroyInstance(instance); - return boolToError(handlePvdEvent(DestroyInstance(toStream(instance)))); - } - - // Profiling hooks - virtual PvdError beginSection(const void* instance, String name) - { - PX_ASSERT(mStreamState == DataStreamState::Open); - return boolToError(handlePvdEvent( - BeginSection(toStream(instance), toStream(name), Time::getCurrentCounterValue()))); - } - - virtual PvdError endSection(const void* instance, String name) - { - PX_ASSERT(mStreamState == DataStreamState::Open); - return boolToError(handlePvdEvent( - EndSection(toStream(instance), toStream(name), Time::getCurrentCounterValue()))); - } - - virtual PvdError originShift(const void* scene, PxVec3 shift) - { - PX_ASSERT(mStreamState == DataStreamState::Open); - return boolToError(handlePvdEvent(OriginShift(toStream(scene), shift))); - } - - virtual void addProfileZone(void* zone, const char* name) - { - handlePvdEvent(AddProfileZone(toStream(zone), name)); - } - virtual void addProfileZoneEvent(void* zone, const char* name, uint16_t eventId, bool compileTimeEnabled) - { - handlePvdEvent(AddProfileZoneEvent(toStream(zone), name, eventId, compileTimeEnabled)); - } - - // add a variable sized event - void addEvent(const EventSerializeable& evt, PvdCommStreamEventTypes::Enum evtType) - { - MeasureStream measure; - PvdCommStreamEventSink::writeStreamEvent(evt, evtType, measure); - EventGroup evtGroup(measure.mSize, 1, mStreamId, Time::getCurrentCounterValue()); - EventStreamifier<PxPvdTransport> streamifier(mTransport.lock()); - evtGroup.serialize(streamifier); - PvdCommStreamEventSink::writeStreamEvent(evt, evtType, mTransport); - mTransport.unlock(); - } - - void setIsTopLevelUIElement(const void* instance, bool topLevel) - { - addEvent(SetIsTopLevel(static_cast<uint64_t>(reinterpret_cast<size_t>(instance)), topLevel), - getCommStreamEventType<SetIsTopLevel>()); - } - - void sendErrorMessage(uint32_t code, const char* message, const char* file, uint32_t line) - { - addEvent(ErrorMessage(code, message, file, line), getCommStreamEventType<ErrorMessage>()); - } - - void updateCamera(const char* name, const PxVec3& origin, const PxVec3& up, const PxVec3& target) - { - addEvent(SetCamera(name, origin, up, target), getCommStreamEventType<SetCamera>()); - } - - template <typename TEventType> - bool handlePvdEvent(const TEventType& evt) - { - addEvent(evt, getCommStreamEventType<TEventType>()); - return mConnected; - } - - virtual PvdPropertyDefinitionHelper& getPropertyDefinitionHelper() - { - mPropertyDefinitionHelper.clearBufferedData(); - return mPropertyDefinitionHelper; - } - - virtual bool isConnected() - { - return mConnected; - } - - virtual void* allocateMemForCmd(uint32_t length) - { - return mPvdCommandPool.allocate(length); - } - - virtual void pushPvdCommand(PvdCommand& cmd) - { - mPvdCommandArray.pushBack(&cmd); - } - - virtual void flushPvdCommand() - { - uint32_t cmdQueueSize = mPvdCommandArray.size(); - for(uint32_t i = 0; i < cmdQueueSize; i++) - { - if(mPvdCommandArray[i]) - { - // if(mPvdCommandArray[i]->canRun(*this)) - mPvdCommandArray[i]->run(*this); - mPvdCommandArray[i]->~PvdCommand(); - } - } - mPvdCommandArray.clear(); - mPvdCommandPool.clear(); - } - - PX_NOCOPY(PvdOutStream) -}; -} - -PvdDataStream* PvdDataStream::create(PxPvd* pvd) -{ - if(pvd == NULL) - { - getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PvdDataStream::create - pvd must be non-NULL!"); - return NULL; - } - - PvdImpl* pvdImpl = static_cast<PvdImpl*>(pvd); - return PVD_NEW(PvdOutStream)(*pvdImpl->getTransport(), pvdImpl->getMetaDataProvider(), pvdImpl->getNextStreamId()); -} diff --git a/PxShared/src/pvd/src/PxPvdDefaultFileTransport.cpp b/PxShared/src/pvd/src/PxPvdDefaultFileTransport.cpp deleted file mode 100644 index e3499a6..0000000 --- a/PxShared/src/pvd/src/PxPvdDefaultFileTransport.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "pvd/PxPvdTransport.h" -#include "foundation/PxAssert.h" - -#include "PxPvdDefaultFileTransport.h" - -namespace physx -{ -namespace pvdsdk -{ - -PvdDefaultFileTransport::PvdDefaultFileTransport(const char* name) : mConnected(false), mWrittenData(0), mLocked(false) -{ - mFileBuffer = PX_NEW(PsFileBuffer)(name, PxFileBuf::OPEN_WRITE_ONLY); -} - -PvdDefaultFileTransport::~PvdDefaultFileTransport() -{ -} - -bool PvdDefaultFileTransport::connect() -{ - PX_ASSERT(mFileBuffer); - mConnected = mFileBuffer->isOpen(); - return mConnected; -} - -void PvdDefaultFileTransport::disconnect() -{ - mConnected = false; -} - -bool PvdDefaultFileTransport::isConnected() -{ - return mConnected; -} - -bool PvdDefaultFileTransport::write(const uint8_t* inBytes, uint32_t inLength) -{ - PX_ASSERT(mLocked); - PX_ASSERT(mFileBuffer); - if (mConnected) - { - uint32_t len = mFileBuffer->write(inBytes, inLength); - mWrittenData += len; - return len == inLength; - } - else - return false; -} - -PxPvdTransport& PvdDefaultFileTransport::lock() -{ - mMutex.lock(); - PX_ASSERT(!mLocked); - mLocked = true; - return *this; -} - -void PvdDefaultFileTransport::unlock() -{ - PX_ASSERT(mLocked); - mLocked = false; - mMutex.unlock(); -} - -void PvdDefaultFileTransport::flush() -{ -} - -uint64_t PvdDefaultFileTransport::getWrittenDataSize() -{ - return mWrittenData; -} - -void PvdDefaultFileTransport::release() -{ - if (mFileBuffer) - { - mFileBuffer->close(); - delete mFileBuffer; - } - mFileBuffer = NULL; - PX_DELETE(this); -} - -} // namespace pvdsdk - -PxPvdTransport* PxDefaultPvdFileTransportCreate(const char* name) -{ - return PX_NEW(pvdsdk::PvdDefaultFileTransport)(name); -} - -} // namespace physx - diff --git a/PxShared/src/pvd/src/PxPvdDefaultFileTransport.h b/PxShared/src/pvd/src/PxPvdDefaultFileTransport.h deleted file mode 100644 index 9f4166f..0000000 --- a/PxShared/src/pvd/src/PxPvdDefaultFileTransport.h +++ /dev/null @@ -1,77 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDDEFAULTFILETRANSPORT_H -#define PXPVDSDK_PXPVDDEFAULTFILETRANSPORT_H - -#include "pvd/PxPvdTransport.h" - -#include "PsUserAllocated.h" -#include "PsFileBuffer.h" -#include "PsMutex.h" - -namespace physx -{ -namespace pvdsdk -{ - -class PvdDefaultFileTransport : public physx::PxPvdTransport, public physx::shdfnd::UserAllocated -{ - PX_NOCOPY(PvdDefaultFileTransport) - public: - PvdDefaultFileTransport(const char* name); - virtual ~PvdDefaultFileTransport(); - - virtual bool connect(); - virtual void disconnect(); - virtual bool isConnected(); - - virtual bool write(const uint8_t* inBytes, uint32_t inLength); - - virtual PxPvdTransport& lock(); - virtual void unlock(); - - virtual void flush(); - - virtual uint64_t getWrittenDataSize(); - - virtual void release(); - - private: - physx::PsFileBuffer* mFileBuffer; - bool mConnected; - uint64_t mWrittenData; - physx::shdfnd::Mutex mMutex; - bool mLocked; // for debug, remove it when finished -}; - -} // pvdsdk -} // physx - -#endif // PXPVDSDK_PXPVDDEFAULTFILETRANSPORT_H diff --git a/PxShared/src/pvd/src/PxPvdDefaultSocketTransport.cpp b/PxShared/src/pvd/src/PxPvdDefaultSocketTransport.cpp deleted file mode 100644 index 48b94b1..0000000 --- a/PxShared/src/pvd/src/PxPvdDefaultSocketTransport.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "pvd/PxPvdTransport.h" - -#include "PxPvdDefaultSocketTransport.h" - -namespace physx -{ -namespace pvdsdk -{ -PvdDefaultSocketTransport::PvdDefaultSocketTransport(const char* host, int port, unsigned int timeoutInMilliseconds) -: mHost(host), mPort(uint16_t(port)), mTimeout(timeoutInMilliseconds), mConnected(false), mWrittenData(0) -{ -} - -PvdDefaultSocketTransport::~PvdDefaultSocketTransport() -{ -} - -bool PvdDefaultSocketTransport::connect() -{ - if(mConnected) - return true; - - if(mSocket.connect(mHost, mPort, mTimeout)) - { - mSocket.setBlocking(true); - mConnected = true; - } - return mConnected; -} - -void PvdDefaultSocketTransport::disconnect() -{ - mSocket.flush(); - mSocket.disconnect(); - mConnected = false; -} - -bool PvdDefaultSocketTransport::isConnected() -{ - return mSocket.isConnected(); -} - -bool PvdDefaultSocketTransport::write(const uint8_t* inBytes, uint32_t inLength) -{ - if(mConnected) - { - if(inLength == 0) - return true; - - uint32_t amountWritten = 0; - uint32_t totalWritten = 0; - do - { - // Sockets don't have to write as much as requested, so we need - // to wrap this call in a do/while loop. - // If they don't write any bytes then we consider them disconnected. - amountWritten = mSocket.write(inBytes, inLength); - inLength -= amountWritten; - inBytes += amountWritten; - totalWritten += amountWritten; - } while(inLength && amountWritten); - - if(amountWritten == 0) - return false; - - mWrittenData += totalWritten; - - return true; - } - else - return false; -} - -PxPvdTransport& PvdDefaultSocketTransport::lock() -{ - mMutex.lock(); - return *this; -} - -void PvdDefaultSocketTransport::unlock() -{ - mMutex.unlock(); -} - -void PvdDefaultSocketTransport::flush() -{ - mSocket.flush(); -} - -uint64_t PvdDefaultSocketTransport::getWrittenDataSize() -{ - return mWrittenData; -} - -void PvdDefaultSocketTransport::release() -{ - PX_DELETE(this); -} - -} // namespace pvdsdk - -PxPvdTransport* PxDefaultPvdSocketTransportCreate(const char* host, int port, unsigned int timeoutInMilliseconds) -{ - return PX_NEW(pvdsdk::PvdDefaultSocketTransport)(host, port, timeoutInMilliseconds); -} - -} // namespace physx diff --git a/PxShared/src/pvd/src/PxPvdDefaultSocketTransport.h b/PxShared/src/pvd/src/PxPvdDefaultSocketTransport.h deleted file mode 100644 index b02b934..0000000 --- a/PxShared/src/pvd/src/PxPvdDefaultSocketTransport.h +++ /dev/null @@ -1,79 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDDEFAULTSOCKETTRANSPORT_H -#define PXPVDSDK_PXPVDDEFAULTSOCKETTRANSPORT_H - -#include "pvd/PxPvdTransport.h" - -#include "PsUserAllocated.h" -#include "PsSocket.h" -#include "PsMutex.h" - -namespace physx -{ -namespace pvdsdk -{ -class PvdDefaultSocketTransport : public PxPvdTransport, public shdfnd::UserAllocated -{ - PX_NOCOPY(PvdDefaultSocketTransport) - public: - PvdDefaultSocketTransport(const char* host, int port, unsigned int timeoutInMilliseconds); - virtual ~PvdDefaultSocketTransport(); - - virtual bool connect(); - virtual void disconnect(); - virtual bool isConnected(); - - virtual bool write(const uint8_t* inBytes, uint32_t inLength); - - virtual void flush(); - - virtual PxPvdTransport& lock(); - virtual void unlock(); - - virtual uint64_t getWrittenDataSize(); - - virtual void release(); - - private: - shdfnd::Socket mSocket; - const char* mHost; - uint16_t mPort; - unsigned int mTimeout; - bool mConnected; - uint64_t mWrittenData; - shdfnd::Mutex mMutex; - bool mlocked; -}; - -} // pvdsdk -} // physx - -#endif // PXPVDSDK_PXPVDDEFAULTSOCKETTRANSPORT_H diff --git a/PxShared/src/pvd/src/PxPvdFoundation.h b/PxShared/src/pvd/src/PxPvdFoundation.h deleted file mode 100644 index 90fc77f..0000000 --- a/PxShared/src/pvd/src/PxPvdFoundation.h +++ /dev/null @@ -1,504 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDFOUNDATION_H -#define PXPVDSDK_PXPVDFOUNDATION_H - -#include "foundation/PxVec3.h" -#include "foundation/PxTransform.h" -#include "foundation/PxBounds3.h" - -#include "PsArray.h" -#include "PsHashMap.h" -#include "PsHashSet.h" -#include "PsPool.h" -#include "PsString.h" - -#include "PxPvdObjectModelBaseTypes.h" - -namespace physx -{ -namespace pvdsdk -{ - -extern PxAllocatorCallback* gPvdAllocatorCallback; - -class ForwardingAllocator : public PxAllocatorCallback -{ - void* allocate(size_t size, const char* typeName, const char* filename, int line) - { - return shdfnd::getAllocator().allocate(size, typeName, filename, line); - } - void deallocate(void* ptr) - { - shdfnd::getAllocator().deallocate(ptr); - } -}; - -class RawMemoryBuffer -{ - uint8_t* mBegin; - uint8_t* mEnd; - uint8_t* mCapacityEnd; - const char* mBufDataName; - - public: - RawMemoryBuffer(const char* name) : mBegin(0), mEnd(0), mCapacityEnd(0),mBufDataName(name) - { - PX_UNUSED(mBufDataName); - } - ~RawMemoryBuffer() - { - if(mBegin) - PX_FREE(mBegin); - } - uint32_t size() const - { - return static_cast<uint32_t>(mEnd - mBegin); - } - uint32_t capacity() const - { - return static_cast<uint32_t>(mCapacityEnd - mBegin); - } - uint8_t* begin() - { - return mBegin; - } - uint8_t* end() - { - return mEnd; - } - const uint8_t* begin() const - { - return mBegin; - } - const uint8_t* end() const - { - return mEnd; - } - void clear() - { - mEnd = mBegin; - } - const char* cStr() - { - if(mEnd && (*mEnd != 0)) - write(0); - return reinterpret_cast<const char*>(mBegin); - } - uint32_t write(uint8_t inValue) - { - *growBuf(1) = inValue; - return 1; - } - - template <typename TDataType> - uint32_t write(const TDataType& inValue) - { - const uint8_t* __restrict readPtr = reinterpret_cast<const uint8_t*>(&inValue); - uint8_t* __restrict writePtr = growBuf(sizeof(TDataType)); - for(uint32_t idx = 0; idx < sizeof(TDataType); ++idx) - writePtr[idx] = readPtr[idx]; - return sizeof(TDataType); - } - - template <typename TDataType> - uint32_t write(const TDataType* inValue, uint32_t inLength) - { - uint32_t writeSize = inLength * sizeof(TDataType); - if(inValue && inLength) - { - physx::intrinsics::memCopy(growBuf(writeSize), inValue, writeSize); - } - if(inLength && !inValue) - { - PX_ASSERT(false); - // You can't not write something, because that will cause - // the receiving end to crash. - for(uint32_t idx = 0; idx < writeSize; ++idx) - write(0); - } - return writeSize; - } - - uint8_t* growBuf(uint32_t inAmount) - { - uint32_t offset = size(); - uint32_t newSize = offset + inAmount; - reserve(newSize); - mEnd += inAmount; - return mBegin + offset; - } - void writeZeros(uint32_t inAmount) - { - uint32_t offset = size(); - growBuf(inAmount); - physx::intrinsics::memZero(begin() + offset, inAmount); - } - void reserve(uint32_t newSize) - { - uint32_t currentSize = size(); - if(newSize && newSize >= capacity()) - { - uint32_t newDataSize = newSize > 4096 ? newSize + (newSize >> 2) : newSize*2; - uint8_t* newData = static_cast<uint8_t*>(PX_ALLOC(newDataSize, mBufDataName)); - if(mBegin) - { - physx::intrinsics::memCopy(newData, mBegin, currentSize); - PX_FREE(mBegin); - } - mBegin = newData; - mEnd = mBegin + currentSize; - mCapacityEnd = mBegin + newDataSize; - } - } -}; - -struct ForwardingMemoryBuffer : public RawMemoryBuffer -{ - ForwardingMemoryBuffer(const char* bufDataName) : RawMemoryBuffer(bufDataName) - { - } - - ForwardingMemoryBuffer& operator<<(const char* inString) - { - if(inString && *inString) - { - uint32_t len = static_cast<uint32_t>(strlen(inString)); - write(inString, len); - } - return *this; - } - - template <typename TDataType> - inline ForwardingMemoryBuffer& toStream(const char* inFormat, const TDataType inData) - { - char buffer[128] = { 0 }; - shdfnd::snprintf(buffer, 128, inFormat, inData); - *this << buffer; - return *this; - } - - inline ForwardingMemoryBuffer& operator<<(bool inData) - { - *this << (inData ? "true" : "false"); - return *this; - } - inline ForwardingMemoryBuffer& operator<<(int32_t inData) - { - return toStream("%d", inData); - } - inline ForwardingMemoryBuffer& operator<<(uint16_t inData) - { - return toStream("%u", uint32_t(inData)); - } - inline ForwardingMemoryBuffer& operator<<(uint8_t inData) - { - return toStream("%u", uint32_t(inData)); - } - inline ForwardingMemoryBuffer& operator<<(char inData) - { - return toStream("%c", inData); - } - inline ForwardingMemoryBuffer& operator<<(uint32_t inData) - { - return toStream("%u", inData); - } - inline ForwardingMemoryBuffer& operator<<(uint64_t inData) - { - return toStream("%I64u", inData); - } - inline ForwardingMemoryBuffer& operator<<(int64_t inData) - { - return toStream("%I64d", inData); - } - inline ForwardingMemoryBuffer& operator<<(const void* inData) - { - return *this << static_cast<uint64_t>(reinterpret_cast<size_t>(inData)); - } - inline ForwardingMemoryBuffer& operator<<(float inData) - { - return toStream("%g", double(inData)); - } - inline ForwardingMemoryBuffer& operator<<(double inData) - { - return toStream("%g", inData); - } - inline ForwardingMemoryBuffer& operator<<(const PxVec3& inData) - { - *this << inData[0]; - *this << " "; - *this << inData[1]; - *this << " "; - *this << inData[2]; - return *this; - } - - inline ForwardingMemoryBuffer& operator<<(const PxQuat& inData) - { - *this << inData.x; - *this << " "; - *this << inData.y; - *this << " "; - *this << inData.z; - *this << " "; - *this << inData.w; - return *this; - } - - inline ForwardingMemoryBuffer& operator<<(const PxTransform& inData) - { - *this << inData.q; - *this << " "; - *this << inData.p; - return *this; - } - - inline ForwardingMemoryBuffer& operator<<(const PxBounds3& inData) - { - *this << inData.minimum; - *this << " "; - *this << inData.maximum; - return *this; - } - -}; - -template <typename TObjectType, typename TGetSetIndexOp, typename TSetSetIndexOp> -class InvasiveSet -{ - shdfnd::Array<TObjectType*> mSet; - - InvasiveSet(const InvasiveSet& other); - InvasiveSet& operator=(const InvasiveSet& other); - - public: - InvasiveSet(const char* allocName) : mSet(allocName) - { - } - - bool insert(TObjectType& inObject) - { - uint32_t currentIdx = TGetSetIndexOp()(inObject); - if(currentIdx == UINT32_MAX) - { - TSetSetIndexOp()(inObject, mSet.size()); - mSet.pushBack(&inObject); - return true; - } - return false; - } - - bool remove(TObjectType& inObject) - { - uint32_t currentIdx = TGetSetIndexOp()(inObject); - if(currentIdx != UINT32_MAX) - { - TObjectType* theEnd = mSet.back(); - TObjectType* theObj = &inObject; - if(theEnd != theObj) - { - TSetSetIndexOp()(*theEnd, currentIdx); - mSet[currentIdx] = theEnd; - } - mSet.popBack(); - TSetSetIndexOp()(inObject, UINT32_MAX); - return true; - } - return false; - } - - bool contains(TObjectType& inObject) - { - return TGetSetIndexOp()(inObject) != UINT32_MAX; - } - - void clear() - { - for(uint32_t idx = 0; idx < mSet.size(); ++idx) - TSetSetIndexOp()(*(mSet[idx]), UINT32_MAX); - mSet.clear(); - } - - TObjectType* operator[](uint32_t idx) - { - return mSet[idx]; - } - const TObjectType* operator[](uint32_t idx) const - { - return mSet[idx]; - } - uint32_t size() const - { - return mSet.size(); - } - TObjectType** begin() - { - return mSet.begin(); - } - TObjectType** end() - { - return mSet.end(); - } - const TObjectType** begin() const - { - return mSet.begin(); - } - const TObjectType** end() const - { - return mSet.end(); - } - const TObjectType* back() const - { - return mSet.back(); - } - TObjectType* back() - { - return mSet.back(); - } -}; - -template <typename TDataType> -inline void* PvdAllocate(const char* typeName, const char* file, int line) -{ - PX_ASSERT(gPvdAllocatorCallback); - return gPvdAllocatorCallback->allocate(sizeof(TDataType), typeName, file, line); -} - -template <typename TDataType> -inline void PvdDeleteAndDeallocate(TDataType* inDType) -{ - PX_ASSERT(gPvdAllocatorCallback); - if(inDType) - { - inDType->~TDataType(); - gPvdAllocatorCallback->deallocate(inDType); - } -} -} -} - -#define PVD_NEW(dtype) new (PvdAllocate<dtype>(#dtype, __FILE__, __LINE__)) dtype -#define PVD_DELETE(obj) PvdDeleteAndDeallocate(obj); -//#define PVD_NEW(dtype) PX_NEW(dtype) -//#define PVD_DELETE(obj) PX_DELETE(obj) -#define PVD_FOREACH(varname, stop) for(uint32_t varname = 0; varname < stop; ++varname) - -namespace physx -{ -namespace pvdsdk -{ - -template <typename TKeyType, typename TValueType, typename THashType, typename TBufType, typename TOperator> -uint32_t getMapKeysOp(shdfnd::HashMap<TKeyType, TValueType, THashType>& map, TBufType* buffer, uint32_t bufSize, - uint32_t startIdx, TOperator op) -{ - uint32_t numItems = static_cast<uint32_t>(map.size()); - if(numItems == 0 || bufSize == 0) - return 0; - - startIdx = PxMin(numItems - 1, startIdx); - uint32_t retval = 0; - for(typename shdfnd::HashMap<TKeyType, TValueType, THashType>::Iterator iter = map.getIterator(); - iter.done() == false && bufSize; ++iter) - { - if(startIdx) - --startIdx; - else - { - buffer[retval] = op(iter->first); - --bufSize; - ++retval; - } - } - return retval; -} - -struct IdOp -{ - template <typename TDataType> - TDataType operator()(const TDataType& item) - { - return item; - } -}; - -template <typename TKeyType, typename TValueType, typename THashType> -uint32_t getMapKeys(shdfnd::HashMap<TKeyType, TValueType, THashType>& map, TKeyType* buffer, uint32_t bufSize, uint32_t startIdx) -{ - return getMapKeysOp(map, buffer, bufSize, startIdx, IdOp()); -} - -struct DerefOp -{ - template <typename TDataType> - TDataType operator()(const TDataType* item) - { - return *item; - } -}; - -template <typename TKeyType, typename TValueType, typename TBufType, typename TOp> -uint32_t getMapValues(shdfnd::HashMap<TKeyType, TValueType>& map, TBufType* buffer, uint32_t bufSize, uint32_t startIdx, TOp op) -{ - uint32_t numItems = static_cast<uint32_t>(map.size()); - if(numItems == 0 || bufSize == 0) - return 0; - - startIdx = PxMin(numItems - 1, startIdx); - uint32_t retval = 0; - for(typename shdfnd::HashMap<TKeyType, TValueType>::Iterator iter = map.getIterator(); iter.done() == false && bufSize; ++iter) - { - if(startIdx) - --startIdx; - else - { - buffer[retval] = op(iter->second); - --bufSize; - ++retval; - } - } - return retval; -} - -template <typename TValueType, typename TBufType> -uint32_t getArrayEntries(shdfnd::Array<TValueType>& data, TBufType* buffer, uint32_t bufSize, uint32_t startIdx) -{ - uint32_t numItems = static_cast<uint32_t>(data.size()); - if(numItems == 0 || bufSize == 0) - return 0; - - startIdx = PxMin(numItems - 1, startIdx); - uint32_t available = PxMin(numItems - startIdx, bufSize); - PVD_FOREACH(idx, available) - buffer[idx] = data[idx + startIdx]; - return available; -} -#define PVD_POINTER_TO_U64(ptr) static_cast<uint64_t>(reinterpret_cast<size_t>(ptr)) -} -} -#endif // PXPVDSDK_PXPVDFOUNDATION_H diff --git a/PxShared/src/pvd/src/PxPvdImpl.cpp b/PxShared/src/pvd/src/PxPvdImpl.cpp deleted file mode 100644 index 9fa82a0..0000000 --- a/PxShared/src/pvd/src/PxPvdImpl.cpp +++ /dev/null @@ -1,405 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "pvd/PxPvdTransport.h" - -#include "PxPvdImpl.h" -#include "PxPvdFoundation.h" -#include "PxPvdClient.h" -#include "PxPvdMemClient.h" -#include "PxPvdProfileZoneClient.h" -#include "PxPvdCommStreamTypes.h" -#include "PxProfileZoneManager.h" -#include "PxProfileZone.h" - -#include "PsFoundation.h" - -#if PX_NVTX -#include "nvToolsExt.h" -#endif - -namespace -{ - const char* gSdkName = "PhysXSDK"; -} - -namespace physx -{ -namespace pvdsdk -{ - -class CmEventNameProvider : public physx::profile::PxProfileNameProvider -{ -public: - physx::profile::PxProfileNames getProfileNames() const - { - physx::profile::PxProfileNames ret; - ret.eventCount = 0; - return ret; - } -}; - -CmEventNameProvider gProfileNameProvider; - -void initializeModelTypes(PvdDataStream& stream) -{ - stream.createClass<profile::PxProfileZone>(); - stream.createProperty<profile::PxProfileZone, uint8_t>( - "events", PvdCommStreamEmbeddedTypes::getProfileEventStreamSemantic(), PropertyType::Array); - - stream.createClass<profile::PxProfileMemoryEventBuffer>(); - stream.createProperty<profile::PxProfileMemoryEventBuffer, uint8_t>( - "events", PvdCommStreamEmbeddedTypes::getMemoryEventStreamSemantic(), PropertyType::Array); - - stream.createClass<PvdUserRenderer>(); - stream.createProperty<PvdUserRenderer, uint8_t>( - "events", PvdCommStreamEmbeddedTypes::getRendererEventStreamSemantic(), PropertyType::Array); -} - -PvdImpl* PvdImpl::sInstance = NULL; -uint32_t PvdImpl::sRefCount = 0; - -PvdImpl::PvdImpl() -: mPvdTransport(NULL) -, mSharedMetaProvider(NULL) -, mMemClient(NULL) -, mIsConnected(false) -, mIsNVTXSupportEnabled(true) -, mNVTXContext(0) -, mNextStreamId(1) -, mProfileClient(NULL) -, mProfileZone(NULL) -{ - mProfileZoneManager = &physx::profile::PxProfileZoneManager::createProfileZoneManager(&physx::shdfnd::getAllocator()); - mProfileClient = PVD_NEW(PvdProfileZoneClient)(*this); -} - -PvdImpl::~PvdImpl() -{ - if((mFlags & PxPvdInstrumentationFlag::ePROFILE) ) - { - PxSetProfilerCallback(NULL); - } - - disconnect(); - - if ( mProfileZoneManager ) - { - mProfileZoneManager->release(); - mProfileZoneManager = NULL; - } - - PVD_DELETE(mProfileClient); - mProfileClient = NULL; -} - -bool PvdImpl::connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags) -{ - if(mIsConnected) - { - physx::shdfnd::getFoundation().error(PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, "PxPvd::connect - recall connect! Should call disconnect before re-connect."); - return false; - } - - mFlags = flags; - mPvdTransport = &transport; - - mIsConnected = mPvdTransport->connect(); - - if(mIsConnected) - { - mSharedMetaProvider = PVD_NEW(MetaDataProvider); - sendTransportInitialization(); - - PvdDataStream* stream = PvdDataStream::create(this); - initializeModelTypes(*stream); - stream->release(); - - if(mFlags & PxPvdInstrumentationFlag::eMEMORY) - { - mMemClient = PVD_NEW(PvdMemClient)(*this); - mPvdClients.pushBack(mMemClient); - } - - if((mFlags & PxPvdInstrumentationFlag::ePROFILE) && mProfileZoneManager) - { - mPvdClients.pushBack(mProfileClient); - mProfileZone = &physx::profile::PxProfileZone::createProfileZone(&physx::shdfnd::getAllocator(),gSdkName,gProfileNameProvider.getProfileNames()); - } - - for(uint32_t i = 0; i < mPvdClients.size(); i++) - mPvdClients[i]->onPvdConnected(); - - if (mProfileZone) - { - mProfileZoneManager->addProfileZoneHandler(*mProfileClient); - mProfileZoneManager->addProfileZone( *mProfileZone ); - } - - if ((mFlags & PxPvdInstrumentationFlag::ePROFILE)) - { - PxSetProfilerCallback(this); - } - } - return mIsConnected; -} - -void PvdImpl::disconnect() -{ - if(mProfileZone) - { - mProfileZoneManager->removeProfileZoneHandler(*mProfileClient); - mProfileZoneManager->removeProfileZone( *mProfileZone ); - mProfileZone->release(); - mProfileZone=NULL; - removeClient(mProfileClient); - } - - if(mIsConnected) - { - for(uint32_t i = 0; i < mPvdClients.size(); i++) - mPvdClients[i]->onPvdDisconnected(); - - if(mMemClient) - { - removeClient(mMemClient); - PvdMemClient* tmp = mMemClient; //avoid tracking deallocation itsself - mMemClient = NULL; - PVD_DELETE(tmp); - } - - mSharedMetaProvider->release(); - mPvdTransport->disconnect(); - mObjectRegistrar.clear(); - mIsConnected = false; - } -} - -void PvdImpl::flush() -{ - for(uint32_t i = 0; i < mPvdClients.size(); i++) - mPvdClients[i]->flush(); - if ( mProfileZone ) - { - mProfileZone->flushEventIdNameMap(); - mProfileZone->flushProfileEvents(); - } -} - -bool PvdImpl::isConnected(bool useCachedStatus) -{ - if(mPvdTransport) - return useCachedStatus ? mIsConnected : mPvdTransport->isConnected(); - else - return false; -} - -PxPvdTransport* PvdImpl::getTransport() -{ - return mPvdTransport; -} - -PxPvdInstrumentationFlags PvdImpl::getInstrumentationFlags() -{ - return mFlags; -} - -void PvdImpl::sendTransportInitialization() -{ - StreamInitialization init; - EventStreamifier<PxPvdTransport> stream(mPvdTransport->lock()); - init.serialize(stream); - mPvdTransport->unlock(); -} - -void PvdImpl::addClient(PvdClient* client) -{ - PX_ASSERT(client); - for(uint32_t i = 0; i < mPvdClients.size(); i++) - { - if(client == mPvdClients[i]) - return; - } - mPvdClients.pushBack(client); - if(mIsConnected) - { - client->onPvdConnected(); - } -} - -void PvdImpl::removeClient(PvdClient* client) -{ - for(uint32_t i = 0; i < mPvdClients.size(); i++) - { - if(client == mPvdClients[i]) - { - client->onPvdDisconnected(); - mPvdClients.remove(i); - } - } -} - -void PvdImpl::onAllocation(size_t inSize, const char* inType, const char* inFile, int inLine, void* inAddr) -{ - if(mMemClient) - mMemClient->onAllocation(inSize, inType, inFile, inLine, inAddr); -} - -void PvdImpl::onDeallocation(void* inAddr) -{ - if(mMemClient) - mMemClient->onDeallocation(inAddr); -} - -PvdOMMetaDataProvider& PvdImpl::getMetaDataProvider() -{ - return *mSharedMetaProvider; -} - -bool PvdImpl::registerObject(const void* inItem) -{ - return mObjectRegistrar.addItem(inItem); -} - - -bool PvdImpl::unRegisterObject(const void* inItem) -{ - return mObjectRegistrar.decItem(inItem); -} - -uint64_t PvdImpl::getNextStreamId() -{ - uint64_t retval = ++mNextStreamId; - return retval; -} - -bool PvdImpl::initialize() -{ - if(0 == sRefCount) - { - sInstance = PVD_NEW(PvdImpl)(); - } - ++sRefCount; - return !!sInstance; -} - -void PvdImpl::release() -{ - if(sRefCount > 0) - { - if(--sRefCount) - return; - - PVD_DELETE(sInstance); - sInstance = NULL; - } -} - -PvdImpl* PvdImpl::getInstance() -{ - return sInstance; -} - - -/************************************************************************************************************************** -Instrumented profiling events -***************************************************************************************************************************/ - -static const uint32_t CrossThreadId = 99999789; - -void* PvdImpl::zoneStart(const char* eventName, bool detached, uint64_t contextId) -{ - if(mProfileZone) - { - const uint16_t id = mProfileZone->getEventIdForName(eventName); - if(detached) - mProfileZone->startEvent(id, contextId, CrossThreadId); - else - mProfileZone->startEvent(id, contextId); - } -#if PX_NVTX - if(mIsNVTXSupportEnabled) - { - if(detached) - { - // TODO : Need to use the nvtxRangeStart API for cross thread events - nvtxEventAttributes_t eventAttrib; - memset(&eventAttrib, 0, sizeof(eventAttrib)); - eventAttrib.version = NVTX_VERSION; - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; - eventAttrib.colorType = NVTX_COLOR_ARGB; - eventAttrib.color = 0xFF00FF00; - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; - eventAttrib.message.ascii = eventName; - nvtxMarkEx(&eventAttrib); - } - else - { - nvtxRangePush(eventName); - } - } -#endif - return NULL; -} - -void PvdImpl::zoneEnd(void* /*profilerData*/, const char* eventName, bool detached, uint64_t contextId) -{ - if(mProfileZone) - { - const uint16_t id = mProfileZone->getEventIdForName(eventName); - if(detached) - mProfileZone->stopEvent(id, contextId, CrossThreadId); - else - mProfileZone->stopEvent(id, contextId); - } -#if PX_NVTX - if(mIsNVTXSupportEnabled) - { - if(detached) - { - nvtxEventAttributes_t eventAttrib; - memset(&eventAttrib, 0, sizeof(eventAttrib)); - eventAttrib.version = NVTX_VERSION; - eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; - eventAttrib.colorType = NVTX_COLOR_ARGB; - eventAttrib.color = 0xFFFF0000; - eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; - eventAttrib.message.ascii = eventName; - nvtxMarkEx(&eventAttrib); - } - else - { - nvtxRangePop(); - } - } -#endif -} -} // pvd - -} // physx diff --git a/PxShared/src/pvd/src/PxPvdImpl.h b/PxShared/src/pvd/src/PxPvdImpl.h deleted file mode 100644 index 64d4e16..0000000 --- a/PxShared/src/pvd/src/PxPvdImpl.h +++ /dev/null @@ -1,221 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDIMPL_H -#define PXPVDSDK_PXPVDIMPL_H - -#include "foundation/PxProfiler.h" - -#include "PsAllocator.h" -#include "PsPvd.h" -#include "PsArray.h" -#include "PsMutex.h" -#include "PxPvdCommStreamTypes.h" -#include "PxPvdFoundation.h" -#include "PxPvdObjectModelMetaData.h" -#include "PxPvdObjectRegistrar.h" - -namespace physx -{ - -namespace profile -{ - class PxProfileZoneManager; -} - -namespace pvdsdk -{ -class PvdMemClient; -class PvdProfileZoneClient; - -struct MetaDataProvider : public PvdOMMetaDataProvider, public shdfnd::UserAllocated -{ - typedef shdfnd::Mutex::ScopedLock TScopedLockType; - typedef shdfnd::HashMap<const void*, int32_t> TInstTypeMap; - PvdObjectModelMetaData& mMetaData; - shdfnd::Mutex mMutex; - uint32_t mRefCount; - TInstTypeMap mTypeMap; - - MetaDataProvider() - : mMetaData(PvdObjectModelMetaData::create()), mRefCount(0), mTypeMap("MetaDataProvider::mTypeMap") - { - mMetaData.addRef(); - } - virtual ~MetaDataProvider() - { - mMetaData.release(); - } - - virtual void addRef() - { - TScopedLockType locker(mMutex); - ++mRefCount; - } - virtual void release() - { - { - TScopedLockType locker(mMutex); - if(mRefCount) - --mRefCount; - } - if(!mRefCount) - PVD_DELETE(this); - } - virtual PvdObjectModelMetaData& lock() - { - mMutex.lock(); - return mMetaData; - } - virtual void unlock() - { - mMutex.unlock(); - } - - virtual bool createInstance(const NamespacedName& clsName, const void* instance) - { - TScopedLockType locker(mMutex); - Option<ClassDescription> cls(mMetaData.findClass(clsName)); - if(cls.hasValue() == false) - return false; - int32_t instType = cls->mClassId; - mTypeMap.insert(instance, instType); - return true; - } - virtual bool isInstanceValid(const void* instance) - { - TScopedLockType locker(mMutex); - ClassDescription classDesc; - bool retval = mTypeMap.find(instance) != NULL; -#if PX_DEBUG - if(retval) - classDesc = mMetaData.getClass(mTypeMap.find(instance)->second); -#endif - return retval; - } - virtual void destroyInstance(const void* instance) - { - { - TScopedLockType locker(mMutex); - mTypeMap.erase(instance); - } - } - virtual int32_t getInstanceClassType(const void* instance) - { - TScopedLockType locker(mMutex); - const TInstTypeMap::Entry* entry = mTypeMap.find(instance); - if(entry) - return entry->second; - return -1; - } - - private: - MetaDataProvider& operator=(const MetaDataProvider&); - MetaDataProvider(const MetaDataProvider&); -}; - -////////////////////////////////////////////////////////////////////////// -/*! -PvdImpl is the realization of PxPvd. -It implements the interface methods and provides richer functionality for advanced users or internal clients (such as -PhysX or APEX), including handler notification for clients. -*/ -////////////////////////////////////////////////////////////////////////// -class PvdImpl : public PsPvd, public shdfnd::UserAllocated -{ - PX_NOCOPY(PvdImpl) - - typedef shdfnd::Mutex::ScopedLock TScopedLockType; - typedef void (PvdImpl::*TAllocationHandler)(size_t size, const char* typeName, const char* filename, int line, - void* allocatedMemory); - typedef void (PvdImpl::*TDeallocationHandler)(void* allocatedMemory); - - public: - PvdImpl(); - virtual ~PvdImpl(); - void release(); - - bool connect(PxPvdTransport& transport, PxPvdInstrumentationFlags flags); - void disconnect(); - bool isConnected(bool useCachedStatus = true); - void flush(); - - PxPvdTransport* getTransport(); - PxPvdInstrumentationFlags getInstrumentationFlags(); - - void addClient(PvdClient* client); - void removeClient(PvdClient* client); - - PvdOMMetaDataProvider& getMetaDataProvider(); - - bool registerObject(const void* inItem); - bool unRegisterObject(const void* inItem); - - //AllocationListener - void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory); - void onDeallocation(void* addr); - - uint64_t getNextStreamId(); - - static bool initialize(); - static PvdImpl* getInstance(); - - // Profiling - - virtual void* zoneStart(const char* eventName, bool detached, uint64_t contextId); - - virtual void zoneEnd(void* profilerData, const char *eventName, bool detached, uint64_t contextId); - - private: - void sendTransportInitialization(); - - PxPvdTransport* mPvdTransport; - physx::shdfnd::Array<PvdClient*> mPvdClients; - - MetaDataProvider* mSharedMetaProvider; // shared between clients - ObjectRegistrar mObjectRegistrar; - - PvdMemClient* mMemClient; - - PxPvdInstrumentationFlags mFlags; - bool mIsConnected; - bool mIsNVTXSupportEnabled; - uint32_t mNVTXContext; - uint64_t mNextStreamId; - physx::profile::PxProfileZoneManager*mProfileZoneManager; - PvdProfileZoneClient* mProfileClient; - physx::profile::PxProfileZone* mProfileZone; - static PvdImpl* sInstance; - static uint32_t sRefCount; -}; - -} // namespace pvdsdk -} - -#endif // PXPVDSDK_PXPVDIMPL_H diff --git a/PxShared/src/pvd/src/PxPvdInternalByteStreams.h b/PxShared/src/pvd/src/PxPvdInternalByteStreams.h deleted file mode 100644 index 1fd5ddd..0000000 --- a/PxShared/src/pvd/src/PxPvdInternalByteStreams.h +++ /dev/null @@ -1,147 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDINTERNALBYTESTREAMS_H -#define PXPVDSDK_PXPVDINTERNALBYTESTREAMS_H - -#include "PxPvdByteStreams.h" -#include "PxPvdFoundation.h" - -namespace physx -{ -namespace pvdsdk -{ -struct MemPvdOutputStream : public PvdOutputStream -{ - ForwardingMemoryBuffer mBuffer; - MemPvdOutputStream(const char* memName) : mBuffer(memName) - { - } - - virtual bool write(const uint8_t* buffer, uint32_t len) - { - mBuffer.write(buffer, len); - return true; - } - - virtual bool directCopy(PvdInputStream& inStream, uint32_t len) - { - uint32_t offset = mBuffer.size(); - mBuffer.growBuf(len); - uint32_t readLen = len; - inStream.read(mBuffer.begin() + offset, readLen); - if(readLen != len) - physx::intrinsics::memZero(mBuffer.begin() + offset, len); - return readLen == len; - } - - const uint8_t* begin() const - { - return mBuffer.begin(); - } - uint32_t size() const - { - return mBuffer.size(); - } - void clear() - { - mBuffer.clear(); - } - DataRef<const uint8_t> toRef() const - { - return DataRef<const uint8_t>(mBuffer.begin(), mBuffer.end()); - } -}; - -struct MemPvdInputStream : public PvdInputStream -{ - const uint8_t* mBegin; - const uint8_t* mEnd; - bool mGood; - - MemPvdInputStream(const MemPvdOutputStream& stream) : mGood(true) - { - mBegin = stream.mBuffer.begin(); - mEnd = stream.mBuffer.end(); - } - - MemPvdInputStream(const uint8_t* beg = NULL, const uint8_t* end = NULL) - { - mBegin = beg; - mEnd = end; - mGood = true; - } - - uint32_t size() const - { - return mGood ? static_cast<uint32_t>(mEnd - mBegin) : 0; - } - bool isGood() const - { - return mGood; - } - - void setup(uint8_t* start, uint8_t* stop) - { - mBegin = start; - mEnd = stop; - } - - void nocopyRead(uint8_t*& buffer, uint32_t& len) - { - if(len == 0 || mGood == false) - { - len = 0; - buffer = NULL; - return; - } - uint32_t original = len; - len = PxMin(len, size()); - if(mGood && len != original) - mGood = false; - buffer = const_cast<uint8_t*>(mBegin); - mBegin += len; - } - - virtual bool read(uint8_t* buffer, uint32_t& len) - { - if(len == 0) - return true; - uint32_t original = len; - len = PxMin(len, size()); - - physx::intrinsics::memCopy(buffer, mBegin, len); - mBegin += len; - if(len < original) - physx::intrinsics::memZero(buffer + len, original - len); - mGood = mGood && len == original; - return mGood; - } -}; -} -} -#endif // PXPVDSDK_PXPVDINTERNALBYTESTREAMS_H diff --git a/PxShared/src/pvd/src/PxPvdMarshalling.h b/PxShared/src/pvd/src/PxPvdMarshalling.h deleted file mode 100644 index 0aeaee4..0000000 --- a/PxShared/src/pvd/src/PxPvdMarshalling.h +++ /dev/null @@ -1,220 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDMARSHALLING_H -#define PXPVDSDK_PXPVDMARSHALLING_H - -#include "foundation/PxIntrinsics.h" - -#include "PxPvdObjectModelBaseTypes.h" -#include "PxPvdBits.h" - -namespace physx -{ -namespace pvdsdk -{ - -// Define marshalling - -template <typename TSmallerType, typename TLargerType> -struct PvdMarshalling -{ - bool canMarshal; - PvdMarshalling() : canMarshal(false) - { - } -}; - -template <typename smtype, typename lgtype> -static inline void marshalSingleT(const uint8_t* srcData, uint8_t* destData) -{ - smtype incoming; - - physx::intrinsics::memCopy(&incoming, srcData, sizeof(smtype)); - lgtype outgoing = static_cast<lgtype>(incoming); - physx::intrinsics::memCopy(destData, &outgoing, sizeof(lgtype)); -} - -template <typename smtype, typename lgtype> -static inline void marshalBlockT(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes) -{ - for(const uint8_t* item = srcData, *end = srcData + numBytes; item < end; - item += sizeof(smtype), destData += sizeof(lgtype)) - marshalSingleT<smtype, lgtype>(item, destData); -} - -#define PVD_TYPE_MARSHALLER(smtype, lgtype) \ - template <> \ - struct PvdMarshalling<smtype, lgtype> \ - { \ - uint32_t canMarshal; \ - static void marshalSingle(const uint8_t* srcData, uint8_t* destData) \ - { \ - marshalSingleT<smtype, lgtype>(srcData, destData); \ - } \ - static void marshalBlock(const uint8_t* srcData, uint8_t* destData, uint32_t numBytes) \ - { \ - marshalBlockT<smtype, lgtype>(srcData, destData, numBytes); \ - } \ - }; - -// define marshalling tables. -PVD_TYPE_MARSHALLER(int8_t, int16_t) -PVD_TYPE_MARSHALLER(int8_t, uint16_t) -PVD_TYPE_MARSHALLER(int8_t, int32_t) -PVD_TYPE_MARSHALLER(int8_t, uint32_t) -PVD_TYPE_MARSHALLER(int8_t, int64_t) -PVD_TYPE_MARSHALLER(int8_t, uint64_t) -PVD_TYPE_MARSHALLER(int8_t, PvdF32) -PVD_TYPE_MARSHALLER(int8_t, PvdF64) - -PVD_TYPE_MARSHALLER(uint8_t, int16_t) -PVD_TYPE_MARSHALLER(uint8_t, uint16_t) -PVD_TYPE_MARSHALLER(uint8_t, int32_t) -PVD_TYPE_MARSHALLER(uint8_t, uint32_t) -PVD_TYPE_MARSHALLER(uint8_t, int64_t) -PVD_TYPE_MARSHALLER(uint8_t, uint64_t) -PVD_TYPE_MARSHALLER(uint8_t, PvdF32) -PVD_TYPE_MARSHALLER(uint8_t, PvdF64) - -PVD_TYPE_MARSHALLER(int16_t, int32_t) -PVD_TYPE_MARSHALLER(int16_t, uint32_t) -PVD_TYPE_MARSHALLER(int16_t, int64_t) -PVD_TYPE_MARSHALLER(int16_t, uint64_t) -PVD_TYPE_MARSHALLER(int16_t, PvdF32) -PVD_TYPE_MARSHALLER(int16_t, PvdF64) - -PVD_TYPE_MARSHALLER(uint16_t, int32_t) -PVD_TYPE_MARSHALLER(uint16_t, uint32_t) -PVD_TYPE_MARSHALLER(uint16_t, int64_t) -PVD_TYPE_MARSHALLER(uint16_t, uint64_t) -PVD_TYPE_MARSHALLER(uint16_t, PvdF32) -PVD_TYPE_MARSHALLER(uint16_t, PvdF64) - -PVD_TYPE_MARSHALLER(int32_t, int64_t) -PVD_TYPE_MARSHALLER(int32_t, uint64_t) -PVD_TYPE_MARSHALLER(int32_t, PvdF64) -PVD_TYPE_MARSHALLER(int32_t, PvdF32) - -PVD_TYPE_MARSHALLER(uint32_t, int64_t) -PVD_TYPE_MARSHALLER(uint32_t, uint64_t) -PVD_TYPE_MARSHALLER(uint32_t, PvdF64) -PVD_TYPE_MARSHALLER(uint32_t, PvdF32) - -PVD_TYPE_MARSHALLER(PvdF32, PvdF64) -PVD_TYPE_MARSHALLER(PvdF32, uint32_t) -PVD_TYPE_MARSHALLER(PvdF32, int32_t) - -PVD_TYPE_MARSHALLER(uint64_t, PvdF64) -PVD_TYPE_MARSHALLER(int64_t, PvdF64) -PVD_TYPE_MARSHALLER(PvdF64, uint64_t) -PVD_TYPE_MARSHALLER(PvdF64, int64_t) - -template <typename TMarshaller> -static inline bool getMarshalOperators(TSingleMarshaller&, TBlockMarshaller&, TMarshaller&, bool) -{ - return false; -} - -template <typename TMarshaller> -static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, TMarshaller&, uint32_t) -{ - single = TMarshaller::marshalSingle; - block = TMarshaller::marshalBlock; - return true; -} - -template <typename smtype, typename lgtype> -static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block) -{ - single = NULL; - block = NULL; - PvdMarshalling<smtype, lgtype> marshaller = PvdMarshalling<smtype, lgtype>(); - return getMarshalOperators(single, block, marshaller, marshaller.canMarshal); -} - -template <typename smtype> -static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t lgtypeId) -{ - switch(lgtypeId) - { - case PvdBaseType::PvdI8: // int8_t: - return getMarshalOperators<smtype, int8_t>(single, block); - case PvdBaseType::PvdU8: // uint8_t: - return getMarshalOperators<smtype, uint8_t>(single, block); - case PvdBaseType::PvdI16: // int16_t: - return getMarshalOperators<smtype, int16_t>(single, block); - case PvdBaseType::PvdU16: // uint16_t: - return getMarshalOperators<smtype, uint16_t>(single, block); - case PvdBaseType::PvdI32: // int32_t: - return getMarshalOperators<smtype, int32_t>(single, block); - case PvdBaseType::PvdU32: // uint32_t: - return getMarshalOperators<smtype, uint32_t>(single, block); - case PvdBaseType::PvdI64: // int64_t: - return getMarshalOperators<smtype, int64_t>(single, block); - case PvdBaseType::PvdU64: // uint64_t: - return getMarshalOperators<smtype, uint64_t>(single, block); - case PvdBaseType::PvdF32: - return getMarshalOperators<smtype, PvdF32>(single, block); - case PvdBaseType::PvdF64: - return getMarshalOperators<smtype, PvdF64>(single, block); - } - return false; -} - -static inline bool getMarshalOperators(TSingleMarshaller& single, TBlockMarshaller& block, int32_t smtypeId, - int32_t lgtypeId) -{ - switch(smtypeId) - { - case PvdBaseType::PvdI8: // int8_t: - return getMarshalOperators<int8_t>(single, block, lgtypeId); - case PvdBaseType::PvdU8: // uint8_t: - return getMarshalOperators<uint8_t>(single, block, lgtypeId); - case PvdBaseType::PvdI16: // int16_t: - return getMarshalOperators<int16_t>(single, block, lgtypeId); - case PvdBaseType::PvdU16: // uint16_t: - return getMarshalOperators<uint16_t>(single, block, lgtypeId); - case PvdBaseType::PvdI32: // int32_t: - return getMarshalOperators<int32_t>(single, block, lgtypeId); - case PvdBaseType::PvdU32: // uint32_t: - return getMarshalOperators<uint32_t>(single, block, lgtypeId); - case PvdBaseType::PvdI64: // int64_t: - return getMarshalOperators<int64_t>(single, block, lgtypeId); - case PvdBaseType::PvdU64: // uint64_t: - return getMarshalOperators<uint64_t>(single, block, lgtypeId); - case PvdBaseType::PvdF32: - return getMarshalOperators<PvdF32>(single, block, lgtypeId); - case PvdBaseType::PvdF64: - return getMarshalOperators<PvdF64>(single, block, lgtypeId); - } - return false; -} -} -} - -#endif // PXPVDSDK_PXPVDMARSHALLING_H diff --git a/PxShared/src/pvd/src/PxPvdMemClient.cpp b/PxShared/src/pvd/src/PxPvdMemClient.cpp deleted file mode 100644 index 05b7899..0000000 --- a/PxShared/src/pvd/src/PxPvdMemClient.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "pvd/PxPvdTransport.h" -#include "foundation/PxProfiler.h" - -#include "PxPvdImpl.h" -#include "PxPvdMemClient.h" -#include "PxProfileMemory.h" - -namespace physx -{ -namespace pvdsdk -{ - -PvdMemClient::PvdMemClient(PvdImpl& pvd) -: mSDKPvd(pvd) -, mPvdDataStream(NULL) -, mIsConnected(false) -, mMemEventBuffer(profile::PxProfileMemoryEventBuffer::createMemoryEventBuffer(*gPvdAllocatorCallback)) -{ -} - -PvdMemClient::~PvdMemClient() -{ - mSDKPvd.removeClient(this); - if(mMemEventBuffer.hasClients()) - mPvdDataStream->destroyInstance(&mMemEventBuffer); - mMemEventBuffer.release(); -} - -PvdDataStream* PvdMemClient::getDataStream() -{ - return mPvdDataStream; -} - -PvdUserRenderer* PvdMemClient::getUserRender() -{ - PX_ASSERT(0); - return NULL; -} - -void PvdMemClient::setObjectRegistrar(ObjectRegistrar*) -{ -} - -bool PvdMemClient::isConnected() const -{ - return mIsConnected; -} - -void PvdMemClient::onPvdConnected() -{ - if(mIsConnected) - return; - mIsConnected = true; - - mPvdDataStream = PvdDataStream::create(&mSDKPvd); - mPvdDataStream->createInstance(&mMemEventBuffer); - mMemEventBuffer.addClient(*this); -} - -void PvdMemClient::onPvdDisconnected() -{ - if(!mIsConnected) - return; - mIsConnected = false; - - flush(); - - mMemEventBuffer.removeClient(*this); - mPvdDataStream->release(); - mPvdDataStream = NULL; -} - -void PvdMemClient::onAllocation(size_t inSize, const char* inType, const char* inFile, int inLine, void* inAddr) -{ - mMutex.lock(); - mMemEventBuffer.onAllocation(inSize, inType, inFile, inLine, inAddr); - mMutex.unlock(); -} - -void PvdMemClient::onDeallocation(void* inAddr) -{ - mMutex.lock(); - mMemEventBuffer.onDeallocation(inAddr); - mMutex.unlock(); -} - -void PvdMemClient::flush() -{ - mMutex.lock(); - mMemEventBuffer.flushProfileEvents(); - mMutex.unlock(); -} - -void PvdMemClient::handleBufferFlush(const uint8_t* inData, uint32_t inLength) -{ - if(mPvdDataStream) - mPvdDataStream->setPropertyValue(&mMemEventBuffer, "events", inData, inLength); -} - -void PvdMemClient::handleClientRemoved() -{ -} - -} // pvd -} // physx diff --git a/PxShared/src/pvd/src/PxPvdMemClient.h b/PxShared/src/pvd/src/PxPvdMemClient.h deleted file mode 100644 index 37ac4ff..0000000 --- a/PxShared/src/pvd/src/PxPvdMemClient.h +++ /dev/null @@ -1,85 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDMEMCLIENT_H -#define PXPVDSDK_PXPVDMEMCLIENT_H - -#include "PxPvdClient.h" -#include "PsHashMap.h" -#include "PsMutex.h" -#include "PsBroadcast.h" -#include "PxProfileEventBufferClient.h" -#include "PxProfileMemory.h" - -namespace physx -{ -class PvdDataStream; - -namespace pvdsdk -{ -class PvdImpl; -class PvdMemClient : public PvdClient, - public profile::PxProfileEventBufferClient, - public shdfnd::UserAllocated -{ - PX_NOCOPY(PvdMemClient) - public: - PvdMemClient(PvdImpl& pvd); - virtual ~PvdMemClient(); - - bool isConnected() const; - void onPvdConnected(); - void onPvdDisconnected(); - void flush(); - - PvdDataStream* getDataStream(); - PvdUserRenderer* getUserRender(); - void setObjectRegistrar(ObjectRegistrar*); - void sendMemEvents(); - - // memory event - void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory); - void onDeallocation(void* addr); - - private: - PvdImpl& mSDKPvd; - PvdDataStream* mPvdDataStream; - bool mIsConnected; - - // mem profile - shdfnd::Mutex mMutex; // mem onallocation can called from different threads - profile::PxProfileMemoryEventBuffer& mMemEventBuffer; - void handleBufferFlush(const uint8_t* inData, uint32_t inLength); - void handleClientRemoved(); -}; - -} // namespace pvdsdk -} // namespace physx - -#endif // PXPVDSDK_PXPVDMEMCLIENT_H diff --git a/PxShared/src/pvd/src/PxPvdObjectModel.h b/PxShared/src/pvd/src/PxPvdObjectModel.h deleted file mode 100644 index f4858df..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectModel.h +++ /dev/null @@ -1,437 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDOBJECTMODEL_H -#define PXPVDSDK_PXPVDOBJECTMODEL_H - -#include "PsBasicTemplates.h" -#include "PxPvdObjectModelMetaData.h" - -namespace physx -{ -namespace pvdsdk -{ - -#if PX_VC == 11 || PX_VC == 12 || PX_VC == 14 -#pragma warning(push) -#pragma warning(disable : 4435) // 'class1' : Object layout under /vd2 will change due to virtual base 'class2' -#endif - -class PvdInputStream; -class PvdOutputStream; - -struct InstanceDescription -{ - int32_t mId; - int32_t mClassId; - void* mInstPtr; - bool mAlive; - - InstanceDescription(int32_t id, int32_t classId, void* inst, bool alive) - : mId(id), mClassId(classId), mInstPtr(inst), mAlive(alive) - { - } - InstanceDescription() : mId(-1), mClassId(-1), mInstPtr(NULL), mAlive(false) - { - } - operator void*() - { - PX_ASSERT(mAlive); - if(mAlive) - return mInstPtr; - return NULL; - } - operator int32_t() - { - return mId; - } -}; - -typedef physx::shdfnd::Pair<int32_t, int32_t> InstancePropertyPair; - -class PvdObjectModelBase -{ - protected: - virtual ~PvdObjectModelBase() - { - } - - public: - virtual void addRef() = 0; - virtual void release() = 0; - virtual void* idToPtr(int32_t instId) const = 0; - virtual int32_t ptrToId(void* instPtr) const = 0; - virtual InstanceDescription idToDescriptor(int32_t instId) const = 0; - virtual InstanceDescription ptrToDescriptor(void* instPtr) const = 0; - virtual Option<ClassDescription> getClassOf(void* instId) const = 0; - virtual const PvdObjectModelMetaData& getMetaData() const = 0; -}; - -class PvdObjectModelMutator : public virtual PvdObjectModelBase -{ - protected: - virtual ~PvdObjectModelMutator() - { - } - - public: - // if the instance is alive, this destroyes any arrays and sets the instance back to its initial state. - virtual InstanceDescription createInstance(int32_t clsId, int32_t instId) = 0; - virtual InstanceDescription createInstance(int32_t clsId) = 0; - // Instances that are pinned are not removed from the system, ever. - // This means that createInstance, pinInstance, deleteInstance - // can be called in this order and you can still call getClassOf, etc. on the instances. - // The instances will never be removed from memory if they are pinned, so use at your - // careful discretion. - virtual void pinInstance(void* instId) = 0; - virtual void unPinInstance(void* instId) = 0; - // when doing capture, should update all events in a section at once, otherwis there possible parse data - // incompltely. - virtual void recordCompletedInstances() = 0; - - virtual void destroyInstance(void* instId) = 0; - virtual int32_t getNextInstanceHandleValue() const = 0; - // reserve a set of instance handle values by getting the current, adding an amount to it - // and setting the value. You can never set the value lower than it already is, it only climbs. - virtual void setNextInstanceHandleValue(int32_t hdlValue) = 0; - // If incoming type is provided, then we may be able to marshal simple types - // This works for arrays, it just completely replaces the entire array. - // Because if this, it is an error of the property identifier - virtual bool setPropertyValue(void* instId, int32_t propId, const uint8_t* data, uint32_t dataLen, - int32_t incomingType) = 0; - // Set a set of properties defined by a property message - virtual bool setPropertyMessage(void* instId, int32_t msgId, const uint8_t* data, uint32_t dataLen) = 0; - // insert an element(s) into array index. If index > numElements, element(s) is(are) appended. - virtual bool insertArrayElement(void* instId, int32_t propId, int32_t index, const uint8_t* data, uint32_t dataLen, - int32_t incomingType = -1) = 0; - virtual bool removeArrayElement(void* instId, int32_t propId, int32_t index) = 0; - // Add this array element to end end if it doesn't already exist in the array. - // The option is false if there was an error with the function call. - // The integer has no value if nothing was added, else it tells you the index - // where the item was added. Comparison is done using memcmp. - virtual Option<int32_t> pushBackArrayElementIf(void* instId, int32_t propId, const uint8_t* data, uint32_t dataLen, - int32_t incomingType = -1) = 0; - // Remove an array element if it exists in the array. - // The option is false if there was an error with the function call. - // the integer has no value if the item wasn't found, else it tells you the index where - // the item resided. Comparison is memcmp. - virtual Option<int32_t> removeArrayElementIf(void* instId, int32_t propId, const uint8_t* data, uint32_t dataLen, - int32_t incomingType = -1) = 0; - virtual bool setArrayElementValue(void* instId, int32_t propId, int32_t propIdx, const uint8_t* data, - uint32_t dataLen, int32_t incomingType) = 0; - - virtual void originShift(void* instId, PxVec3 shift) = 0; - - InstanceDescription createInstance(const NamespacedName& name) - { - return createInstance(getMetaData().findClass(name)->mClassId); - } - template <typename TDataType> - bool setPropertyValue(void* instId, const char* propName, const TDataType* dtype, uint32_t count) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return false; - } - const PropertyDescription& prop(descOpt); - Option<ClassDescription> incomingCls(getMetaData().findClass(getPvdNamespacedNameForType<TDataType>())); - if(incomingCls.hasValue()) - return setPropertyValue(instId, prop.mPropertyId, reinterpret_cast<const uint8_t*>(dtype), - sizeof(*dtype) * count, incomingCls.getValue().mClassId); - return false; - } - - // Simplest possible setPropertyValue - template <typename TDataType> - bool setPropertyValue(void* instId, const char* propName, const TDataType& dtype) - { - return setPropertyValue(instId, propName, &dtype, 1); - } - - template <typename TDataType> - bool setPropertyMessage(void* instId, const TDataType& msg) - { - Option<PropertyMessageDescription> msgId = - getMetaData().findPropertyMessage(getPvdNamespacedNameForType<TDataType>()); - if(msgId.hasValue() == false) - return false; - return setPropertyMessage(instId, msgId.getValue().mMessageId, reinterpret_cast<const uint8_t*>(&msg), - sizeof(msg)); - } - template <typename TDataType> - bool insertArrayElement(void* instId, const char* propName, int32_t idx, const TDataType& dtype) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return false; - } - const PropertyDescription& prop(descOpt); - Option<ClassDescription> incomingCls(getMetaData().findClass(getPvdNamespacedNameForType<TDataType>())); - if(incomingCls.hasValue()) - { - return insertArrayElement(instId, prop.mPropertyId, idx, reinterpret_cast<const uint8_t*>(&dtype), - sizeof(dtype), incomingCls.getValue().mClassId); - } - return false; - } - - bool removeArrayElement(void* instId, const char* propName, int32_t idx) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return false; - } - const PropertyDescription& prop(descOpt); - return removeArrayElement(instId, prop.mPropertyId, idx); - } - template <typename TDataType> - Option<int32_t> pushBackArrayElementIf(void* instId, const char* pname, const TDataType& item) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, pname)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return None(); - } - const PropertyDescription& prop(descOpt); - Option<ClassDescription> incomingCls(getMetaData().findClass(getPvdNamespacedNameForType<TDataType>())); - if(incomingCls.hasValue() && (incomingCls.getValue().mClassId == prop.mDatatype)) - { - return pushBackArrayElementIf(instId, prop.mPropertyId, reinterpret_cast<const uint8_t*>(&item), - sizeof(item), incomingCls.getValue().mClassId); - } - return None(); - } - template <typename TDataType> - Option<int32_t> removeArrayElementIf(void* instId, const char* propId, const TDataType& item) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propId)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return None(); - } - const PropertyDescription& prop(descOpt); - Option<ClassDescription> incomingCls(getMetaData().findClass(getPvdNamespacedNameForType<TDataType>())); - if(incomingCls.hasValue() && (incomingCls.getValue().mClassId == prop.mDatatype)) - { - return removeArrayElementIf(instId, prop.mPropertyId, reinterpret_cast<const uint8_t*>(&item), sizeof(item), - incomingCls.getValue().mClassId); - } - return None(); - } - template <typename TDataType> - bool setArrayElementValue(void* instId, const char* propName, int32_t propIdx, TDataType& item) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return false; - } - const PropertyDescription& prop(descOpt); - Option<ClassDescription> incomingCls(getMetaData().findClass(getPvdNamespacedNameForType<TDataType>())); - if(incomingCls.hasValue() && (incomingCls.getValue().mClassId == prop.mDatatype)) - return setArrayElementValue(instId, prop.mPropertyId, propIdx, reinterpret_cast<const uint8_t*>(&item), - sizeof(item), incomingCls.getValue().mClassId); - PX_ASSERT(false); - return false; - } -}; - -class PvdObjectModelReader : public virtual PvdObjectModelBase -{ - protected: - virtual ~PvdObjectModelReader() - { - } - - public: - // Return the byte size of a possible nested property - virtual uint32_t getPropertyByteSize(void* instId, int32_t propId) = 0; - uint32_t getPropertyByteSize(void* instId, String propName) - { - int32_t propId = getMetaData().findProperty(getClassOf(instId)->mClassId, propName)->mPropertyId; - return getPropertyByteSize(instId, propId); - } - // Return the value of a possible nested property - virtual uint32_t getPropertyValue(void* instId, int32_t propId, uint8_t* outData, uint32_t outDataLen) = 0; - // Get the actual raw database memory. This is subject to change drastically if the object gets deleted. - virtual DataRef<uint8_t> getRawPropertyValue(void* instId, int32_t propId) = 0; - - DataRef<uint8_t> getRawPropertyValue(void* instId, const char* propName) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return 0; - } - return getRawPropertyValue(instId, descOpt->mPropertyId); - } - - template <typename TDataType> - DataRef<TDataType> getTypedRawPropertyValue(void* instId, int32_t propId) - { - DataRef<uint8_t> propVal = getRawPropertyValue(instId, propId); - return DataRef<TDataType>(reinterpret_cast<const TDataType*>(propVal.begin()), - propVal.size() / sizeof(TDataType)); - } - - template <typename TDataType> - DataRef<TDataType> getTypedRawPropertyValue(void* instId, const char* propName) - { - DataRef<uint8_t> propVal = getRawPropertyValue(instId, propName); - return DataRef<TDataType>(reinterpret_cast<const TDataType*>(propVal.begin()), - propVal.size() / sizeof(TDataType)); - } - - template <typename TDataType> - uint32_t getPropertyValue(void* instId, const char* propName, TDataType* outBuffer, uint32_t outNumBufferItems) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return 0; - } - const PropertyDescription& prop(descOpt); - uint32_t desired = outNumBufferItems * sizeof(TDataType); - return getPropertyValue(instId, prop.mPropertyId, reinterpret_cast<uint8_t*>(outBuffer), desired) / - sizeof(TDataType); - } - - template <typename TDataType> - Option<TDataType> getPropertyValue(void* instId, const char* propName) - { - TDataType retval; - if(getPropertyValue(instId, propName, &retval, 1) == 1) - return retval; - return None(); - } - - // Get this one item out of the array - // return array[idx] - virtual uint32_t getPropertyValue(void* instId, int32_t propId, int inArrayIndex, uint8_t* outData, - uint32_t outDataLen) = 0; - // Get this sub element of one item out of the array - // return array[idx].a - virtual uint32_t getPropertyValue(void* instId, int32_t propId, int inArrayIndex, int nestedProperty, - uint8_t* outData, uint32_t outDataLen) = 0; - - // Get a set of properties defined by a property message - virtual bool getPropertyMessage(void* instId, int32_t msgId, uint8_t* data, uint32_t dataLen) const = 0; - - template <typename TDataType> - bool getPropertyMessage(void* instId, TDataType& msg) - { - Option<PropertyMessageDescription> msgId( - getMetaData().findPropertyMessage(getPvdNamespacedNameForType<TDataType>())); - if(msgId.hasValue() == false) - return false; - return getPropertyMessage(instId, msgId.getValue().mMessageId, reinterpret_cast<uint8_t*>(&msg), sizeof(msg)); - } - - // clearing the array is performed with a set property value call with no data. - virtual uint32_t getNbArrayElements(void* instId, int32_t propId) = 0; - uint32_t getNbArrayElements(void* instId, const char* propName) - { - ClassDescription cls(getClassOf(instId)); - Option<PropertyDescription> descOpt(getMetaData().findProperty(cls.mClassId, propName)); - if(!descOpt.hasValue()) - { - PX_ASSERT(false); - return false; - } - const PropertyDescription& prop(descOpt); - return getNbArrayElements(instId, prop.mPropertyId); - } - - // Write this instance out. Offset is set as the instances last write offset. - // This offset is cleared if the object is changed. - // If offset doesn't have a value, then the instance isn't changed. - virtual void writeInstance(void* instId, PvdOutputStream& stream) = 0; - - virtual uint32_t getNbInstances() const = 0; - virtual uint32_t getInstances(InstanceDescription* outBuffer, uint32_t count, uint32_t startIndex = 0) const = 0; - - // Get the list of updated objects since the last time someone cleared the updated instance list. - virtual uint32_t getNbUpdatedInstances() const = 0; - virtual uint32_t getUpdatedInstances(InstanceDescription* outBuffer, uint32_t count, uint32_t startIndex = 0) = 0; - // Must be called for instances to be released. Only instances that aren't live nor are they updated - // are valid. - virtual void clearUpdatedInstances() = 0; -}; - -class PvdObjectModel : public PvdObjectModelMutator, public PvdObjectModelReader -{ - protected: - virtual ~PvdObjectModel() - { - } - - public: - virtual void destroyAllInstances() = 0; - virtual bool setPropertyValueToDefault(void* instId, int32_t propId) = 0; - // Read an instance data and put a copy of the data in the output stream. - static bool readInstance(PvdInputStream& inStream, PvdOutputStream& outStream); - virtual InstanceDescription readInstance(DataRef<const uint8_t> writtenData) = 0; - // Set just this property from this serialized instance. - // Expects the instance to be alive, just like setPropertyValue - virtual bool readInstanceProperty(DataRef<const uint8_t> writtenData, int32_t propId) = 0; - - virtual void recordCompletedInstances() = 0; - - // OriginShift seekback support - virtual uint32_t getNbShifted() = 0; - virtual void getShiftedPair(InstancePropertyPair* outData, uint32_t count) = 0; - virtual void clearShiftedPair() = 0; - virtual void shiftObject(void* instId, int32_t propId, PxVec3 shift) = 0; - static PvdObjectModel& create(physx::PxAllocatorCallback& callback, PvdObjectModelMetaData& metaData, - bool isCapture = false); -}; - -#if PX_VC == 11 || PX_VC == 12 || PX_VC == 14 -#pragma warning(pop) -#endif -} -} -#endif // PXPVDSDK_PXPVDOBJECTMODEL_H diff --git a/PxShared/src/pvd/src/PxPvdObjectModelInternalTypeDefs.h b/PxShared/src/pvd/src/PxPvdObjectModelInternalTypeDefs.h deleted file mode 100644 index eca7858..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectModelInternalTypeDefs.h +++ /dev/null @@ -1,32 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON - -DECLARE_INTERNAL_PVD_TYPE(ArrayData) - -#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/PxShared/src/pvd/src/PxPvdObjectModelInternalTypes.h b/PxShared/src/pvd/src/PxPvdObjectModelInternalTypes.h deleted file mode 100644 index 3344140..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectModelInternalTypes.h +++ /dev/null @@ -1,171 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#ifndef PXPVDSDK_PXPVDOBJECTMODELINTERNALTYPES_H -#define PXPVDSDK_PXPVDOBJECTMODELINTERNALTYPES_H - -#include "foundation/PxMemory.h" -#include "PxPvdObjectModelBaseTypes.h" -#include "PsArray.h" -#include "PxPvdFoundation.h" -#include "PxPvdObjectModel.h" - -namespace physx -{ -namespace pvdsdk -{ - -struct PvdInternalType -{ - enum Enum - { - None = 0, -#define DECLARE_INTERNAL_PVD_TYPE(type) type, -#include "PxPvdObjectModelInternalTypeDefs.h" - Last -#undef DECLARE_INTERNAL_PVD_TYPE - }; -}; - -PX_COMPILE_TIME_ASSERT(uint32_t(PvdInternalType::Last) <= uint32_t(PvdBaseType::InternalStop)); - -template <typename T> -struct DataTypeToPvdTypeMap -{ - bool compile_error; -}; -template <PvdInternalType::Enum> -struct PvdTypeToDataTypeMap -{ - bool compile_error; -}; - -#define DECLARE_INTERNAL_PVD_TYPE(type) \ - template <> \ - struct DataTypeToPvdTypeMap<type> \ - { \ - enum Enum \ - { \ - BaseTypeEnum = PvdInternalType::type \ - }; \ - }; \ - template <> \ - struct PvdTypeToDataTypeMap<PvdInternalType::type> \ - { \ - typedef type TDataType; \ - }; \ - template <> \ - struct PvdDataTypeToNamespacedNameMap<type> \ - { \ - NamespacedName Name; \ - PvdDataTypeToNamespacedNameMap<type>() : Name("physx3_debugger_internal", #type) \ - { \ - } \ - }; -#include "PxPvdObjectModelInternalTypeDefs.h" -#undef DECLARE_INTERNAL_PVD_TYPE - -template <typename TDataType, typename TAlloc> -DataRef<TDataType> toDataRef(const shdfnd::Array<TDataType, TAlloc>& data) -{ - return DataRef<TDataType>(data.begin(), data.end()); -} - -static inline bool safeStrEq(const DataRef<String>& lhs, const DataRef<String>& rhs) -{ - uint32_t count = lhs.size(); - if(count != rhs.size()) - return false; - for(uint32_t idx = 0; idx < count; ++idx) - if(!safeStrEq(lhs[idx], rhs[idx])) - return false; - return true; -} - -static inline char* copyStr(const char* str) -{ - str = nonNull(str); - uint32_t len = static_cast<uint32_t>(strlen(str)); - char* newData = reinterpret_cast<char*>(PX_ALLOC(len + 1, "string")); - PxMemCopy(newData, str, len); - newData[len] = 0; - return newData; -} - -// Used for predictable bit fields. -template <typename TDataType, uint8_t TNumBits, uint8_t TOffset, typename TInputType> -struct BitMaskSetter -{ - // Create a mask that masks out the orginal value shift into place - static TDataType createOffsetMask() - { - return createMask() << TOffset; - } - // Create a mask of TNumBits number of tis - static TDataType createMask() - { - return static_cast<TDataType>((1 << TNumBits) - 1); - } - void setValue(TDataType& inCurrent, TInputType inData) - { - PX_ASSERT(inData < (1 << TNumBits)); - - // Create a mask to remove the current value. - TDataType theMask = ~(createOffsetMask()); - // Clear out current value. - inCurrent = inCurrent & theMask; - // Create the new value. - TDataType theAddition = reinterpret_cast<TDataType>(inData << TOffset); - // or it into the existing value. - inCurrent = inCurrent | theAddition; - } - - TInputType getValue(TDataType inCurrent) - { - return static_cast<TInputType>((inCurrent >> TOffset) & createMask()); - } -}; - -template <typename TObjType> -DataRef<TObjType> getArray(shdfnd::Array<uint8_t>& dataBuffer, PvdObjectModelReader& reader, InstanceDescription instanceDesc, - String propName) -{ - int32_t propId = reader.getMetaData().findProperty(reader.getClassOf(instanceDesc)->mClassId, propName)->mPropertyId; - uint32_t numBytes = reader.getPropertyByteSize(instanceDesc.mInstPtr, propId); - uint32_t numItems = reader.getNbArrayElements(instanceDesc.mInstPtr, propId); - if(numBytes == 0) - return NULL; - if(numBytes > dataBuffer.size()) - dataBuffer.resize(numBytes); - - TObjType* dataPtr = reinterpret_cast<TObjType*>(dataBuffer.begin()); - reader.getPropertyValue(instanceDesc, propId, dataBuffer.begin(), numBytes); - return DataRef<TObjType>(dataPtr, numItems); -} -} -} -#endif // PXPVDSDK_PXPVDOBJECTMODELINTERNALTYPES_H diff --git a/PxShared/src/pvd/src/PxPvdObjectModelMetaData.cpp b/PxShared/src/pvd/src/PxPvdObjectModelMetaData.cpp deleted file mode 100644 index 9971d00..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectModelMetaData.cpp +++ /dev/null @@ -1,1515 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#include "PxPvdObjectModel.h" -#include "PxPvdObjectModelBaseTypes.h" -#include "PxPvdObjectModelInternalTypes.h" -#include "PxPvdObjectModelMetaData.h" -#include "PxPvdFoundation.h" -#include "PsMutex.h" -#include "PxPvdByteStreams.h" -#include "PxPvdInternalByteStreams.h" -#include "PxPvdMarshalling.h" - -using namespace physx; -using namespace pvdsdk; -using namespace shdfnd; - -namespace -{ - -struct PropDescImpl : public PropertyDescription, public UserAllocated -{ - Array<NamedValue> mValueNames; - PropDescImpl(const PropertyDescription& inBase, StringTable& table) - : PropertyDescription(inBase), mValueNames("NamedValue") - { - mName = table.registerStr(mName); - } - PropDescImpl() : mValueNames("NamedValue") - { - } - - template <typename TSerializer> - void serialize(TSerializer& serializer) - { - serializer.streamify(mOwnerClassName); - serializer.streamify(mOwnerClassId); - serializer.streamify(mSemantic); - serializer.streamify(mDatatype); - serializer.streamify(mDatatypeName); - serializer.streamify(mPropertyType); - serializer.streamify(mPropertyId); - serializer.streamify(m32BitOffset); - serializer.streamify(m64BitOffset); - serializer.streamify(mValueNames); - serializer.streamify(mName); - } -}; - -struct ClassDescImpl : public ClassDescription, public UserAllocated -{ - Array<PropDescImpl*> mPropImps; - Array<PtrOffset> m32OffsetArray; - Array<PtrOffset> m64OffsetArray; - ClassDescImpl(const ClassDescription& inBase) - : ClassDescription(inBase) - , mPropImps("PropDescImpl*") - , m32OffsetArray("ClassDescImpl::m32OffsetArray") - , m64OffsetArray("ClassDescImpl::m64OffsetArray") - { - PVD_FOREACH(idx, get32BitSizeInfo().mPtrOffsets.size()) - m32OffsetArray.pushBack(get32BitSizeInfo().mPtrOffsets[idx]); - PVD_FOREACH(idx, get64BitSizeInfo().mPtrOffsets.size()) - m64OffsetArray.pushBack(get64BitSizeInfo().mPtrOffsets[idx]); - } - ClassDescImpl() - : mPropImps("PropDescImpl*") - , m32OffsetArray("ClassDescImpl::m32OffsetArray") - , m64OffsetArray("ClassDescImpl::m64OffsetArray") - { - } - PropDescImpl* findProperty(String name) - { - PVD_FOREACH(idx, mPropImps.size()) - { - if(safeStrEq(mPropImps[idx]->mName, name)) - return mPropImps[idx]; - } - return NULL; - } - void addProperty(PropDescImpl* prop) - { - mPropImps.pushBack(prop); - } - - void addPtrOffset(PtrOffsetType::Enum type, uint32_t offset32, uint32_t offset64) - { - m32OffsetArray.pushBack(PtrOffset(type, offset32)); - m64OffsetArray.pushBack(PtrOffset(type, offset64)); - get32BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m32OffsetArray.begin(), m32OffsetArray.end()); - get64BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m64OffsetArray.begin(), m64OffsetArray.end()); - } - - template <typename TSerializer> - void serialize(TSerializer& serializer) - { - serializer.streamify(mName); - serializer.streamify(mClassId); - serializer.streamify(mBaseClass); - serializer.streamify(mPackedUniformWidth); - serializer.streamify(mPackedClassType); - serializer.streamify(mLocked); - serializer.streamify(mRequiresDestruction); - serializer.streamify(get32BitSize()); - serializer.streamify(get32BitSizeInfo().mDataByteSize); - serializer.streamify(get32BitSizeInfo().mAlignment); - serializer.streamify(get64BitSize()); - serializer.streamify(get64BitSizeInfo().mDataByteSize); - serializer.streamify(get64BitSizeInfo().mAlignment); - serializer.streamifyLinks(mPropImps); - serializer.streamify(m32OffsetArray); - serializer.streamify(m64OffsetArray); - get32BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m32OffsetArray.begin(), m32OffsetArray.end()); - get64BitSizeInfo().mPtrOffsets = DataRef<PtrOffset>(m64OffsetArray.begin(), m64OffsetArray.end()); - } -}; - -class StringTableImpl : public StringTable, public UserAllocated -{ - HashMap<const char*, char*> mStrings; - uint32_t mNextStrHandle; - HashMap<uint32_t, char*> mHandleToStr; - HashMap<const char*, uint32_t> mStrToHandle; - - public: - StringTableImpl() - : mStrings("StringTableImpl::mStrings") - , mNextStrHandle(1) - , mHandleToStr("StringTableImpl::mHandleToStr") - , mStrToHandle("StringTableImpl::mStrToHandle") - { - } - uint32_t nextHandleValue() - { - return mNextStrHandle++; - } - virtual ~StringTableImpl() - { - for(HashMap<const char*, char*>::Iterator iter = mStrings.getIterator(); !iter.done(); ++iter) - PX_FREE(iter->second); - mStrings.clear(); - } - virtual uint32_t getNbStrs() - { - return mStrings.size(); - } - virtual uint32_t getStrs(const char** outStrs, uint32_t bufLen, uint32_t startIdx = 0) - { - startIdx = PxMin(getNbStrs(), startIdx); - uint32_t numStrs(PxMin(getNbStrs() - startIdx, bufLen)); - HashMap<const char*, char*>::Iterator iter(mStrings.getIterator()); - for(uint32_t idx = 0; idx < startIdx; ++idx, ++iter) - ; - for(uint32_t idx = 0; idx < numStrs && !iter.done(); ++idx, ++iter) - outStrs[idx] = iter->second; - return numStrs; - } - void addStringHandle(char* str, uint32_t hdl) - { - mHandleToStr.insert(hdl, str); - mStrToHandle.insert(str, hdl); - } - - uint32_t addStringHandle(char* str) - { - uint32_t theNewHandle = nextHandleValue(); - addStringHandle(str, theNewHandle); - return theNewHandle; - } - const char* doRegisterStr(const char* str, bool& outAdded) - { - PX_ASSERT(isMeaningful(str)); - const HashMap<const char*, char*>::Entry* entry(mStrings.find(str)); - if(entry == NULL) - { - outAdded = true; - char* retval(copyStr(str)); - mStrings.insert(retval, retval); - return retval; - } - return entry->second; - } - virtual const char* registerStr(const char* str, bool& outAdded) - { - outAdded = false; - if(isMeaningful(str) == false) - return ""; - const char* retval = doRegisterStr(str, outAdded); - if(outAdded) - addStringHandle(const_cast<char*>(retval)); - return retval; - } - - NamespacedName registerName(const NamespacedName& nm) - { - return NamespacedName(registerStr(nm.mNamespace), registerStr(nm.mName)); - } - const char* registerStr(const char* str) - { - bool ignored; - return registerStr(str, ignored); - } - - virtual StringHandle strToHandle(const char* str) - { - if(isMeaningful(str) == false) - return 0; - const HashMap<const char*, uint32_t>::Entry* entry(mStrToHandle.find(str)); - if(entry) - return entry->second; - bool added = false; - const char* registeredStr = doRegisterStr(str, added); - uint32_t theNewHandle = addStringHandle(const_cast<char*>(registeredStr)); - PX_ASSERT(mStrToHandle.find(str)); - PX_ASSERT(added); - return theNewHandle; - } - - virtual const char* handleToStr(uint32_t hdl) - { - if(hdl == 0) - return ""; - const HashMap<uint32_t, char*>::Entry* entry(mHandleToStr.find(hdl)); - if(entry) - return entry->second; - // unregistered handle... - return ""; - } - - void write(PvdOutputStream& stream) - { - uint32_t numStrs = static_cast<uint32_t>(mHandleToStr.size()); - stream << numStrs; - stream << mNextStrHandle; - for(HashMap<uint32_t, char*>::Iterator iter = mHandleToStr.getIterator(); !iter.done(); ++iter) - { - stream << iter->first; - uint32_t len = static_cast<uint32_t>(strlen(iter->second) + 1); - stream << len; - stream.write(reinterpret_cast<uint8_t*>(iter->second), len); - } - } - - template <typename TReader> - void read(TReader& stream) - { - mHandleToStr.clear(); - mStrToHandle.clear(); - uint32_t numStrs; - stream >> numStrs; - stream >> mNextStrHandle; - Array<uint8_t> readBuffer("StringTable::read::readBuffer"); - uint32_t bufSize = 0; - for(uint32_t idx = 0; idx < numStrs; ++idx) - { - uint32_t handleValue; - uint32_t bufLen; - stream >> handleValue; - stream >> bufLen; - if(bufSize < bufLen) - readBuffer.resize(bufLen); - bufSize = PxMax(bufSize, bufLen); - stream.read(readBuffer.begin(), bufLen); - bool ignored; - const char* newStr = doRegisterStr(reinterpret_cast<const char*>(readBuffer.begin()), ignored); - addStringHandle(const_cast<char*>(newStr), handleValue); - } - } - - virtual void release() - { - PVD_DELETE(this); - } - - private: - StringTableImpl& operator=(const StringTableImpl&); -}; - -struct NamespacedNameHasher -{ - uint32_t operator()(const NamespacedName& nm) - { - return Hash<const char*>()(nm.mNamespace) ^ Hash<const char*>()(nm.mName); - } - bool equal(const NamespacedName& lhs, const NamespacedName& rhs) - { - return safeStrEq(lhs.mNamespace, rhs.mNamespace) && safeStrEq(lhs.mName, rhs.mName); - } -}; - -struct ClassPropertyName -{ - NamespacedName mName; - String mPropName; - ClassPropertyName(const NamespacedName& name = NamespacedName(), String propName = "") - : mName(name), mPropName(propName) - { - } -}; - -struct ClassPropertyNameHasher -{ - uint32_t operator()(const ClassPropertyName& nm) - { - return NamespacedNameHasher()(nm.mName) ^ Hash<const char*>()(nm.mPropName); - } - bool equal(const ClassPropertyName& lhs, const ClassPropertyName& rhs) - { - return NamespacedNameHasher().equal(lhs.mName, rhs.mName) && safeStrEq(lhs.mPropName, rhs.mPropName); - } -}; - -struct PropertyMessageEntryImpl : public PropertyMessageEntry -{ - PropertyMessageEntryImpl(const PropertyMessageEntry& data) : PropertyMessageEntry(data) - { - } - PropertyMessageEntryImpl() - { - } - template <typename TSerializerType> - void serialize(TSerializerType& serializer) - { - serializer.streamify(mDatatypeName); - serializer.streamify(mDatatypeId); - serializer.streamify(mMessageOffset); - serializer.streamify(mByteSize); - serializer.streamify(mDestByteSize); - serializer.streamify(mProperty); - } -}; - -struct PropertyMessageDescriptionImpl : public PropertyMessageDescription, public UserAllocated -{ - Array<PropertyMessageEntryImpl> mEntryImpls; - Array<PropertyMessageEntry> mEntries; - Array<uint32_t> mStringOffsetArray; - PropertyMessageDescriptionImpl(const PropertyMessageDescription& data) - : PropertyMessageDescription(data) - , mEntryImpls("PropertyMessageDescriptionImpl::mEntryImpls") - , mEntries("PropertyMessageDescriptionImpl::mEntries") - , mStringOffsetArray("PropertyMessageDescriptionImpl::mStringOffsets") - { - } - PropertyMessageDescriptionImpl() - : mEntryImpls("PropertyMessageDescriptionImpl::mEntryImpls") - , mEntries("PropertyMessageDescriptionImpl::mEntries") - , mStringOffsetArray("PropertyMessageDescriptionImpl::mStringOffsets") - { - } - - ~PropertyMessageDescriptionImpl() - { - } - - void addEntry(const PropertyMessageEntryImpl& entry) - { - mEntryImpls.pushBack(entry); - mEntries.pushBack(entry); - mProperties = DataRef<PropertyMessageEntry>(mEntries.begin(), mEntries.end()); - } - - template <typename TSerializerType> - void serialize(TSerializerType& serializer) - { - serializer.streamify(mClassName); - serializer.streamify(mClassId); // No other class has this id, it is DB-unique - serializer.streamify(mMessageName); - serializer.streamify(mMessageId); - serializer.streamify(mMessageByteSize); - serializer.streamify(mEntryImpls); - serializer.streamify(mStringOffsetArray); - if(mEntries.size() != mEntryImpls.size()) - { - mEntries.clear(); - uint32_t numEntries = static_cast<uint32_t>(mEntryImpls.size()); - for(uint32_t idx = 0; idx < numEntries; ++idx) - mEntries.pushBack(mEntryImpls[idx]); - } - mProperties = DataRef<PropertyMessageEntry>(mEntries.begin(), mEntries.end()); - mStringOffsets = DataRef<uint32_t>(mStringOffsetArray.begin(), mStringOffsetArray.end()); - } - - private: - PropertyMessageDescriptionImpl& operator=(const PropertyMessageDescriptionImpl&); -}; - -struct PvdObjectModelMetaDataImpl : public PvdObjectModelMetaData, public UserAllocated -{ - typedef HashMap<NamespacedName, ClassDescImpl*, NamespacedNameHasher> TNameToClassMap; - typedef HashMap<ClassPropertyName, PropDescImpl*, ClassPropertyNameHasher> TNameToPropMap; - typedef HashMap<NamespacedName, PropertyMessageDescriptionImpl*, NamespacedNameHasher> TNameToPropertyMessageMap; - - TNameToClassMap mNameToClasses; - TNameToPropMap mNameToProperties; - Array<ClassDescImpl*> mClasses; - Array<PropDescImpl*> mProperties; - StringTableImpl* mStringTable; - TNameToPropertyMessageMap mPropertyMessageMap; - Array<PropertyMessageDescriptionImpl*> mPropertyMessages; - int32_t mNextClassId; - uint32_t mRefCount; - - PvdObjectModelMetaDataImpl() - : mNameToClasses("NamespacedName->ClassDescImpl*") - , mNameToProperties("ClassPropertyName->PropDescImpl*") - , mClasses("ClassDescImpl*") - , mProperties("PropDescImpl*") - , mStringTable(PVD_NEW(StringTableImpl)()) - , mPropertyMessageMap("PropertyMessageMap") - , mPropertyMessages("PvdObjectModelMetaDataImpl::mPropertyMessages") - , mNextClassId(1) - , mRefCount(0) - { - } - - private: - PvdObjectModelMetaDataImpl& operator=(const PvdObjectModelMetaDataImpl&); - - public: - int32_t nextClassId() - { - return mNextClassId++; - } - void initialize() - { - // Create the default classes. - { - ClassDescImpl& aryData = getOrCreateClassImpl(getPvdNamespacedNameForType<ArrayData>(), - DataTypeToPvdTypeMap<ArrayData>::BaseTypeEnum); - aryData.get32BitSize() = sizeof(ArrayData); - aryData.get32BitSizeInfo().mAlignment = sizeof(void*); - aryData.get64BitSize() = sizeof(ArrayData); - aryData.get64BitSizeInfo().mAlignment = sizeof(void*); - aryData.mLocked = true; - } -#define CREATE_BASIC_PVD_CLASS(type) \ - { \ - ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<type>(), getPvdTypeForType<type>()); \ - cls.get32BitSize() = sizeof(type); \ - cls.get32BitSizeInfo().mAlignment = sizeof(type); \ - cls.get64BitSize() = sizeof(type); \ - cls.get64BitSizeInfo().mAlignment = sizeof(type); \ - cls.mLocked = true; \ - cls.mPackedUniformWidth = sizeof(type); \ - cls.mPackedClassType = getPvdTypeForType<type>(); \ - } - CREATE_BASIC_PVD_CLASS(int8_t) - CREATE_BASIC_PVD_CLASS(uint8_t) - CREATE_BASIC_PVD_CLASS(bool) - CREATE_BASIC_PVD_CLASS(int16_t) - CREATE_BASIC_PVD_CLASS(uint16_t) - CREATE_BASIC_PVD_CLASS(int32_t) - CREATE_BASIC_PVD_CLASS(uint32_t) - // CREATE_BASIC_PVD_CLASS(uint32_t) - CREATE_BASIC_PVD_CLASS(int64_t) - CREATE_BASIC_PVD_CLASS(uint64_t) - CREATE_BASIC_PVD_CLASS(float) - CREATE_BASIC_PVD_CLASS(double) -#undef CREATE_BASIC_PVD_CLASS - -#define CREATE_PTR_TYPE_PVD_CLASS(type, ptrType) \ - { \ - ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<type>(), getPvdTypeForType<type>()); \ - cls.get32BitSize() = 4; \ - cls.get32BitSizeInfo().mAlignment = 4; \ - cls.get64BitSize() = 8; \ - cls.get64BitSizeInfo().mAlignment = 8; \ - cls.mLocked = true; \ - cls.addPtrOffset(PtrOffsetType::ptrType, 0, 0); \ - } - - CREATE_PTR_TYPE_PVD_CLASS(String, StringOffset) - CREATE_PTR_TYPE_PVD_CLASS(VoidPtr, VoidPtrOffset) - CREATE_PTR_TYPE_PVD_CLASS(StringHandle, StringOffset) - CREATE_PTR_TYPE_PVD_CLASS(ObjectRef, VoidPtrOffset) - -#undef CREATE_64BIT_ADJUST_PVD_CLASS - - int32_t fltClassType = getPvdTypeForType<float>(); - int32_t u32ClassType = getPvdTypeForType<uint32_t>(); - int32_t v3ClassType = getPvdTypeForType<PxVec3>(); - int32_t v4ClassType = getPvdTypeForType<PxVec4>(); - int32_t qtClassType = getPvdTypeForType<PxQuat>(); - { - ClassDescImpl& cls = - getOrCreateClassImpl(getPvdNamespacedNameForType<PvdColor>(), getPvdTypeForType<PvdColor>()); - createProperty(cls.mClassId, "r", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar); - createProperty(cls.mClassId, "g", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar); - createProperty(cls.mClassId, "b", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar); - createProperty(cls.mClassId, "a", "", getPvdTypeForType<uint8_t>(), PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 1); - PX_ASSERT(cls.get32BitSize() == 4); - PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 1); - PX_ASSERT(cls.get64BitSize() == 4); - PX_ASSERT(cls.mPackedUniformWidth == 1); - PX_ASSERT(cls.mPackedClassType == getPvdTypeForType<uint8_t>()); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxVec2>(), getPvdTypeForType<PxVec2>()); - createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 8); - PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get64BitSize() == 8); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - { - ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxVec3>(), getPvdTypeForType<PxVec3>()); - createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 12); - PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get64BitSize() == 12); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - { - ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxVec4>(), getPvdTypeForType<PxVec4>()); - createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "w", "", fltClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 16); - PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get64BitSize() == 16); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = getOrCreateClassImpl(getPvdNamespacedNameForType<PxQuat>(), getPvdTypeForType<PxQuat>()); - createProperty(cls.mClassId, "x", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "y", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "z", "", fltClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "w", "", fltClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 16); - PX_ASSERT(cls.get64BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get64BitSize() == 16); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = - getOrCreateClassImpl(getPvdNamespacedNameForType<PxBounds3>(), getPvdTypeForType<PxBounds3>()); - createProperty(cls.mClassId, "minimum", "", v3ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "maximum", "", v3ClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 24); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = - getOrCreateClassImpl(getPvdNamespacedNameForType<PxTransform>(), getPvdTypeForType<PxTransform>()); - createProperty(cls.mClassId, "q", "", qtClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "p", "", v3ClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 28); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = - getOrCreateClassImpl(getPvdNamespacedNameForType<PxMat33>(), getPvdTypeForType<PxMat33>()); - createProperty(cls.mClassId, "column0", "", v3ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "column1", "", v3ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "column2", "", v3ClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 36); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = - getOrCreateClassImpl(getPvdNamespacedNameForType<PxMat44>(), getPvdTypeForType<PxMat44>()); - createProperty(cls.mClassId, "column0", "", v4ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "column1", "", v4ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "column2", "", v4ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "column3", "", v4ClassType, PropertyType::Scalar); - PX_ASSERT(cls.get32BitSizeInfo().mAlignment == 4); - PX_ASSERT(cls.get32BitSize() == 64); - PX_ASSERT(cls.mPackedUniformWidth == 4); - PX_ASSERT(cls.mPackedClassType == fltClassType); - cls.mLocked = true; - } - - { - ClassDescImpl& cls = - getOrCreateClassImpl(getPvdNamespacedNameForType<U32Array4>(), getPvdTypeForType<U32Array4>()); - createProperty(cls.mClassId, "d0", "", u32ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "d1", "", u32ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "d2", "", u32ClassType, PropertyType::Scalar); - createProperty(cls.mClassId, "d3", "", u32ClassType, PropertyType::Scalar); - cls.mLocked = true; - } - } - virtual ~PvdObjectModelMetaDataImpl() - { - mStringTable->release(); - PVD_FOREACH(idx, mClasses.size()) - { - if(mClasses[idx] != NULL) - PVD_DELETE(mClasses[idx]); - } - mClasses.clear(); - PVD_FOREACH(idx, mProperties.size()) PVD_DELETE(mProperties[idx]); - mProperties.clear(); - PVD_FOREACH(idx, mPropertyMessages.size()) PVD_DELETE(mPropertyMessages[idx]); - mPropertyMessages.clear(); - } - - ClassDescImpl& getOrCreateClassImpl(const NamespacedName& nm, int32_t idx) - { - ClassDescImpl* impl(getClassImpl(idx)); - if(impl) - return *impl; - NamespacedName safeName(mStringTable->registerStr(nm.mNamespace), mStringTable->registerStr(nm.mName)); - while(idx >= int32_t(mClasses.size())) - mClasses.pushBack(NULL); - mClasses[uint32_t(idx)] = PVD_NEW(ClassDescImpl)(ClassDescription(safeName, idx)); - mNameToClasses.insert(nm, mClasses[uint32_t(idx)]); - mNextClassId = PxMax(mNextClassId, idx + 1); - return *mClasses[uint32_t(idx)]; - } - - ClassDescImpl& getOrCreateClassImpl(const NamespacedName& nm) - { - ClassDescImpl* retval = findClassImpl(nm); - if(retval) - return *retval; - return getOrCreateClassImpl(nm, nextClassId()); - } - virtual ClassDescription getOrCreateClass(const NamespacedName& nm) - { - return getOrCreateClassImpl(nm); - } - // get or create parent, lock parent. deriveFrom getOrCreatechild. - virtual bool deriveClass(const NamespacedName& parent, const NamespacedName& child) - { - ClassDescImpl& p(getOrCreateClassImpl(parent)); - ClassDescImpl& c(getOrCreateClassImpl(child)); - - if(c.mBaseClass >= 0) - { - PX_ASSERT(c.mBaseClass == p.mClassId); - return false; - } - p.mLocked = true; - c.mBaseClass = p.mClassId; - c.get32BitSizeInfo() = p.get32BitSizeInfo(); - c.get64BitSizeInfo() = p.get64BitSizeInfo(); - c.mPackedClassType = p.mPackedClassType; - c.mPackedUniformWidth = p.mPackedUniformWidth; - c.mRequiresDestruction = p.mRequiresDestruction; - c.m32OffsetArray = p.m32OffsetArray; - c.m64OffsetArray = p.m64OffsetArray; - // Add all the parent propertes to this class in the global name map. - for(ClassDescImpl* parent0 = &p; parent0 != NULL; parent0 = getClassImpl(parent0->mBaseClass)) - { - PVD_FOREACH(idx, parent0->mPropImps.size()) - mNameToProperties.insert(ClassPropertyName(c.mName, parent0->mPropImps[idx]->mName), parent0->mPropImps[idx]); - - if(parent0->mBaseClass < 0) - break; - } - - return true; - } - ClassDescImpl* findClassImpl(const NamespacedName& nm) const - { - const TNameToClassMap::Entry* entry(mNameToClasses.find(nm)); - if(entry) - return entry->second; - return NULL; - } - virtual Option<ClassDescription> findClass(const NamespacedName& nm) const - { - ClassDescImpl* retval = findClassImpl(nm); - if(retval) - return *retval; - return Option<ClassDescription>(); - } - - ClassDescImpl* getClassImpl(int32_t classId) const - { - if(classId < 0) - return NULL; - uint32_t idx = uint32_t(classId); - if(idx < mClasses.size()) - return mClasses[idx]; - return NULL; - } - - virtual Option<ClassDescription> getClass(int32_t classId) const - { - ClassDescImpl* impl(getClassImpl(classId)); - if(impl) - return *impl; - return None(); - } - - virtual ClassDescription* getClassPtr(int32_t classId) const - { - return getClassImpl(classId); - } - - virtual Option<ClassDescription> getParentClass(int32_t classId) const - { - ClassDescImpl* impl(getClassImpl(classId)); - if(impl == NULL) - return None(); - return getClass(impl->mBaseClass); - } - - virtual void lockClass(int32_t classId) - { - ClassDescImpl* impl(getClassImpl(classId)); - PX_ASSERT(impl); - if(impl) - impl->mLocked = true; - } - virtual uint32_t getNbClasses() const - { - uint32_t total = 0; - PVD_FOREACH(idx, mClasses.size()) if(mClasses[idx])++ total; - return total; - } - - virtual uint32_t getClasses(ClassDescription* outClasses, uint32_t requestCount, uint32_t startIndex = 0) const - { - uint32_t classCount(getNbClasses()); - startIndex = PxMin(classCount, startIndex); - uint32_t retAmount = PxMin(requestCount, classCount - startIndex); - - uint32_t idx = 0; - while(startIndex) - { - if(mClasses[idx] != NULL) - --startIndex; - ++idx; - } - - uint32_t inserted = 0; - uint32_t classesSize = static_cast<uint32_t>(mClasses.size()); - while(inserted < retAmount && idx < classesSize) - { - if(mClasses[idx] != NULL) - { - outClasses[inserted] = *mClasses[idx]; - ++inserted; - } - ++idx; - } - return inserted; - } - - uint32_t updateByteSizeAndGetPropertyAlignment(ClassDescriptionSizeInfo& dest, const ClassDescriptionSizeInfo& src) - { - uint32_t alignment = src.mAlignment; - dest.mAlignment = PxMax(dest.mAlignment, alignment); - uint32_t offset = align(dest.mDataByteSize, alignment); - dest.mDataByteSize = offset + src.mByteSize; - dest.mByteSize = align(dest.mDataByteSize, dest.mAlignment); - return offset; - } - - void transferPtrOffsets(ClassDescriptionSizeInfo& destInfo, Array<PtrOffset>& destArray, - const Array<PtrOffset>& src, uint32_t offset) - { - PVD_FOREACH(idx, src.size()) - destArray.pushBack(PtrOffset(src[idx].mOffsetType, src[idx].mOffset + offset)); - destInfo.mPtrOffsets = DataRef<PtrOffset>(destArray.begin(), destArray.end()); - } - - virtual Option<PropertyDescription> createProperty(int32_t classId, String name, String semantic, int32_t datatype, - PropertyType::Enum propertyType) - { - ClassDescImpl* cls(getClassImpl(classId)); - PX_ASSERT(cls); - if(!cls) - return None(); - if(cls->mLocked) - { - PX_ASSERT(false); - return None(); - } - PropDescImpl* impl(cls->findProperty(name)); - // duplicate property definition - if(impl) - { - PX_ASSERT(false); - return None(); - } - if(datatype == getPvdTypeForType<String>()) - { - PX_ASSERT(false); - return None(); - } - // The datatype for this property has not been declared. - ClassDescImpl* propDType(getClassImpl(datatype)); - PX_ASSERT(propDType); - if(!propDType) - return None(); - NamespacedName propClsName(propDType->mName); - int32_t propPackedWidth = propDType->mPackedUniformWidth; - int32_t propPackedType = propDType->mPackedClassType; - // The implications of properties being complex types aren't major - //*until* you start trying to undue a property event that set values - // of those complex types. Then things just get too complex. - if(propDType->mRequiresDestruction) - { - PX_ASSERT(false); - return None(); - } - bool requiresDestruction = propDType->mRequiresDestruction || cls->mRequiresDestruction; - - if(propertyType == PropertyType::Array) - { - int32_t tempId = DataTypeToPvdTypeMap<ArrayData>::BaseTypeEnum; - propDType = getClassImpl(tempId); - PX_ASSERT(propDType); - if(!propDType) - return None(); - requiresDestruction = true; - } - uint32_t offset32 = updateByteSizeAndGetPropertyAlignment(cls->get32BitSizeInfo(), propDType->get32BitSizeInfo()); - uint32_t offset64 = updateByteSizeAndGetPropertyAlignment(cls->get64BitSizeInfo(), propDType->get64BitSizeInfo()); - transferPtrOffsets(cls->get32BitSizeInfo(), cls->m32OffsetArray, propDType->m32OffsetArray, offset32); - transferPtrOffsets(cls->get64BitSizeInfo(), cls->m64OffsetArray, propDType->m64OffsetArray, offset64); - propDType->mLocked = true; // Can't add members to the property type. - cls->mRequiresDestruction = requiresDestruction; - int32_t propId = int32_t(mProperties.size()); - PropertyDescription newDesc(cls->mName, cls->mClassId, name, semantic, datatype, propClsName, propertyType, - propId, offset32, offset64); - mProperties.pushBack(PVD_NEW(PropDescImpl)(newDesc, *mStringTable)); - mNameToProperties.insert(ClassPropertyName(cls->mName, mProperties.back()->mName), mProperties.back()); - cls->addProperty(mProperties.back()); - bool firstProp = cls->mPropImps.size() == 1; - - if(firstProp) - { - cls->mPackedUniformWidth = propPackedWidth; - cls->mPackedClassType = propPackedType; - } - else - { - bool packed = (propPackedWidth > 0) && (cls->get32BitSizeInfo().mDataByteSize % propPackedWidth) == 0; - if(cls->mPackedClassType >= 0) // maybe uncheck packed class type - { - if(propPackedType < 0 || cls->mPackedClassType != propPackedType - // Object refs require conversion from stream to db id - || - datatype == getPvdTypeForType<ObjectRef>() - // Strings also require conversion from stream to db id. - || - datatype == getPvdTypeForType<StringHandle>() || packed == false) - cls->mPackedClassType = -1; - } - if(cls->mPackedUniformWidth >= 0) // maybe uncheck packed class width - { - if(propPackedWidth < 0 || cls->mPackedUniformWidth != propPackedWidth - // object refs, because they require special treatment during parsing, - // cannot be packed - || - datatype == getPvdTypeForType<ObjectRef>() - // Likewise, string handles are special because the data needs to be sent *after* - // the - || - datatype == getPvdTypeForType<StringHandle>() || packed == false) - cls->mPackedUniformWidth = -1; // invalid packed width. - } - } - return *mProperties.back(); - } - - PropDescImpl* findPropImpl(const NamespacedName& clsName, String prop) const - { - const TNameToPropMap::Entry* entry = mNameToProperties.find(ClassPropertyName(clsName, prop)); - if(entry) - return entry->second; - return NULL; - } - virtual Option<PropertyDescription> findProperty(const NamespacedName& cls, String propName) const - { - PropDescImpl* prop(findPropImpl(cls, propName)); - if(prop) - return *prop; - return None(); - } - - virtual Option<PropertyDescription> findProperty(int32_t clsId, String propName) const - { - ClassDescImpl* cls(getClassImpl(clsId)); - PX_ASSERT(cls); - if(!cls) - return None(); - PropDescImpl* prop(findPropImpl(cls->mName, propName)); - if(prop) - return *prop; - return None(); - } - - PropDescImpl* getPropertyImpl(int32_t propId) const - { - PX_ASSERT(propId >= 0); - if(propId < 0) - return NULL; - uint32_t val = uint32_t(propId); - if(val >= mProperties.size()) - { - PX_ASSERT(false); - return NULL; - } - return mProperties[val]; - } - - virtual Option<PropertyDescription> getProperty(int32_t propId) const - { - PropDescImpl* impl(getPropertyImpl(propId)); - if(impl) - return *impl; - return None(); - } - - virtual void setNamedPropertyValues(DataRef<NamedValue> values, int32_t propId) - { - PropDescImpl* impl(getPropertyImpl(propId)); - if(impl) - { - impl->mValueNames.resize(values.size()); - PVD_FOREACH(idx, values.size()) impl->mValueNames[idx] = values[idx]; - } - } - - virtual DataRef<NamedValue> getNamedPropertyValues(int32_t propId) const - { - PropDescImpl* impl(getPropertyImpl(propId)); - if(impl) - { - return toDataRef(impl->mValueNames); - } - return DataRef<NamedValue>(); - } - - virtual uint32_t getNbProperties(int32_t classId) const - { - uint32_t retval = 0; - for(ClassDescImpl* impl(getClassImpl(classId)); impl; impl = getClassImpl(impl->mBaseClass)) - { - retval += impl->mPropImps.size(); - if(impl->mBaseClass < 0) - break; - } - return retval; - } - - // Properties need to be returned in base class order, so this requires a recursive function. - uint32_t getPropertiesImpl(int32_t classId, PropertyDescription*& outBuffer, uint32_t& numItems, - uint32_t& startIdx) const - { - ClassDescImpl* impl = getClassImpl(classId); - if(impl) - { - uint32_t retval = 0; - if(impl->mBaseClass >= 0) - retval = getPropertiesImpl(impl->mBaseClass, outBuffer, numItems, startIdx); - - uint32_t localStart = PxMin(impl->mPropImps.size(), startIdx); - uint32_t localNumItems = PxMin(numItems, impl->mPropImps.size() - localStart); - PVD_FOREACH(idx, localNumItems) - { - outBuffer[idx] = *impl->mPropImps[localStart + idx]; - } - - startIdx -= localStart; - numItems -= localNumItems; - outBuffer += localNumItems; - return retval + localNumItems; - } - return 0; - } - - virtual uint32_t getProperties(int32_t classId, PropertyDescription* outBuffer, uint32_t numItems, - uint32_t startIdx) const - { - return getPropertiesImpl(classId, outBuffer, numItems, startIdx); - } - - virtual MarshalQueryResult checkMarshalling(int32_t srcClsId, int32_t dstClsId) const - { - Option<ClassDescription> propTypeOpt(getClass(dstClsId)); - if(propTypeOpt.hasValue() == false) - { - PX_ASSERT(false); - return MarshalQueryResult(); - } - const ClassDescription& propType(propTypeOpt); - - Option<ClassDescription> incomingTypeOpt(getClass(srcClsId)); - if(incomingTypeOpt.hasValue() == false) - { - PX_ASSERT(false); - return MarshalQueryResult(); - } - const ClassDescription& incomingType(incomingTypeOpt); - // Can only marshal simple things at this point in time. - bool needsMarshalling = false; - bool canMarshal = false; - TSingleMarshaller single = NULL; - TBlockMarshaller block = NULL; - if(incomingType.mClassId != propType.mClassId) - { - // Check that marshalling is even possible. - if((incomingType.mPackedUniformWidth >= 0 && propType.mPackedUniformWidth >= 0) == false) - { - PX_ASSERT(false); - return MarshalQueryResult(); - } - - int32_t srcType = incomingType.mPackedClassType; - int32_t dstType = propType.mPackedClassType; - - int32_t srcWidth = incomingType.mPackedUniformWidth; - int32_t dstWidth = propType.mPackedUniformWidth; - canMarshal = getMarshalOperators(single, block, srcType, dstType); - if(srcWidth == dstWidth) - needsMarshalling = canMarshal; // If the types are the same width, we assume we can convert between some - // of them seamlessly (uint16_t, int16_t) - else - { - needsMarshalling = true; - // If we can't marshall and we have to then we can't set the property value. - // This indicates that the src and dest are different properties and we don't - // know how to convert between them. - if(!canMarshal) - { - PX_ASSERT(false); - return MarshalQueryResult(); - } - } - } - return MarshalQueryResult(srcClsId, dstClsId, canMarshal, needsMarshalling, block); - } - - PropertyMessageDescriptionImpl* findPropertyMessageImpl(const NamespacedName& messageName) const - { - const TNameToPropertyMessageMap::Entry* entry = mPropertyMessageMap.find(messageName); - if(entry) - return entry->second; - return NULL; - } - - PropertyMessageDescriptionImpl* getPropertyMessageImpl(int32_t msg) const - { - int32_t msgCount = int32_t(mPropertyMessages.size()); - if(msg >= 0 && msg < msgCount) - return mPropertyMessages[uint32_t(msg)]; - return NULL; - } - - virtual Option<PropertyMessageDescription> createPropertyMessage(const NamespacedName& clsName, - const NamespacedName& messageName, - DataRef<PropertyMessageArg> entries, - uint32_t messageSize) - { - PropertyMessageDescriptionImpl* existing(findPropertyMessageImpl(messageName)); - if(existing) - { - PX_ASSERT(false); - return None(); - } - ClassDescImpl* cls = findClassImpl(clsName); - PX_ASSERT(cls); - if(!cls) - return None(); - int32_t msgId = int32_t(mPropertyMessages.size()); - PropertyMessageDescriptionImpl* newMessage = PVD_NEW(PropertyMessageDescriptionImpl)( - PropertyMessageDescription(mStringTable->registerName(clsName), cls->mClassId, - mStringTable->registerName(messageName), msgId, messageSize)); - uint32_t calculatedSize = 0; - PVD_FOREACH(idx, entries.size()) - { - PropertyMessageArg entry(entries[idx]); - ClassDescImpl* dtypeCls = findClassImpl(entry.mDatatypeName); - if(dtypeCls == NULL) - { - PX_ASSERT(false); - goto DestroyNewMessage; - } - ClassDescriptionSizeInfo dtypeInfo(dtypeCls->get32BitSizeInfo()); - uint32_t incomingSize = dtypeInfo.mByteSize; - if(entry.mByteSize < incomingSize) - { - PX_ASSERT(false); - goto DestroyNewMessage; - } - - calculatedSize = PxMax(calculatedSize, entry.mMessageOffset + entry.mByteSize); - if(calculatedSize > messageSize) - { - PX_ASSERT(false); - goto DestroyNewMessage; - } - - Option<PropertyDescription> propName(findProperty(cls->mClassId, entry.mPropertyName)); - if(propName.hasValue() == false) - { - PX_ASSERT(false); - goto DestroyNewMessage; - } - - Option<ClassDescription> propCls(getClass(propName.getValue().mDatatype)); - if(propCls.hasValue() == false) - { - PX_ASSERT(false); - goto DestroyNewMessage; - } - - PropertyMessageEntryImpl newEntry(PropertyMessageEntry( - propName, dtypeCls->mName, dtypeCls->mClassId, entry.mMessageOffset, incomingSize, dtypeInfo.mByteSize)); - newMessage->addEntry(newEntry); - - if(newEntry.mDatatypeId == getPvdTypeForType<String>()) - newMessage->mStringOffsetArray.pushBack(entry.mMessageOffset); - - // property messages cannot be marshalled at this time. - if(newEntry.mDatatypeId != getPvdTypeForType<String>() && newEntry.mDatatypeId != getPvdTypeForType<VoidPtr>()) - { - MarshalQueryResult marshalInfo = checkMarshalling(newEntry.mDatatypeId, newEntry.mProperty.mDatatype); - if(marshalInfo.needsMarshalling) - { - PX_ASSERT(false); - goto DestroyNewMessage; - } - } - } - - if(newMessage) - { - newMessage->mStringOffsets = - DataRef<uint32_t>(newMessage->mStringOffsetArray.begin(), newMessage->mStringOffsetArray.end()); - mPropertyMessages.pushBack(newMessage); - mPropertyMessageMap.insert(messageName, newMessage); - return *newMessage; - } - - DestroyNewMessage: - if(newMessage) - PVD_DELETE(newMessage); - - return None(); - } - virtual Option<PropertyMessageDescription> findPropertyMessage(const NamespacedName& msgName) const - { - PropertyMessageDescriptionImpl* desc(findPropertyMessageImpl(msgName)); - if(desc) - return *desc; - return None(); - } - - virtual Option<PropertyMessageDescription> getPropertyMessage(int32_t msgId) const - { - PropertyMessageDescriptionImpl* desc(getPropertyMessageImpl(msgId)); - if(desc) - return *desc; - return None(); - } - - virtual uint32_t getNbPropertyMessages() const - { - return mPropertyMessages.size(); - } - - virtual uint32_t getPropertyMessages(PropertyMessageDescription* msgBuf, uint32_t bufLen, uint32_t startIdx = 0) const - { - startIdx = PxMin(startIdx, getNbPropertyMessages()); - bufLen = PxMin(bufLen, getNbPropertyMessages() - startIdx); - PVD_FOREACH(idx, bufLen) msgBuf[idx] = *mPropertyMessages[idx + startIdx]; - return bufLen; - } - - struct MetaDataWriter - { - const PvdObjectModelMetaDataImpl& mMetaData; - PvdOutputStream& mStream; - MetaDataWriter(const PvdObjectModelMetaDataImpl& meta, PvdOutputStream& stream) - : mMetaData(meta), mStream(stream) - { - } - - void streamify(NamespacedName& type) - { - mStream << mMetaData.mStringTable->strToHandle(type.mNamespace); - mStream << mMetaData.mStringTable->strToHandle(type.mName); - } - void streamify(String& type) - { - mStream << mMetaData.mStringTable->strToHandle(type); - } - void streamify(int32_t& type) - { - mStream << type; - } - void streamify(uint32_t& type) - { - mStream << type; - } - void streamify(uint8_t type) - { - mStream << type; - } - void streamify(bool type) - { - streamify( uint8_t(type)); - } - void streamify(PropertyType::Enum type) - { - uint32_t val = static_cast<uint32_t>(type); - mStream << val; - } - void streamify(NamedValue& type) - { - streamify(type.mValue); - streamify(type.mName); - } - void streamifyLinks(PropDescImpl* prop) - { - streamify(prop->mPropertyId); - } - void streamify(PropertyDescription& prop) - { - streamify(prop.mPropertyId); - } - void streamify(PropertyMessageEntryImpl& prop) - { - prop.serialize(*this); - } - void streamify(PtrOffset& off) - { - uint32_t type = off.mOffsetType; - mStream << type; - mStream << off.mOffset; - } - template <typename TDataType> - void streamify(TDataType* type) - { - int32_t existMarker = type ? 1 : 0; - mStream << existMarker; - if(type) - type->serialize(*this); - } - template <typename TArrayType> - void streamify(const Array<TArrayType>& type) - { - mStream << static_cast<uint32_t>(type.size()); - PVD_FOREACH(idx, type.size()) streamify(const_cast<TArrayType&>(type[idx])); - } - template <typename TArrayType> - void streamifyLinks(const Array<TArrayType>& type) - { - mStream << static_cast<uint32_t>(type.size()); - PVD_FOREACH(idx, type.size()) streamifyLinks(const_cast<TArrayType&>(type[idx])); - } - - private: - MetaDataWriter& operator=(const MetaDataWriter&); - }; - - template <typename TStreamType> - struct MetaDataReader - { - PvdObjectModelMetaDataImpl& mMetaData; - TStreamType& mStream; - MetaDataReader(PvdObjectModelMetaDataImpl& meta, TStreamType& stream) : mMetaData(meta), mStream(stream) - { - } - - void streamify(NamespacedName& type) - { - streamify(type.mNamespace); - streamify(type.mName); - } - - void streamify(String& type) - { - uint32_t handle; - mStream >> handle; - type = mMetaData.mStringTable->handleToStr(handle); - } - void streamify(int32_t& type) - { - mStream >> type; - } - void streamify(uint32_t& type) - { - mStream >> type; - } - void streamify(bool& type) - { - uint8_t data; - mStream >> data; - type = data ? true : false; - } - - void streamify(PropertyType::Enum& type) - { - uint32_t val; - mStream >> val; - type = static_cast<PropertyType::Enum>(val); - } - void streamify(NamedValue& type) - { - streamify(type.mValue); - streamify(type.mName); - } - void streamify(PropertyMessageEntryImpl& type) - { - type.serialize(*this); - } - void streamify(PtrOffset& off) - { - uint32_t type; - mStream >> type; - mStream >> off.mOffset; - off.mOffsetType = static_cast<PtrOffsetType::Enum>(type); - } - void streamifyLinks(PropDescImpl*& prop) - { - int32_t propId; - streamify(propId); - prop = mMetaData.getPropertyImpl(propId); - } - void streamify(PropertyDescription& prop) - { - streamify(prop.mPropertyId); - prop = mMetaData.getProperty(prop.mPropertyId); - } - template <typename TDataType> - void streamify(TDataType*& type) - { - uint32_t existMarker; - mStream >> existMarker; - if(existMarker) - { - TDataType* newType = PVD_NEW(TDataType)(); - newType->serialize(*this); - type = newType; - } - else - type = NULL; - } - template <typename TArrayType> - void streamify(Array<TArrayType>& type) - { - uint32_t typeSize; - mStream >> typeSize; - type.resize(typeSize); - PVD_FOREACH(idx, type.size()) streamify(type[idx]); - } - template <typename TArrayType> - void streamifyLinks(Array<TArrayType>& type) - { - uint32_t typeSize; - mStream >> typeSize; - type.resize(typeSize); - PVD_FOREACH(idx, type.size()) streamifyLinks(type[idx]); - } - - private: - MetaDataReader& operator=(const MetaDataReader&); - }; - - virtual void write(PvdOutputStream& stream) const - { - stream << getCurrentPvdObjectModelVersion(); - stream << mNextClassId; - mStringTable->write(stream); - MetaDataWriter writer(*this, stream); - writer.streamify(mProperties); - writer.streamify(mClasses); - writer.streamify(mPropertyMessages); - } - - template <typename TReaderType> - void read(TReaderType& stream) - { - uint32_t version; - stream >> version; - stream >> mNextClassId; - mStringTable->read(stream); - MetaDataReader<TReaderType> reader(*this, stream); - reader.streamify(mProperties); - reader.streamify(mClasses); - reader.streamify(mPropertyMessages); - - mNameToClasses.clear(); - mNameToProperties.clear(); - mPropertyMessageMap.clear(); - PVD_FOREACH(i, mClasses.size()) - { - ClassDescImpl* cls(mClasses[i]); - if(cls == NULL) - continue; - mNameToClasses.insert(cls->mName, mClasses[i]); - uint32_t propCount = getNbProperties(cls->mClassId); - PropertyDescription descs[16]; - uint32_t offset = 0; - for(uint32_t idx = 0; idx < propCount; idx = offset) - { - uint32_t numProps = getProperties(cls->mClassId, descs, 16, offset); - offset += numProps; - for(uint32_t propIdx = 0; propIdx < numProps; ++propIdx) - { - PropDescImpl* prop = getPropertyImpl(descs[propIdx].mPropertyId); - if(prop) - mNameToProperties.insert(ClassPropertyName(cls->mName, prop->mName), prop); - } - } - } - PVD_FOREACH(idx, mPropertyMessages.size()) - mPropertyMessageMap.insert(mPropertyMessages[idx]->mMessageName, mPropertyMessages[idx]); - } - - virtual PvdObjectModelMetaData& clone() const - { - MemPvdOutputStream tempStream("PvdObjectModelMetaData::clone"); - write(tempStream); - MemPvdInputStream inStream(tempStream); - return create(inStream); - } - - virtual StringTable& getStringTable() const - { - return *mStringTable; - } - virtual void addRef() - { - ++mRefCount; - } - virtual void release() - { - if(mRefCount) - --mRefCount; - if(!mRefCount) - PVD_DELETE(this); - } -}; -} - -uint32_t PvdObjectModelMetaData::getCurrentPvdObjectModelVersion() -{ - return 1; -} - -PvdObjectModelMetaData& PvdObjectModelMetaData::create() -{ - PvdObjectModelMetaDataImpl& retval(*PVD_NEW(PvdObjectModelMetaDataImpl)()); - retval.initialize(); - return retval; -} - -PvdObjectModelMetaData& PvdObjectModelMetaData::create(PvdInputStream& stream) -{ - PvdObjectModelMetaDataImpl& retval(*PVD_NEW(PvdObjectModelMetaDataImpl)()); - retval.read(stream); - return retval; -} - -StringTable& StringTable::create() -{ - return *PVD_NEW(StringTableImpl)(); -} diff --git a/PxShared/src/pvd/src/PxPvdObjectModelMetaData.h b/PxShared/src/pvd/src/PxPvdObjectModelMetaData.h deleted file mode 100644 index 7357708..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectModelMetaData.h +++ /dev/null @@ -1,495 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#ifndef PXPVDSDK_PXPVDOBJECTMODELMETADATA_H -#define PXPVDSDK_PXPVDOBJECTMODELMETADATA_H - -#include "foundation/PxAssert.h" -#include "PxPvdObjectModelBaseTypes.h" -#include "PxPvdBits.h" - -namespace physx -{ -namespace pvdsdk -{ - -class PvdInputStream; -class PvdOutputStream; - -struct PropertyDescription -{ - NamespacedName mOwnerClassName; - int32_t mOwnerClassId; - String mName; - String mSemantic; - // The datatype this property corresponds to. - int32_t mDatatype; - // The name of the datatype - NamespacedName mDatatypeName; - // Scalar or array. - PropertyType::Enum mPropertyType; - // No other property under any class has this id, it is DB-unique. - int32_t mPropertyId; - // Offset in bytes into the object's data section where this property starts. - uint32_t m32BitOffset; - // Offset in bytes into the object's data section where this property starts. - uint32_t m64BitOffset; - - PropertyDescription(const NamespacedName& clsName, int32_t classId, String name, String semantic, int32_t datatype, - const NamespacedName& datatypeName, PropertyType::Enum propType, int32_t propId, - uint32_t offset32, uint32_t offset64) - : mOwnerClassName(clsName) - , mOwnerClassId(classId) - , mName(name) - , mSemantic(semantic) - , mDatatype(datatype) - , mDatatypeName(datatypeName) - , mPropertyType(propType) - , mPropertyId(propId) - , m32BitOffset(offset32) - , m64BitOffset(offset64) - { - } - PropertyDescription() - : mOwnerClassId(-1) - , mName("") - , mSemantic("") - , mDatatype(-1) - , mPropertyType(PropertyType::Unknown) - , mPropertyId(-1) - , m32BitOffset(0) - , m64BitOffset(0) - - { - } - - virtual ~PropertyDescription() - { - } -}; - -struct PtrOffsetType -{ - enum Enum - { - UnknownOffset, - VoidPtrOffset, - StringOffset - }; -}; - -struct PtrOffset -{ - PtrOffsetType::Enum mOffsetType; - uint32_t mOffset; - PtrOffset(PtrOffsetType::Enum type, uint32_t offset) : mOffsetType(type), mOffset(offset) - { - } - PtrOffset() : mOffsetType(PtrOffsetType::UnknownOffset), mOffset(0) - { - } -}; - -inline uint32_t align(uint32_t offset, uint32_t alignment) -{ - uint32_t startOffset = offset; - uint32_t alignmentMask = ~(alignment - 1); - offset = (offset + alignment - 1) & alignmentMask; - PX_ASSERT(offset >= startOffset && (offset % alignment) == 0); - (void)startOffset; - return offset; -} - -struct ClassDescriptionSizeInfo -{ - // The size of the data section of this object, padded to alignment. - uint32_t mByteSize; - // The last data member goes to here. - uint32_t mDataByteSize; - // Alignment in bytes of the data section of this object. - uint32_t mAlignment; - // the offsets of string handles in the binary value of this class - DataRef<PtrOffset> mPtrOffsets; - ClassDescriptionSizeInfo() : mByteSize(0), mDataByteSize(0), mAlignment(0) - { - } -}; - -struct ClassDescription -{ - NamespacedName mName; - // No other class has this id, it is DB-unique - int32_t mClassId; - // Only single derivation supported. - int32_t mBaseClass; - // If this class has properties that are of uniform type, then we note that. - // This means that when deserialization an array of these objects we can just use - // single function to endian convert the entire mess at once. - int32_t mPackedUniformWidth; - // If this class is composed uniformly of members of a given type - // Or all of its properties are composed uniformly of members of - // a give ntype, then this class's packed type is that type. - // PxTransform's packed type would be float. - int32_t mPackedClassType; - // 0: 32Bit 1: 64Bit - ClassDescriptionSizeInfo mSizeInfo[2]; - // No further property additions allowed. - bool mLocked; - // True when this datatype has an array on it that needs to be - // separately deleted. - bool mRequiresDestruction; - - ClassDescription(NamespacedName name, int32_t id) - : mName(name) - , mClassId(id) - , mBaseClass(-1) - , mPackedUniformWidth(-1) - , mPackedClassType(-1) - , mLocked(false) - , mRequiresDestruction(false) - { - } - ClassDescription() - : mClassId(-1), mBaseClass(-1), mPackedUniformWidth(-1), mPackedClassType(-1), mLocked(false), mRequiresDestruction(false) - { - } - virtual ~ClassDescription() - { - } - - ClassDescriptionSizeInfo& get32BitSizeInfo() - { - return mSizeInfo[0]; - } - ClassDescriptionSizeInfo& get64BitSizeInfo() - { - return mSizeInfo[1]; - } - uint32_t& get32BitSize() - { - return get32BitSizeInfo().mByteSize; - } - uint32_t& get64BitSize() - { - return get64BitSizeInfo().mByteSize; - } - - uint32_t get32BitSize() const - { - return mSizeInfo[0].mByteSize; - } - const ClassDescriptionSizeInfo& getNativeSizeInfo() const - { - return mSizeInfo[(sizeof(void*) >> 2) - 1]; - } - uint32_t getNativeSize() const - { - return getNativeSizeInfo().mByteSize; - } -}; - -struct MarshalQueryResult -{ - int32_t srcType; - int32_t dstType; - // If canMarshal != needsMarshalling we have a problem. - bool canMarshal; - bool needsMarshalling; - // Non null if marshalling is possible. - TBlockMarshaller marshaller; - MarshalQueryResult(int32_t _srcType = -1, int32_t _dstType = -1, bool _canMarshal = false, bool _needs = false, - TBlockMarshaller _m = NULL) - : srcType(_srcType), dstType(_dstType), canMarshal(_canMarshal), needsMarshalling(_needs), marshaller(_m) - { - } -}; - -struct PropertyMessageEntry -{ - PropertyDescription mProperty; - NamespacedName mDatatypeName; - // datatype of the data in the message. - int32_t mDatatypeId; - // where in the message this property starts. - uint32_t mMessageOffset; - // size of this entry object - uint32_t mByteSize; - - // If the chain of properties doesn't have any array properties this indicates the - uint32_t mDestByteSize; - - PropertyMessageEntry(PropertyDescription propName, NamespacedName dtypeName, int32_t dtype, uint32_t messageOff, - uint32_t byteSize, uint32_t destByteSize) - : mProperty(propName) - , mDatatypeName(dtypeName) - , mDatatypeId(dtype) - , mMessageOffset(messageOff) - , mByteSize(byteSize) - , mDestByteSize(destByteSize) - { - } - PropertyMessageEntry() : mDatatypeId(-1), mMessageOffset(0), mByteSize(0), mDestByteSize(0) - { - } -}; - -// Create a struct that defines a subset of the properties on an object. -struct PropertyMessageDescription -{ - NamespacedName mClassName; - // No other class has this id, it is DB-unique - int32_t mClassId; - NamespacedName mMessageName; - int32_t mMessageId; - DataRef<PropertyMessageEntry> mProperties; - uint32_t mMessageByteSize; - // Offsets into the property message where const char* items are. - DataRef<uint32_t> mStringOffsets; - PropertyMessageDescription(const NamespacedName& nm, int32_t clsId, const NamespacedName& msgName, int32_t msgId, - uint32_t msgSize) - : mClassName(nm), mClassId(clsId), mMessageName(msgName), mMessageId(msgId), mMessageByteSize(msgSize) - { - } - PropertyMessageDescription() : mClassId(-1), mMessageId(-1), mMessageByteSize(0) - { - } - virtual ~PropertyMessageDescription() - { - } -}; - -class StringTable -{ - protected: - virtual ~StringTable() - { - } - - public: - virtual uint32_t getNbStrs() = 0; - virtual uint32_t getStrs(const char** outStrs, uint32_t bufLen, uint32_t startIdx = 0) = 0; - virtual const char* registerStr(const char* str, bool& outAdded) = 0; - const char* registerStr(const char* str) - { - bool ignored; - return registerStr(str, ignored); - } - virtual StringHandle strToHandle(const char* str) = 0; - virtual const char* handleToStr(uint32_t hdl) = 0; - virtual void release() = 0; - - static StringTable& create(); -}; - -struct None -{ -}; - -template <typename T> -class Option -{ - T mValue; - bool mHasValue; - - public: - Option(const T& val) : mValue(val), mHasValue(true) - { - } - Option(None nothing = None()) : mHasValue(false) - { - (void)nothing; - } - Option(const Option& other) : mValue(other.mValue), mHasValue(other.mHasValue) - { - } - Option& operator=(const Option& other) - { - mValue = other.mValue; - mHasValue = other.mHasValue; - return *this; - } - bool hasValue() const - { - return mHasValue; - } - const T& getValue() const - { - PX_ASSERT(hasValue()); - return mValue; - } - T& getValue() - { - PX_ASSERT(hasValue()); - return mValue; - } - operator const T&() const - { - return getValue(); - } - operator T&() - { - return getValue(); - } - T* operator->() - { - return &getValue(); - } - const T* operator->() const - { - return &getValue(); - } -}; - -/** - * Create new classes and add properties to some existing ones. - * The default classes are created already, the simple types - * along with the basic math types. - * (uint8_t, int8_t, etc ) - * (PxVec3, PxQuat, PxTransform, PxMat33, PxMat34, PxMat44) - */ -class PvdObjectModelMetaData -{ - protected: - virtual ~PvdObjectModelMetaData() - { - } - - public: - virtual ClassDescription getOrCreateClass(const NamespacedName& nm) = 0; - // get or create parent, lock parent. deriveFrom getOrCreatechild. - virtual bool deriveClass(const NamespacedName& parent, const NamespacedName& child) = 0; - virtual Option<ClassDescription> findClass(const NamespacedName& nm) const = 0; - template <typename TDataType> - Option<ClassDescription> findClass() - { - return findClass(getPvdNamespacedNameForType<TDataType>()); - } - virtual Option<ClassDescription> getClass(int32_t classId) const = 0; - virtual ClassDescription* getClassPtr(int32_t classId) const = 0; - - virtual Option<ClassDescription> getParentClass(int32_t classId) const = 0; - bool isDerivedFrom(int32_t classId, int32_t parentClass) const - { - if(classId == parentClass) - return true; - ClassDescription* p = getClassPtr(getClassPtr(classId)->mBaseClass); - while(p != NULL) - { - if(p->mClassId == parentClass) - return true; - p = getClassPtr(p->mBaseClass); - } - return false; - } - - virtual void lockClass(int32_t classId) = 0; - - virtual uint32_t getNbClasses() const = 0; - virtual uint32_t getClasses(ClassDescription* outClasses, uint32_t requestCount, uint32_t startIndex = 0) const = 0; - - // Create a nested property. - // This way you can have obj.p.x without explicity defining the class p. - virtual Option<PropertyDescription> createProperty(int32_t classId, String name, String semantic, int32_t datatype, - PropertyType::Enum propertyType = PropertyType::Scalar) = 0; - Option<PropertyDescription> createProperty(NamespacedName clsId, String name, String semantic, NamespacedName dtype, - PropertyType::Enum propertyType = PropertyType::Scalar) - { - return createProperty(findClass(clsId)->mClassId, name, semantic, findClass(dtype)->mClassId, propertyType); - } - Option<PropertyDescription> createProperty(NamespacedName clsId, String name, NamespacedName dtype, - PropertyType::Enum propertyType = PropertyType::Scalar) - { - return createProperty(findClass(clsId)->mClassId, name, "", findClass(dtype)->mClassId, propertyType); - } - Option<PropertyDescription> createProperty(int32_t clsId, String name, int32_t dtype, - PropertyType::Enum propertyType = PropertyType::Scalar) - { - return createProperty(clsId, name, "", dtype, propertyType); - } - template <typename TDataType> - Option<PropertyDescription> createProperty(int32_t clsId, String name, String semantic = "", - PropertyType::Enum propertyType = PropertyType::Scalar) - { - return createProperty(clsId, name, semantic, getPvdNamespacedNameForType<TDataType>(), propertyType); - } - virtual Option<PropertyDescription> findProperty(const NamespacedName& cls, String prop) const = 0; - virtual Option<PropertyDescription> findProperty(int32_t clsId, String prop) const = 0; - virtual Option<PropertyDescription> getProperty(int32_t propId) const = 0; - virtual void setNamedPropertyValues(DataRef<NamedValue> values, int32_t propId) = 0; - // for enumerations and flags. - virtual DataRef<NamedValue> getNamedPropertyValues(int32_t propId) const = 0; - - virtual uint32_t getNbProperties(int32_t classId) const = 0; - virtual uint32_t getProperties(int32_t classId, PropertyDescription* outBuffer, uint32_t bufCount, - uint32_t startIdx = 0) const = 0; - - // Check that a property path, starting at the given class id and first property is value. Return the resolved - // properties. - // outbuffer.size *must* equal the propPath.size(). - Option<PropertyDescription> resolvePropertyPath(int32_t clsId, const int32_t propId) const - { - Option<PropertyDescription> prop(getProperty(propId)); - if(prop.hasValue() == false) - return prop; - if(isDerivedFrom(clsId, prop.getValue().mOwnerClassId) == false) - return None(); - return prop; - } - // Does one cls id differ marshalling to another and if so return the functions to do it. - virtual MarshalQueryResult checkMarshalling(int32_t srcClsId, int32_t dstClsId) const = 0; - - // messages and classes are stored in separate maps, so a property message can have the same name as a class. - virtual Option<PropertyMessageDescription> createPropertyMessage(const NamespacedName& cls, - const NamespacedName& msgName, - DataRef<PropertyMessageArg> entries, - uint32_t messageSize) = 0; - virtual Option<PropertyMessageDescription> findPropertyMessage(const NamespacedName& msgName) const = 0; - virtual Option<PropertyMessageDescription> getPropertyMessage(int32_t msgId) const = 0; - - virtual uint32_t getNbPropertyMessages() const = 0; - virtual uint32_t getPropertyMessages(PropertyMessageDescription* msgBuf, uint32_t bufLen, - uint32_t startIdx = 0) const = 0; - - virtual StringTable& getStringTable() const = 0; - - virtual void write(PvdOutputStream& stream) const = 0; - void save(PvdOutputStream& stream) const - { - write(stream); - } - - virtual PvdObjectModelMetaData& clone() const = 0; - - virtual void addRef() = 0; - virtual void release() = 0; - - static uint32_t getCurrentPvdObjectModelVersion(); - static PvdObjectModelMetaData& create(); - static PvdObjectModelMetaData& create(PvdInputStream& stream); -}; -} -} -#endif // PXPVDSDK_PXPVDOBJECTMODELMETADATA_H diff --git a/PxShared/src/pvd/src/PxPvdObjectRegistrar.cpp b/PxShared/src/pvd/src/PxPvdObjectRegistrar.cpp deleted file mode 100644 index 67667f9..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectRegistrar.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "PxPvdObjectRegistrar.h" - -namespace physx -{ -namespace pvdsdk -{ - -bool ObjectRegistrar::addItem(const void* inItem) -{ - physx::shdfnd::Mutex::ScopedLock lock(mRefCountMapLock); - - if(mRefCountMap.find(inItem)) - { - uint32_t& counter = mRefCountMap[inItem]; - counter++; - return false; - } - else - { - mRefCountMap.insert(inItem, 1); - return true; - } -} - -bool ObjectRegistrar::decItem(const void* inItem) -{ - physx::shdfnd::Mutex::ScopedLock lock(mRefCountMapLock); - const physx::shdfnd::HashMap<const void*, uint32_t>::Entry* entry = mRefCountMap.find(inItem); - if(entry) - { - uint32_t& retval(const_cast<uint32_t&>(entry->second)); - if(retval) - --retval; - uint32_t theValue = retval; - if(theValue == 0) - { - mRefCountMap.erase(inItem); - return true; - } - } - return false; -} - -void ObjectRegistrar::clear() -{ - physx::shdfnd::Mutex::ScopedLock lock(mRefCountMapLock); - mRefCountMap.clear(); -} - -} // pvdsdk -} // physx diff --git a/PxShared/src/pvd/src/PxPvdObjectRegistrar.h b/PxShared/src/pvd/src/PxPvdObjectRegistrar.h deleted file mode 100644 index dbd9ebc..0000000 --- a/PxShared/src/pvd/src/PxPvdObjectRegistrar.h +++ /dev/null @@ -1,71 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDOBJECTREGISTRAR_H -#define PXPVDSDK_PXPVDOBJECTREGISTRAR_H - -/** \addtogroup pvd -@{ -*/ - -#include "PsHashMap.h" -#include "PsMutex.h" - -#if !PX_DOXYGEN -namespace physx -{ -namespace pvdsdk -{ -#endif -class ObjectRegistrar -{ - PX_NOCOPY(ObjectRegistrar) - public: - ObjectRegistrar() - { - } - virtual ~ObjectRegistrar() - { - } - - bool addItem(const void* inItem); - bool decItem(const void* inItem); - void clear(); - - private: - physx::shdfnd::HashMap<const void*, uint32_t> mRefCountMap; - physx::shdfnd::Mutex mRefCountMapLock; -}; -#if !PX_DOXYGEN -} // pvdsdk -} // physx -#endif - -/** @} */ -#endif // PXPVDSDK_PXPVDOBJECTREGISTRAR_H diff --git a/PxShared/src/pvd/src/PxPvdProfileZoneClient.cpp b/PxShared/src/pvd/src/PxPvdProfileZoneClient.cpp deleted file mode 100644 index 8d8582c..0000000 --- a/PxShared/src/pvd/src/PxPvdProfileZoneClient.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#include "pvd/PxPvdTransport.h" - -#include "PxPvdImpl.h" -#include "PxPvdProfileZoneClient.h" -#include "PxProfileZone.h" - -namespace physx -{ -namespace pvdsdk -{ -struct ProfileZoneClient : public profile::PxProfileZoneClient, public shdfnd::UserAllocated -{ - profile::PxProfileZone& mZone; - PvdDataStream& mStream; - - ProfileZoneClient(profile::PxProfileZone& zone, PvdDataStream& stream) : mZone(zone), mStream(stream) - { - } - - ~ProfileZoneClient() - { - mZone.removeClient(*this); - } - - virtual void createInstance() - { - mStream.addProfileZone(&mZone, mZone.getName()); - mStream.createInstance(&mZone); - mZone.addClient(*this); - profile::PxProfileNames names(mZone.getProfileNames()); - PVD_FOREACH(idx, names.eventCount) - { - handleEventAdded(names.events[idx]); - } - } - - virtual void handleEventAdded(const profile::PxProfileEventName& inName) - { - mStream.addProfileZoneEvent(&mZone, inName.name, inName.eventId.eventId, inName.eventId.compileTimeEnabled); - } - - virtual void handleBufferFlush(const uint8_t* inData, uint32_t inLength) - { - mStream.setPropertyValue(&mZone, "events", inData, inLength); - } - - virtual void handleClientRemoved() - { - mStream.destroyInstance(&mZone); - } - - private: - ProfileZoneClient& operator=(const ProfileZoneClient&); -}; -} -} - -using namespace physx; -using namespace pvdsdk; - -PvdProfileZoneClient::PvdProfileZoneClient(PvdImpl& pvd) : mSDKPvd(pvd), mPvdDataStream(NULL), mIsConnected(false) -{ -} - -PvdProfileZoneClient::~PvdProfileZoneClient() -{ - mSDKPvd.removeClient(this); - // all zones should removed - PX_ASSERT(mProfileZoneClients.size() == 0); -} - -PvdDataStream* PvdProfileZoneClient::getDataStream() -{ - return mPvdDataStream; -} - -PvdUserRenderer* PvdProfileZoneClient::getUserRender() -{ - PX_ASSERT(0); - return NULL; -} - -void PvdProfileZoneClient::setObjectRegistrar(ObjectRegistrar*) -{ -} - -bool PvdProfileZoneClient::isConnected() const -{ - return mIsConnected; -} - -void PvdProfileZoneClient::onPvdConnected() -{ - if(mIsConnected) - return; - mIsConnected = true; - - mPvdDataStream = PvdDataStream::create(&mSDKPvd); - -} - -void PvdProfileZoneClient::onPvdDisconnected() -{ - if(!mIsConnected) - return; - - mIsConnected = false; - flush(); - - mPvdDataStream->release(); - mPvdDataStream = NULL; -} - -void PvdProfileZoneClient::flush() -{ - PVD_FOREACH(idx, mProfileZoneClients.size()) - mProfileZoneClients[idx]->mZone.flushProfileEvents(); -} - -void PvdProfileZoneClient::onZoneAdded(profile::PxProfileZone& zone) -{ - PX_ASSERT(mIsConnected); - ProfileZoneClient* client = PVD_NEW(ProfileZoneClient)(zone, *mPvdDataStream); - mMutex.lock(); - client->createInstance(); - mProfileZoneClients.pushBack(client); - mMutex.unlock(); -} - -void PvdProfileZoneClient::onZoneRemoved(profile::PxProfileZone& zone) -{ - for(uint32_t i = 0; i < mProfileZoneClients.size(); i++) - { - if(&zone == &mProfileZoneClients[i]->mZone) - { - mMutex.lock(); - ProfileZoneClient* client = mProfileZoneClients[i]; - mProfileZoneClients.replaceWithLast(i); - PVD_DELETE(client); - mMutex.unlock(); - return; - } - } -} diff --git a/PxShared/src/pvd/src/PxPvdProfileZoneClient.h b/PxShared/src/pvd/src/PxPvdProfileZoneClient.h deleted file mode 100644 index 4484997..0000000 --- a/PxShared/src/pvd/src/PxPvdProfileZoneClient.h +++ /dev/null @@ -1,77 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - -#ifndef PXPVDSDK_PXPVDPROFILEZONECLIENT_H -#define PXPVDSDK_PXPVDPROFILEZONECLIENT_H -#include "PxPvdClient.h" -#include "PsHashMap.h" -#include "PsMutex.h" -#include "PxProfileZoneManager.h" - -namespace physx -{ -namespace pvdsdk -{ -class PvdImpl; -class PvdDataStream; - -struct ProfileZoneClient; - -class PvdProfileZoneClient : public PvdClient, public profile::PxProfileZoneHandler, public shdfnd::UserAllocated -{ - PX_NOCOPY(PvdProfileZoneClient) - public: - PvdProfileZoneClient(PvdImpl& pvd); - virtual ~PvdProfileZoneClient(); - - bool isConnected() const; - void onPvdConnected(); - void onPvdDisconnected(); - void flush(); - - PvdDataStream* getDataStream(); - PvdUserRenderer* getUserRender(); - void setObjectRegistrar(ObjectRegistrar*); - - // PxProfileZoneHandler - void onZoneAdded(profile::PxProfileZone& inSDK); - void onZoneRemoved(profile::PxProfileZone& inSDK); - - private: - shdfnd::Mutex mMutex; // zoneAdded can called from different threads - PvdImpl& mSDKPvd; - PvdDataStream* mPvdDataStream; - physx::shdfnd::Array<ProfileZoneClient*> mProfileZoneClients; - bool mIsConnected; -}; - -} // namespace pvdsdk -} // namespace physx - -#endif // PXPVDSDK_PXPVDPROFILEZONECLIENT_H diff --git a/PxShared/src/pvd/src/PxPvdUserRenderImpl.h b/PxShared/src/pvd/src/PxPvdUserRenderImpl.h deleted file mode 100644 index 04574e9..0000000 --- a/PxShared/src/pvd/src/PxPvdUserRenderImpl.h +++ /dev/null @@ -1,411 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#ifndef PXPVDSDK_PXPVDUSERRENDERIMPL_H -#define PXPVDSDK_PXPVDUSERRENDERIMPL_H - -#include "PxPvdUserRenderer.h" - -namespace physx -{ -namespace pvdsdk -{ - -struct PvdUserRenderTypes -{ - enum Enum - { - Unknown = 0, -#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) type, -#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA(type) type -#include "PxPvdUserRenderTypes.h" -#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA -#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE - }; -}; - -class RenderSerializer -{ - protected: - virtual ~RenderSerializer() - { - } - - public: - virtual void streamify(uint64_t& val) = 0; - virtual void streamify(float& val) = 0; - virtual void streamify(uint32_t& val) = 0; - virtual void streamify(uint8_t& val) = 0; - virtual void streamify(DataRef<uint8_t>& val) = 0; - virtual void streamify(DataRef<PvdDebugPoint>& val) = 0; - virtual void streamify(DataRef<PvdDebugLine>& val) = 0; - virtual void streamify(DataRef<PvdDebugTriangle>& val) = 0; - virtual void streamify(PvdDebugText& val) = 0; - virtual bool isGood() = 0; - virtual uint32_t hasData() = 0; - - void streamify(PvdUserRenderTypes::Enum& val) - { - uint8_t data = static_cast<uint8_t>(val); - streamify(data); - val = static_cast<PvdUserRenderTypes::Enum>(data); - } - void streamify(PxVec3& val) - { - streamify(val[0]); - streamify(val[1]); - streamify(val[2]); - } - - void streamify(PvdColor& val) - { - streamify(val.r); - streamify(val.g); - streamify(val.b); - streamify(val.a); - } - void streamify(PxTransform& val) - { - streamify(val.q.x); - streamify(val.q.y); - streamify(val.q.z); - streamify(val.q.w); - streamify(val.p.x); - streamify(val.p.y); - streamify(val.p.z); - } - void streamify(bool& val) - { - uint8_t tempVal = uint8_t(val ? 1 : 0); - streamify(tempVal); - val = tempVal ? true : false; - } -}; - -template <typename TBulkRenderType> -struct BulkRenderEvent -{ - DataRef<TBulkRenderType> mData; - BulkRenderEvent(const TBulkRenderType* data, uint32_t count) : mData(data, count) - { - } - BulkRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(mData); - } -}; -struct SetInstanceIdRenderEvent -{ - uint64_t mInstanceId; - SetInstanceIdRenderEvent(uint64_t iid) : mInstanceId(iid) - { - } - SetInstanceIdRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(mInstanceId); - } -}; -struct PointsRenderEvent : BulkRenderEvent<PvdDebugPoint> -{ - PointsRenderEvent(const PvdDebugPoint* data, uint32_t count) : BulkRenderEvent<PvdDebugPoint>(data, count) - { - } - PointsRenderEvent() - { - } -}; -struct LinesRenderEvent : BulkRenderEvent<PvdDebugLine> -{ - LinesRenderEvent(const PvdDebugLine* data, uint32_t count) : BulkRenderEvent<PvdDebugLine>(data, count) - { - } - LinesRenderEvent() - { - } -}; -struct TrianglesRenderEvent : BulkRenderEvent<PvdDebugTriangle> -{ - TrianglesRenderEvent(const PvdDebugTriangle* data, uint32_t count) : BulkRenderEvent<PvdDebugTriangle>(data, count) - { - } - TrianglesRenderEvent() - { - } -}; -struct DebugRenderEvent -{ - DataRef<PvdDebugPoint> mPointData; - DataRef<PvdDebugLine> mLineData; - DataRef<PvdDebugTriangle> mTriangleData; - DebugRenderEvent(const PvdDebugPoint* pointData, uint32_t pointCount, const PvdDebugLine* lineData, - uint32_t lineCount, const PvdDebugTriangle* triangleData, uint32_t triangleCount) - : mPointData(pointData, pointCount), mLineData(lineData, lineCount), mTriangleData(triangleData, triangleCount) - { - } - - DebugRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(mPointData); - serializer.streamify(mLineData); - serializer.streamify(mTriangleData); - } -}; - -struct TextRenderEvent -{ - PvdDebugText mText; - TextRenderEvent(const PvdDebugText& text) - { - mText.color = text.color; - mText.position = text.position; - mText.size = text.size; - mText.string = text.string; - } - TextRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(mText); - } -}; - -struct JointFramesRenderEvent -{ - PxTransform parent; - PxTransform child; - JointFramesRenderEvent(const PxTransform& p, const PxTransform& c) : parent(p), child(c) - { - } - JointFramesRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(parent); - serializer.streamify(child); - } -}; -struct LinearLimitRenderEvent -{ - PxTransform t0; - PxTransform t1; - float value; - bool active; - LinearLimitRenderEvent(const PxTransform& _t0, const PxTransform& _t1, float _value, bool _active) - : t0(_t0), t1(_t1), value(_value), active(_active) - { - } - LinearLimitRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(t0); - serializer.streamify(t1); - serializer.streamify(value); - serializer.streamify(active); - } -}; -struct AngularLimitRenderEvent -{ - PxTransform t0; - float lower; - float upper; - bool active; - AngularLimitRenderEvent(const PxTransform& _t0, float _lower, float _upper, bool _active) - : t0(_t0), lower(_lower), upper(_upper), active(_active) - { - } - AngularLimitRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(t0); - serializer.streamify(lower); - serializer.streamify(upper); - serializer.streamify(active); - } -}; -struct LimitConeRenderEvent -{ - PxTransform t; - float ySwing; - float zSwing; - bool active; - LimitConeRenderEvent(const PxTransform& _t, float _ySwing, float _zSwing, bool _active) - : t(_t), ySwing(_ySwing), zSwing(_zSwing), active(_active) - { - } - LimitConeRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(t); - serializer.streamify(ySwing); - serializer.streamify(zSwing); - serializer.streamify(active); - } -}; -struct DoubleConeRenderEvent -{ - PxTransform t; - float angle; - bool active; - DoubleConeRenderEvent(const PxTransform& _t, float _angle, bool _active) : t(_t), angle(_angle), active(_active) - { - } - DoubleConeRenderEvent() - { - } - void serialize(RenderSerializer& serializer) - { - serializer.streamify(t); - serializer.streamify(angle); - serializer.streamify(active); - } -}; - -template <typename TDataType> -struct RenderSerializerMap -{ - void serialize(RenderSerializer& s, TDataType& d) - { - d.serialize(s); - } -}; -template <> -struct RenderSerializerMap<uint8_t> -{ - void serialize(RenderSerializer& s, uint8_t& d) - { - s.streamify(d); - } -}; - -template <> -struct RenderSerializerMap<PvdDebugPoint> -{ - void serialize(RenderSerializer& s, PvdDebugPoint& d) - { - s.streamify(d.pos); - s.streamify(d.color); - } -}; - -template <> -struct RenderSerializerMap<PvdDebugLine> -{ - void serialize(RenderSerializer& s, PvdDebugLine& d) - { - s.streamify(d.pos0); - s.streamify(d.color0); - s.streamify(d.pos1); - s.streamify(d.color1); - } -}; - -template <> -struct RenderSerializerMap<PvdDebugTriangle> -{ - void serialize(RenderSerializer& s, PvdDebugTriangle& d) - { - s.streamify(d.pos0); - s.streamify(d.color0); - s.streamify(d.pos1); - s.streamify(d.color1); - s.streamify(d.pos2); - s.streamify(d.color2); - } -}; - -template <typename TDataType> -struct PvdTypeToRenderType -{ - bool compile_error; -}; - -#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) \ - template <> \ - struct PvdTypeToRenderType<type##RenderEvent> \ - { \ - enum Enum \ - { \ - EnumVal = PvdUserRenderTypes::type \ - }; \ - }; - -#include "PxPvdUserRenderTypes.h" -#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE - -template <typename TDataType> -PvdUserRenderTypes::Enum getPvdRenderTypeFromType() -{ - return static_cast<PvdUserRenderTypes::Enum>(PvdTypeToRenderType<TDataType>::EnumVal); -} - -class PvdUserRenderHandler -{ - protected: - virtual ~PvdUserRenderHandler() - { - } - - public: -#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) virtual void handleRenderEvent(const type##RenderEvent& evt) = 0; - -#include "PxPvdUserRenderTypes.h" -#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE -}; - -class PvdUserRenderParser -{ - protected: - virtual ~PvdUserRenderParser() - { - } - - public: - virtual void release() = 0; - virtual void parseData(DataRef<const uint8_t> data, PvdUserRenderHandler& handler) = 0; - - static PvdUserRenderParser& create(bool swapBytes); -}; -} -} - -#endif // PXPVDSDK_PXPVDUSERRENDERIMPL_H diff --git a/PxShared/src/pvd/src/PxPvdUserRenderTypes.h b/PxShared/src/pvd/src/PxPvdUserRenderTypes.h deleted file mode 100644 index 6a47abb..0000000 --- a/PxShared/src/pvd/src/PxPvdUserRenderTypes.h +++ /dev/null @@ -1,46 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#define THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON - -#ifndef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA -#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA DECLARE_PVD_IMMEDIATE_RENDER_TYPE -#endif - -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(SetInstanceId) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Points) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Lines) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Triangles) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(JointFrames) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(LinearLimit) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(AngularLimit) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(LimitCone) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(DoubleCone) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE(Text) -DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA(Debug) - -#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE_NO_COMMA -#undef THERE_IS_NO_INCLUDE_GUARD_HERE_FOR_A_REASON diff --git a/PxShared/src/pvd/src/PxPvdUserRenderer.cpp b/PxShared/src/pvd/src/PxPvdUserRenderer.cpp deleted file mode 100644 index 784d115..0000000 --- a/PxShared/src/pvd/src/PxPvdUserRenderer.cpp +++ /dev/null @@ -1,460 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -#include "PxPvdUserRenderer.h" -#include "PxPvdUserRenderImpl.h" -#include "PxPvdFoundation.h" -#include "PxPvdInternalByteStreams.h" -#include "PxPvdBits.h" -#include "PxPvdCommStreamTypes.h" -#include <stdarg.h> - -using namespace physx; -using namespace physx::pvdsdk; - -namespace -{ - -template <typename TStreamType> -struct RenderWriter : public RenderSerializer -{ - TStreamType& mStream; - RenderWriter(TStreamType& stream) : mStream(stream) - { - } - template <typename TDataType> - void write(const TDataType* val, uint32_t count) - { - uint32_t numBytes = count * sizeof(TDataType); - mStream.write(reinterpret_cast<const uint8_t*>(val), numBytes); - } - template <typename TDataType> - void write(const TDataType& val) - { - write(&val, 1); - } - - template <typename TDataType> - void writeRef(DataRef<TDataType>& val) - { - uint32_t amount = val.size(); - write(amount); - if(amount) - write(val.begin(), amount); - } - - virtual void streamify(uint64_t& val) - { - write(val); - } - virtual void streamify(uint32_t& val) - { - write(val); - } - virtual void streamify(float& val) - { - write(val); - } - virtual void streamify(uint8_t& val) - { - write(val); - } - virtual void streamify(DataRef<uint8_t>& val) - { - writeRef(val); - } - - virtual void streamify(PvdDebugText& val) - { - write(val.color); - write(val.position); - write(val.size); - - uint32_t amount = static_cast<uint32_t>(strlen(val.string)) + 1; - write(amount); - if(amount) - write(val.string, amount); - } - - virtual void streamify(DataRef<PvdDebugPoint>& val) - { - writeRef(val); - } - virtual void streamify(DataRef<PvdDebugLine>& val) - { - writeRef(val); - } - virtual void streamify(DataRef<PvdDebugTriangle>& val) - { - writeRef(val); - } - - virtual uint32_t hasData() - { - return false; - } - virtual bool isGood() - { - return true; - } - - private: - RenderWriter& operator=(const RenderWriter&); -}; - -struct UserRenderer : public PvdUserRenderer -{ - ForwardingMemoryBuffer mBuffer; - uint32_t mBufferCapacity; - RendererEventClient* mClient; - - UserRenderer(uint32_t bufferFullAmount) - : mBuffer("UserRenderBuffer"), mBufferCapacity(bufferFullAmount), mClient(NULL) - { - } - virtual ~UserRenderer() - { - } - virtual void release() - { - PVD_DELETE(this); - } - - template <typename TEventType> - void handleEvent(TEventType evt) - { - RenderWriter<ForwardingMemoryBuffer> _writer(mBuffer); - RenderSerializer& writer(_writer); - - PvdUserRenderTypes::Enum evtType(getPvdRenderTypeFromType<TEventType>()); - writer.streamify(evtType); - evt.serialize(writer); - if(mBuffer.size() >= mBufferCapacity) - flushRenderEvents(); - } - virtual void setInstanceId(const void* iid) - { - handleEvent(SetInstanceIdRenderEvent(PVD_POINTER_TO_U64(iid))); - } - // Draw these points associated with this instance - virtual void drawPoints(const PvdDebugPoint* points, uint32_t count) - { - handleEvent(PointsRenderEvent(points, count)); - } - // Draw these lines associated with this instance - virtual void drawLines(const PvdDebugLine* lines, uint32_t count) - { - handleEvent(LinesRenderEvent(lines, count)); - } - // Draw these triangles associated with this instance - virtual void drawTriangles(const PvdDebugTriangle* triangles, uint32_t count) - { - handleEvent(TrianglesRenderEvent(triangles, count)); - } - - virtual void drawText(const PvdDebugText& text) - { - handleEvent(TextRenderEvent(text)); - } - - virtual void drawRenderbuffer(const PvdDebugPoint* pointData, uint32_t pointCount, const PvdDebugLine* lineData, - uint32_t lineCount, const PvdDebugTriangle* triangleData, uint32_t triangleCount) - { - handleEvent(DebugRenderEvent(pointData, pointCount, lineData, lineCount, triangleData, triangleCount)); - } - - // Constraint visualization routines - virtual void visualizeJointFrames(const PxTransform& parent, const PxTransform& child) - { - handleEvent(JointFramesRenderEvent(parent, child)); - } - virtual void visualizeLinearLimit(const PxTransform& t0, const PxTransform& t1, float value, bool active) - { - handleEvent(LinearLimitRenderEvent(t0, t1, value, active)); - } - virtual void visualizeAngularLimit(const PxTransform& t0, float lower, float upper, bool active) - { - handleEvent(AngularLimitRenderEvent(t0, lower, upper, active)); - } - virtual void visualizeLimitCone(const PxTransform& t, float ySwing, float zSwing, bool active) - { - handleEvent(LimitConeRenderEvent(t, ySwing, zSwing, active)); - } - virtual void visualizeDoubleCone(const PxTransform& t, float angle, bool active) - { - handleEvent(DoubleConeRenderEvent(t, angle, active)); - } - // Clear the immedate buffer. - virtual void flushRenderEvents() - { - if(mClient) - mClient->handleBufferFlush(mBuffer.begin(), mBuffer.size()); - mBuffer.clear(); - } - - virtual void setClient(RendererEventClient* client) - { - mClient = client; - } - - private: - UserRenderer& operator=(const UserRenderer&); -}; - -template <bool swapBytes> -struct RenderReader : public RenderSerializer -{ - MemPvdInputStream mStream; - ForwardingMemoryBuffer& mBuffer; - - RenderReader(ForwardingMemoryBuffer& buf) : mBuffer(buf) - { - } - void setData(DataRef<const uint8_t> data) - { - mStream.setup(const_cast<uint8_t*>(data.begin()), const_cast<uint8_t*>(data.end())); - } - virtual void streamify(uint32_t& val) - { - mStream >> val; - } - virtual void streamify(uint64_t& val) - { - mStream >> val; - } - virtual void streamify(float& val) - { - mStream >> val; - } - virtual void streamify(uint8_t& val) - { - mStream >> val; - } - template <typename TDataType> - void readRef(DataRef<TDataType>& val) - { - uint32_t count; - mStream >> count; - uint32_t numBytes = sizeof(TDataType) * count; - - TDataType* dataPtr = reinterpret_cast<TDataType*>(mBuffer.growBuf(numBytes)); - mStream.read(reinterpret_cast<uint8_t*>(dataPtr), numBytes); - val = DataRef<TDataType>(dataPtr, count); - } - - virtual void streamify(DataRef<PvdDebugPoint>& val) - { - readRef(val); - } - virtual void streamify(DataRef<PvdDebugLine>& val) - { - readRef(val); - } - virtual void streamify(DataRef<PvdDebugTriangle>& val) - { - readRef(val); - } - virtual void streamify(PvdDebugText& val) - { - mStream >> val.color; - mStream >> val.position; - mStream >> val.size; - - uint32_t len = 0; - mStream >> len; - - uint8_t* dataPtr = mBuffer.growBuf(len); - mStream.read(dataPtr, len); - val.string = reinterpret_cast<const char*>(dataPtr); - } - virtual void streamify(DataRef<uint8_t>& val) - { - readRef(val); - } - virtual bool isGood() - { - return mStream.isGood(); - } - virtual uint32_t hasData() - { - return uint32_t(mStream.size() > 0); - } - - private: - RenderReader& operator=(const RenderReader&); -}; - -template <> -struct RenderReader<true> : public RenderSerializer -{ - MemPvdInputStream mStream; - ForwardingMemoryBuffer& mBuffer; - RenderReader(ForwardingMemoryBuffer& buf) : mBuffer(buf) - { - } - void setData(DataRef<const uint8_t> data) - { - mStream.setup(const_cast<uint8_t*>(data.begin()), const_cast<uint8_t*>(data.end())); - } - - template <typename TDataType> - void read(TDataType& val) - { - mStream >> val; - swapBytes(val); - } - virtual void streamify(uint64_t& val) - { - read(val); - } - virtual void streamify(uint32_t& val) - { - read(val); - } - virtual void streamify(float& val) - { - read(val); - } - virtual void streamify(uint8_t& val) - { - read(val); - } - template <typename TDataType> - void readRef(DataRef<TDataType>& val) - { - uint32_t count; - mStream >> count; - swapBytes(count); - uint32_t numBytes = sizeof(TDataType) * count; - - TDataType* dataPtr = reinterpret_cast<TDataType*>(mBuffer.growBuf(numBytes)); - PVD_FOREACH(idx, count) - RenderSerializerMap<TDataType>().serialize(*this, dataPtr[idx]); - val = DataRef<TDataType>(dataPtr, count); - } - - virtual void streamify(DataRef<PvdDebugPoint>& val) - { - readRef(val); - } - virtual void streamify(DataRef<PvdDebugLine>& val) - { - readRef(val); - } - virtual void streamify(DataRef<PvdDebugTriangle>& val) - { - readRef(val); - } - virtual void streamify(PvdDebugText& val) - { - mStream >> val.color; - mStream >> val.position; - mStream >> val.size; - - uint32_t len = 0; - mStream >> len; - - uint8_t* dataPtr = mBuffer.growBuf(len); - mStream.read(dataPtr, len); - val.string = reinterpret_cast<const char*>(dataPtr); - } - virtual void streamify(DataRef<uint8_t>& val) - { - readRef(val); - } - virtual bool isGood() - { - return mStream.isGood(); - } - virtual uint32_t hasData() - { - return uint32_t(mStream.size() > 0); - } - - private: - RenderReader& operator=(const RenderReader&); -}; - -template <bool swapBytes> -struct Parser : public PvdUserRenderParser -{ - ForwardingMemoryBuffer mBuffer; - RenderReader<swapBytes> mReader; - Parser() : mBuffer("PvdUserRenderParser::mBuffer"), mReader(mBuffer) - { - } - - void release() - { - PVD_DELETE(this); - } - void parseData(DataRef<const uint8_t> data, PvdUserRenderHandler& handler) - { - mReader.setData(data); - RenderSerializer& serializer(mReader); - while(serializer.isGood() && serializer.hasData()) - { - mReader.mBuffer.clear(); - PvdUserRenderTypes::Enum evtType = PvdUserRenderTypes::Unknown; - serializer.streamify(evtType); - switch(evtType) - { -#define DECLARE_PVD_IMMEDIATE_RENDER_TYPE(type) \ - case PvdUserRenderTypes::type: \ - { \ - type##RenderEvent evt; \ - evt.serialize(serializer); \ - handler.handleRenderEvent(evt); \ - } \ - break; -#include "PxPvdUserRenderTypes.h" -#undef DECLARE_PVD_IMMEDIATE_RENDER_TYPE - case PvdUserRenderTypes::Unknown: - PX_ASSERT(false); - return; - } - } - PX_ASSERT(serializer.isGood()); - return; - } - - PX_NOCOPY(Parser<swapBytes>) -}; -} - -PvdUserRenderParser& PvdUserRenderParser::create(bool swapBytes) -{ - if(swapBytes) - return *PVD_NEW(Parser<true>); - else - return *PVD_NEW(Parser<false>); -} - -PvdUserRenderer* PvdUserRenderer::create(uint32_t bufferSize) -{ - return PVD_NEW(UserRenderer)(bufferSize); -} - diff --git a/PxShared/src/pvd/src/windows/PxWindowsPvdDelayLoadHook.cpp b/PxShared/src/pvd/src/windows/PxWindowsPvdDelayLoadHook.cpp deleted file mode 100644 index a8c6df0..0000000 --- a/PxShared/src/pvd/src/windows/PxWindowsPvdDelayLoadHook.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. -// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved. -// Copyright (c) 2001-2004 NovodeX AG. All rights reserved. - - -#include "pvd/windows/PxWindowsPvdDelayLoadHook.h" -#include "windows/PsWindowsInclude.h" -#include "windows/PsWindowsLoadLibrary.h" - -// Prior to Visual Studio 2015 Update 3, these hooks were non-const. -#define DELAYIMP_INSECURE_WRITABLE_HOOKS -#include <delayimp.h> - -static const physx::PxFoundationDelayLoadHook* gDelayLoadHook = NULL; - -void physx::PxPvdSetFoundationDelayLoadHook(const physx::PxFoundationDelayLoadHook* hook) -{ - gDelayLoadHook = hook; -} - -using namespace physx; - -#pragma comment(lib, "delayimp") - -FARPROC WINAPI delayHook(unsigned dliNotify, PDelayLoadInfo pdli) -{ - switch (dliNotify) { - case dliStartProcessing : - break; - - case dliNotePreLoadLibrary : - { - return physx::shdfnd::foundationDliNotePreLoadLibrary(pdli->szDll, gDelayLoadHook); - } - break; - - case dliNotePreGetProcAddress : - break; - - case dliFailLoadLib : - break; - - case dliFailGetProc : - break; - - case dliNoteEndProcessing : - break; - - default : - - return NULL; - } - - return NULL; -} - -PfnDliHook __pfnDliNotifyHook2 = delayHook; diff --git a/PxShared/src/task/src/TaskManager.cpp b/PxShared/src/task/src/TaskManager.cpp deleted file mode 100644 index 1551216..0000000 --- a/PxShared/src/task/src/TaskManager.cpp +++ /dev/null @@ -1,701 +0,0 @@ -// This code contains NVIDIA Confidential Information and is disclosed to you -// under a form of NVIDIA software license agreement provided separately to you. -// -// Notice -// NVIDIA Corporation and its licensors retain all intellectual property and -// proprietary rights in and to this software and related documentation and -// any modifications thereto. Any use, reproduction, disclosure, or -// distribution of this software and related documentation without an express -// license agreement from NVIDIA Corporation is strictly prohibited. -// -// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES -// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO -// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT, -// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. -// -// Information and code furnished is believed to be accurate and reliable. -// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such -// information or for any infringement of patents or other rights of third parties that may -// result from its use. No license is granted by implication or otherwise under any patent -// or patent rights of NVIDIA Corporation. Details are subject to change without notice. -// This code supersedes and replaces all information previously supplied. -// NVIDIA Corporation products are not authorized for use as critical -// components in life support devices or systems without express written approval of -// NVIDIA Corporation. -// -// Copyright (c) 2008-2017 NVIDIA Corporation. All rights reserved. - -#include "task/PxTask.h" -#include "task/PxTaskDefine.h" -#include "foundation/PxErrors.h" - -#include "PsThread.h" -#include "PsAtomic.h" -#include "PsMutex.h" -#include "PsHashMap.h" -#include "PsArray.h" -#include "PsAllocator.h" - - -#if PX_SUPPORT_PXTASK_PROFILING -#include "foundation/PxProfiler.h" -#endif - -#define DOT_LOG 0 - -// for information on generating tasks graphs see this wiki page -// https://wiki.nvidia.com/engwiki/index.php/PhysX/sdk/InternalDoc_Example_TaskGraph -#if DOT_LOG -#include "stdio.h" -#define LOG_FRAME_NUM 60 -static int framenum; -static FILE *logfile; - -static const char* logFilename = "pxtask-graph.txt"; -__declspec(thread) static physx::PxBaseTask* currentTask; - -template<class A, class B> PX_FORCE_INLINE A PxTaskUnionCast(B b) -{ - union AB - { - AB(B bb) - : _b(bb) - { - } - B _b; - A _a; - } u(b); - return u._a; -} -#endif - -#define LOCK() shdfnd::Mutex::ScopedLock __lock__(mMutex) - -namespace physx -{ - const int EOL = -1; - typedef shdfnd::HashMap<const char *, PxTaskID> PxTaskNameToIDMap; - - struct PxTaskDepTableRow - { - PxTaskID mTaskID; - int mNextDep; - }; - typedef shdfnd::Array<PxTaskDepTableRow> PxTaskDepTable; - - class PxTaskTableRow - { - public: - PxTaskTableRow() : mRefCount( 1 ), mStartDep(EOL), mLastDep(EOL) {} - void addDependency( PxTaskDepTable& depTable, PxTaskID taskID ) - { - int newDep = int(depTable.size()); - PxTaskDepTableRow row; - row.mTaskID = taskID; - row.mNextDep = EOL; - depTable.pushBack( row ); - - if( mLastDep == EOL ) - { - mStartDep = mLastDep = newDep; - } - else - { - depTable[ uint32_t(mLastDep) ].mNextDep = newDep; - mLastDep = newDep; - } - } - - PxTask * mTask; - volatile int mRefCount; - PxTaskType::Enum mType; - int mStartDep; - int mLastDep; - }; - typedef shdfnd::Array<PxTaskTableRow> PxTaskTable; - - -/* Implementation of PxTaskManager abstract API */ -class PxTaskMgr : public PxTaskManager, public shdfnd::UserAllocated -{ - PX_NOCOPY(PxTaskMgr) -public: - PxTaskMgr(PxErrorCallback& , PxCpuDispatcher*, PxGpuDispatcher*); - ~PxTaskMgr(); - - void setCpuDispatcher( PxCpuDispatcher& ref ) - { - mCpuDispatcher = &ref; - } - - void setGpuDispatcher( PxGpuDispatcher& ref ) - { - mGpuDispatcher = &ref; - } - - PxCpuDispatcher* getCpuDispatcher() const - { - return mCpuDispatcher; - } - - PxGpuDispatcher* getGpuDispatcher() const - { - return mGpuDispatcher; - } - - void resetDependencies(); - void startSimulation(); - void stopSimulation(); - void taskCompleted( PxTask& task ); - - PxTaskID getNamedTask( const char *name ); - PxTaskID submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type = PxTaskType::TT_CPU ); - PxTaskID submitUnnamedTask( PxTask& task, PxTaskType::Enum type = PxTaskType::TT_CPU ); - PxTask* getTaskFromID( PxTaskID ); - - bool dispatchTask( PxTaskID taskID, bool gpuGroupStart ); - bool resolveRow( PxTaskID taskID, bool gpuGroupStart ); - - void release(); - - void finishBefore( PxTask& task, PxTaskID taskID ); - void startAfter( PxTask& task, PxTaskID taskID ); - - void addReference( PxTaskID taskID ); - void decrReference( PxTaskID taskID ); - int32_t getReference( PxTaskID taskID ) const; - - void decrReference( PxLightCpuTask& lighttask ); - void addReference( PxLightCpuTask& lighttask ); - - PxErrorCallback& mErrorCallback; - PxCpuDispatcher *mCpuDispatcher; - PxGpuDispatcher *mGpuDispatcher; - PxTaskNameToIDMap mName2IDmap; - volatile int mPendingTasks; - shdfnd::Mutex mMutex; - - PxTaskDepTable mDepTable; - PxTaskTable mTaskTable; - - shdfnd::Array<PxTaskID> mStartDispatch; - - -#if DOT_LOG - static void debugGraphEnd(); - static void debugGraphEdge(PxBaseTask* prev, uint32_t prevIndex, uint32_t prevType, PxBaseTask* next, uint32_t nextIndex, uint32_t nextType, uint32_t weight); - static void debugGraphBegin(const char* filename); -#endif - }; - -PxTaskManager* PxTaskManager::createTaskManager(PxErrorCallback& errorCallback, PxCpuDispatcher* cpuDispatcher, PxGpuDispatcher* gpuDispatcher) -{ - return PX_NEW(PxTaskMgr)(errorCallback, cpuDispatcher, gpuDispatcher); -} - -PxTaskMgr::PxTaskMgr(PxErrorCallback& errorCallback, PxCpuDispatcher* cpuDispatcher, PxGpuDispatcher* gpuDispatcher) - : mErrorCallback (errorCallback) - , mCpuDispatcher( cpuDispatcher ) - , mGpuDispatcher( gpuDispatcher ) - , mPendingTasks( 0 ) - , mDepTable(PX_DEBUG_EXP("PxTaskDepTable")) - , mTaskTable(PX_DEBUG_EXP("PxTaskTable")) - , mStartDispatch(PX_DEBUG_EXP("StartDispatch")) -{ -} - - -#if DOT_LOG -void PxTaskMgr::debugGraphBegin(const char* filename) -{ - logfile = fopen(filename, "w"); - - if (logfile) - { - fprintf(logfile, "digraph tasks {\n"); - fprintf(logfile, "dpi=300;\n"); - fprintf(logfile, "node [width=.3, height=0.8 style=\"rounded, filled\"];"); - } -} -void PxTaskMgr::debugGraphEnd() -{ - if (logfile) - { - fprintf(logfile, "}\n"); - fclose(logfile); - logfile = NULL; - } -} - -void PxTaskMgr::debugGraphEdge(PxBaseTask* prev, uint32_t prevIndex, uint32_t prevType, PxBaseTask* next, uint32_t nextIndex, uint32_t nextType, uint32_t weight) -{ - PX_ASSERT(next); - - enum Type - { - eCpuNode, - eSpuNode, - eJoinNode - }; - - if (logfile) - { - // lock - PxTaskMgr& mgr = static_cast<PxTaskMgr&>(*next->getTaskManager()); - shdfnd::Mutex::ScopedLock lock(mgr.mMutex); - - // check both task and their task manager is valid - if (prev && prev->mTm) - fprintf(logfile, "{node [shape=%s,label=\"%s\"] t%d%d};\n", (prevType==eSpuNode)?"box,fillcolor=lightblue":"ellipse,fillcolor=lightgrey", prev->getName(), PxTaskUnionCast<uint32_t>(prev), prevIndex); - - if (next && next->mTm) - fprintf(logfile, "{node [shape=%s,label=\"%s\"] t%d%d};\n", (nextType==eSpuNode)?"box,fillcolor=lightblue":"ellipse,fillcolor=lightgrey", next->getName(), PxTaskUnionCast<uint32_t>(next), nextIndex); - - if (weight > 0 && prev && next) - fprintf(logfile, "t%d%d->t%d%d [weight=%d];\n", PxTaskUnionCast<uint32_t>(prev), prevIndex, PxTaskUnionCast<uint32_t>(next), nextIndex, weight); - } -} -#endif - - -PxTaskMgr::~PxTaskMgr() -{ -} - -void PxTaskMgr::release() -{ - PX_DELETE(this); -} - -void PxTaskMgr::decrReference(PxLightCpuTask& lighttask) -{ -#if DOT_LOG - uint32_t weight = 1; -#endif - - /* This does not need a lock! */ - if (!shdfnd::atomicDecrement(&lighttask.mRefCount)) - { -#if DOT_LOG - ++weight; -#endif - PX_ASSERT(mCpuDispatcher); - if (mCpuDispatcher) - { - mCpuDispatcher->submitTask(lighttask); - } - else - { - lighttask.release(); - } - } - -#if DOT_LOG - debugGraphEdge(currentTask, 0, 0, &lighttask, 0, 0, weight); -#endif -} - -void PxTaskMgr::addReference(PxLightCpuTask& lighttask) -{ - /* This does not need a lock! */ - shdfnd::atomicIncrement(&lighttask.mRefCount); -} - - -/* - * Called by the owner (Scene) at the start of every frame, before - * asking for tasks to be submitted. - */ -void PxTaskMgr::resetDependencies() -{ -#if DOT_LOG - if( logfile ) - { - debugGraphEnd(); - } - if( framenum++ == LOG_FRAME_NUM ) - { - debugGraphBegin(logFilename); - } -#endif - - PX_ASSERT( !mPendingTasks ); // only valid if you don't resubmit named tasks, this is true for the SDK - PX_ASSERT( mCpuDispatcher ); - mTaskTable.clear(); - mDepTable.clear(); - mName2IDmap.clear(); - mPendingTasks = 0; -} - -/* - * Called by the owner (Scene) to start simulating the task graph. - * Dispatch all tasks with refCount == 1 - */ -void PxTaskMgr::startSimulation() -{ - PX_ASSERT( mCpuDispatcher ); - - if( mGpuDispatcher ) - { - mGpuDispatcher->startSimulation(); - } - - /* Handle empty task graph */ - if( mPendingTasks == 0 ) - { - - return; - } - - bool gpuDispatch = false; - for( PxTaskID i = 0 ; i < mTaskTable.size() ; i++ ) - { - if( mTaskTable[ i ].mType == PxTaskType::TT_COMPLETED ) - { - continue; - } - if( !shdfnd::atomicDecrement( &mTaskTable[ i ].mRefCount ) ) - { - mStartDispatch.pushBack(i); - } - } - for( uint32_t i=0; i<mStartDispatch.size(); ++i) - { - gpuDispatch |= dispatchTask( mStartDispatch[i], gpuDispatch ); - } - //mStartDispatch.resize(0); - mStartDispatch.forceSize_Unsafe(0); - - if( mGpuDispatcher && gpuDispatch ) - { - mGpuDispatcher->finishGroup(); - } -} - -void PxTaskMgr::stopSimulation() -{ - if( mGpuDispatcher ) - { - mGpuDispatcher->stopSimulation(); - } -} - -PxTaskID PxTaskMgr::getNamedTask( const char *name ) -{ - const PxTaskNameToIDMap::Entry *ret; - { - LOCK(); - ret = mName2IDmap.find( name ); - } - if( ret ) - { - return ret->second; - } - else - { - // create named entry in task table, without a task - return submitNamedTask( NULL, name, PxTaskType::TT_NOT_PRESENT ); -} -} - -PxTask* PxTaskMgr::getTaskFromID( PxTaskID id ) -{ - LOCK(); // todo: reader lock necessary? - return mTaskTable[ id ].mTask; -} - - -/* If called at runtime, must be thread-safe */ -PxTaskID PxTaskMgr::submitNamedTask( PxTask *task, const char *name, PxTaskType::Enum type ) -{ - if( task ) - { - task->mTm = this; - task->submitted(); - } - - LOCK(); - - const PxTaskNameToIDMap::Entry *ret = mName2IDmap.find( name ); - if( ret ) - { - PxTaskID prereg = ret->second; - if( task ) - { - /* name was registered for us by a dependent task */ - PX_ASSERT( !mTaskTable[ prereg ].mTask ); - PX_ASSERT( mTaskTable[ prereg ].mType == PxTaskType::TT_NOT_PRESENT ); - mTaskTable[ prereg ].mTask = task; - mTaskTable[ prereg ].mType = type; - task->mTaskID = prereg; - } - return prereg; - } - else - { - shdfnd::atomicIncrement(&mPendingTasks); - PxTaskID id = static_cast<PxTaskID>(mTaskTable.size()); - mName2IDmap[ name ] = id; - if( task ) - { - task->mTaskID = id; - } - PxTaskTableRow r; - r.mTask = task; - r.mType = type; -#if DOT_LOG - if( logfile ) - { - if( type == PxTaskType::TT_GPU ) - { - fprintf(logfile, "{node [shape=box,label=\"%s\"] t%d0};\n", task->getName(), PxTaskUnionCast<uint32_t>(task)); - } - else if (type == PxTaskType::TT_NOT_PRESENT) - { - fprintf(logfile, "{node [shape=invhouse,label=\"%s\"] t%d0};\n", name, PxTaskUnionCast<uint32_t>(task)); - } - else - { - fprintf(logfile, "{node [label=\"%s\"] t%d0};\n", task->getName(), PxTaskUnionCast<uint32_t>(task)); - } - } -#endif - mTaskTable.pushBack(r); - return id; - } -} - -/* - * Add an unnamed task to the task table - */ -PxTaskID PxTaskMgr::submitUnnamedTask( PxTask& task, PxTaskType::Enum type ) -{ - shdfnd::atomicIncrement(&mPendingTasks); - - task.mTm = this; - task.submitted(); - - LOCK(); - task.mTaskID = static_cast<PxTaskID>(mTaskTable.size()); - PxTaskTableRow r; - r.mTask = &task; - r.mType = type; -#if DOT_LOG - if( logfile ) - { - if( type == PxTaskType::TT_GPU ) - { - fprintf(logfile, "{node [shape=box,label=\"%s\"] t%d0};\n", task.getName(), PxTaskUnionCast<uint32_t>(&task)); - } - else - { - fprintf(logfile, "{node [label=\"%s\"] t%d0};\n", task.getName(), PxTaskUnionCast<uint32_t>(&task)); - } - } -#endif - mTaskTable.pushBack(r); - return task.mTaskID; -} - - -/* Called by worker threads (or cooperating application threads) when a - * PxTask has completed. Propogate depdenencies, decrementing all - * referenced tasks' refCounts. If any of those reach zero, activate - * those tasks. - */ -void PxTaskMgr::taskCompleted( PxTask& task ) -{ - LOCK(); - if( resolveRow( task.mTaskID, false ) ) - { - mGpuDispatcher->finishGroup(); - } -} - -/* ================== Private Functions ======================= */ - -/* - * Add a dependency to force 'task' to complete before the - * referenced 'taskID' is allowed to be dispatched. - */ -void PxTaskMgr::finishBefore( PxTask& task, PxTaskID taskID ) -{ - LOCK(); - PX_ASSERT( mTaskTable[ taskID ].mType != PxTaskType::TT_COMPLETED ); - -#if DOT_LOG - if( logfile ) - { - fprintf(logfile, "t%d0->t%d0;\n", PxTaskUnionCast<uint32_t>(&task), PxTaskUnionCast<uint32_t>(mTaskTable[ taskID ].mTask)); - } -#endif - - mTaskTable[ task.mTaskID ].addDependency( mDepTable, taskID ); - shdfnd::atomicIncrement( &mTaskTable[ taskID ].mRefCount ); -} - - -/* - * Add a dependency to force 'task' to wait for the referenced 'taskID' - * to complete before it is allowed to be dispatched. - */ -void PxTaskMgr::startAfter( PxTask& task, PxTaskID taskID ) -{ - LOCK(); - PX_ASSERT( mTaskTable[ taskID ].mType != PxTaskType::TT_COMPLETED ); - -#if DOT_LOG - if( logfile ) - { - fprintf(logfile, "t%d0->t%d0;\n", PxTaskUnionCast<uint32_t>(mTaskTable[ taskID ].mTask), PxTaskUnionCast<uint32_t>(&task)); - } -#endif - - mTaskTable[ taskID ].addDependency( mDepTable, task.mTaskID ); - shdfnd::atomicIncrement( &mTaskTable[ task.mTaskID ].mRefCount ); -} - - -void PxTaskMgr::addReference( PxTaskID taskID ) -{ - LOCK(); - shdfnd::atomicIncrement( &mTaskTable[ taskID ].mRefCount ); -} - -/* - * Remove one reference count from a task. Intended for use by the - * GPU dispatcher, to remove reference counts when CUDA events are - * resolved. Must be done here to make it thread safe. - */ -void PxTaskMgr::decrReference( PxTaskID taskID ) -{ - LOCK(); - -#if DOT_LOG - debugGraphEdge(currentTask, 0, 0, mTaskTable[ taskID ].mTask, 0, 0, 1); -#endif - - if( !shdfnd::atomicDecrement( &mTaskTable[ taskID ].mRefCount ) ) - { - if( dispatchTask( taskID, false ) ) - { - mGpuDispatcher->finishGroup(); - } - } -} - -int32_t PxTaskMgr::getReference(PxTaskID taskID) const -{ - return mTaskTable[ taskID ].mRefCount; -} - -/* - * A task has completed, decrement all dependencies and submit tasks - * that are ready to run. Signal simulation end if ther are no more - * pending tasks. - */ -bool PxTaskMgr::resolveRow( PxTaskID taskID, bool gpuGroupStart ) -{ - int depRow = mTaskTable[ taskID ].mStartDep; - - uint32_t streamIndex = 0; - bool syncRequired = false; - if( mTaskTable[ taskID ].mTask ) - { - streamIndex = mTaskTable[ taskID ].mTask->mStreamIndex; - } - - while( depRow != EOL ) - { - PxTaskDepTableRow& row = mDepTable[ uint32_t(depRow) ]; - PxTaskTableRow& dtt = mTaskTable[ row.mTaskID ]; - - // pass stream index to (up to one) dependent GPU task - if( dtt.mTask && dtt.mType == PxTaskType::TT_GPU && streamIndex ) - { - if( dtt.mTask->mStreamIndex ) - { - PX_ASSERT( dtt.mTask->mStreamIndex != streamIndex ); - dtt.mTask->mPreSyncRequired = true; - } - else if( syncRequired ) - { - dtt.mTask->mPreSyncRequired = true; - } - else - { - dtt.mTask->mStreamIndex = streamIndex; - /* only one forward task gets to use this stream */ - syncRequired = true; - } - } - - if( !shdfnd::atomicDecrement( &dtt.mRefCount ) ) - { - gpuGroupStart |= dispatchTask( row.mTaskID, gpuGroupStart ); - } - - depRow = row.mNextDep; - } - - shdfnd::atomicDecrement( &mPendingTasks ); - return gpuGroupStart; -} - -/* - * Submit a ready task to its appropriate dispatcher. - */ -bool PxTaskMgr::dispatchTask( PxTaskID taskID, bool gpuGroupStart ) -{ - LOCK(); // todo: reader lock necessary? - PxTaskTableRow& tt = mTaskTable[ taskID ]; - - // prevent re-submission - if( tt.mType == PxTaskType::TT_COMPLETED ) - { - mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "PxTask dispatched twice", __FILE__, __LINE__); - return false; - } - - switch ( tt.mType ) - { - case PxTaskType::TT_CPU: - mCpuDispatcher->submitTask( *tt.mTask ); - break; - - case PxTaskType::TT_GPU: -#if PX_WINDOWS_FAMILY - if( mGpuDispatcher ) - { - if( !gpuGroupStart ) - { - mGpuDispatcher->startGroup(); - } - mGpuDispatcher->submitTask( *tt.mTask ); - gpuGroupStart = true; - } - else -#endif - { - mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "No GPU dispatcher", __FILE__, __LINE__); - } - break; - - case PxTaskType::TT_NOT_PRESENT: - /* No task registered with this taskID, resolve its dependencies */ - PX_ASSERT(!tt.mTask); - //shdfnd::getFoundation().error(PX_INFO, "unregistered task resolved"); - gpuGroupStart |= resolveRow( taskID, gpuGroupStart ); - break; - case PxTaskType::TT_COMPLETED: - default: - mErrorCallback.reportError(PxErrorCode::eDEBUG_WARNING, "Unknown task type", __FILE__, __LINE__); - gpuGroupStart |= resolveRow( taskID, gpuGroupStart ); - break; - } - - mTaskTable[taskID].mType = PxTaskType::TT_COMPLETED; - return gpuGroupStart; -} - -}// end physx namespace @@ -1,4 +1,4 @@ -NvCloth 1.1.5 +NvCloth 1.0 =========== Introduction @@ -17,3 +17,8 @@ Documentation See ./NvCloth/ReleaseNotes.txt for changes and platform support. See ./NvCloth/docs/documentation/index.html for the release notes, API users guide and compiling instructions. See ./NvCloth/docs/doxy/index.html for the api documentation. + +PhysX / PxShared compatibility +----------------------------------- +Note that 1.1.6 is compatible with the same version of PxShared shipped with PhysX 4.0. +Please use 1.1.5 if you are compiling it together with PhysX 3.4.
\ No newline at end of file |