View Full Version : readpixels grinding on the cpu

09-16-2009, 05:42 AM
I am doing a rendering, swapping the buffers and binding a read to the frontbuffer after which I call glReadpixels with a pixel buffer as target.
I beleive the read from front buffer into pixel buffer should nbe a non blocking dma transfer. That call returns right away and only later when calling mapbuffer, to get an address of the pixel buffer, should anything block and only if the read is not yet complete.

None of this should, blocking or not blocking, put any strain on the cpu.

I do however see an almost 95% load on one core, indicating that my thread is in fact using the cpu a lot.

It seems that incompatible pixelformats will cause the driver to do a conversion while copying, but in my case the pixeldescriptor is RGBA and the readpixels has been called with both GL_RGBA and GL_BGRA, which is equally cpu demanding.

Does anyone have a hint as to where to go next with this problem?

09-16-2009, 07:55 AM
Do you have 95% load without glReadPixels? It might be just a busy wait on the SwapBuffers call (is VSync on?).

Do you use PBO for glReadPixels? It's designed to prevent stalling, so I'd not be surprised to see bad results when not using it.

09-22-2009, 01:33 AM
I am sorry about that post. It turns out the grinding was not from readpixels but rather from a problem related to a sdi videocard with some bad drivers.

OpenGL was at no fault.