Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide NuGet package for CUDA support #10

Open
PathogenDavid opened this issue May 6, 2022 · 1 comment
Open

Provide NuGet package for CUDA support #10

PathogenDavid opened this issue May 6, 2022 · 1 comment

Comments

@PathogenDavid
Copy link
Member

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.)

@PathogenDavid
Copy link
Member Author

Note that while the PhysX user guide doesn't mention PhysXDevice64.dll, it is mentioned in the Windows platform readme. It is required, and reside alongside PhysXGPU_64.dll.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant