Skip to main content
GameDev.net gamedev.net
🔒 Locked

glReadPixels performance

Started by Desperado Jun 25, 2006 at 3:11 PM 4 replies 4.1k views
Original Post
Desperado
Desperado
Hello folks I'm currently doing some general purpose programming on the GPU and thererfore I need to download the data back to the main memory for more calculations. The only method I have found so far are framebuffer objects in combination with a glReadPixels call on the FBO that receives the final output image. However, I found the result to be quite slow. On a FBO with a texture size of 352x288 pixels reading back the whole image takes about 60-70 milliseconds which is about six times slower than the computations themselves. Therefore I have some questions to you: 1) Can I speed up the process by doing a shrink operation that reduces the size of the final output texture to 176x144 pixels? Or is the amount of data neglectible for glReadPixels? 2) Is there a faster way than glReadPixels? Thanks for your admittance.
taby
taby
I don't know of any other way to copy from GPU RAM to CPU RAM than glReadPixels.

The amount of RAM copied over the bus is definitely a major factor, though glReadPixels does have its own function call overhead. At these tiny sizes though, the tiny size difference would not be beneficial enough to provide any major increase in reponse time.

The only way to speed this up would be to completely avoid transferring data from GPU RAM to CPU RAM by implementing everything on the GPU.

Is there any way to do this for your objective (if even applicable)? If you can do this, you will be usually rewarded well with high performance.

In cases where the textures are small like that, I've even found that a pure CPU implementation can be faster than a CPU/GPU combination implementation, simply due to the bus latency/tx speed exhibited by glReadPixels.

With a faster PCI Express bus though, this is less of an issue. Plus GPUs are becoming more flexible programmatically as time goes by, so there will be less and less need for the GPU RAM to CPU RAM copy process regardless.
Desperado
Desperado
These are my system specs:

Athlon 64 3000
ATI Radeon 9800 Pro
Abit KV8 3rd eye mainboard
1 GB Ram

Is 60 Ms for one glReadPixels call a little bit slow even for that system?
zedzeek
zedzeek
its does sound slow
try different data types, see performance pdf's for hints.
also the PBO (or something similar named) extension i believe helps with readpixels performance
Kalidor
Kalidor
Quote:
Original post by zedzeek
...see performance pdf's for hints...
Especially this one.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.