clCreateSampler - Creates a sampler object.
Contents
Copyright
Copyright © 2007-2011 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.
Errors
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_CONTEXT if context is not a valid context.
• CL_INVALID_VALUE if addressing_mode, filter_mode, or normalized_coords or a combination of these
argument values are not valid.
• CL_INVALID_OPERATION if images are not supported by any device associated with context (i.e.
CL_DEVICE_IMAGE_SUPPORT specified in the table of OpenCL Device Queries for clGetDeviceInfo(3clc) is
CL_FALSE).
• CL_OUT_OF_RESOURCES if there is a failure to allocate resources required by the OpenCL implementation
on the device.
• CL_OUT_OF_HOST_MEMORY if there is a failure to allocate resources required by the OpenCL
implementation on the host.
Name
clCreateSampler - Creates a sampler object.
cl_samplerclCreateSampler(cl_contextcontext,cl_boolnormalized_coords,cl_addressing_modeaddressing_mode,cl_filter_modefilter_mode,cl_int*errcode_ret);Notes
1. OpenCL Specification
page 128, section 5.5.1 - Creating Sampler Objects
The Khronos Group 11/18/2024 CLCREATESAMPLER(3clc)
Parameters
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_MIRRORED_REPEAT, CL_ADDRESS_REPEAT, CL_ADDRESS_CLAMP_TO_EDGE, CL_ADDRESS_CLAMP, and
CL_ADDRESS_NONE.
filter_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.
See Also
clRetainSampler(3clc), clReleaseSampler(3clc), clGetSamplerInfo(3clc), classDiagram(3clc) sampler_t(3clc)
Specification
OpenCLSpecification[1]
