cl_sampler clCreateSampler ( cl_context context,
cl_int *errcode_ret) ,
in the above function what is the object
please explain the dufference between these two.
onst sampler_t imgSamplerInt2 = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
I’ll try to explain it in simple terms.
This function is executed in the host (CPU). It returns a new sampler object. You can pass this sampler object to the device (GPU, etc) as a kernel argument using clSetKernelArg().
On the other hand,
const sampler_t imgSamplerInt2 = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_NONE | CLK_FILTER_NEAREST;
is source code written in OpenCL C. It is not executed by the host (CPU). Instead, it is executed by the device (GPU, etc).
Both are valid ways to initialize a sampler. The first method allows you to pass different sampler objects at different times to the same kernel. With the second method the sampler is constant, so you can’t change it.