C Specification
To create a sampler object, call the function
// Provided by CL_VERSION_2_0
cl_sampler clCreateSamplerWithProperties(
cl_context context,
const cl_sampler_properties* sampler_properties,
cl_int* errcode_ret);
| clCreateSamplerWithProperties is missing before version 2.0. |
Parameters
-
context must be a valid OpenCL context.
-
sampler_properties specifies a list of sampler property names and their corresponding values. Each sampler property name is immediately followed by the corresponding desired value. The list is terminated with 0. The list of supported properties is described in the Sampler Properties table. If a supported property and its value is not specified in sampler_properties, its default value will be used. sampler_properties can be
NULLin which case the default values for supported sampler properties will be used. -
errcode_ret will return an appropriate error code. If errcode_ret is
NULL, no error code is returned.
Description
| Sampler Property | Property Value | Description |
|---|---|---|
|
|
A boolean value that specifies whether the image coordinates specified are normalized or not. The default value (i.e. the value used if this property is not
specified in sampler_properties) is |
|
|
Specifies how out-of-range image coordinates are handled when reading from an image. Valid values are: The default is |
|
|
Specifies the type of filter that is applied when reading an image. Valid values are: The default value is |
provided by the |
|
Specifies the mipmap filter used when sampling from a mipmapped image. The available filter are: The default is |
provided by the |
|
Specifies the minimum value to which the computed level of detail lambda is clamped when sampling from a mipmapped image. The default is |
provided by the |
|
Specifies the maximum value to which the computed level of detail lambda is clamped when sampling from a mipmapped image. The default is |
When the cl_khr_ extension is supported, the sampler
properties CL_SAMPLER_, CL_SAMPLER_ and
CL_SAMPLER_ cannot be specified with any samplers initialized
in the OpenCL program source.
Only the default values for these properties will be used.
To create a sampler with specific values for these properties, a sampler
object must be created with clCreateSamplerWithProperties and passed as an
argument to a kernel.
|
clCreateSamplerWithProperties 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:
-
CL_INVALID_if context is not a valid context.CONTEXT -
CL_INVALID_if the property name in sampler_properties is not a supported property name, if the value specified for a supported property name is not valid, or if the same property name is specified more than once.VALUE -
CL_INVALID_if images are not supported by any device associated with context (i.e.OPERATION CL_DEVICE_specified in the Device Queries table isIMAGE_ SUPPORT CL_FALSE). -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the device.OF_ RESOURCES -
CL_OUT_if there is a failure to allocate resources required by the OpenCL implementation on the host.OF_ HOST_ MEMORY
Document Notes
For more information, see the OpenCL Specification
This page is extracted from the OpenCL Specification. Fixes and changes should be made to the Specification, not directly.