cl_sampler clCreateSampler
(
| cl_context context, |
cl_bool normalized_coords, | |
cl_addressing_mode addressing_mode, | |
cl_filter_mode filter_mode, | |
cl_int *errcode_ret) |
context
Must be a valid OpenCL context.
normalized_coords
Determines if the image coordinates specified are normalized (if
normalized_coords
is CL_TRUE
) or not (if normalized_coords
is CL_FALSE
).
addressing_mode
Specifies how out-of-range image coordinates are handled when reading from
an image. This can be set to CL_ADDRESS_REPEAT
, CL_ADDRESS_CLAMP_TO_EDGE
, CL_ADDRESS_CLAMP
, and CL_ADDRESS_NONE
.
filtering_mode
Specifies the type of filter that must be applied when reading an image. This can be CL_FILTER_NEAREST
or CL_FILTER_LINEAR
.
errcode_ret
Returns an appropriate error code. If errcode_ret
is NULL, no error code is returned.
A sampler object describes how to sample an image when the image is read in the kernel. The built-in functions to read from an image in a kernel take a sampler as an argument. The sampler arguments to the image read function can be sampler objects created using OpenCL functions and passed as argument values to the kernel or can be samplers declared inside a kernel. In this section we discuss how sampler objects are created using OpenCL functions.
Returns a valid non-zero sampler object and errcode_ret
is set to CL_SUCCESS if the sampler object is created successfully. Otherwise, it returns a NULL value with one of the following error values returned in errcode_ret
:
context
is not a valid context.
addressing_mode
,
filter_mode
, or normalized_coords
or a combination of these argument values are not valid.
context
(i.e. CL_DEVICE_IMAGE_SUPPORT specified in the table of OpenCL Device Queries for clGetDeviceInfo is CL_FALSE).