Quartz Composer - OpenCL - Mesh Bend and Mesh Noise Updates

After messing around with "Pages Jiggle" yesterday, I ended up going ahead and committing proper, 100% correct fixes to both non-working Mesh Filters for Quartz Composer.

They are available at:

http://kineme.net/composition/gtoledo3/MeshNoise

and

http://kineme.net/composition/gtoledo3/MeshBend

The crux of the problem is that in OpenCL, a constant cannot be reassigned. For example, in Mesh Noise there is a line that states:

attenuation = clamp(attenuation, 0.0f, 1.0f);

THAT, when run, will reveal itself to "not work". The OpenCL patch in QC doesn't mark it as being an error until you run it (go back and look at the OpenCL code editor after running the kernel), and at that, it isn't entirely clear how to fix it.

The OpenCL standard requires that constants cannot be written to. So, to fix this, one can make a new float, and rename.

For example, a fix would look like:


float clampedAttenuation = clamp(attenuation, 0.0f, 1.0f);


This is the same scenario for Mesh Bend, where a few constants are reassigned in all of the kernels that comprise the qtz.