Class ARBSync
This extension introduces the concept of "sync objects". Sync objects are a synchronization primitive - a representation of events whose completion status can be tested or waited upon. One specific type of sync object, the "fence sync object", is supported in this extension, and additional types can easily be added in the future.
Fence sync objects have corresponding fences, which are inserted into the OpenGL command stream at the time the sync object is created. A sync object can be queried for a given condition. The only condition supported for fence sync objects is completion of the corresponding fence command. Fence completion allows applications to request a partial Finish, wherein all commands prior to the fence will be forced to complete before control is returned to the calling process.
These new mechanisms allow for synchronization between the host CPU and the GPU, which may be accessing the same resources (typically memory), as well as between multiple GL contexts bound to multiple threads in the host CPU.
Requires OpenGL 3.1
. Promoted to core in OpenGL 3.2
.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Returned by ClientWaitSync.static final int
Returned by ClientWaitSync.static final int
Accepted as thepname
parameter of GetInteger64v.static final int
Accepted as thepname
parameter of GetSynciv.static final int
Returned invalues
for GetSyncivpname
SYNC_STATUS.static final int
Accepted as thepname
parameter of GetSynciv.static final int
Returned invalues
for GetSyncivpname
OBJECT_TYPE.static final int
Accepted as thepname
parameter of GetSynciv.static final int
Accepted in theflags
parameter of ClientWaitSync.static final int
Returned invalues
for GetSyncivpname
SYNC_CONDITION.static final int
Accepted as thepname
parameter of GetSynciv.static final int
Returned by ClientWaitSync.static final long
Accepted in thetimeout
parameter of WaitSync.static final int
Returned invalues
for GetSyncivpname
SYNC_STATUS.static final int
Returned by ClientWaitSync. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
glClientWaitSync
(long sync, int flags, long timeout) Causes the client to block and wait for a sync object to become signaled.static void
glDeleteSync
(long sync) Deletes a sync object.static long
glFenceSync
(int condition, int flags) Creates a new sync object and inserts it into the GL command stream.static long
glGetInteger64
(int pname) Returns the 64bit integer value or values of a selected parameter.static void
glGetInteger64v
(int pname, long[] params) Array version of:GetInteger64v
static void
glGetInteger64v
(int pname, LongBuffer params) Returns the 64bit integer value or values of a selected parameter.static int
glGetSynci
(long sync, int pname, IntBuffer length) Queries the properties of a sync object.static void
glGetSynciv
(long sync, int pname, int[] length, int[] values) Array version of:GetSynciv
static void
glGetSynciv
(long sync, int pname, IntBuffer length, IntBuffer values) Queries the properties of a sync object.static boolean
glIsSync
(long sync) Determines if a name corresponds to a sync object.static void
glWaitSync
(long sync, int flags, long timeout) Causes the GL server to block and wait for a sync object to become signaled.static int
nglClientWaitSync
(long sync, int flags, long timeout) Unsafe version of:ClientWaitSync
static void
nglDeleteSync
(long sync) Unsafe version of:DeleteSync
static void
nglGetInteger64v
(int pname, long params) Unsafe version of:GetInteger64v
static void
nglGetSynciv
(long sync, int pname, int bufSize, long length, long values) Unsafe version of:GetSynciv
static boolean
nglIsSync
(long sync) Unsafe version of:IsSync
static void
nglWaitSync
(long sync, int flags, long timeout) Unsafe version of:WaitSync
-
Field Details
-
GL_MAX_SERVER_WAIT_TIMEOUT
public static final int GL_MAX_SERVER_WAIT_TIMEOUTAccepted as thepname
parameter of GetInteger64v.- See Also:
-
GL_OBJECT_TYPE
public static final int GL_OBJECT_TYPEAccepted as thepname
parameter of GetSynciv.- See Also:
-
GL_SYNC_CONDITION
public static final int GL_SYNC_CONDITIONAccepted as thepname
parameter of GetSynciv.- See Also:
-
GL_SYNC_STATUS
public static final int GL_SYNC_STATUSAccepted as thepname
parameter of GetSynciv.- See Also:
-
GL_SYNC_FLAGS
public static final int GL_SYNC_FLAGSAccepted as thepname
parameter of GetSynciv.- See Also:
-
GL_SYNC_FENCE
public static final int GL_SYNC_FENCEReturned invalues
for GetSyncivpname
OBJECT_TYPE.- See Also:
-
GL_SYNC_GPU_COMMANDS_COMPLETE
public static final int GL_SYNC_GPU_COMMANDS_COMPLETEReturned invalues
for GetSyncivpname
SYNC_CONDITION.- See Also:
-
GL_UNSIGNALED
public static final int GL_UNSIGNALEDReturned invalues
for GetSyncivpname
SYNC_STATUS.- See Also:
-
GL_SIGNALED
public static final int GL_SIGNALEDReturned invalues
for GetSyncivpname
SYNC_STATUS.- See Also:
-
GL_SYNC_FLUSH_COMMANDS_BIT
public static final int GL_SYNC_FLUSH_COMMANDS_BITAccepted in theflags
parameter of ClientWaitSync.- See Also:
-
GL_TIMEOUT_IGNORED
public static final long GL_TIMEOUT_IGNOREDAccepted in thetimeout
parameter of WaitSync.- See Also:
-
GL_ALREADY_SIGNALED
public static final int GL_ALREADY_SIGNALEDReturned by ClientWaitSync.- See Also:
-
GL_TIMEOUT_EXPIRED
public static final int GL_TIMEOUT_EXPIREDReturned by ClientWaitSync.- See Also:
-
GL_CONDITION_SATISFIED
public static final int GL_CONDITION_SATISFIEDReturned by ClientWaitSync.- See Also:
-
GL_WAIT_FAILED
public static final int GL_WAIT_FAILEDReturned by ClientWaitSync.- See Also:
-
-
Method Details
-
glFenceSync
public static long glFenceSync(int condition, int flags) Creates a new sync object and inserts it into the GL command stream.- Parameters:
condition
- the condition that must be met to set the sync object's state to signaled. Must be:SYNC_GPU_COMMANDS_COMPLETE
flags
- a bitwise combination of flags controlling the behavior of the sync object. No flags are presently defined for this operation andflags
must be zero.
-
nglIsSync
public static boolean nglIsSync(long sync) Unsafe version of:IsSync
-
glIsSync
public static boolean glIsSync(long sync) Determines if a name corresponds to a sync object.- Parameters:
sync
- a value that may be the name of a sync object
-
nglDeleteSync
public static void nglDeleteSync(long sync) Unsafe version of:DeleteSync
-
glDeleteSync
public static void glDeleteSync(long sync) Deletes a sync object.- Parameters:
sync
- the sync object to be deleted
-
nglClientWaitSync
public static int nglClientWaitSync(long sync, int flags, long timeout) Unsafe version of:ClientWaitSync
-
glClientWaitSync
public static int glClientWaitSync(long sync, int flags, long timeout) Causes the client to block and wait for a sync object to become signaled. Ifsync
is signaled whenglClientWaitSync
is called,glClientWaitSync
returns immediately, otherwise it will block and wait for up to timeout nanoseconds forsync
to become signaled.The return value is one of four status values:
ALREADY_SIGNALED
indicates that sync was signaled at the time that glClientWaitSync was called.TIMEOUT_EXPIRED
indicates that at least timeout nanoseconds passed and sync did not become signaled.CONDITION_SATISFIED
indicates that sync was signaled before the timeout expired.WAIT_FAILED
indicates that an error occurred. Additionally, an OpenGL error will be generated.
- Parameters:
sync
- the sync object whose status to wait onflags
- a bitfield controlling the command flushing behavior. One or more of:0 SYNC_FLUSH_COMMANDS_BIT
timeout
- the timeout, specified in nanoseconds, for which the implementation should wait forsync
to become signaled
-
nglWaitSync
public static void nglWaitSync(long sync, int flags, long timeout) Unsafe version of:WaitSync
-
glWaitSync
public static void glWaitSync(long sync, int flags, long timeout) Causes the GL server to block and wait for a sync object to become signaled.glWaitSync
will always wait no longer than an implementation-dependent timeout. The duration of this timeout in nanoseconds may be queried by withMAX_SERVER_WAIT_TIMEOUT
. There is currently no way to determine whether glWaitSync unblocked because the timeout expired or because the sync object being waited on was signaled.If an error occurs,
glWaitSync
does not cause the GL server to block.- Parameters:
sync
- the sync object whose status to wait onflags
- a bitfield controlling the command flushing behavior. Must be:0 timeout
- the timeout that the server should wait before continuing. Must be:TIMEOUT_IGNORED
-
nglGetInteger64v
public static void nglGetInteger64v(int pname, long params) Unsafe version of:GetInteger64v
-
glGetInteger64v
Returns the 64bit integer value or values of a selected parameter.- Parameters:
pname
- the parameter value to be returnedparams
- the value or values of the specified parameter
-
glGetInteger64
public static long glGetInteger64(int pname) Returns the 64bit integer value or values of a selected parameter.- Parameters:
pname
- the parameter value to be returned
-
nglGetSynciv
public static void nglGetSynciv(long sync, int pname, int bufSize, long length, long values) Unsafe version of:GetSynciv
- Parameters:
bufSize
- the size of the buffer whose address is given invalues
-
glGetSynciv
Queries the properties of a sync object.- Parameters:
sync
- the sync object whose properties to querypname
- the parameter whose value to retrieve from the sync object specified insync
. One of:OBJECT_TYPE
SYNC_CONDITION
SYNC_STATUS
SYNC_FLAGS
length
- the address of an variable to receive the number of integers placed invalues
values
- the address of an array to receive the values of the queried parameter
-
glGetSynci
Queries the properties of a sync object.- Parameters:
sync
- the sync object whose properties to querypname
- the parameter whose value to retrieve from the sync object specified insync
. One of:OBJECT_TYPE
SYNC_CONDITION
SYNC_STATUS
SYNC_FLAGS
length
- the address of an variable to receive the number of integers placed invalues
-
glGetInteger64v
public static void glGetInteger64v(int pname, long[] params) Array version of:GetInteger64v
-
glGetSynciv
public static void glGetSynciv(long sync, int pname, @Nullable int[] length, int[] values) Array version of:GetSynciv
-