I found my solution already, but for posterity…
If you’re trying to embed your kernel source in your application in a string, and clBuildProgram dies ignobly with assertions like:
Expression: isa(Val) && “cast() argument of incompatible type!”
The problem seems to be that you need carriage returns.
For example:
"\
__kernel void samplePatch(__read_only image2d_t src, sampler_t sampler, \
float fromx, float fromy, \
const uint patchRadius, \
float d11, float d12, float d21, float d22, \
__global float *d_dest) \
{ \
blah... \
blah... \
blah... \
} \
";
Needs to be:
"\
__kernel void samplePatch(__read_only image2d_t src, sampler_t sampler, \n\
float fromx, float fromy, \n\
const uint patchRadius, \n\
float d11, float d12, float d21, float d22, \n\
__global float *d_dest) \n\
{ \n\
blah... \n\
blah... \n\
blah... \n\
} \n\
";
Cheers