• Neil Roberts's avatar
    Add a test for GLX_ARB_context_flush_control · 0a3404cd
    Neil Roberts authored
    The test takes the following steps using two threads. The threads are
    only used so it can operate on another context without having to
    rebind it. The threads are run lock-step so that each step is run
    Thread 1: Make a flushless context A
    Thread 1: Make a flushy context B, shared with A
    Thread 1: Make a flushy context C, shared with A
    Thread 1: Bind context A
    Thread 2: Bind context C
    Thread 1: Make a renderbuffer.
    Thread 1: glClear() it to green.
    Thread 1: glFinish()
    Thread 1: glClear() it to red.
    Thread 2: Do a glReadPixels()
    (At this point the GL implementation is allowed to have finished
    the clear to red but it probably won't have. If the read pixels
    returns green here then it's not a failure but the test won't work
    so it will report PIGLIT_SKIP)
    Thread 1: Bind context C
    Thread 1: sleep(.5)
    Thread 2: Make sure glReadPixels() is still green, otherwise fail.
    All of the steps are then run again but this time context A is made
    flushy and the last step ensures that the pixel becomes red instead
    of green. If it did become red then the GL successfully made a
    flush when context A was released.
    The test also verifies that calling glGetIntegerv with
    GL_CONTEXT_RELEASE_BEHAVIOR returns the expected value when setting
    the attribute to none and flush and also when the attribute is left
    out entirely.
glx-context-flush-control.c 12.9 KB