'\" t .\" Title: read_imagei (3D) .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "READ_IMAGEI (3D)" "3clc" "01/14/2021" "The Khronos Group" "OpenCL Manual" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" read_imagei_(3D) \- Do an element lookup in the 3D image object, returning unnormalized signed integer and unsigned integer values .SH "" .HP \w'int4\ read_imagei('u .BI "int4 read_imagei(image3d_t\ " "image" ", sampler_t\ " "sampler" ", int4\ " "coord" ");" .HP \w'int4\ read_imagei('u .BI "int4 read_imagei(image3d_t\ " "image" ", sampler_t\ " "sampler" ", float4\ " "coord" ");" .HP \w'uint4\ read_imageui('u .BI "uint4 read_imageui(image3d_t\ " "image" ", sampler_t\ " "sampler" ", int4\ " "coord" ");" .HP \w'uint4\ read_imageui('u .BI "uint4 read_imageui(image3d_t\ " "image" ", sampler_t\ " "sampler" ", float4\ " "coord" ");" .HP \w'int4\ read_imagei('u .BI "int4 read_imagei(image3d_t\ " "image" ", int4\ " "coord" ");" .HP \w'uint4\ read_imageui('u .BI "uint4 read_imageui(image3d_t\ " "image" ", int4\ " "coord" ");" .SH "DESCRIPTION" .PP The forms that take a \fBsampler_t\fR use the coordinate \fI(coord\&.x, coord\&.y, coord\&.z))\fR to do an element lookup in the 3D image object specified by \fIimage\fR\&. \fIcoord\&.w\fR is ignored\&. .PP The samplerless read image functions behave exactly as the corresponding read image functions that take integer coordinates and a sampler with filter mode set to \fBCLK_FILTER_NEAREST\fR, normalized coordinates set to \fBCLK_NORMALIZED_COORDS_FALSE\fR and addressing mode to \fBCLK_ADDRESS_NONE\fR\&. .PP \fBread_imagei\fR and \fBread_imageui\fR return unnormalized signed integer and unsigned integer values respectively\&. Each channel will be stored in a 32\-bit integer\&. .PP \fBread_imagei\fR can only be used with image objects created with \fIimage_channel_data_type\fR set to one of the following values: \fBCL_SIGNED_INT8\fR, \fBCL_SIGNED_INT16\fR, or \fBCL_SIGNED_INT32\fR\&. If the \fIimage_channel_data_type\fR is not one of the above values, the values returned by \fBread_imagei\fR are undefined\&. .PP \fBread_imageui\fR can only be used with image objects created with \fIimage_channel_data_type\fR set to one of the following values: \fBCL_UNSIGNED_INT8\fR, \fBCL_UNSIGNED_INT16\fR, and \fBCL_UNSIGNED_INT32\fR\&. If the \fIimage_channel_data_type\fR is not one of the above values, the values returned by \fBread_imageui\fR are undefined\&. .PP The \fBread_imageui\fR calls support a nearest filter only\&. The filter_mode specified in \fIsampler\fR must be set to \fBCLK_FILTER_NEAREST\fR; otherwise the values returned are undefined\&. .PP Furthermore, the \fBread_image{i|ui}\fR calls that take integer coordinates must use a sampler with normalized coordinates set to \fBCLK_NORMALIZED_COORDS_FALSE\fR and addressing mode set to \fBCLK_ADDRESS_CLAMP_TO_EDGE\fR, \fBCLK_ADDRESS_CLAMP\fR or \fBCLK_ADDRESS_NONE\fR; otherwise the values returned are undefined\&. .SH "NOTES" .PP The built\-in functions defined in this section can only be used with image memory objects\&. An image memory object can be accessed by specific function calls that read from and/or write to specific locations in the image\&. .PP Image memory objects that are being read by a kernel should be declared with the \fBaccessQualifiers\fR(3clc) qualifier\&. \fBwrite_image\fR calls to image memory objects declared with the \fBaccessQualifiers\fR(3clc) qualifier will generate a compilation error\&. Image memory objects that are being written to by a kernel should be declared with the \fBaccessQualifiers\fR(3clc) qualifier\&. \fBread_image\fR calls to image memory objects declared with the \fBaccessQualifiers\fR(3clc) qualifier will generate a compilation error\&. \fBread_image\fR and \fBwrite_image\fR calls to the same image memory object in a kernel are not supported\&. .PP The \fBread_image\fR calls returns a four component floating\-point, integer or unsigned integer color value\&. The color values returned by \fBread_image\fR are identified as x, y, z, w where x refers to the red component, y refers to the green component, z refers to the blue component and w refers to the alpha component\&. .PP The following table describes the mapping of the number of channels of an image element to the appropriate components in the \fBfloat4\fR, \fBint4\fR or \fBuint4\fR vector data type for the color values returned by \fBread_image{f|i|ui}\fR or supplied to \fBwrite_image{f|i|ui}\fR\&. The unmapped components will be set to \fB0\&.0\fR for red, green and blue channels and will be set to \fB1\&.0\fR for the alpha channel\&. .PP .TS allbox center tab(:); cB cB. T{ Channel Order T}:T{ \fBfloat4\fR, \fBint4\fR or \fBuint4\fR components of channel data T} .T& c c c c c c c c c c c c c c c c. T{ \fBCL_R\fR, \fBCL_Rx\fR T}:T{ \fB(r, 0\&.0, 0\&.0, 1\&.0)\fR T} T{ \fBCL_A\fR T}:T{ \fB(0\&.0, 0\&.0, 0\&.0, a)\fR T} T{ \fBCL_RG\fR, \fBCL_RGx\fR T}:T{ \fB(r, g, 0\&.0, 1\&.0)\fR T} T{ \fBCL_RA\fR T}:T{ \fB(r, 0\&.0, 0\&.0, a)\fR T} T{ \fBCL_RGB\fR, \fBCL_RGBx\fR T}:T{ \fB(r, g, b, 1\&.0)\fR T} T{ \fBCL_RGBA, CL_BGRA, CL_ARGB\fR T}:T{ \fB(r, g, b, a)\fR T} T{ \fBCL_INTENSITY\fR T}:T{ \fB(I, I, I, I)\fR T} T{ \fBCL_LUMINANCE\fR T}:T{ \fB(L, L, L, 1\&.0)\fR T} .TE .sp 1 .PP A kernel that uses a sampler with the \fBCL_ADDRESS_CLAMP\fR addressing mode with multiple images may result in additional samplers being used internally by an implementation\&. If the same sampler is used with multiple images called via \fBread_image{f|i|ui}\fR, then it is possible that an implementation may need to allocate an additional sampler to handle the different border color values that may be needed depending on the image formats being used\&. These implementation allocated samplers will count against the maximum sampler values supported by the device and given by \fBCL_DEVICE_MAX_SAMPLERS\fR\&. Enqueuing a kernel that requires more samplers than the implementation can support will result in a \fBCL_OUT_OF_RESOURCES\fR error being returned\&. .SH "SPECIFICATION" .PP \m[blue]\fBOpenCL Specification\fR\m[]\&\s-2\u[1]\d\s+2 .SH "SEE ALSO" .PP \fBimageFunctions\fR(3clc) .SH "AUTHORS" .PP \fBThe Khronos Group\fR .SH "COPYRIGHT" .br Copyright \(co 2007-2011 The Khronos Group Inc. .br 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. .sp .SH "NOTES" .IP " 1." 4 OpenCL Specification .RS 4 \%page 292, section 6.12.14 - Image Read and Write Functions .RE