[cfe-dev] [OpenCL patch] sampler_t as a builtin type

Anton Lokhmotov Anton.Lokhmotov at arm.com
Fri Mar 18 09:54:57 PDT 2011


Hi Tanya,

I've invested a lot of time trying to understand the sampler type.  Here's a
summary.

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 (6.11.13.1).  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
scope.

== 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
way.

I'm going to submit our first patch for the image and sampler types shortly.
Hope we can do a merge in some way.

Best regards,
Anton.







More information about the cfe-dev mailing list