Are PhysX and FleX platform independent?

I’m interested in using PhysX, and possible using FleX for water and particles in my game engine, but I am worried about one thing. How platform indipendent is PhysX and FleX? Do they use any platform specific features?
I’m interested in using it on Linux, Windows, Android, MAC/IOS, PS4 and Nintendo Switch. Also, I am interested in using it in a game server, where there is no OpenGL/DirectX and no GPU at all.(So everything must be CPU) My servers mostly run Linux and Windows, but some use older OS.
Also, I am correct that PhysX and FleX can be rendered and used with any GPU(NVidia, AMD, Intel, Mobile GPU’s) right(as long as I write a renderer)?

Thanks!
And one additional question, what do PhysX and FleX require to compile? Let’s say, I only have c++14 with stl library, software renderer and a timer/clock, will it run?

PhysX can run on CPU on all platforms you mentioned. In addition, there are CUDA-based implementations of clothing, particles and rigid bodies that can run on NVIDIA GPUs on Windows and Linux.

You get full CPU source code with PhysX. It comes with visual studio solution files, OSX and makefiles for Linux. You should not need anything besides the visual studio/xcode/basic compilers like gcc. GPU implementations are delivered in binary-only form so you don’t need to worry about having the relevant tools installed.

For access to source code/binaries for consoles, you need to contact PhysX licensing.

Flex can only run on GPUs. There is a CUDA-based implementation for Linux/Windows that will only work with NVIDIA GPUs and a DirectX port that works on Windows that can run on any D3D11-class GPU.

Flex is delivered pre-compiled through GitHub so you don’t need to build it. You get source access to a flex demo application so you can learn how to use the various flex features, but you do not get source access to the simulation code.

Thank you very much for your reply!
Are there any libraries that allow water particles and softbody’s without a DX11 or CUDA GPU?(APEX maybe?)
Are the CPU and GPU PhysX libraries interchangeable? So can I just swap the DLL’s and it will “just” work?

You say for console libraries/source, I need to contact licensing. But what stops me from compiling it myself? Or do I require different source code for consoles?

Unfortunately, Flex won’t work for me then, as I need it to support every platform.

But I’m still wondering, what libraries does PhysX need? Can I just compile it on every platform with e.g. an c++14 compiler? And, can I then compile it on Linux ARM, and Android? And what about older platforms like PSP or Nintendo DS?

CPU and GPU in PhysX are easily interchangeable. In order to use the GPU features, the GPU DLL must be present (either explicitly loaded by your executable or in the same folder as the executable so it can be automatically loaded if needed). You must also initialize GPU features - examples of all of this are provided in the samples and snippets. In addition, the user must also have a compatible GPU and permit PhysX to run on that GPU in the NVIDIA control panel (it should be permitted by default). If there is not a compatible GPU or the user has disabled PhysX in the control panel, all simulation will fall back on CPU, even if you set your application up to use GPU PhysX.

I am not involved in licensing but, as I understand it, we are restricted from providing console solution/makefiles to anyone who isn’t a licensed developer on that platform by the platform holders’ NDAs so there are additional steps to access code for those platforms.

The majority of the code for PhysX is the same for all platforms. However, to support a new platform, you would need to fill in a lot of platform-specific blanks (how to create/destroy/synchronize threads, atomic operations, SIMD maths implementations, memory fence and barrier instructions, file access, networking etc.). You would also need to create makefiles or solutions that work with a given platform’s compilers and toolchains.

We do not currently support PSP or Nintendo DS so, for those platforms, you would need to do some work yourself to support them.

Okay, thank you very much.
Do you maybe know if PhysX has a CPU library that can do softbody’s and water particles?

But so, the only thing stopping PhysX from working on another platform are some thread related things? Is there maybe an option to leave those out?

And, I know this is a question I can guess the answer to, but, will PhysX every become fully opensource? It would be great to have community also support the engine. Because, as far as I know, we are not allowed to modify PhysX source.
It would also be great if things like Flex would be fully opensourced.

You are allowed to modify the engine and a lot of developers do for their projects. This is the primary reason we provide source code. There are some licensing restrictions involved, which I don’t know the full details of. One of the key restrictions is that you can’t share the PhysX source code (modified or otherwise) unless the recipient has agreed to our EULA and has access to the PhysX source code already.

There is some fluid/particle simulation in PhysX which can run on CPU or GPU.

APEX also provides volumetric fluid simulation (gases etc.) called turbulence.

PhysX does not specifically provide a soft body feature but you can create something that looks quite similar from a set of rigid bodies and springs.

Okay, so if I fork your PhysX repo, I should be good.(As they can only view my forked repo if they can view your original repo, which they need to accept the EULA for)

Are there any plans to make Flex CPU compatible?

Also, I can’t seem to compile PhysX or Apex, it always gives me errors like “Cannot open include file ‘stddef.h’”, and the samples can’t find files like ‘ctype.h’, ‘assert.h’ and ‘corecrt.h’.
What do I need to do to fix that? I use Visual Studio 2017 and I open the vc15 64 bit projects.

I can’t seem to compile the PhysX samples, they aren’t for VS2017, do you know where I can find compatible samples?

Also, would it maybe be possible if you could point me to a few files that would need modification if I’d want to port it to an unsupported platform? I need to be able to port the PhysX library for future projects. I have access to the github, so you can just post links to the github files.
Thanks!

If you take a look in the source code for any folders called “windows” or “unix” or “osx”, they contain platform-specific code for that platform.

Other than that, there are solution/makefile changes required (to build those platform-specific cpp files), pre-processor directives (in PxPreprocessor.h) and code changes to include any platform-specific headers that may be required.

It’s a relatively big job.

The lack of samples for VS2017 is an omission. We will be pushing a new distro to gitHub soon, which will include them. You should have solutions for the snippets for VS2017 already, and they are probably more informative than the samples.