I’ve been following the CUDA-D3D9 interop sample to implement video decoding and rendering via NVCUVID and a D3D texture. This sample uses cuD3D9CtxCreate to create the CUcontext, and this is what I’ve been using as well, and it works. However, I’ve noticed two things:
There is also a cuD3D9CtxCreateOnDevice function that takes a CUdevice as a parameter and creates the context on that device. Since in my code, I start by creating a D3D device, and then obtain the corresponding CUDA device via cuD3D9GetDevice, it seems like I should be using this one instead: is this true? I’ve tried both approaches and both work, however since I only have one physical GPU I suppose it won’t make a difference on my machine. Would it make a difference on a computer with multiple video cards? How does that work?
Also, the “documentation” (i.e. the header file comments) for both of these functions states:
[i]* Note that this function is never required for correct functionality. Use of
- this function will result in accelerated interoperability only when the
- operating system is Windows Vista or Windows 7, and the device \p pD3DDdevice
- is not an IDirect3DDevice9Ex. In all other cirumstances, this function is
- not necessary.[/i]
I will always be using Vista and up and an IDirect3DDevice9Ex. Does that mean I should use cuCtxCreate instead? There’s no cuCtxCreateOnDevice, so how could I specify on which device the context should be created?