Is Cuda capable of doing a screen capture and saving the result to an image file?
I’m not sure if file I/O can happen via the GPU. But maybe at least the GPU might scale the screen before saving. Or possibly do the expensive compression to get a really fast capture rate.
Maybe if you were crazy enough you could use a PBO with glReadPixels to load the frame buffer into CUDA and then use the CUDA accelerated Dirac codec to make a movie out of it. I’m not sure how much of the dirac processing is done on the GPU though.
glReadPixels, that sounds like OpenGL. I thought Cuda and OpenGL didn’t play together. Wouldn’t that be slow too. There should be a DirectX counterpart.
CUDA should have access to the DirectX capture surface and can perform scale operations and potentially output to a new surface that is saved. That would save some CPU time.
Below I attach some Python code (an extended translation of one of the CUDA SDK examples). This uses OpenGL (via my own python-ogl bindings - you can substitute PyOpenGL for that) and Qt with the QtOpenGL widget. The “screen capture” is a single of code image = self.grabFrameBuffer() within this code and the image saved as PNG. You can probably substitute your own favorite programming language for that (C/C++/Fortran). You may have to reproduce what grabFrameBuffer does, presumably, as others have pointed out glReadPixels. But the short summary answer is: yes, you can do screen capture when using CUDA, although not in CUDA itself. The example below using vertex buffer objects, to store the result of the CUDA computation. You may read this yourself with a cudaMemCopy, I guess - minus all color and lighting info. Note that if you use Qt, life is very simple and if you are not doing this commercially, you can use the GPL versions of Qt and PyQt - plus my CUDA bindings for Python which you can find at ftp://graviscom.com/pub/code/python-cuda/ or via http (graviscom.com/sources/rpms/python-cuda. CUDA and OpenGL work together very well, there are several examples in the CUDA SDK. Don*t know about DirectX, as I am not using that.