Class CL10GL
- java.lang.Object
-
- org.lwjgl.opencl.CL10GL
-
- Direct Known Subclasses:
CL12GL
public class CL10GL extends java.lang.Object
The OpenCL 1.0 OpenGL interoperability functionality.OpenCL memory objects may be created from OpenGL objects if and only if the OpenCL context has been created from an OpenGL share group object or context. OpenGL share groups and contexts are created using platform specific APIs such as EGL, CGL, WGL, and GLX. On macOS, an OpenCL context may be created from an OpenGL share group object using the OpenCL platform extension cl_apple_gl_sharing. On other platforms including Microsoft Windows, Linux/Unix and others, an OpenCL context may be created from an OpenGL context using the Khronos platform extension cl_khr_gl_sharing.
Any supported OpenGL object defined within the GL share group object, or the share group associated with the GL context from which the CL context is created, may be shared, with the exception of the default OpenGL objects (i.e. objects named zero), which may not be shared.
Lifetime of Shared Objects
An OpenCL memory object created from an OpenGL object (hereinafter refered to as a “shared CL/GL object”) remains valid as long as the corresponding GL object has not been deleted. If the GL object is deleted through the GL API (e.g.
glDeleteBuffers
,glDeleteTextures
, orglDeleteRenderbuffers
), subsequent use of the CL buffer or image object will result in undefined behavior, including but not limited to possible CL errors and data corruption, but may not result in program termination.The CL context and corresponding command-queues are dependent on the existence of the GL share group object, or the share group associated with the GL context from which the CL context is created. If the GL share group object or all GL contexts in the share group are destroyed, any use of the CL context or command-queue(s) will result in undefined behavior, which may include program termination. Applications should destroy the CL command-queue(s) and CL context before destroying the corresponding GL share group or contexts.
Synchronizing OpenCL and OpenGL Access to Shared Objects
The application is responsible for maintaining the proper order of operations if the CL and GL contexts are in separate threads.
If a GL context is bound to a thread other than the one in which
EnqueueReleaseGLObjects
is called, changes to any of the objects inmem_objects
may not be visible to that context without additional steps being taken by the application. For an OpenGL 3.1 (or later) context, the requirements are described in Appendix D ("Shared Objects and Multiple Contexts") of the OpenGL 3.1 Specification. For prior versions of OpenGL, the requirements are implementation dependent.Attempting to access the data store of an OpenGL object after it has been acquired by OpenCL and before it has been released will result in undefined behavior. Similarly, attempting to access a shared CL/GL object from OpenCL before it has been acquired by the OpenCL command queue, or after it has been released, will result in undefined behavior.
-
-
Field Summary
Fields Modifier and Type Field Description static int
CL_GL_MIPMAP_LEVEL
cl_gl_texture_infostatic int
CL_GL_OBJECT_BUFFER
CL_GL_OBJECT_RENDERBUFFER
CL_GL_OBJECT_TEXTURE2D
CL_GL_OBJECT_TEXTURE3Dcl_gl_object_typestatic int
CL_GL_TEXTURE_TARGET
cl_gl_texture_infostatic int
CL_INVALID_GL_OBJECT
CL_INVALID_MIP_LEVELError Codes
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
clCreateFromGLBuffer(long context, long flags, int bufobj, int[] errcode_ret)
Array version of:CreateFromGLBuffer
static long
clCreateFromGLBuffer(long context, long flags, int bufobj, java.nio.IntBuffer errcode_ret)
Creates an OpenCL buffer object from an OpenGL buffer object.static long
clCreateFromGLRenderbuffer(long context, long flags, int renderbuffer, int[] errcode_ret)
Array version of:CreateFromGLRenderbuffer
static long
clCreateFromGLRenderbuffer(long context, long flags, int renderbuffer, java.nio.IntBuffer errcode_ret)
Creates an OpenCL 2D image object from an OpenGL renderbuffer object.static long
clCreateFromGLTexture2D(long context, long flags, int texture_target, int miplevel, int texture, int[] errcode_ret)
Array version of:CreateFromGLTexture2D
static long
clCreateFromGLTexture2D(long context, long flags, int texture_target, int miplevel, int texture, java.nio.IntBuffer errcode_ret)
Creates an OpenCL 2D image object from an OpenGL 2D texture object, or a single face of an OpenGL cubemap texture object.static long
clCreateFromGLTexture3D(long context, long flags, int texture_target, int miplevel, int texture, int[] errcode_ret)
Array version of:CreateFromGLTexture3D
static long
clCreateFromGLTexture3D(long context, long flags, int texture_target, int miplevel, int texture, java.nio.IntBuffer errcode_ret)
Creates an OpenCL 3D image object from an OpenGL 3D texture object.static int
clEnqueueAcquireGLObjects(long command_queue, long mem_object, org.lwjgl.PointerBuffer event_wait_list, org.lwjgl.PointerBuffer event)
Acquire OpenCL memory objects that have been created from OpenGL objects.static int
clEnqueueAcquireGLObjects(long command_queue, org.lwjgl.PointerBuffer mem_objects, org.lwjgl.PointerBuffer event_wait_list, org.lwjgl.PointerBuffer event)
Acquire OpenCL memory objects that have been created from OpenGL objects.static int
clEnqueueReleaseGLObjects(long command_queue, long mem_object, org.lwjgl.PointerBuffer event_wait_list, org.lwjgl.PointerBuffer event)
Releases OpenCL memory objects that have been created from OpenGL objects.static int
clEnqueueReleaseGLObjects(long command_queue, org.lwjgl.PointerBuffer mem_objects, org.lwjgl.PointerBuffer event_wait_list, org.lwjgl.PointerBuffer event)
Releases OpenCL memory objects that have been created from OpenGL objects.static int
clGetGLObjectInfo(long memobj, int[] gl_object_type, int[] gl_object_name)
Array version of:GetGLObjectInfo
static int
clGetGLObjectInfo(long memobj, java.nio.IntBuffer gl_object_type, java.nio.IntBuffer gl_object_name)
Queries the OpenGL object used to create the OpenCL memory object and information about the object type i.e.static int
clGetGLTextureInfo(long memobj, int param_name, int[] param_value, org.lwjgl.PointerBuffer param_value_size_ret)
Array version of:GetGLTextureInfo
static int
clGetGLTextureInfo(long memobj, int param_name, java.nio.ByteBuffer param_value, org.lwjgl.PointerBuffer param_value_size_ret)
Returns additional information about the GL texture object associated withmemobj
.static int
clGetGLTextureInfo(long memobj, int param_name, java.nio.IntBuffer param_value, org.lwjgl.PointerBuffer param_value_size_ret)
Returns additional information about the GL texture object associated withmemobj
.static long
nclCreateFromGLBuffer(long context, long flags, int bufobj, long errcode_ret)
Unsafe version of:CreateFromGLBuffer
static long
nclCreateFromGLRenderbuffer(long context, long flags, int renderbuffer, long errcode_ret)
Unsafe version of:CreateFromGLRenderbuffer
static long
nclCreateFromGLTexture2D(long context, long flags, int texture_target, int miplevel, int texture, long errcode_ret)
Unsafe version of:CreateFromGLTexture2D
static long
nclCreateFromGLTexture3D(long context, long flags, int texture_target, int miplevel, int texture, long errcode_ret)
Unsafe version of:CreateFromGLTexture3D
static int
nclEnqueueAcquireGLObjects(long command_queue, int num_objects, long mem_objects, int num_events_in_wait_list, long event_wait_list, long event)
Unsafe version of:EnqueueAcquireGLObjects
static int
nclEnqueueReleaseGLObjects(long command_queue, int num_objects, long mem_objects, int num_events_in_wait_list, long event_wait_list, long event)
Unsafe version of:EnqueueReleaseGLObjects
static int
nclGetGLObjectInfo(long memobj, long gl_object_type, long gl_object_name)
Unsafe version of:GetGLObjectInfo
static int
nclGetGLTextureInfo(long memobj, int param_name, long param_value_size, long param_value, long param_value_size_ret)
Unsafe version of:GetGLTextureInfo
-
-
-
Field Detail
-
CL_INVALID_GL_OBJECT, CL_INVALID_MIP_LEVEL
Error Codes
-
CL_GL_OBJECT_BUFFER, CL_GL_OBJECT_TEXTURE2D, CL_GL_OBJECT_TEXTURE3D, CL_GL_OBJECT_RENDERBUFFER
cl_gl_object_type
-
CL_GL_TEXTURE_TARGET, CL_GL_MIPMAP_LEVEL
cl_gl_texture_info
-
-
Method Detail
-
nclCreateFromGLBuffer
public static long nclCreateFromGLBuffer(long context, long flags, int bufobj, long errcode_ret)
Unsafe version of:CreateFromGLBuffer
-
clCreateFromGLBuffer
public static long clCreateFromGLBuffer(long context, long flags, int bufobj, @Nullable java.nio.IntBuffer errcode_ret)
Creates an OpenCL buffer object from an OpenGL buffer object.The size of the GL buffer object data store at the time
clCreateFromGLBuffer
is called will be used as the size of buffer object returned byclCreateFromGLBuffer
. If the state of a GL buffer object is modified through the GL API (e.g.glBufferData
) while there exists a corresponding CL buffer object, subsequent use of the CL buffer object will result in undefined behavior.The
RetainMemObject
andReleaseMemObject
functions can be used to retain and release the buffer object.- Parameters:
context
- a valid OpenCL context created from an OpenGL contextflags
- a bit-field that is used to specify usage information. One of:MEM_READ_ONLY
MEM_WRITE_ONLY
MEM_READ_WRITE
bufobj
- the name of a GL buffer object. The data store of the GL buffer object must have have been previously created by callingglBufferData
, although its contents need not be initialized. The size of the data store will be used to determine the size of the CL buffer object.errcode_ret
- will return an appropriate error code. Iferrcode_ret
isNULL
, no error code is returned.- Returns:
- a valid non-zero OpenCL buffer object and
errcode_ret
is set toSUCCESS
if the buffer object is created successfully. Otherwise, it returns aNULL
value with one of the following error values returned inerrcode_ret
:INVALID_CONTEXT
ifcontext
is not a valid context or was not created from a GL context.INVALID_VALUE
if values specified inflags
are not valid.INVALID_GL_OBJECT
ifbufobj
is not a GL buffer object or is a GL buffer object but does not have an existing data store or the size of the buffer is 0.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
nclCreateFromGLTexture2D
public static long nclCreateFromGLTexture2D(long context, long flags, int texture_target, int miplevel, int texture, long errcode_ret)
Unsafe version of:CreateFromGLTexture2D
-
clCreateFromGLTexture2D
public static long clCreateFromGLTexture2D(long context, long flags, int texture_target, int miplevel, int texture, @Nullable java.nio.IntBuffer errcode_ret)
Creates an OpenCL 2D image object from an OpenGL 2D texture object, or a single face of an OpenGL cubemap texture object.If the state of a GL texture object is modified through the GL API (e.g.
glTexImage2D
or the values of the texture parametersGL_TEXTURE_BASE_LEVEL
orGL_TEXTURE_MAX_LEVEL
are modified) while there exists a corresponding CL image object, subsequent use of the CL image object will result in undefined behavior.The
RetainMemObject
andReleaseMemObject
functions can be used to retain and release the image objects.- Parameters:
context
- a valid OpenCL context created from an OpenGL contextflags
- a bit-field that is used to specify usage information. One of:MEM_READ_ONLY
MEM_WRITE_ONLY
MEM_READ_WRITE
texture_target
- defines the image type oftexture
. No reference to a bound GL texture object is made or implied by this parameter. One of:GL_TEXTURE_2D GL_TEXTURE_CUBE_MAP_POSITIVE_X GL_TEXTURE_CUBE_MAP_POSITIVE_Y GL_TEXTURE_CUBE_MAP_POSITIVE_Z GL_TEXTURE_CUBE_MAP_NEGATIVE_X GL_TEXTURE_CUBE_MAP_NEGATIVE_Y GL_TEXTURE_CUBE_MAP_NEGATIVE_Z GL_TEXTURE_RECTANGLE miplevel
- the mipmap level to be used. Implementations may returnINVALID_OPERATION
formiplevel
values > 0.texture
- the name of a GL 2D, cubemap or rectangle texture object. The texture object must be a complete texture as per OpenGL rules on texture completeness. The texture format and dimensions defined by OpenGL for the specifiedmiplevel
of the texture will be used to create the 2D image object. Only GL texture objects with an internal format that maps to appropriate OpenCL image channel order and data type may be used to create a 2D image object.errcode_ret
- will return an appropriate error code. Iferrcode_ret
isNULL
, no error code is returned.- Returns:
- a valid non-zero OpenCL image object and
errcode_ret
is set toSUCCESS
if the image object is created successfully. Otherwise, it returns aNULL
value with one of the following error values returned inerrcode_ret
:INVALID_CONTEXT
ifcontext
is not a valid context or was not created from a GL context.INVALID_VALUE
if values specified inflags
are not valid or if value specified intexture_target
is not one of the values specified in the description oftexture_target
.INVALID_MIP_LEVEL
ifmiplevel
is less than the value oflevel
base (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value ofq
(for both OpenGL and OpenGL ES).INVALID_MIP_LEVEL
ifmiplevel
is greather than zero and the OpenGL implementation does not support creating from non-zero mipmap levels.INVALID_GL_OBJECT
iftexture
is not a GL texture object whose type matchestexture_target
, if the specifiedmiplevel
of texture is not defined, or if the width or height of the specifiedmiplevel
is zero.INVALID_IMAGE_FORMAT_DESCRIPTOR
if the OpenGL texture internal format does not map to a supported OpenCL image format.INVALID_OPERATION
iftexture
is a GL texture object created with a border width value greater than zero.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page - This function is deprecated after OpenCL 1.1
-
nclCreateFromGLTexture3D
public static long nclCreateFromGLTexture3D(long context, long flags, int texture_target, int miplevel, int texture, long errcode_ret)
Unsafe version of:CreateFromGLTexture3D
-
clCreateFromGLTexture3D
public static long clCreateFromGLTexture3D(long context, long flags, int texture_target, int miplevel, int texture, @Nullable java.nio.IntBuffer errcode_ret)
Creates an OpenCL 3D image object from an OpenGL 3D texture object.If the state of a GL texture object is modified through the GL API (e.g.
glTexImage3D
or the values of the texture parametersGL_TEXTURE_BASE_LEVEL
orGL_TEXTURE_MAX_LEVEL
are modified) while there exists a corresponding CL image object, subsequent use of the CL image object will result in undefined behavior.The
RetainMemObject
andReleaseMemObject
functions can be used to retain and release the image objects.- Parameters:
context
- a valid OpenCL context created from an OpenGL contextflags
- a bit-field that is used to specify usage information. One of:MEM_READ_ONLY
MEM_WRITE_ONLY
MEM_READ_WRITE
texture_target
- defines the image type oftexture
. No reference to a bound GL texture object is made or implied by this parameter. Must be:GL_TEXTURE_3D miplevel
- the mipmap level to be usedtexture
- the name of a GL 3D texture object. The texture object must be a complete texture as per OpenGL rules on texture completeness. The texture format and dimensions defined by OpenGL for the specifiedmiplevel
of the texture will be used to create the 3D image object. Only GL texture objects with an internal format that maps to appropriate OpenCL image channel order and data type can be used to create the 3D image object.errcode_ret
- will return an appropriate error code. Iferrcode_ret
isNULL
, no error code is returned.- Returns:
- a valid non-zero image object and
errcode_ret
is set toSUCCESS
if the image object is created successfully. Otherwise, it returns aNULL
value with one of the following error values returned inerrcode_ret
:INVALID_CONTEXT
ifcontext
is not a valid context or was not created from a GL context.INVALID_VALUE
if values specified inflags
are not valid or if value specified intexture_target
is not one of the values specified in the description oftexture_target
.INVALID_MIP_LEVEL
ifmiplevel
is less than the value oflevel
base (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value ofq
(for both OpenGL and OpenGL ES).INVALID_MIP_LEVEL
ifmiplevel
is greather than zero and the OpenGL implementation does not support creating from non-zero mipmap levels.INVALID_GL_OBJECT
iftexture
is not a GL texture object whose type matchestexture_target
, if the specifiedmiplevel
of texture is not defined, or if the width or height of the specifiedmiplevel
is zero.INVALID_IMAGE_FORMAT_DESCRIPTOR
if the OpenGL texture internal format does not map to a supported OpenCL image format.INVALID_OPERATION
iftexture
is a GL texture object created with a border width value greater than zero.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page - This function is deprecated after OpenCL 1.1
-
nclCreateFromGLRenderbuffer
public static long nclCreateFromGLRenderbuffer(long context, long flags, int renderbuffer, long errcode_ret)
Unsafe version of:CreateFromGLRenderbuffer
-
clCreateFromGLRenderbuffer
public static long clCreateFromGLRenderbuffer(long context, long flags, int renderbuffer, @Nullable java.nio.IntBuffer errcode_ret)
Creates an OpenCL 2D image object from an OpenGL renderbuffer object.If the state of a GL renderbuffer object is modified through the GL API (i.e. changes to the dimensions or format used to represent pixels of the GL renderbuffer using appropriate GL API calls such as
glRenderbufferStorage
) while there exists a corresponding CL image object, subsequent use of the CL image object will result in undefined behavior.The
RetainMemObject
andReleaseMemObject
functions can be used to retain and release the image objects.- Parameters:
context
- a valid OpenCL context created from an OpenGL contextflags
- a bit-field that is used to specify usage information. One of:MEM_READ_ONLY
MEM_WRITE_ONLY
MEM_READ_WRITE
renderbuffer
- the name of a GL renderbuffer object. The renderbuffer storage must be specified before the image object can be created. Therenderbuffer
format and dimensions defined by OpenGL will be used to create the 2D image object. Only GL renderbuffers with internal formats that maps to appropriate OpenCL image channel order and data type can be used to create the 2D image object.errcode_ret
- will return an appropriate error code. Iferrcode_ret
isNULL
, no error code is returned.- Returns:
- a valid non-zero OpenCL image object and
errcode_ret
is set toSUCCESS
if the image object is created successfully. Otherwise, it returns aNULL
value with one of the following error values returned inerrcode_ret
:INVALID_CONTEXT
ifcontext
is not a valid context or was not created from a GL context.INVALID_VALUE
if values specified inflags
are not valid.INVALID_GL_OBJECT
ifrenderbuffer
is not a GL renderbuffer object or if the width or height ofrenderbuffer
is zero.INVALID_IMAGE_FORMAT_DESCRIPTOR
if the OpenGL renderbuffer internal format does not map to a supported OpenCL image format.INVALID_OPERATION
ifrenderbuffer
is a multi-sample GL renderbuffer object.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
nclGetGLObjectInfo
public static int nclGetGLObjectInfo(long memobj, long gl_object_type, long gl_object_name)
Unsafe version of:GetGLObjectInfo
-
clGetGLObjectInfo
public static int clGetGLObjectInfo(long memobj, @Nullable java.nio.IntBuffer gl_object_type, @Nullable java.nio.IntBuffer gl_object_name)
Queries the OpenGL object used to create the OpenCL memory object and information about the object type i.e. whether it is a texture, renderbuffer or buffer object.- Parameters:
memobj
- the memory object being queriedgl_object_type
- returns the type of GL object attached tomemobj
. Ifgl_object_type
isNULL
, it is ignored. One of:GL_OBJECT_BUFFER
GL_OBJECT_TEXTURE2D
GL_OBJECT_TEXTURE3D
GL_OBJECT_RENDERBUFFER
GL_OBJECT_TEXTURE_2D_ARRAY
GL_OBJECT_TEXTURE1D
GL_OBJECT_TEXTURE1D_ARRAY
GL_OBJECT_TEXTURE_BUFFER
gl_object_name
- the GL object name used to creatememobj
. Ifgl_object_name
isNULL
, it is ignored.- Returns:
SUCCESS
if the call was executed successfully. Otherwise, it returns one of the following errors:INVALID_MEM_OBJECT
ifmemobj
is not a valid OpenCL memory object.INVALID_GL_OBJECT
if there is no GL object associated withmemobj
.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
nclGetGLTextureInfo
public static int nclGetGLTextureInfo(long memobj, int param_name, long param_value_size, long param_value, long param_value_size_ret)
Unsafe version of:GetGLTextureInfo
- Parameters:
param_value_size
- the size in bytes of memory pointed to byparam_value
. This size must be ≥ size of return type. Ifparam_value
isNULL
, it is ignored.
-
clGetGLTextureInfo
public static int clGetGLTextureInfo(long memobj, int param_name, @Nullable java.nio.ByteBuffer param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret) public static int clGetGLTextureInfo(long memobj, int param_name, @Nullable java.nio.IntBuffer param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret)
Returns additional information about the GL texture object associated withmemobj
.- Parameters:
param_name
- specifies what additional information about the GL texture object associated withmemobj
to query. One of:GL_TEXTURE_TARGET
GL_MIPMAP_LEVEL
GL_NUM_SAMPLES
param_value
- a pointer to memory where the appropriate result being queried is returned. Ifparam_value
isNULL
, it is ignored.param_value_size_ret
- the actual size in bytes of data being queried byparam_value
. IfNULL
, it is ignored.- Returns:
SUCCESS
if the function is executed successfully. Otherwise, it returns one of the following errors:INVALID_MEM_OBJECT
ifmemobj
is not a valid OpenCL memory object.INVALID_GL_OBJECT
if there is no GL texture object associated withmemobj
.INVALID_VALUE
ifparam_name
is not valid, or if size in bytes specified byparam_value_size
is < size of return type andparam_value
is notNULL
, or ifparam_value
andparam_value_size_ret
areNULL
.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
nclEnqueueAcquireGLObjects
public static int nclEnqueueAcquireGLObjects(long command_queue, int num_objects, long mem_objects, int num_events_in_wait_list, long event_wait_list, long event)
Unsafe version of:EnqueueAcquireGLObjects
- Parameters:
num_objects
- the number of memory objects to be acquired inmem_objects
num_events_in_wait_list
- the number of events inevent_wait_list
-
clEnqueueAcquireGLObjects
public static int clEnqueueAcquireGLObjects(long command_queue, org.lwjgl.PointerBuffer mem_objects, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
Acquire OpenCL memory objects that have been created from OpenGL objects. These objects need to be acquired before they can be used by any OpenCL commands queued to a command-queue. The OpenGL objects are acquired by the OpenCL context associated with command_queue and can therefore be used by all command-queues associated with the OpenCL context.Prior to calling
clEnqueueAcquireGLObjects
, the application must ensure that any pending GL operations which access the objects specified inmem_objects
have completed. This may be accomplished portably by issuing and waiting for completion of aglFinish
command on all GL contexts with pending references to these objects. Implementations may offer more efficient synchronization methods; for example on some platforms callingglFlush
may be sufficient, or synchronization may be implicit within a thread, or there may be vendor-specific extensions that enable placing a fence in the GL command stream and waiting for completion of that fence in the CL command queue. Note that no synchronization methods other thanglFinish
are portable between OpenGL implementations at this time.- Parameters:
command_queue
- a valid command-queue. All devices used to create the OpenCL context associated withcommand_queue
must support acquiring shared CL/GL objects. This constraint is enforced at context creation time.mem_objects
- a pointer to a list of CL memory objects that correspond to GL objectsevent_wait_list
- a list of events that need to complete before this particular command can be executed. Ifevent_wait_list
isNULL
, then this particular command does not wait on any event to complete. The events specified inevent_wait_list
act as synchronization points. The context associated with events inevent_wait_list
andcommand_queue
must be the same.event
- Returns an event object that identifies this particular command and can be used to query or queue a wait for this particular command to complete.event
can beNULL
in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete. If theevent_wait_list
and theevent
arguments are notNULL
, the event argument should not refer to an element of theevent_wait_list
array.- Returns:
SUCCESS
if the function is executed successfully. Ifnum_objects
is 0 andmem_objects
isNULL
the function does nothing and returnsSUCCESS
. Otherwise, it returns one of the following errors:INVALID_VALUE
ifnum_objects
is zero andmem_objects
is not aNULL
value or ifnum_objects
> 0 andmem_objects
isNULL
.INVALID_MEM_OBJECT
if memory objects inmem_objects
are not valid OpenCL memory objects.INVALID_COMMAND_QUEUE
ifcommand_queue
is not a valid command-queue.INVALID_CONTEXT
if context associated withcommand_queue
was not created from an OpenGL context.INVALID_GL_OBJECT
if memory objects inmem_objects
have not been created from a GL object(s).INVALID_EVENT_WAIT_LIST
ifevent_wait_list
isNULL
andnum_events_in_wait_list
> 0, orevent_wait_list
is notNULL
andnum_events_in_wait_list
is 0, or if event objects inevent_wait_list
are not valid events.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
clEnqueueAcquireGLObjects
public static int clEnqueueAcquireGLObjects(long command_queue, long mem_object, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
Acquire OpenCL memory objects that have been created from OpenGL objects. These objects need to be acquired before they can be used by any OpenCL commands queued to a command-queue. The OpenGL objects are acquired by the OpenCL context associated with command_queue and can therefore be used by all command-queues associated with the OpenCL context.Prior to calling
clEnqueueAcquireGLObjects
, the application must ensure that any pending GL operations which access the objects specified inmem_objects
have completed. This may be accomplished portably by issuing and waiting for completion of aglFinish
command on all GL contexts with pending references to these objects. Implementations may offer more efficient synchronization methods; for example on some platforms callingglFlush
may be sufficient, or synchronization may be implicit within a thread, or there may be vendor-specific extensions that enable placing a fence in the GL command stream and waiting for completion of that fence in the CL command queue. Note that no synchronization methods other thanglFinish
are portable between OpenGL implementations at this time.- Parameters:
command_queue
- a valid command-queue. All devices used to create the OpenCL context associated withcommand_queue
must support acquiring shared CL/GL objects. This constraint is enforced at context creation time.event_wait_list
- a list of events that need to complete before this particular command can be executed. Ifevent_wait_list
isNULL
, then this particular command does not wait on any event to complete. The events specified inevent_wait_list
act as synchronization points. The context associated with events inevent_wait_list
andcommand_queue
must be the same.event
- Returns an event object that identifies this particular command and can be used to query or queue a wait for this particular command to complete.event
can beNULL
in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete. If theevent_wait_list
and theevent
arguments are notNULL
, the event argument should not refer to an element of theevent_wait_list
array.- Returns:
SUCCESS
if the function is executed successfully. Ifnum_objects
is 0 andmem_objects
isNULL
the function does nothing and returnsSUCCESS
. Otherwise, it returns one of the following errors:INVALID_VALUE
ifnum_objects
is zero andmem_objects
is not aNULL
value or ifnum_objects
> 0 andmem_objects
isNULL
.INVALID_MEM_OBJECT
if memory objects inmem_objects
are not valid OpenCL memory objects.INVALID_COMMAND_QUEUE
ifcommand_queue
is not a valid command-queue.INVALID_CONTEXT
if context associated withcommand_queue
was not created from an OpenGL context.INVALID_GL_OBJECT
if memory objects inmem_objects
have not been created from a GL object(s).INVALID_EVENT_WAIT_LIST
ifevent_wait_list
isNULL
andnum_events_in_wait_list
> 0, orevent_wait_list
is notNULL
andnum_events_in_wait_list
is 0, or if event objects inevent_wait_list
are not valid events.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
nclEnqueueReleaseGLObjects
public static int nclEnqueueReleaseGLObjects(long command_queue, int num_objects, long mem_objects, int num_events_in_wait_list, long event_wait_list, long event)
Unsafe version of:EnqueueReleaseGLObjects
- Parameters:
num_objects
- the number of memory objects to be released inmem_objects
num_events_in_wait_list
- the number of events inevent_wait_list
-
clEnqueueReleaseGLObjects
public static int clEnqueueReleaseGLObjects(long command_queue, org.lwjgl.PointerBuffer mem_objects, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
Releases OpenCL memory objects that have been created from OpenGL objects. These objects need to be released before they can be used by OpenGL. The OpenGL objects are released by the OpenCL context associated withcommand_queue
.After calling
clEnqueueReleaseGLObjects
, the application is responsible for ensuring that any pending OpenCL operations which access the objects specified inmem_objects
have completed prior to executing subsequent GL commands which reference these objects. This may be accomplished portably by callingWaitForEvents
with the event object returned byclEnqueueReleaseGLObjects
, or by callingFinish
. Some implementations may offer more efficient methods.- Parameters:
command_queue
- a valid command-queuemem_objects
- a pointer to a list of CL memory objects that correpond to GL objectsevent_wait_list
- a list of events that need to complete before this particular command can be executed. Ifevent_wait_list
isNULL
, then this particular command does not wait on any event to complete. The events specified inevent_wait_list
act as synchronization points. The context associated with events inevent_wait_list
andcommand_queue
must be the same.event
- Returns an event object that identifies this particular command and can be used to query or queue a wait for this particular command to complete.event
can beNULL
in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete. If theevent_wait_list
and theevent
arguments are notNULL
, the event argument should not refer to an element of theevent_wait_list
array.- Returns:
SUCCESS
if the function is executed successfully. Ifnum_objects
is 0 andmem_objects
isNULL
the function does nothing and returnsSUCCESS
. Otherwise, it returns one of the following errors:INVALID_VALUE
ifnum_objects
is zero andmem_objects
is not aNULL
value or ifnum_objects
> 0 andmem_objects
isNULL
.INVALID_MEM_OBJECT
if memory objects inmem_objects
are not valid OpenCL memory objects.INVALID_COMMAND_QUEUE
ifcommand_queue
is not a valid command-queue.INVALID_CONTEXT
if context associated withcommand_queue
was not created from an OpenGL context.INVALID_GL_OBJECT
if memory objects inmem_objects
have not been created from a GL object(s).INVALID_EVENT_WAIT_LIST
ifevent_wait_list
isNULL
andnum_events_in_wait_list
> 0, orevent_wait_list
is notNULL
andnum_events_in_wait_list
is 0, or if event objects inevent_wait_list
are not valid events.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
clEnqueueReleaseGLObjects
public static int clEnqueueReleaseGLObjects(long command_queue, long mem_object, @Nullable org.lwjgl.PointerBuffer event_wait_list, @Nullable org.lwjgl.PointerBuffer event)
Releases OpenCL memory objects that have been created from OpenGL objects. These objects need to be released before they can be used by OpenGL. The OpenGL objects are released by the OpenCL context associated withcommand_queue
.After calling
clEnqueueReleaseGLObjects
, the application is responsible for ensuring that any pending OpenCL operations which access the objects specified inmem_objects
have completed prior to executing subsequent GL commands which reference these objects. This may be accomplished portably by callingWaitForEvents
with the event object returned byclEnqueueReleaseGLObjects
, or by callingFinish
. Some implementations may offer more efficient methods.- Parameters:
command_queue
- a valid command-queueevent_wait_list
- a list of events that need to complete before this particular command can be executed. Ifevent_wait_list
isNULL
, then this particular command does not wait on any event to complete. The events specified inevent_wait_list
act as synchronization points. The context associated with events inevent_wait_list
andcommand_queue
must be the same.event
- Returns an event object that identifies this particular command and can be used to query or queue a wait for this particular command to complete.event
can beNULL
in which case it will not be possible for the application to query the status of this command or queue a wait for this command to complete. If theevent_wait_list
and theevent
arguments are notNULL
, the event argument should not refer to an element of theevent_wait_list
array.- Returns:
SUCCESS
if the function is executed successfully. Ifnum_objects
is 0 andmem_objects
isNULL
the function does nothing and returnsSUCCESS
. Otherwise, it returns one of the following errors:INVALID_VALUE
ifnum_objects
is zero andmem_objects
is not aNULL
value or ifnum_objects
> 0 andmem_objects
isNULL
.INVALID_MEM_OBJECT
if memory objects inmem_objects
are not valid OpenCL memory objects.INVALID_COMMAND_QUEUE
ifcommand_queue
is not a valid command-queue.INVALID_CONTEXT
if context associated withcommand_queue
was not created from an OpenGL context.INVALID_GL_OBJECT
if memory objects inmem_objects
have not been created from a GL object(s).INVALID_EVENT_WAIT_LIST
ifevent_wait_list
isNULL
andnum_events_in_wait_list
> 0, orevent_wait_list
is notNULL
andnum_events_in_wait_list
is 0, or if event objects inevent_wait_list
are not valid events.OUT_OF_RESOURCES
if there is a failure to allocate resources required by the OpenCL implementation on the device.OUT_OF_HOST_MEMORY
if there is a failure to allocate resources required by the OpenCL implementation on the host.
- See Also:
- Reference Page
-
clCreateFromGLBuffer
public static long clCreateFromGLBuffer(long context, long flags, int bufobj, @Nullable int[] errcode_ret)
Array version of:CreateFromGLBuffer
- See Also:
- Reference Page
-
clCreateFromGLTexture2D
public static long clCreateFromGLTexture2D(long context, long flags, int texture_target, int miplevel, int texture, @Nullable int[] errcode_ret)
Array version of:CreateFromGLTexture2D
- See Also:
- Reference Page - This function is deprecated after OpenCL 1.1
-
clCreateFromGLTexture3D
public static long clCreateFromGLTexture3D(long context, long flags, int texture_target, int miplevel, int texture, @Nullable int[] errcode_ret)
Array version of:CreateFromGLTexture3D
- See Also:
- Reference Page - This function is deprecated after OpenCL 1.1
-
clCreateFromGLRenderbuffer
public static long clCreateFromGLRenderbuffer(long context, long flags, int renderbuffer, @Nullable int[] errcode_ret)
Array version of:CreateFromGLRenderbuffer
- See Also:
- Reference Page
-
clGetGLObjectInfo
public static int clGetGLObjectInfo(long memobj, @Nullable int[] gl_object_type, @Nullable int[] gl_object_name)
Array version of:GetGLObjectInfo
- See Also:
- Reference Page
-
clGetGLTextureInfo
public static int clGetGLTextureInfo(long memobj, int param_name, @Nullable int[] param_value, @Nullable org.lwjgl.PointerBuffer param_value_size_ret)
Array version of:GetGLTextureInfo
- See Also:
- Reference Page
-
-