Class KHRGLSharing

java.lang.Object
org.lwjgl.opencl.KHRGLSharing

public class KHRGLSharing extends Object
Native bindings to the khr_gl_sharing extension.
  • Field Details

  • Method Details

    • nclGetGLContextInfoKHR

      public static int nclGetGLContextInfoKHR(long properties, int param_name, long param_value_size, long param_value, long param_value_size_ret)
      Unsafe version of: GetGLContextInfoKHR
      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.
    • clGetGLContextInfoKHR

      public static int clGetGLContextInfoKHR(PointerBuffer properties, int param_name, @Nullable ByteBuffer param_value, @Nullable PointerBuffer param_value_size_ret)
      Queries the OpenCL device currently corresponding to an OpenGL context.

      Such a device may not always exist (for example, if an OpenGL context is specified on a GPU not supporting OpenCL command queues, but which does support shared CL/GL objects), and if it does exist, may change over time. When such a device does exist, acquiring and releasing shared CL/GL objects may be faster on a command queue corresponding to this device than on command queues corresponding to other devices available to an OpenCL context.

      Parameters:
      properties - points to an attribute list whose format and valid contents are identical to the {code properties} argument of CreateContext. properties must identify a single valid GL context or GL share group object.
      param_name - a constant that specifies the GL context information to query. One of:
      DEVICES_FOR_GL_CONTEXT_KHRCURRENT_DEVICE_FOR_GL_CONTEXT_KHR
      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. If no device(s) exist corresponding to param_name, the call will not fail, but the value of param_value_size_ret will be zero.

      Returns INVALID_GL_SHAREGROUP_REFERENCE_KHR if a context was specified by any of the following means:

      and any of the following conditions hold:

      • The specified display and context attributes do not identify a valid OpenGL or OpenGL ES context.
      • The specified context does not support buffer and renderbuffer objects.
      • The specified context is not compatible with the OpenCL context being created (for example, it exists in a physically distinct address space, such as another hardware device; or it does not support sharing data with OpenCL due to implementation restrictions).

      Returns INVALID_GL_SHAREGROUP_REFERENCE_KHR if a share group was specified for a CGL-based OpenGL implementation by setting the attribute CGL_SHAREGROUP_KHR, and the specified share group does not identify a valid CGL share group object.

      Returns INVALID_OPERATION if a context was specified as described above and any of the following conditions hold:

      • A context or share group object was specified for one of CGL, EGL, GLX, or WGL and the OpenGL implementation does not support that window-system binding API.
      • More than one of the attributes CGL_SHAREGROUP_KHR, EGL_DISPLAY_KHR, GLX_DISPLAY_KHR, and WGL_HDC_KHR is set to a non-default value.
      • Both of the attributes CGL_SHAREGROUP_KHR and GL_CONTEXT_KHR are set to non-default values.
      • Any of the devices specified in the devices argument cannot support OpenCL objects which share the data store of an OpenGL object.

      Returns INVALID_VALUE if an invalid attribute name is specified in properties.

      Additionally, returns INVALID_VALUE if param_name is invalid, or if the size in bytes specified by param_value_size is less than the size of the return type and param_value is not a NULL value, OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device, or OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.

    • clGetGLContextInfoKHR

      public static int clGetGLContextInfoKHR(PointerBuffer properties, int param_name, @Nullable PointerBuffer param_value, @Nullable PointerBuffer param_value_size_ret)
      Queries the OpenCL device currently corresponding to an OpenGL context.

      Such a device may not always exist (for example, if an OpenGL context is specified on a GPU not supporting OpenCL command queues, but which does support shared CL/GL objects), and if it does exist, may change over time. When such a device does exist, acquiring and releasing shared CL/GL objects may be faster on a command queue corresponding to this device than on command queues corresponding to other devices available to an OpenCL context.

      Parameters:
      properties - points to an attribute list whose format and valid contents are identical to the {code properties} argument of CreateContext. properties must identify a single valid GL context or GL share group object.
      param_name - a constant that specifies the GL context information to query. One of:
      DEVICES_FOR_GL_CONTEXT_KHRCURRENT_DEVICE_FOR_GL_CONTEXT_KHR
      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. If no device(s) exist corresponding to param_name, the call will not fail, but the value of param_value_size_ret will be zero.

      Returns INVALID_GL_SHAREGROUP_REFERENCE_KHR if a context was specified by any of the following means:

      and any of the following conditions hold:

      • The specified display and context attributes do not identify a valid OpenGL or OpenGL ES context.
      • The specified context does not support buffer and renderbuffer objects.
      • The specified context is not compatible with the OpenCL context being created (for example, it exists in a physically distinct address space, such as another hardware device; or it does not support sharing data with OpenCL due to implementation restrictions).

      Returns INVALID_GL_SHAREGROUP_REFERENCE_KHR if a share group was specified for a CGL-based OpenGL implementation by setting the attribute CGL_SHAREGROUP_KHR, and the specified share group does not identify a valid CGL share group object.

      Returns INVALID_OPERATION if a context was specified as described above and any of the following conditions hold:

      • A context or share group object was specified for one of CGL, EGL, GLX, or WGL and the OpenGL implementation does not support that window-system binding API.
      • More than one of the attributes CGL_SHAREGROUP_KHR, EGL_DISPLAY_KHR, GLX_DISPLAY_KHR, and WGL_HDC_KHR is set to a non-default value.
      • Both of the attributes CGL_SHAREGROUP_KHR and GL_CONTEXT_KHR are set to non-default values.
      • Any of the devices specified in the devices argument cannot support OpenCL objects which share the data store of an OpenGL object.

      Returns INVALID_VALUE if an invalid attribute name is specified in properties.

      Additionally, returns INVALID_VALUE if param_name is invalid, or if the size in bytes specified by param_value_size is less than the size of the return type and param_value is not a NULL value, OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation on the device, or OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL implementation on the host.