Graphics Reference
In-Depth Information
The
glClientWaitSync
function can return the following values:
•
GL_ALREADY_SIGNALED
: the sync object was already at the signaled
state when the function was called.
•
GL_TIMEOUT_EXPIRED
: the sync object did not become signaled after
timeout
nanoseconds passed.
•
GL_CONDITION_SATISFIED
: the sync object was signaled before the
timeout expired.
•
GL_WAIT_FAILED
: an error occurred.
The
glWaitSync
function is similar to the
glClientWaitSync
function,
except that the function returns immediately and blocks the GPU until
the sync object is signaled.
void
glWaitSync
(GLsync
sync
, GLbitfield
flags
,
GLuint64
timeout
)
specifies the sync object to wait on for its status.
sync
specifies a bitfield controlling the command flushing
behavior; must be zero.
flags
timeout
specifies the timeout in nanoseconds that the server should
wait before continuing; must be
GL_TIMEOUT_IGNORED
.
Example 13-1 shows an example of inserting a fence command after
transform feedback buffers are created (see the
EmitParticles
function
implementation) and blocking the GPU to wait on the transform feedback
results before drawing them (see the
Draw
function implementation). The
EmitParticles
function and
Draw
function are executed by two separate
CPU threads.
This code segment is a part of the particle system with transform feedback
example that will be described in more detail in Chapter 14, “Advanced
Programming with OpenGL ES 3.0.”