summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLMemory.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-09-02 23:45:05 +0200
committerMichael Bien <[email protected]>2010-09-02 23:45:05 +0200
commitbc4e1521cc2ccc91a033998847dc35e1a8c8687b (patch)
treeebd2a6e94b69519afc5aed07ebf49b03b80fbaea /src/com/jogamp/opencl/CLMemory.java
parent048f09aafe49e4eaddfe25ec4b302268510bc27b (diff)
CLMemObjectDestructorCallback for HLB and LLB.
Diffstat (limited to 'src/com/jogamp/opencl/CLMemory.java')
-rw-r--r--src/com/jogamp/opencl/CLMemory.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/jogamp/opencl/CLMemory.java b/src/com/jogamp/opencl/CLMemory.java
index d66db3c8..416b8019 100644
--- a/src/com/jogamp/opencl/CLMemory.java
+++ b/src/com/jogamp/opencl/CLMemory.java
@@ -3,6 +3,7 @@ package com.jogamp.opencl;
import com.jogamp.opencl.gl.CLGLI;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.opencl.impl.CLMemObjectDestructorCallback;
import java.nio.Buffer;
import java.nio.ByteBuffer;
import java.nio.DoubleBuffer;
@@ -73,6 +74,18 @@ public abstract class CLMemory <B extends Buffer> extends CLObject implements CL
}
/**
+ * Registers a callback which will be called by the OpenCL implementation
+ * when the memory object is released.
+ */
+ public void registerDestructorCallback(final CLMemObjectListener listener) {
+ cl.clSetMemObjectDestructorCallback(ID, new CLMemObjectDestructorCallback() {
+ public void memoryDeallocated(long memObjID) {
+ listener.memoryDeallocated(CLMemory.this);
+ }
+ });
+ }
+
+ /**
* Returns a new instance of CLMemory pointing to the same CLResource but using a different Buffer.
*/
public abstract <T extends Buffer> CLMemory<T> cloneWith(T directBuffer);