Top Description Fields Constructors Methods
org.lwjgl.opengl

public Class ARBSync

extends Object
Class Inheritance
Imports
javax.annotation.*, java.nio.*, org.lwjgl.system.*

Native bindings to the ARB_sync extension.

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 TypeField and Description
public static final int
GL_ALREADY_SIGNALED

Returned by ClientWaitSync.

public static final int
GL_CONDITION_SATISFIED

Returned by ClientWaitSync.

public static final int
GL_MAX_SERVER_WAIT_TIMEOUT

Accepted as the pname parameter of GetInteger64v.

public static final int
GL_OBJECT_TYPE

Accepted as the pname parameter of GetSynciv.

public static final int
GL_SIGNALED

Returned in values for GetSynciv pname SYNC_STATUS.

public static final int
GL_SYNC_CONDITION

Accepted as the pname parameter of GetSynciv.

public static final int
GL_SYNC_FENCE

Returned in values for GetSynciv pname OBJECT_TYPE.

public static final int
GL_SYNC_FLAGS

Accepted as the pname parameter of GetSynciv.

public static final int
GL_SYNC_FLUSH_COMMANDS_BIT

Accepted in the flags parameter of ClientWaitSync.

public static final int
GL_SYNC_GPU_COMMANDS_COMPLETE

Returned in values for GetSynciv pname SYNC_CONDITION.

public static final int
GL_SYNC_STATUS

Accepted as the pname parameter of GetSynciv.

public static final int
GL_TIMEOUT_EXPIRED

Returned by ClientWaitSync.

public static final long
GL_TIMEOUT_IGNORED

Accepted in the timeout parameter of WaitSync.

public static final int
GL_UNSIGNALED

Returned in values for GetSynciv pname SYNC_STATUS.

public static final int
GL_WAIT_FAILED

Returned by ClientWaitSync.

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public static int
glClientWaitSync(long
the sync object whose status to wait on
sync
,
int
a bitfield controlling the command flushing behavior. One or more of:
0SYNC_FLUSH_COMMANDS_BIT
flags
,
long
the timeout, specified in nanoseconds, for which the implementation should wait for sync to become signaled
timeout
)

Causes the client to block and wait for a sync object to become signaled.

public static void
glDeleteSync(long
the sync object to be deleted
sync
)

Deletes a sync object.

public static long
glFenceSync(int
the condition that must be met to set the sync object's state to signaled. Must be:
SYNC_GPU_COMMANDS_COMPLETE
condition
,
int
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.
flags
)

Creates a new sync object and inserts it into the GL command stream.

public static long
glGetInteger64(int
the parameter value to be returned
pname
)

Returns the 64bit integer value or values of a selected parameter.

public static void
glGetInteger64v(int
the parameter value to be returned
pname
,
LongBuffer
the value or values of the specified parameter
params
)

Returns the 64bit integer value or values of a selected parameter.

public static void
glGetInteger64v(int pname, long[] params)

Array version of: GetInteger64v

public static int
glGetSynci(long
the sync object whose properties to query
sync
,
int
the parameter whose value to retrieve from the sync object specified in sync. One of:
OBJECT_TYPESYNC_CONDITIONSYNC_STATUSSYNC_FLAGS
pname
,
IntBuffer
the address of an variable to receive the number of integers placed in values
length
)

Queries the properties of a sync object.

public static void
glGetSynciv(long
the sync object whose properties to query
sync
,
int
the parameter whose value to retrieve from the sync object specified in sync. One of:
OBJECT_TYPESYNC_CONDITIONSYNC_STATUSSYNC_FLAGS
pname
,
IntBuffer
the address of an variable to receive the number of integers placed in values
length
,
IntBuffer
the address of an array to receive the values of the queried parameter
values
)

Queries the properties of a sync object.

public static void
glGetSynciv(long sync, int pname, int[] length, int[] values)

Array version of: GetSynciv

public static boolean
glIsSync(long
a value that may be the name of a sync object
sync
)

Determines if a name corresponds to a sync object.

public static void
glWaitSync(long
the sync object whose status to wait on
sync
,
int
a bitfield controlling the command flushing behavior. Must be:
0
flags
,
long
the timeout that the server should wait before continuing. Must be:
TIMEOUT_IGNORED
timeout
)

Causes the GL server to block and wait for a sync object to become signaled.

public static int
nglClientWaitSync(long sync, int flags, long timeout)

Unsafe version of: ClientWaitSync

public static void
nglDeleteSync(long sync)

Unsafe version of: DeleteSync

public static void
nglGetInteger64v(int pname, long params)

Unsafe version of: GetInteger64v

public static void
nglGetSynciv(long sync, int pname, int
the size of the buffer whose address is given in values
bufSize
,
long length, long values)

Unsafe version of: GetSynciv

public static boolean
nglIsSync(long sync)

Unsafe version of: IsSync

public static void
nglWaitSync(long sync, int flags, long timeout)

Unsafe version of: WaitSync

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

GL_ALREADY_SIGNALEDback to summary
public static final int GL_ALREADY_SIGNALED

Returned by ClientWaitSync.

GL_CONDITION_SATISFIEDback to summary
public static final int GL_CONDITION_SATISFIED

Returned by ClientWaitSync.

GL_MAX_SERVER_WAIT_TIMEOUTback to summary
public static final int GL_MAX_SERVER_WAIT_TIMEOUT

Accepted as the pname parameter of GetInteger64v.

GL_OBJECT_TYPEback to summary
public static final int GL_OBJECT_TYPE

Accepted as the pname parameter of GetSynciv.

GL_SIGNALEDback to summary
public static final int GL_SIGNALED

Returned in values for GetSynciv pname SYNC_STATUS.

GL_SYNC_CONDITIONback to summary
public static final int GL_SYNC_CONDITION

Accepted as the pname parameter of GetSynciv.

GL_SYNC_FENCEback to summary
public static final int GL_SYNC_FENCE

Returned in values for GetSynciv pname OBJECT_TYPE.

GL_SYNC_FLAGSback to summary
public static final int GL_SYNC_FLAGS

Accepted as the pname parameter of GetSynciv.

GL_SYNC_FLUSH_COMMANDS_BITback to summary
public static final int GL_SYNC_FLUSH_COMMANDS_BIT

Accepted in the flags parameter of ClientWaitSync.

GL_SYNC_GPU_COMMANDS_COMPLETEback to summary
public static final int GL_SYNC_GPU_COMMANDS_COMPLETE

Returned in values for GetSynciv pname SYNC_CONDITION.

GL_SYNC_STATUSback to summary
public static final int GL_SYNC_STATUS

Accepted as the pname parameter of GetSynciv.

GL_TIMEOUT_EXPIREDback to summary
public static final int GL_TIMEOUT_EXPIRED

Returned by ClientWaitSync.

GL_TIMEOUT_IGNOREDback to summary
public static final long GL_TIMEOUT_IGNORED

Accepted in the timeout parameter of WaitSync.

GL_UNSIGNALEDback to summary
public static final int GL_UNSIGNALED

Returned in values for GetSynciv pname SYNC_STATUS.

GL_WAIT_FAILEDback to summary
public static final int GL_WAIT_FAILED

Returned by ClientWaitSync.

Constructor Detail

ARBSyncback to summary
protected ARBSync()

Method Detail

glClientWaitSyncback to summary
public static int glClientWaitSync(long sync, int flags, long timeout)

Causes the client to block and wait for a sync object to become signaled. If sync is signaled when glClientWaitSync is called, glClientWaitSync returns immediately, otherwise it will block and wait for up to timeout nanoseconds for sync 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:long

the sync object whose status to wait on

flags:int

a bitfield controlling the command flushing behavior. One or more of:

0SYNC_FLUSH_COMMANDS_BIT
timeout:long

the timeout, specified in nanoseconds, for which the implementation should wait for sync to become signaled

Annotations
@NativeType:GLenum
glDeleteSyncback to summary
public static void glDeleteSync(long sync)

Deletes a sync object.

Parameters
sync:long

the sync object to be deleted

glFenceSyncback to summary
public static long glFenceSync(int condition, int flags)

Creates a new sync object and inserts it into the GL command stream.

Parameters
condition:int

the condition that must be met to set the sync object's state to signaled. Must be:

SYNC_GPU_COMMANDS_COMPLETE
flags:int

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.

Annotations
@NativeType:GLsync
glGetInteger64back to summary
public static long glGetInteger64(int pname)

Returns the 64bit integer value or values of a selected parameter.

Parameters
pname:int

the parameter value to be returned

Annotations
@NativeType:void
glGetInteger64vback to summary
public static void glGetInteger64v(int pname, LongBuffer params)

Returns the 64bit integer value or values of a selected parameter.

Parameters
pname:int

the parameter value to be returned

params:LongBuffer

the value or values of the specified parameter

glGetInteger64vback to summary
public static void glGetInteger64v(int pname, long[] params)

Array version of: GetInteger64v

glGetSynciback to summary
public static int glGetSynci(long sync, int pname, IntBuffer length)

Queries the properties of a sync object.

Parameters
sync:long

the sync object whose properties to query

pname:int

the parameter whose value to retrieve from the sync object specified in sync. One of:

OBJECT_TYPESYNC_CONDITIONSYNC_STATUSSYNC_FLAGS
length:IntBuffer

the address of an variable to receive the number of integers placed in values

Annotations
@NativeType:void
glGetSyncivback to summary
public static void glGetSynciv(long sync, int pname, IntBuffer length, IntBuffer values)

Queries the properties of a sync object.

Parameters
sync:long

the sync object whose properties to query

pname:int

the parameter whose value to retrieve from the sync object specified in sync. One of:

OBJECT_TYPESYNC_CONDITIONSYNC_STATUSSYNC_FLAGS
length:IntBuffer

the address of an variable to receive the number of integers placed in values

values:IntBuffer

the address of an array to receive the values of the queried parameter

glGetSyncivback to summary
public static void glGetSynciv(long sync, int pname, int[] length, int[] values)

Array version of: GetSynciv

glIsSyncback to summary
public static boolean glIsSync(long sync)

Determines if a name corresponds to a sync object.

Parameters
sync:long

a value that may be the name of a sync object

Annotations
@NativeType:GLboolean
glWaitSyncback to summary
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 with MAX_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:long

the sync object whose status to wait on

flags:int

a bitfield controlling the command flushing behavior. Must be:

0
timeout:long

the timeout that the server should wait before continuing. Must be:

TIMEOUT_IGNORED
nglClientWaitSyncback to summary
public static int nglClientWaitSync(long sync, int flags, long timeout)

Unsafe version of: ClientWaitSync

nglDeleteSyncback to summary
public static void nglDeleteSync(long sync)

Unsafe version of: DeleteSync

nglGetInteger64vback to summary
public static void nglGetInteger64v(int pname, long params)

Unsafe version of: GetInteger64v

nglGetSyncivback to summary
public static void nglGetSynciv(long sync, int pname, int bufSize, long length, long values)

Unsafe version of: GetSynciv

Parameters
bufSize:int

the size of the buffer whose address is given in values

nglIsSyncback to summary
public static boolean nglIsSync(long sync)

Unsafe version of: IsSync

nglWaitSyncback to summary
public static void nglWaitSync(long sync, int flags, long timeout)

Unsafe version of: WaitSync