displaying CUDA result as picture/video kernel -> texture, I think


I’d like to code a kernel that processes video and doesn’t return any data to the CPU, but instead displays the processed result in a window. In other words, a complex CUDA-based video renderer, like VMR9.

It doesn’t need to be a directshow filter nor DMO, although that would be really nice ~ displaying in my own window is enough for now.

The processing kernel in question can be, for example, deinterlacing or advanced resizing.

Any ideas how to do that? How to use CUDA and display the result, without costly (and pointless) trip to main memory?


[edit] Apologies, it seems that everything I need is in section B5 and B6. I have no idea how I missed that. Moreover, there is fluids example ~

Interoperability between CUDA and OpenGL with respect to Pixel Buffer Objects is supported. PBO contents can be set/read by CUDA and OpenGL in cooperation. See section D.6 of the Programming Guide.

Typical CUDA call sequence in a video processing application might look like:

  1. Allocate OpenGL PBO.
  2. Register PBO to CUDA.
  3. Map PBO to CUDA device memory, obaining CUDA global memory pointer.
  4. For each frame:
  • Output CUDA results to PBO, using obtained global memory pointer.
  • Copy PBO contents to OpenGL texture (with glTexSubImage2D() ).
  • Display textured fullscreen quad.
  1. On termination: unmap PBO, unregister PBO from CUDA.
    While PBO is registered to CUDA, it can be used by OpenGL only for data sourcing.