Passing cl_sampler to kernel looses the filtering property

Hi,

I’m trying to pass a cl_sampler that I created in my C code to my OpenCL kernel, but along the way it looses the filtering property, i.e. it always uses CL_FILTERING_NEAREST even if the cl_sampler was created with CL_FILTERING_LINEAR. Other properties make it through to the kernel. Is this a known problem with NVidia’s OpenCL implementation ?

I’m using OpenCL 1.0 CUDA 3.0.1 and driver 195.30 on Linux x64.

How did you check the filtering property from the kernel?

Got the same issue here as well.
CL_FILTER_LINEAR worked fine before I upgraded to the 3.0 SDK today, but now it just does nearest.

I didn’t - I compared the resulting images when running the kernel with a cl_sampler created with CL_FILTER_NEAREST and a cl_sampler created with CL_FILTER_LINEAR. Both cases produced the exact same results. I then changed the addressing mode from CL_ADDRESS_CLAMP to CL_ADDRESS_CLAMP_TO_EDGE; the resulting images clearly show that the addressing mode property of a cl_sampler is passed to the kernel, but the filtering property is not.

As a workaround, I’ve changed my kernel to use two static sampler_t objects (one with CLK_FILTER_NEAREST, one with CLK_FILTER_LINEAR), with a kernel parameter to select which one of the two to use. This does produce the desired effect, but is somewhat of a hack.