Remix.run Logo
almostgotcaught 4 days ago

tangential question: does anyone know a way to call/use CUDA from graphics code? like directx or opengl (or whatever). as opposed to this code which is named "renderer" but doesn't draw to the screen...

corysama 4 days ago | parent | next [-]

There are DX/GL interop functions in the CUDA API. But, they are a bit tricky. Unless you really have a strong, specific need for something only available in CUDA, you are better off using compute shaders.

pixelpoet 3 days ago | parent | prev | next [-]

Just because a program isn't using DirectX or OpenGL etc doesn't mean it's not a renderer / graphics code.

Ono-Sendai 4 days ago | parent | prev [-]

compute shaders?

animal531 3 days ago | parent [-]

Yeah, for example Unity uses C#, so you can used a managed CUDA library. If you're using a C engine like Unreal etc. its even easier since you can just include the code.

But having said that, a giant drawback to using CUDA in gaming is that the overhead of transforming and copying your data to/from CUDA kills off a lot of the performance, so while its still great its not nearly as good as writing compute shaders.

They are a topic of their own, the code can start off quite basic but with recent additions you can now also do some really advanced thread management and coordination.

They still come with big overhead to moving data around, but in general they're better suited to the use-case than CUDA.