## Name

glFenceSync — create a new sync object and insert it into the GL command stream

## C Specification

`GLsync glFenceSync(` | GLenum condition,
| GLbitfield flags`)`;

## Parameters

`condition`

  Specifies the condition that must be met to set the sync object's state to signaled. `condition` must be `GL_SYNC_GPU_COMMANDS_COMPLETE`.

`flags`

  Specifies a bitwise combination of flags controlling the behavior of the sync object. No flags are presently defined for this operation and `flags` must be zero.[1]

## Description

`glFenceSync` creates a new fence sync object, inserts a fence command into the GL command stream and associates it with that sync object, and returns a non-zero name corresponding to the sync object.

When the specified `condition` of the sync object is satisfied by the fence command, the sync object is signaled by the GL, causing any glWaitSync, glClientWaitSync commands blocking in `sync` to unblock. No other state is affected by `glFenceSync` or by the execution of the associated fence command.

`condition` must be `GL_SYNC_GPU_COMMANDS_COMPLETE`. This condition is satisfied by completion of the fence command corresponding to the sync object and all preceding commands in the same command stream. The sync object will not be signaled until all effects from these commands on GL client and server state and the framebuffer are fully realized. Note that completion of the fence command occurs once the state of the corresponding sync object has been changed, but commands waiting on that sync object may not be unblocked until after the fence command completes.

## Notes

`glFenceSync` is only supported if the GL version is 3.2 or greater, or if the `ARB_sync` extension is supported.

## Errors

`GL_INVALID_ENUM` is generated if `condition` is not `GL_SYNC_GPU_COMMANDS_COMPLETE`.

`GL_INVALID_VALUE` is generated if `flags` is not zero.

Additionally, if `glFenceSync` fails, it will return zero.

## See Also

glDeleteSync, glGetSync, glWaitSync, glClientWaitSync

## Copyright

Copyright © 2010 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

[1] `flags` is a placeholder for anticipated future extensions of fence sync object capabilities.