Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 3 of 3

Thread: Know if draw call has finished

  1. #1
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    28

    Know if draw call has finished

    Is it possible to know if a specific draw call has finished? For example:
    Code :
    bind_some_data(foo);
    glDraw*(); // -> draw1
     
    bind_some_data(bar);
    glDraw*(); // -> draw2
     
    if (draw1_has_finished())
        do_something();

    I'm not asking something like glFinish() nor glFlush() because I don't mind if "draw2" has finished or not.
    I'm using OpenGL 4.3 core/4.4 compatibility.
    Last edited by rodrigoloc; 06-07-2014 at 11:00 PM.

  2. #2
    Junior Member Newbie
    Join Date
    Jul 2013
    Posts
    10
    Use fences.

    Add this after your draw call:

    GLsync fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0)

    and then wait for it to finish:

    if (glClientWaitSync(fence, GL_SYNC_FLUSH_COMMANDS_BIT, 0) == GL_ALREADY_SIGNALED) {
    // Draw call finished
    }else {
    // Do some other useful stuff
    }

    You also can block until its finished. The above will not block. Furthermore you can specify a max waiting time.

    Hope this helps.

  3. #3
    Junior Member Newbie
    Join Date
    Sep 2012
    Posts
    28
    Thank you. I thought sync objects do a full synchronization but now they're working.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •