get* block?

What guarantees does one have when performing readback from GPU to main memory, when performing glReadPixels() and glTexImage*() functions? Does one need to perform a glFinish() to make sure the main memory data is valid, or do those call block?

Thanks,

–nico

they do block the cpu. when the glReadPixels call is finished, the your memory buffer is filled with phantastic colors. i dont want to sign it, but i’m quite sure :slight_smile:
asynchronal readback functions are provided through extension, e.g. NV_occlusion_query.

Originally posted by ngaloppo:
What guarantees does one have when performing readback from GPU to main memory, when performing glReadPixels() and glTexImage*() functions? Does one need to perform a glFinish() to make sure the main memory data is valid, or do those call block?
On Windows OSes, this is true only if you are issuing the commands sequentially in a single context. Since multiple contexts can be current against a single window via multithreading, it is a definite requirement that glFinish() be called “in context” AFTER calling glTexImageXXX() and BEFORE calling glReadPixels() on any other context. This also applies to the GDI SwapBuffers() (and presumably to the wglSwapLayerBuffers() variants). The terms BEFORE and AFTER imply synchronizing all rendering threads. If your application is a single threaded application, you should have no problems.

– tim