I really like the points made by The Zen of Python. I try to follow these when I can when coding any language basically. But every language has its own "Zen", and figuring those out is a long process. Right now, I'm thinking a lot about "The Zen of C++", what are the idiomatic way of doing things?
Right now I can handle buffers (memory location on the GPU) something like this:
cl::Buffer cBuffer = env.createBuffer<float>(CL_MEM_READ_WRITE, 1024); // Do things std::vector<float> result(1024, 0.0f); cl::Event ev2 = dev.readBuffer(cBuffer, result);
However there is a problem here. The buffers are made by the Environment. While it's the Device that manipulates it. Therefor, a buffer is seperated from the device explicitly, but implicitly it's dependent on it. This mean that you can do something like this:
dev << cBuffer;
But because of the explicit separation, you cannot do something like this:
cBuffer >> result; // From what device should you read the buffer? // or dev >> result; // What buffer from the device?
Maybe you could do:
dev(cBuffer) >> result;
I havn't really thought about that. What I have thought about is creating a "Device Bound Buffer", making every relation very explicit and every transfer known to the programmer. This might make it easier to handle things like offsets for buffers and regions for images. I havn't fully explored that yet. I don't want to do anything that breaks "pure OpenCL" interoperability too much.
Next on my TODO list is to get image support fully working. Right now I can generate simple mandelbrot fractals using my library and a few lines of png++. I'm going to write an example that loads an image from disk, applies an arbitrary filter and then saves it back to disk. We'll see how much I get done in the coming week.