Interesting, if I use __constant instead of const the error goes away.
Here is my exact line (realising that I never gave it in previous posts):
__constant sampler_t demSampler = CLK_NORMALIZED_COORDS_FALSE |
I did not realise that __constant and const were similar yet different…
I always thought __constant is to specify that a kernel argument was from the DirectX/OpenGL constant buffer cache, and that const was to tell the compiler to ensure that no code attempts to modify that variable.
I would have thought that const for a global sampler_t was correct though as a sampler_t cannot be modified by the kernel. (In fact in the NVIDIA PTX you can see that a global sampler_t is actually compiled in)
The strange this is that on pg. 236 of the 1.1 spec:
So either the spec is wrong or AMD is wrong.
Just goes to show that anyone serious about OpenCL compatibility should test kernel C code on both AMD and NVIDIA compilers, as they are likely to pick up different things. (Somewhat similar to the OpenGL shader compilers from AMD v NVIDIA, where AMD’s compiler is always more strictly following the spec than NVIDIA’s)
I might go post something on the Khronos forum to see what they say about this. (I have posted to here)
Have you found the kernel.h file NVIDIA have embedded in their DLLs? I notice it defines CLK_FILTER_ANISOTROPIC… (line 321) I put it in and it compiled fine but I am not able to test to see if it actually works (I think I need to specify the filter level in the upper 4 bits). Looks like OpenCL 1.2 might have some further image extensions? (Hopefully they add border color control). I have attached the header.