cl_int
clGetGLContextInfoKHR
(
| const cl_context_properties *properties , |
| cl_gl_context_info param_name , | |
| size_t param_value_size , | |
| void *param_value , | |
size_t
*param_value_size_ret
) |
properties
Points to an attribute list whose format and valid contents
are identical to the properties argument of
clCreateContext.
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, and must be one of the values shown in the table below.
param_value_size
Specifies the size in bytes of memory pointed to by
param_value. This size must be greater than or equal
to the size of the return type described in the table below.
param_value
A pointer to memory where the result of the query is returned as described
in the table below. If param_value is NULL, it is ignored.
param_value_size_ret
Returns the actual size in bytes of data being queried by
param_value. If param_value_size_ret
is NULL, it is ignored.
| param_name | Return Type | Information returned in param_value |
|---|---|---|
CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR
|
cl_device_id | Return the CL device currently associated with the specified OpenGL context. |
CL_DEVICES_FOR_GL_CONTEXT_KHR
|
cl_device_id[] | List of all CL devices which may be associated with the specified OpenGL context. |
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 can be queried using this function.
The OpenCL specification in section 9.7 defines how to
share data with texture and buffer objects in a parallel OpenGL implementation,
but does not define how the association between an OpenCL context and an OpenGL
context or share group is established. This extension defines optional attributes
to OpenCL context creation routines which associate a GL context or share group
object with a newly created OpenCL context. If this extension is supported
by an implementation, the string "cl_khr_gl_sharing" will be present in the
CL_PLATFORM_EXTENSIONS or CL_DEVICE_EXTENSIONS
string described in the table of allowed values for param_name
for clGetDeviceInfo.
An OpenGL implementation supporting buffer objects and sharing of texture and buffer object images with OpenCL is required by this extension.
OpenCL device(s) corresponding to an OpenGL context may be queried. 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.
Returns CL_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. Otherwise
returns one of the following:
CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR when an
invalid OpenGL context or share group object handle is specified in
properties.
CL_GL_CONTEXT_KHR and
CL_EGL_DISPLAY_KHRCL_GL_CONTEXT_KHR and
CL_GLX_DISPLAY_KHRCL_GL_CONTEXT_KHR and
CL_WGL_HDC_KHRand any of the following conditions hold:
CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR if a share group
was specified for a CGL-based OpenGL implementation by setting the attribute
CL_CGL_SHAREGROUP_KHR, and the specified share group
does not identify a valid CGL share group object.
CL_INVALID_OPERATION if a context was specified as described above and any of the following conditions hold:
CL_CGL_SHAREGROUP_KHR,
CL_EGL_DISPLAY_KHR,
CL_GLX_DISPLAY_KHR, and
CL_WGL_HDC_KHR is set to a non-default value.
CL_CGL_SHAREGROUP_KHR and
CL_GL_CONTEXT_KHR are set to non-default values.
devices argument
cannot support OpenCL objects which share the data store of an OpenGL object.
properties
for clCreateContext
is specified in properties.
param_name is not
CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR or
CL_DEVICES_FOR_GL_CONTEXT_KHR; or if the size in bytes specified
by param_value_size is less than the size of the return type
shown above for CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR
or CL_DEVICES_FOR_GL_CONTEXT_KHR; and
param_value is not a NULL value.
Copyright © 2007-2011 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the condition that this copyright notice and permission notice shall be included
in all copies or substantial portions of the Materials.