Class 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, or glDeleteRenderbuffers), 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 in mem_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.

    • 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 by clCreateFromGLBuffer. 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 and ReleaseMemObject functions can be used to retain and release the buffer object.

        Parameters:
        context - a valid OpenCL context created from an OpenGL context
        flags - a bit-field that is used to specify usage information. One of:
        MEM_READ_ONLYMEM_WRITE_ONLYMEM_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 calling glBufferData, 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. If errcode_ret is NULL, no error code is returned.
        Returns:
        a valid non-zero OpenCL buffer object and errcode_ret is set to SUCCESS if the buffer object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:
        • INVALID_CONTEXT if context is not a valid context or was not created from a GL context.
        • INVALID_VALUE if values specified in flags are not valid.
        • INVALID_GL_OBJECT if bufobj 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 parameters GL_TEXTURE_BASE_LEVEL or GL_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 and ReleaseMemObject functions can be used to retain and release the image objects.

        Parameters:
        context - a valid OpenCL context created from an OpenGL context
        flags - a bit-field that is used to specify usage information. One of:
        MEM_READ_ONLYMEM_WRITE_ONLYMEM_READ_WRITE
        texture_target - defines the image type of texture. No reference to a bound GL texture object is made or implied by this parameter. One of:
        GL_TEXTURE_2DGL_TEXTURE_CUBE_MAP_POSITIVE_X
        GL_TEXTURE_CUBE_MAP_POSITIVE_YGL_TEXTURE_CUBE_MAP_POSITIVE_Z
        GL_TEXTURE_CUBE_MAP_NEGATIVE_XGL_TEXTURE_CUBE_MAP_NEGATIVE_Y
        GL_TEXTURE_CUBE_MAP_NEGATIVE_ZGL_TEXTURE_RECTANGLE
        miplevel - the mipmap level to be used. Implementations may return INVALID_OPERATION for miplevel 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 specified miplevel 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. If errcode_ret is NULL, no error code is returned.
        Returns:
        a valid non-zero OpenCL image object and errcode_ret is set to SUCCESS if the image object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:
        • INVALID_CONTEXT if context is not a valid context or was not created from a GL context.
        • INVALID_VALUE if values specified in flags are not valid or if value specified in texture_target is not one of the values specified in the description of texture_target.
        • INVALID_MIP_LEVEL if miplevel is less than the value of levelbase (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value of q (for both OpenGL and OpenGL ES).
        • INVALID_MIP_LEVEL if miplevel is greather than zero and the OpenGL implementation does not support creating from non-zero mipmap levels.
        • INVALID_GL_OBJECT if texture is not a GL texture object whose type matches texture_target, if the specified miplevel of texture is not defined, or if the width or height of the specified miplevel is zero.
        • INVALID_IMAGE_FORMAT_DESCRIPTOR if the OpenGL texture internal format does not map to a supported OpenCL image format.
        • INVALID_OPERATION if texture 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 parameters GL_TEXTURE_BASE_LEVEL or GL_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 and ReleaseMemObject functions can be used to retain and release the image objects.

        Parameters:
        context - a valid OpenCL context created from an OpenGL context
        flags - a bit-field that is used to specify usage information. One of:
        MEM_READ_ONLYMEM_WRITE_ONLYMEM_READ_WRITE
        texture_target - defines the image type of texture. 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 used
        texture - 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 specified miplevel 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. If errcode_ret is NULL, no error code is returned.
        Returns:
        a valid non-zero image object and errcode_ret is set to SUCCESS if the image object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:
        • INVALID_CONTEXT if context is not a valid context or was not created from a GL context.
        • INVALID_VALUE if values specified in flags are not valid or if value specified in texture_target is not one of the values specified in the description of texture_target.
        • INVALID_MIP_LEVEL if miplevel is less than the value of levelbase (for OpenGL implementations) or zero (for OpenGL ES implementations); or greater than the value of q (for both OpenGL and OpenGL ES).
        • INVALID_MIP_LEVEL if miplevel is greather than zero and the OpenGL implementation does not support creating from non-zero mipmap levels.
        • INVALID_GL_OBJECT if texture is not a GL texture object whose type matches texture_target, if the specified miplevel of texture is not defined, or if the width or height of the specified miplevel is zero.
        • INVALID_IMAGE_FORMAT_DESCRIPTOR if the OpenGL texture internal format does not map to a supported OpenCL image format.
        • INVALID_OPERATION if texture 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 and ReleaseMemObject functions can be used to retain and release the image objects.

        Parameters:
        context - a valid OpenCL context created from an OpenGL context
        flags - a bit-field that is used to specify usage information. One of:
        MEM_READ_ONLYMEM_WRITE_ONLYMEM_READ_WRITE
        renderbuffer - the name of a GL renderbuffer object. The renderbuffer storage must be specified before the image object can be created. The renderbuffer 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. If errcode_ret is NULL, no error code is returned.
        Returns:
        a valid non-zero OpenCL image object and errcode_ret is set to SUCCESS if the image object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret:
        • INVALID_CONTEXT if context is not a valid context or was not created from a GL context.
        • INVALID_VALUE if values specified in flags are not valid.
        • INVALID_GL_OBJECT if renderbuffer is not a GL renderbuffer object or if the width or height of renderbuffer is zero.
        • INVALID_IMAGE_FORMAT_DESCRIPTOR if the OpenGL renderbuffer internal format does not map to a supported OpenCL image format.
        • INVALID_OPERATION if renderbuffer 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
      • 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 by param_value. This size must be ≥ size of return type. If param_value is NULL, it is ignored.
      • clGetGLTextureInfo

        public static int clGetGLTextureInfo​(long memobj,
                                             int param_name,
                                             @Nullable
                                             java.nio.ByteBuffer param_value,
                                             @Nullable
                                             PointerBuffer param_value_size_ret)
        
        public static int clGetGLTextureInfo​(long memobj,
                                             int param_name,
                                             @Nullable
                                             java.nio.IntBuffer param_value,
                                             @Nullable
                                             PointerBuffer param_value_size_ret)
        
        Returns additional information about the GL texture object associated with memobj.
        Parameters:
        param_name - specifies what additional information about the GL texture object associated with memobj to query. One of:
        GL_TEXTURE_TARGETGL_MIPMAP_LEVELGL_NUM_SAMPLES
        param_value - a pointer to memory where the appropriate result being queried is returned. If param_value is NULL, it is ignored.
        param_value_size_ret - the actual size in bytes of data being queried by param_value. If NULL, it is ignored.
        Returns:
        SUCCESS if the function is executed successfully. Otherwise, it returns one of the following errors:
        • INVALID_MEM_OBJECT if memobj is not a valid OpenCL memory object.
        • INVALID_GL_OBJECT if there is no GL texture object associated with memobj.
        • INVALID_VALUE if param_name is not valid, or if size in bytes specified by param_value_size is < size of return type and param_value is not NULL, or if param_value and param_value_size_ret are NULL.
        • 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 in mem_objects
        num_events_in_wait_list - the number of events in event_wait_list
      • clEnqueueAcquireGLObjects

        public static int clEnqueueAcquireGLObjects​(long command_queue,
                                                    PointerBuffer mem_objects,
                                                    @Nullable
                                                    PointerBuffer event_wait_list,
                                                    @Nullable
                                                    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 in mem_objects have completed. This may be accomplished portably by issuing and waiting for completion of a glFinish command on all GL contexts with pending references to these objects. Implementations may offer more efficient synchronization methods; for example on some platforms calling glFlush 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 than glFinish are portable between OpenGL implementations at this time.

        Parameters:
        command_queue - a valid command-queue. All devices used to create the OpenCL context associated with command_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 objects
        event_wait_list - a list of events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_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 be NULL 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 the event_wait_list and the event arguments are not NULL, the event argument should not refer to an element of the event_wait_list array.
        Returns:
        SUCCESS if the function is executed successfully. If num_objects is 0 and mem_objects is NULL the function does nothing and returns SUCCESS. Otherwise, it returns one of the following errors:
        • INVALID_VALUE if num_objects is zero and mem_objects is not a NULL value or if num_objects > 0 and mem_objects is NULL.
        • INVALID_MEM_OBJECT if memory objects in mem_objects are not valid OpenCL memory objects.
        • INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
        • INVALID_CONTEXT if context associated with command_queue was not created from an OpenGL context.
        • INVALID_GL_OBJECT if memory objects in mem_objects have not been created from a GL object(s).
        • INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_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
                                                    PointerBuffer event_wait_list,
                                                    @Nullable
                                                    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 in mem_objects have completed. This may be accomplished portably by issuing and waiting for completion of a glFinish command on all GL contexts with pending references to these objects. Implementations may offer more efficient synchronization methods; for example on some platforms calling glFlush 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 than glFinish are portable between OpenGL implementations at this time.

        Parameters:
        command_queue - a valid command-queue. All devices used to create the OpenCL context associated with command_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. If event_wait_list is NULL, then this particular command does not wait on any event to complete. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_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 be NULL 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 the event_wait_list and the event arguments are not NULL, the event argument should not refer to an element of the event_wait_list array.
        Returns:
        SUCCESS if the function is executed successfully. If num_objects is 0 and mem_objects is NULL the function does nothing and returns SUCCESS. Otherwise, it returns one of the following errors:
        • INVALID_VALUE if num_objects is zero and mem_objects is not a NULL value or if num_objects > 0 and mem_objects is NULL.
        • INVALID_MEM_OBJECT if memory objects in mem_objects are not valid OpenCL memory objects.
        • INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
        • INVALID_CONTEXT if context associated with command_queue was not created from an OpenGL context.
        • INVALID_GL_OBJECT if memory objects in mem_objects have not been created from a GL object(s).
        • INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_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 in mem_objects
        num_events_in_wait_list - the number of events in event_wait_list
      • clEnqueueReleaseGLObjects

        public static int clEnqueueReleaseGLObjects​(long command_queue,
                                                    PointerBuffer mem_objects,
                                                    @Nullable
                                                    PointerBuffer event_wait_list,
                                                    @Nullable
                                                    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 with command_queue.

        After calling clEnqueueReleaseGLObjects, the application is responsible for ensuring that any pending OpenCL operations which access the objects specified in mem_objects have completed prior to executing subsequent GL commands which reference these objects. This may be accomplished portably by calling WaitForEvents with the event object returned by clEnqueueReleaseGLObjects, or by calling Finish. Some implementations may offer more efficient methods.

        Parameters:
        command_queue - a valid command-queue
        mem_objects - a pointer to a list of CL memory objects that correpond to GL objects
        event_wait_list - a list of events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_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 be NULL 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 the event_wait_list and the event arguments are not NULL, the event argument should not refer to an element of the event_wait_list array.
        Returns:
        SUCCESS if the function is executed successfully. If num_objects is 0 and mem_objects is NULL the function does nothing and returns SUCCESS. Otherwise, it returns one of the following errors:
        • INVALID_VALUE if num_objects is zero and mem_objects is not a NULL value or if num_objects > 0 and mem_objects is NULL.
        • INVALID_MEM_OBJECT if memory objects in mem_objects are not valid OpenCL memory objects.
        • INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
        • INVALID_CONTEXT if context associated with command_queue was not created from an OpenGL context.
        • INVALID_GL_OBJECT if memory objects in mem_objects have not been created from a GL object(s).
        • INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_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
                                                    PointerBuffer event_wait_list,
                                                    @Nullable
                                                    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 with command_queue.

        After calling clEnqueueReleaseGLObjects, the application is responsible for ensuring that any pending OpenCL operations which access the objects specified in mem_objects have completed prior to executing subsequent GL commands which reference these objects. This may be accomplished portably by calling WaitForEvents with the event object returned by clEnqueueReleaseGLObjects, or by calling Finish. Some implementations may offer more efficient methods.

        Parameters:
        command_queue - a valid command-queue
        event_wait_list - a list of events that need to complete before this particular command can be executed. If event_wait_list is NULL, then this particular command does not wait on any event to complete. The events specified in event_wait_list act as synchronization points. The context associated with events in event_wait_list and command_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 be NULL 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 the event_wait_list and the event arguments are not NULL, the event argument should not refer to an element of the event_wait_list array.
        Returns:
        SUCCESS if the function is executed successfully. If num_objects is 0 and mem_objects is NULL the function does nothing and returns SUCCESS. Otherwise, it returns one of the following errors:
        • INVALID_VALUE if num_objects is zero and mem_objects is not a NULL value or if num_objects > 0 and mem_objects is NULL.
        • INVALID_MEM_OBJECT if memory objects in mem_objects are not valid OpenCL memory objects.
        • INVALID_COMMAND_QUEUE if command_queue is not a valid command-queue.
        • INVALID_CONTEXT if context associated with command_queue was not created from an OpenGL context.
        • INVALID_GL_OBJECT if memory objects in mem_objects have not been created from a GL object(s).
        • INVALID_EVENT_WAIT_LIST if event_wait_list is NULL and num_events_in_wait_list > 0, or event_wait_list is not NULL and num_events_in_wait_list is 0, or if event objects in event_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
                                             PointerBuffer param_value_size_ret)
        Array version of: GetGLTextureInfo
        See Also:
        Reference Page