'\" t .\" Title: read_imagef (1D) .\" Author: The Khronos Group .\" Generator: DocBook XSL Stylesheets vsnapshot .\" Date: 01/14/2021 .\" Manual: OpenCL Manual .\" Source: The Khronos Group .\" Language: English .\" .TH "READ_IMAGEF (1D)" "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_imagef_(1D) \- Do an element lookup in the 1D image object, returning floating\-point values\&. .SH "" .HP \w'float4\ read_imagef('u .BI "float4 read_imagef(image1d_t\ " "image" ", sampler_t\ " "sampler" ", int\ " "coord" ");" .HP \w'float4\ read_imagef('u .BI "float4 read_imagef(image1d_t\ " "image" ", sampler_t\ " "sampler" ", float\ " "coord" ");" .HP \w'float4\ read_imagef('u .BI "float4 read_imagef(image1d_t\ " "image" ", int\ " "coord" ");" .HP \w'float4\ read_imagef('u .BI "float4 read_imagef(image1d_buffer_t\ " "image" ", int\ " "coord" ");" .HP \w'float4\ read_imagef('u .BI "float4 read_imagef(image1d_array_t\ " "image" ", int2\ " "coord" ");" .HP \w'float4\ read_imagef('u .BI "float4 read_imagef(image1d_array_t\ " "image" ", sampler_t\ " "sampler" ", float4\ " "coord" ");" .SH "FUNCTIONS TO READ 1D IMAGES AND IMAGE ARRAYS" .PP For forms that take \fBimage1d_t\fR, use \fIcoord\fR to do an element lookup in the 1D image object specified by \fIimage\fR\&. .PP For forms that take \fBimage1d_array_t\fR, use \fIcoord\&.x\fR to do an element lookup in the 1D image identified by \fIcoord\&.y\fR in the 1D image array specified by \fIimage\fR\&. .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_imagef\fR returns floating\-point values in the range [0\&.0\&.\&.\&. 1\&.0] for image objects created with \fIimage_channel_data_type\fR set to one of the predefined packed formats or \fBCL_UNORM_INT8\fR or \fBCL_UNORM_INT16\fR\&. .PP \fBread_imagef\fR returns floating\-point values in the range [\-1\&.0\&.\&.\&. 1\&.0] for image objects created with \fIimage_channel_data_type\fR set to \fBCL_SNORM_INT8\fR, or \fBCL_SNORM_INT16\fR\&. .PP \fBread_imagef\fR returns floating\-point values for image objects created with \fIimage_channel_data_type\fR set to \fBCL_HALF_FLOAT\fR or \fBCL_FLOAT\fR\&. .PP The \fBread_imagef\fR calls that take integer coordinates must use a sampler with filter mode set to \fBCLK_FILTER_NEAREST\fR, 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\&. .PP Values returned by \fBread_imagef\fR for image objects with \fIimage_channel_data_type\fR values not specified in the description above are undefined\&. .SH "NOTES" .PP General information about the \fBread_image\fR* functions follows\&. .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