cl_khr_gl_sharing(3) Allow applications to use OpenGL buffer, texture and renderbuffer objects as OpenCL memory objects.

cl_khr_gl_sharing

DESCRIPTION

This is a Kronos-approved extension name. If this extension is supported, "cl_khr_gl_sharing" will be returned for CL_DEVICE_EXTENSIONS using clGetDeviceInfo(3clc).

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(3clc)

An OpenGL implementation supporting buffer objects and sharing of texture and buffer object images with OpenCL is required by this extension.

This section discusses OpenCL functions that allow applications to use OpenGL buffer, texture, and renderbuffer objects as OpenCL memory objects. This allows efficient sharing of data between OpenCL and OpenGL. The OpenCL API may be used to execute kernels that read and/or write memory objects that are also OpenGL objects.

An OpenCL image object may be created from an OpenGL texture or renderbuffer object. An OpenCL buffer object may be created from an OpenGL buffer object.

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 X, 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. Refer to the platform documentation for your OpenCL implementation, or visit the Khronos Registry at http://www.khronos.org/registry/cl/ for more information.

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.

allbox center tab(:); cB cB. T{ GL internal format T}:T{ CL image format (channel order, channel data type) T} c c c c c c c c c c c c c c c c c c c c c c c c. T{ GL_RGBA8 T}:T{ CL_RGBA, CL_UNORM_INT8 or CL_BGRA, CL_UNORM_INT8 T} T{ GL_RGBA, GL_UNSIGNED_INT_8_8_8_8_REV T}:T{ CL_RGBA, CL_UNORM_INT8 T} T{ GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV T}:T{ CL_BGRA, CL_UNORM_INT8 T} T{ GL_RGBA16 T}:T{ CL_RGBA, CL_UNORM_INT16 T} T{ GL_RGBA8I, GL_RGBA8I_EXT T}:T{ CL_RGBA, CL_SIGNED_INT8 T} T{ GL_RGBA16I, GL_RGBA16I_EXT T}:T{ CL_RGBA, CL_SIGNED_INT16 T} T{ GL_RGBA32I, GL_RGBA32I_EXT T}:T{ CL_RGBA, CL_SIGNED_INT32 T} T{ GL_RGBA8UI, GL_RGBA8UI_EXT T}:T{ CL_RGBA, CL_UNSIGNED_INT8 T} T{ GL_RGBA16UI, GL_RGBA16UI_EXT T}:T{ CL_RGBA, CL_UNSIGNED_INT16 T} T{ GL_RGBA32UI, GL_RGBA32UI_EXT T}:T{ CL_RGBA, CL_UNSIGNED_INT32 T} T{ GL_RGBA16F, GL_RGBA16F_ARB T}:T{ CL_RGBA, CL_HALF_FLOAT T} T{ GL_RGBA32F, GL_RGBA32F_ARB T}:T{ CL_RGBA, CL_FLOAT T}

OpenCL Functions That Allow Sharing.PP Click an item in the table for details about that function.

clGetGLContextInfoKHR(3clc) Query the device.
clCreateFromGLBuffer(3clc) Creates an OpenCL buffer object from an OpenGL buffer object.
clCreateFromGLTexture(3clc) Creates an OpenCL image object, image array object, or image buffer object from an OpenGL texture object, texture array object, texture buffer object, or a single face of an OpenGL cubemap texture object.
clCreateFromGLRenderbuffer(3clc) Creates an OpenCL 2D image object from an OpenGL renderbuffer object.
clGetGLObjectInfo(3clc) Query an OpenGL memory object used to create an OpenCL memory object.
clGetGLTextureInfo(3clc) Get additional information about the GL texture object associated with a memory object.
clEnqueueAcquireGLObjects(3clc) Acquire OpenCL memory objects that have been created from OpenGL objects.
clEnqueueReleaseGLObjects(3clc) Release OpenCL memory objects that have been created from OpenGL objects.

SPECIFICATION

m[blue]OpenCL Specificationm[][1]

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

1.
OpenCL Specification
page 39, section 9.6 - Creating CL context from a GL context or share group