Is there a faster alternative to glReadPixels for transferring texture data from GPU to CPU?

This topic contains 3 replies, has 2 voices, and was last updated by  Joe Davis 4 years, 2 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #31349

    As part of our application, we use the GPU to speed up the rendering of stroked brushes on iOS devices. In order to facilitate undoing of the stroked brushes, we need to transfer any modified textures back from the GPU to the CPU. In benchmarks with an iPad2, to transfer a 256×256 RGBA texture to the CPU, it took 20ms using glReadPixels (vs ~0.8ms to upload to GPU). I realise getting the data back is always going to be slower than sending it up, but I want to know if there are special features of the SGX chip, which would allow us to transfer data in a faster (and preferably asynchronous) method?

    #37703

    Joe Davis
    Member

    Hi Mark,

    Sorry for the delayed response. There is no core OpenGL ES feature that allows a more efficient read back of buffers that have been written to by the GPU. However, there tend to be platform specific mechanisms that avoid CPU & GPU serialization when data is read back. For example, on Android it’s possible to use a circular buffer of EGLImages so the CPU can read data back from one surface while the GPU writes data into another.

    I’m not sure what mechanisms there may be to do this on iOS. You would have to refer to their documentation or discuss it with their support team.

    Thanks,
    Joe

    #37704

    Hi, thanks Joe. For anyone else reading this question, I did stumble upon an answer here:
    http://stackoverflow.com/questions/9550297/faster-alternative-to-glreadpixels-in-iphone-opengl-es-2-0

    I implemented the answer, and now I don’t have any delay in reading back texture data.

    #37705

    Joe Davis
    Member

    Hi Mark,

    Glad to hear you found a more efficient solution. Thanks for posting the link 🙂

    Joe

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.