kernel void initialize(size_t width, size_t height, write_only image2d_t output){ size_t x = get_global_id(0); size_t y = get_global_id(1); int2 coord = {x, y}; uint4 color = {255 * x / (width - 1), 255 * y / (height - 1), 0, 255}; write_imageui(output, coord, color); } kernel void square(global float* input, size_t width, global float* output){ size_t x = get_global_id(0); size_t y = get_global_id(1); float i = 2.0 * (input[x + width*y] - 0.5); output[x + width*y] = 0.5 + 0.5*sin((1.0 - i) * sin(i*i + 6.2*float(x)/width) + cos(1.0/i + 6.2*float(y)/width)); }