From 24c645d8d2417af5da9f03c12e10661c3c1cbb7c Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Thu, 9 May 2024 20:25:16 +0300 Subject: [PATCH] Build NvCloth for Windows on ARM --- Source/ThirdParty/NvCloth/ps/PsMathUtils.h | 2 +- Source/ThirdParty/NvCloth/ps/windows/PsWindowsIntrinsics.h | 2 +- Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/ThirdParty/NvCloth/ps/PsMathUtils.h b/Source/ThirdParty/NvCloth/ps/PsMathUtils.h index b2c4602c0..123114598 100644 --- a/Source/ThirdParty/NvCloth/ps/PsMathUtils.h +++ b/Source/ThirdParty/NvCloth/ps/PsMathUtils.h @@ -313,7 +313,7 @@ PX_FORCE_INLINE physx::PxI32 rand(const physx::PxI32 a, const physx::PxI32 b) */ PX_FORCE_INLINE physx::PxF32 rand(const physx::PxF32 a, const physx::PxF32 b) { - return a + (b - a) * ::rand() / RAND_MAX; + return a + (b - a) * ::rand() / (physx::PxF32)RAND_MAX; } //! \brief return angle between two vectors in radians diff --git a/Source/ThirdParty/NvCloth/ps/windows/PsWindowsIntrinsics.h b/Source/ThirdParty/NvCloth/ps/windows/PsWindowsIntrinsics.h index 5eaaac40f..f32b3802d 100644 --- a/Source/ThirdParty/NvCloth/ps/windows/PsWindowsIntrinsics.h +++ b/Source/ThirdParty/NvCloth/ps/windows/PsWindowsIntrinsics.h @@ -118,7 +118,7 @@ PX_FORCE_INLINE uint32_t PxCountLeadingZeros(uint32_t v) /*! Prefetch aligned cache size around \c ptr+offset. */ -#if !PX_ARM +#if !PX_ARM && !PX_A64 PX_FORCE_INLINE void PxPrefetchLine(const void* ptr, uint32_t offset = 0) { // cache line on X86/X64 is 64-bytes so a 128-byte prefetch would require 2 prefetches. diff --git a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs index 110e26f81..80852fb61 100644 --- a/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs +++ b/Source/Tools/Flax.Build/Deps/Dependencies/NvCloth.cs @@ -65,6 +65,7 @@ namespace Flax.Deps.Dependencies { case TargetPlatform.Windows: Build(options, platform, TargetArchitecture.x64); + Build(options, platform, TargetArchitecture.ARM64); break; case TargetPlatform.XboxOne: case TargetPlatform.XboxScarlett: @@ -193,7 +194,7 @@ namespace Flax.Deps.Dependencies RunCmake(cmakeFolder, platform, architecture, " -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF " + cmakeArgs, envVars); // Run build - Utilities.Run("cmake", "--build . --config Release", null, cmakeFolder, Utilities.RunOptions.ThrowExceptionOnError, envVars); + BuildCmake(cmakeFolder, envVars); // Deploy binaries var libs = new[]