Graphics interoperability and CUDA

Hi. I have an application in which I read 2 images from memory, stitch them side by side, add a stereo tag, stretchrect them onto a directx surface, and render them. i can view the output as 3D. so far, so good.

my next step is to manipulate those images. i have 3 questions in this regard:


  1. What is the best way to transfer an image to video memory?

(a) DirectX (and possibly OpenGL) using textures and surfaces, or
(B) CUDA using cudaMemcpy


If we use the former method, i.e. transfer the image using DirectX, then to manipulate it using CUDA, the following steps are used:

(a). Use the surface on a texture (offscreen surface does not seem to work)
(B). Use cudaGraphicsD3D9RegisterResource to be able to use the surface on the texture as an array in cuda
©. Manipulate the array in cuda
(4). Unregister

The 3.0 toolkit says this should be avoided on every frame. Then what’s the better way to do this since the documentation does not speak of alternate methods.


If we use the latter method, i.e. transfer the image using CUDA, manipulate it using CUDA, then how can we use DirectX to display it?

These questions have been asked on this forum by a number of people under different headings. It would be great to answer these questions. I will be glad to post code and a detailed solution if I can get answers from several people on whichever part you can help on.