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 256x256 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?
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.
Hi, thanks Joe. For anyone else reading this question, I did stumble upon an answer here:
I implemented the answer, and now I don’t have any delay in reading back texture data.
Glad to hear you found a more efficient solution. Thanks for posting the link