I have downloaded PhysX5 repo (git@github.com:NVIDIA-Omniverse/PhysX.git) and ran the snippet “SnippetPBF” in order to get a notion of how to render particles position calculated by PhysX5 (with cuda) without retrieving the particles position from the gpu to the cpu first and encountered the following code (I have deleted unnecessary lines):
It seems that sPosBuffer.map() returns a pointer to a device address and not a cpu address. If so why is the function used is memcpyDtoH and not memcpyDtoD and why does it work**?**
The general suggestion for physX questions is to post them as issues or dicussions on github. You might want to try that if you don’t get an answer here.
Cuda can determine the location - host or device - from the address and may (I would not count for it) gracefully fall back to the correct copy operation in that case?
If that is confirmed, then it is a bug in the code.
I am very new to Cuda but I assume that somewhere in memcpyDtoH implementation there is a call to:
__host__cudaError_t cudaMemcpy ( void* dst, const void* src, size_t count, cudaMemcpyKind kind ) and that the cudaMemcpyDeviceToHost used as the kind? Does the address resolution you have mentioned holds for this function also (even if the wrong kind is used)?