double buffering

Discussion created by Meteorhead on Jun 7, 2011
Latest reply on Jun 7, 2011 by himanshu.gautam
howto do it efficient


It has come to me several times that I had to do double buffering in OpenCL, but I cannot find a good way to do it efficiently. Problem is that there are two buffers, one READ_ONLY, the other WRITE_ONLY. Once the kernels finish, I wish to read from the active dataset, but buffer flags cannot be changed once they are created. Thus I come to copying buffers on device, to copy the contents of WRITE_ONLY back to READ_ONLY, so it can be used again the same way. Memory bandwidht is high of course, but one can see that it is really unneeded work.

Is there really no other way of doing this?