cl_khr_gl_msaa_sharing

Extends the CL/GL sharing to support GL multi-sampled texture (color or depth).

#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable

float4 read_imagef ( image2d_msaa_t  image ,
  int2  coord ,
  int  sample )
int4 read_imagei ( image2d_msaa_t  image ,
  int2  coord ,
  int  sample )
uint4 read_imageui ( image2d_msaa_t  image ,
  int2  coord ,
  int  sample )
float4 read_imagef ( image2d_array_msaa_t  image ,
  int4  coord ,
  int  sample )
int4 read_imagei ( image2d_array_msaa_t  image ,
  int4  coord ,
  int  sample )
uint4 read_imageui ( image2d_array_msaa_t  image ,
  int4  coord ,
  int  sample )
float read_imagef ( image2d_msaa_depth_t  image ,
  int2  coord ,
  int  sample )
float read_imagef ( image2d_array_msaaa_depth_t  image ,
  int4  coord ,
  int  sample )
int get_image_width ( image2d_msaa_t  image )
int get_image_width ( image2d_array_msaa_t  image )
int get_image_width ( image2d_msaa_depth_t  image )
int get_image_width ( image2d_array_msaa_depth_t  image )
int get_image_height ( image2d_msaa_t  image )
int get_image_height ( image2d_array_msaa_t  image )
int get_image_height ( image2d_msaa_depth_t  image )
int get_image_height ( image2d_array_msaa_depth_t  image )
int get_image_channel_data_type ( image2d_msaa_t  image )
int get_image_channel_data_type ( image2d_array_msaa_t  image )
int get_image_channel_data_type ( image2d_msaa_depth_t  image )
int get_image_channel_data_type ( image2d_array_msaa_depth_t  image )
int get_image_channel_order ( image2d_msaa_t  image )
int get_image_channel_order ( image2d_array_msaa_t  image )
int get_image_channel_order ( image2d_msaa_depth_t  image )
int get_image_channel_order ( image2d_array_msaa_depth_t  image )
int2 get_image_dim ( image2d_msaa_t  image )
int2 get_image_dim ( image2d_array_msaa_t  image )
int2 get_image_dim ( image2d_msaa_depth_t  image )
int2 get_image_dim ( image2d_array_msaa_depth_t  image )
size_t get_image_array_size ( image2d_array_msaa_depth_t  image )
int get_image_num_samples ( image2d_msaa_t  image )
int get_image_num_samples ( image2d_array_msaa_t  image )
int get_image_num_samples ( image2d_msaa_depth_t  image )
int get_image_num_samples ( image2d_array_msaa_depth_t  image )

Description

This extension name is cl_khr_gl_msaa_sharing. This extension requires cl_khr_gl_depth_images.

Multi-sample CL image objects (MSAA) can only be read from a kernel. Multi-sample CL image objects cannot be used as arguments to clEnqueueReadImage , clEnqueueWriteImage, clEnqueueCopyImage, clEnqueueCopyImageToBuffer, clEnqueueCopyBufferToImage, clEnqueueMapImage and clEnqueueFillImage and will return a CL_INVALID_OPERATION error.

Add the following entry to table 9.5 (see clGetGLTextureInfo):

cl_gl_texture_info Return Type Info. returned in param_value
CL_GL_NUM_SAMPLES GLsizei

The samples argument passed to glTexImage2DMultisample or glTexImage3DMultisample.

If image is not a MSAA texture, 1 is returned.

Add the following new data types to table 6.3 in section 6.1.3 of the OpenCL 2.0 specification (see otherDataTypes):

Type Description
image2d_msaa_t A 2D multi-sample color image. Refer to section 6.13.14 for a detailed description of the built-in functions that use this type.
image2d_array_msaa_t A 2D multi-sample color image array. Refer to section 6.13.14 for a detailed description of the built-in functions that use this type.
image2d_msaa_depth_t A 2D multi-sample depth image. Refer to section 6.13.14 for a detailed description of the built-in functions that use this type.
image2d_array_msaa_depth_t A 2D multi-sample depth image array. Refer to section 6.13.14 for a detailed description of the built-in functions that use this type.

NOTE: When a multisample image is accessed in a kernel, the access takes one vector of integers describing which pixel to fetch and an integer corresponding to the sample numbers describing which sample within the pixel to fetch. sample identifies the sample position in the multi-sample image.

For best performance, we recommend that sample be a literal value so it is known at compile time and the OpenCL compiler can perform appropriate optimizations for multisample reads on the device.

No standard sampling instructions are allowed on the multisample image. Accessing a coordinate outside the image and/or a sample that is outside the number of samples associated with each pixel in the image is undefined

read_imagef uses the coordinate (coord.x, coord.y) and sample to do an element lookup in the 2D image or depth image object specified by image.

read_imagef returns floating-point values in the range [0.0 ... 1.0] for image objects created with image_channel_data_type set to one of the predefined packed formats or CL_UNORM_INT8, or CL_UNORM_INT16.

read_imagef returns floating-point values in the range [-1.0 ... 1.0] for image objects created with image_channel_data_type set to CL_SNORM_INT8, or CL_SNORM_INT16.

read_imagef returns floating-point values for image objects created with image_channel_data_type set to CL_HALF_FLOAT or CL_FLOAT.

Values returned by read_imagef for image objects with image_channel_data_type values not specified in the description above are undefined.

read_imagei uses the coordinate (coord.x, coord.y) and sample to do an element lookup in the 2D image object specified by image.

read_imagei and read_imageui return unnormalized signed integer and unsigned integer values respectively. Each channel will be stored in a 32-bit integer.

read_imagei can only be used with image objects created with image_channel_data_type set to one of the following values:

  • CL_SIGNED_INT8,
  • CL_SIGNED_INT16,
  • CL_SIGNED_INT32

If the image_channel_data_type is not one of the above values, the values returned by read_imagei are undefined.

read_imageui can only be used with image objects created with image_channel_data_type set to one of the following values:

  • CL_UNSIGNED_INT8,
  • CL_UNSIGNED_INT16,
  • CL_UNSIGNED_INT32

If the image_channel_data_type is not one of the above values, the values returned by read_imageui are undefined.

Specification

OpenCL Specification

Also see

Image Read and Write Functions

Copyright © 2007-2013 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.