PDA

View Full Version : get* block?



ngaloppo
06-28-2004, 11:12 AM
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

jabe
06-28-2004, 12:56 PM
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 :)
asynchronal readback functions are provided through extension, e.g. NV_occlusion_query.

tranders
06-28-2004, 05:23 PM
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