Skip to content

Latest commit

 

History

History
59 lines (36 loc) · 2.65 KB

cl_khr_gl_depth_images.adoc

File metadata and controls

59 lines (36 loc) · 2.65 KB

cl_khr_gl_depth_images

Extends CL/GL sharing to allow a CL image to be created from a GL depth or depth-stencil texture.

#pragma OPENCL EXTENSION cl_khr_gl_depth_images : enable

Description

The cl_khr_gl_depth_images extension extends CL / GL sharing (i.e. the cl_khr_gl_sharing extension) defined in section 9.7 to allow a CL depth image to be created from a GL depth or depth-stencil texture. If this extension is supported by an implementation, the string cl_khr_gl_depth_images will be present in the CL_PLATFORM_EXTENSIONS string described in table 4.1 or CL_DEVICE_EXTENSIONS string described in table 4.3.

Depth images with an image channel order of CL_DEPTH_STENCIL can only be created using the clCreateFromGLTexture API.

For the image format given by channel order of CL_DEPTH_STENCIL and channel data type of CL_UNORM_INT24, the depth is stored as an unsigned normalized 24-bit value.

For the image format given by channel order of CL DEPTH_STENCIL and channel data type of CL_FLOAT, each pixel is two 32-bit values. The depth is stored as a single precision floating point value followed by the stencil which is stored as a 8-bit integer value.

The stencil value cannot be read or written using the read imagef and write imagef built-in functions in an OpenCL kernel.

Depth image objects with an image channel order = CL_DEPTH_STENCIL cannot be used as arguments to clEnqueueReadImage, clEnqueueWriteImage, clEnqueueCopyImage, clEnqueueCopyImageToBuffer, clEnqueueCopyBufferToImage, clEnqueueMapImage and clEnqueueFillImage and will return a CL_INVALID_OPERATION error.

The following new image formats are added to table 9.4 in section 9.7.3.1 of the OpenCL 2.1 extension specification. If a GL texture object with an internal format from table 9.4 is successfully created by OpenGL, then there is guaranteed to be a mapping to one of the corresponding CL image format(s) in that table.

GL internal format CL image format (channel order, channel data type)

GL_DEPTH_COMPONENT32F

CL_DEPTH, CL_FLOAT

GL_DEPTH_COMPONENT16

CL_DEPTH, CL_UNORM_INT16

GL_DEPTH24_STENCIL8

CL_DEPTH_STENCIL, CL_UNORM_INT24

GL_DEPTH32F_STENCIL8

CL_DEPTH_STENCIL, CL_FLOAT