I've invested a lot of time trying to understand the sampler type. Here's a
The sampler type (sampler_t) is used for sampler objects, either created via
the OpenCL API and set as a kernel argument, or declared in the program
source (22.214.171.124). A sampler value is a 32-bit unsigned integer constant,
interpreted as a bit-field for the image read properties: addressing mode,
filtering mode, normalised coordinates.
== Allowed use ==
* The sampler type can be used as the type of a function argument.
* The sampler type can be used to declare a variable in the program scope.
* The sampler type can be used to declare a variable in a kernel function
== Disallowed use ==
* The sampler type cannot be used to declare an array of samplers.
* The sampler type cannot be used to declare a pointer to a sampler.
* The sampler type cannot be the return type of a function.
* A sampler function argument cannot be modified.
* A sampler variable cannot be modified.
All in all, the sampler type does not behave like a normal integer. It's
actually an opaque type which backends can implement in a target-specific
I'm going to submit our first patch for the image and sampler types shortly.
Hope we can do a merge in some way.