Take the 2-minute tour ×

Is it possible to assign the of a buffer to another buffer defined in OpenCL source code? For example, consider the below code:

cl_mem buff;
cl_mem temp;
temp = buff;

Do I need to call clEnqueueBuffer() again?

share|improve this question
I don't understand your goal. Are you trying to copy the buff into temp, or assign the pointer of buff to temp? –  mfa Feb 15 '12 at 16:19
I want to have a copy of 'buff' placed into 'temp' to pass it to a kernel argument. Because every time the clEnqueueNDRangeKernel() is called the kernel should be called with different buffers. –  Arya Mz Feb 15 '12 at 16:29
add comment

1 Answer

up vote 2 down vote accepted

You would need to copy buff to temp using clEnqueueCopyBuffer between your NDRange calls. I don't recommend doing this if you can help it though. There should be no reason why you cant use the same buffer for NDRange calls unless you are needing it for something else in the meantime.

share|improve this answer
add comment

Your Answer


