Login  Register

How to retain a CLBuffer possibly calling clRetainMemObject

Posted by Andrew Bailey on Apr 18, 2016; 3:41pm
URL: https://forum.jogamp.org/How-to-retain-a-CLBuffer-possibly-calling-clRetainMemObject-tp4036615.html

Hi,

I want to execute 2 kernels the second one processing a CLBuffer generated by the first, however it appears that using the high level jocl api that the buffers are being released automatically.

There is a method CLBuffer.release() however retain() does not appear.

I have looked for a way of calling the low level cl_int clRetainMemObject (cl_mem memobj)
using a class such as org.jocl.utils.Mems however there are only methods to create and release org.jocl.cl_mem.

The only way I have managed to get the program to work so far is by copying the buffer to host memory and creating a new buffer and copying the data back, I would like to avoid this.

Is there another way of implementing the desired funcionality?

Is there any reason why retain() is not implemented in CLBuffer?

Thanks in advance