Class ARBSync
- java.lang.Object
-
- org.lwjgl.opengl.ARBSync
-
public class ARBSync extends java.lang.ObjectNative 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 inOpenGL 3.2.
-
-
Field Summary
Fields Modifier and Type Field and Description static intGL_ALREADY_SIGNALED
GL_CONDITION_SATISFIEDReturned by ClientWaitSync.static intGL_MAX_SERVER_WAIT_TIMEOUTAccepted as thepnameparameter of GetInteger64v.static intGL_OBJECT_TYPEAccepted as thepnameparameter of GetSynciv.static intGL_SIGNALEDReturned invaluesfor GetSyncivpnameSYNC_STATUS.static intGL_SYNC_CONDITIONAccepted as thepnameparameter of GetSynciv.static intGL_SYNC_FENCEReturned invaluesfor GetSyncivpnameOBJECT_TYPE.static intGL_SYNC_FLAGSAccepted as thepnameparameter of GetSynciv.static intGL_SYNC_FLUSH_COMMANDS_BITAccepted in theflagsparameter of ClientWaitSync.static intGL_SYNC_GPU_COMMANDS_COMPLETEReturned invaluesfor GetSyncivpnameSYNC_CONDITION.static intGL_SYNC_STATUSAccepted as thepnameparameter of GetSynciv.static intGL_TIMEOUT_EXPIREDReturned by ClientWaitSync.static longGL_TIMEOUT_IGNOREDAccepted in thetimeoutparameter of WaitSync.static intGL_UNSIGNALEDReturned invaluesfor GetSyncivpnameSYNC_STATUS.static intGL_WAIT_FAILEDReturned by ClientWaitSync.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static intglClientWaitSync(long sync, int flags, long timeout)Causes the client to block and wait for a sync object to become signaled.static voidglDeleteSync(long sync)Deletes a sync object.static longglFenceSync(int condition, int flags)Creates a new sync object and inserts it into the GL command stream.static longglGetInteger64(int pname)Returns the 64bit integer value or values of a selected parameter.static voidglGetInteger64v(int pname, long[] params)Array version of:GetInteger64vstatic voidglGetInteger64v(int pname, java.nio.LongBuffer params)Returns the 64bit integer value or values of a selected parameter.static intglGetSynci(long sync, int pname, java.nio.IntBuffer length)Queries the properties of a sync object.static voidglGetSynciv(long sync, int pname, int[] length, int[] values)Array version of:GetSyncivstatic voidglGetSynciv(long sync, int pname, java.nio.IntBuffer length, java.nio.IntBuffer values)Queries the properties of a sync object.static booleanglIsSync(long sync)Determines if a name corresponds to a sync object.static voidglWaitSync(long sync, int flags, long timeout)Causes the GL server to block and wait for a sync object to become signaled.
-
-
-
Field Detail
-
GL_MAX_SERVER_WAIT_TIMEOUT
Accepted as thepnameparameter of GetInteger64v.
-
GL_OBJECT_TYPE, GL_SYNC_CONDITION, GL_SYNC_STATUS, GL_SYNC_FLAGS
Accepted as thepnameparameter of GetSynciv.
-
GL_SYNC_FENCE
Returned invaluesfor GetSyncivpnameOBJECT_TYPE.
-
GL_SYNC_GPU_COMMANDS_COMPLETE
Returned invaluesfor GetSyncivpnameSYNC_CONDITION.
-
GL_UNSIGNALED, GL_SIGNALED
Returned invaluesfor GetSyncivpnameSYNC_STATUS.
-
GL_SYNC_FLUSH_COMMANDS_BIT
Accepted in theflagsparameter of ClientWaitSync.
-
GL_TIMEOUT_IGNORED
Accepted in thetimeoutparameter of WaitSync.
-
GL_ALREADY_SIGNALED, GL_TIMEOUT_EXPIRED, GL_CONDITION_SATISFIED, GL_WAIT_FAILED
Returned by ClientWaitSync.
-
-
Method Detail
-
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_COMPLETEflags- a bitwise combination of flags controlling the behavior of the sync object. No flags are presently defined for this operation andflagsmust be zero.
-
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
-
glDeleteSync
public static void glDeleteSync(long sync)
Deletes a sync object.- Parameters:
sync- the sync object to be deleted
-
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. Ifsyncis signaled whenglClientWaitSyncis called,glClientWaitSyncreturns immediately, otherwise it will block and wait for up to timeout nanoseconds forsyncto become signaled.The return value is one of four status values:
ALREADY_SIGNALEDindicates that sync was signaled at the time that glClientWaitSync was called.TIMEOUT_EXPIREDindicates that at least timeout nanoseconds passed and sync did not become signaled.CONDITION_SATISFIEDindicates that sync was signaled before the timeout expired.WAIT_FAILEDindicates 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_BITtimeout- the timeout, specified in nanoseconds, for which the implementation should wait forsyncto become signaled
-
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.glWaitSyncwill 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,
glWaitSyncdoes 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
-
glGetInteger64v
public static void glGetInteger64v(int pname, java.nio.LongBuffer params)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
-
glGetSynciv
public static void glGetSynciv(long sync, int pname, java.nio.IntBuffer length, java.nio.IntBuffer values)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_TYPESYNC_CONDITIONSYNC_STATUSSYNC_FLAGSlength- the address of an variable to receive the number of integers placed invaluesvalues- the address of an array to receive the values of the queried parameter
-
glGetSynci
public static int glGetSynci(long sync, int pname, java.nio.IntBuffer length)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_TYPESYNC_CONDITIONSYNC_STATUSSYNC_FLAGSlength- 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, int[] length, int[] values)Array version of:GetSynciv
-
-