PhysX icon indicating copy to clipboard operation
PhysX copied to clipboard

Compile PhysX natively for Apple Silicon (M1)

Open niklas-ourmachinery opened this issue 3 years ago • 6 comments

Are there plans for supporting native compiles of PhysX on Apple Silicon (M1)?

Seems like in theory it shouldn't be too cumbersome, since there is already a linux-aarch64 configuration as well as an ios one, but it might involve some fiddling with the settings.

niklas-ourmachinery avatar Sep 14 '21 19:09 niklas-ourmachinery

I made some a quick hack to get it to compile (if anybody else is looking for this):

https://github.com/NVIDIAGameWorks/PhysX/commit/9fb98ab05294521cbeebab9ec7d18234e94eb219

(Note: This doesn't do things properly, it doesn't preserve the "x86_64" OS X build for example, does not create a new binary platform tag, adds PX_ARM to the list of 64-bit platforms, etc, etc. It's just a super quick hack to get things to compile.)

niklas-ourmachinery avatar Sep 14 '21 21:09 niklas-ourmachinery

thanks bro, can work on my m1.

awkr avatar Oct 20 '21 15:10 awkr

Has this version been working well for people? Definitely not trying to put @niklas-ourmachinery on the spot, he just advertised it as a hack to get it compiling! But I'm having a few weird issues with collision detection that I'm not seeing on Intel. I'm trying to narrow it down specifically to PhysX and not some other weird side effect in the application. But so far everything points to PhysX just not handling some collisions on Apple Silicon.

colincornaby avatar Dec 04 '21 07:12 colincornaby

I went through the Physx SDK changes for Apple Silicon and found that some NEON optimizations were being built only for iOS. I carefully went through and added OSX defines alongside those iOS defines and so far the collision issues were fixed. I'll see if I can post something later.

Would certainly be easier if there was an official update for Apple Silicon though.

colincornaby avatar Dec 04 '21 07:12 colincornaby

Oh great! Yes, I never tested this much so not surprising there are issues.

niklas-ourmachinery avatar Dec 04 '21 14:12 niklas-ourmachinery

I think I've sorted out the M1 issues (and also the CMake build stuff), and put up a PR here: https://github.com/NVIDIAGameWorks/PhysX/pull/569

dpogue avatar Jun 04 '22 18:06 dpogue