CLGETGLCONTEXTINFOKH(3clc)
π CLGETGLCONTEXTINFOKH π
okay bestie, welcome to the clGetGLContextInfoKHR page from the OpenCL Manual (that's section 3clc if you're keeping score β¨). this one's all about asking your OpenCL setup like, "hey, which device is vibing with my OpenGL context rn?" π¦
β¨ NAME β¨
clGetGLContextInfoKHR β get OpenGL context information. literally what it says on the tin, no cap π
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);
π PARAMETERS π
propertiesβ points at an attribute list whose format and valid contents are exactly the same as thepropertiesargument ofclCreateContext(3clc). this thing must identify a single valid GL context or GL share group object. one. single. object. πparam_nameβ a constant that says which GL context info you're querying. has to be one of the values in the table below (scroll down, it's cute, i promise πΈ).param_value_sizeβ how big, in bytes, the memory thatparam_valuepoints to is. this size must be greater than or equal to the size of the return type described in the table below. don't skimp on the bytes bestie πparam_valueβ a pointer to the memory where the query result lands, as described in the table below. ifparam_valueisNULL, it's just ignored. no thoughts, head empty πparam_value_size_retβ returns the actual size in bytes of the data being queried byparam_value. ifparam_value_size_retisNULL, it's ignored too.
π«Ά the table (but make it a list) π«Ά
CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHRβ return typecl_device_idβ returns the CL device currently associated with the specified OpenGL context. your main character device, periodt πCL_DEVICES_FOR_GL_CONTEXT_KHRβ return typecl_device_id[]β the list of all CL devices which may be associated with the specified OpenGL context. the whole squad π
πΈ DESCRIPTION πΈ
the OpenGL object that was used to create the OpenCL memory object β plus info about the object type, like whether it's a texture, a renderbuffer, or a buffer object β can all be queried using this function. it's giving detective energy π
π NOTES π
the OpenCL specification in section 9.7 defines how to share data with texture and buffer objects in a parallel OpenGL implementation, but it does not define how the association between an OpenCL context and an OpenGL context or share group is established. so this extension defines optional attributes to the 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(3clc). iykyk β¨
an OpenGL implementation supporting buffer objects and sharing of texture and buffer object images with OpenCL is required by this extension. no shortcuts, bestie.
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, it 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. so like, it's a vibe thing π¦
π ERRORS π
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_KHRwhen an invalid OpenGL context or share group object handle is specified inproperties.CL_INVALID_GL_SHAREGROUP_REFERENCE_KHRif a context was specified by any of the following means:- A context was specified for an EGL-based OpenGL ES or OpenGL implementation by setting the attributes
CL_GL_CONTEXT_KHRandCL_EGL_DISPLAY_KHR. - A context was specified for a GLX-based OpenGL implementation by setting the attributes
CL_GL_CONTEXT_KHRandCL_GLX_DISPLAY_KHR. - A context was specified for a WGL-based OpenGL implementation by setting the attributes
CL_GL_CONTEXT_KHRandCL_WGL_HDC_KHR.
- A context was specified for an EGL-based OpenGL ES or OpenGL implementation by setting the attributes
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).
CL_INVALID_GL_SHAREGROUP_REFERENCE_KHRif a share group was specified for a CGL-based OpenGL implementation by setting the attributeCL_CGL_SHAREGROUP_KHR, and the specified share group does not identify a valid CGL share group object.CL_INVALID_OPERATIONif 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
CL_CGL_SHAREGROUP_KHR,CL_EGL_DISPLAY_KHR,CL_GLX_DISPLAY_KHR, andCL_WGL_HDC_KHRis set to a non-default value. - Both of the attributes
CL_CGL_SHAREGROUP_KHRandCL_GL_CONTEXT_KHRare set to non-default values. - Any of the devices specified in the
devicesargument cannot support OpenCL objects which share the data store of an OpenGL object.
CL_INVALID_VALUEif an attribute name other than those specified in the table of supported properties forclCreateContext(3clc)is specified inproperties.CL_INVALID_VALUEifparam_nameis notCL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHRorCL_DEVICES_FOR_GL_CONTEXT_KHR; or if the size in bytes specified byparam_value_sizeis less than the size of the return type shown above forCL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHRorCL_DEVICES_FOR_GL_CONTEXT_KHR; andparam_valueis not aNULLvalue.CL_OUT_OF_RESOURCESif there is a failure to allocate resources required by the OpenCL implementation on the device.CL_OUT_OF_HOST_MEMORYif there is a failure to allocate resources required by the OpenCL implementation on the host.
β SPECIFICATION β
OpenCL Specification[1]
π¦ SEE ALSO π¦
clCreateContext(3clc) cl_khr_gl_sharing(3clc)
π AUTHORS π
The Khronos Group
π COPYRIGHT π
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.
π NOTES (the footnote kind) π
- OpenCL Specification page 43, section 9.6.5 - Additions to section 9.8 of the...
and that's the whole page, bestie!! brought to you by The Khronos Group π, dated 01/14/2021, and it lives at CLGETGLCONTEXTINFOKH(3clc) β go forth and share your GL objects responsibly, mwah πβ¨
π¦ where this page comes from
- ubuntu jammy: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- ubuntu noble: opencl-1.2-man-doc 1.0~svn33624-5 Β· other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms