CUDA support in PhysX is closed-source and requires redistributing a pair of additional DLLs. PhysXDevice64.dll and PhysXGpu_64.dll For Linux there is just a single libPhysXGpu_64.so.
These DLLs are fairly huge, even bigger than PhysX its self, so I don't think it makes sense to include them in the Mochi.PhysX.Native packages since not everyone will want or need them.
For whatever reason, these DLLs are not copied to the install folder. So we need to dig them out of the bin directory ourselves.
Additionally, for Windows PhysXGpu_64.dll is only present in the win.x86_64.vc140.mt folder. For other versions of MSVC it is copied from there. The PhysXDevice64.dll is present in all folders, although it's just the same file copied over and over.
It is worth noting that none of these files are the same between build variants. I accidentally loaded the release GPU DLL with a checked build and it crashed, so it's important we match variants.
As such I think we should extend MochiPhysX.SelectRuntimeVariant to call PxSetPhysXGpuLoadHook as appropriate on the user's behalf. It might also be wise to force it to an invalid value in the event the DLL is missing in order to prevent a crash in the scenario where the developer has a Mochi.PhysX.Native.win-x64-checked and ``Mochi.PhysX.NativeGpu.win-x64installed but notMochi.PhysX.NativeGpu.win-x64.checked`. (PhysX gracefully handles the DLL missing, presumably running as if GPU support wasn't enabled. The structure of `SnippetHelloGRB` somewhat implies this is partially the consumer's responsibility, but in practice it doesn't actually seem to work that way.)
CUDA support in PhysX is closed-source and requires redistributing a pair of additional DLLs.
PhysXDevice64.dllandPhysXGpu_64.dllFor Linux there is just a singlelibPhysXGpu_64.so.These DLLs are fairly huge, even bigger than PhysX its self, so I don't think it makes sense to include them in the
Mochi.PhysX.Nativepackages since not everyone will want or need them.For whatever reason, these DLLs are not copied to the
installfolder. So we need to dig them out of thebindirectory ourselves.Additionally, for Windows
PhysXGpu_64.dllis only present in thewin.x86_64.vc140.mtfolder. For other versions of MSVC it is copied from there. ThePhysXDevice64.dllis present in all folders, although it's just the same file copied over and over.It is worth noting that none of these files are the same between build variants. I accidentally loaded the
releaseGPU DLL with acheckedbuild and it crashed, so it's important we match variants.As such I think we should extend
MochiPhysX.SelectRuntimeVariantto callPxSetPhysXGpuLoadHookas appropriate on the user's behalf. It might also be wise to force it to an invalid value in the event the DLL is missing in order to prevent a crash in the scenario where the developer has aMochi.PhysX.Native.win-x64-checkedand ``Mochi.PhysX.NativeGpu.win-x64installed but notMochi.PhysX.NativeGpu.win-x64.checked`. (PhysX gracefully handles the DLL missing, presumably running as if GPU support wasn't enabled. The structure of `SnippetHelloGRB` somewhat implies this is partially the consumer's responsibility, but in practice it doesn't actually seem to work that way.)