summaryrefslogtreecommitdiffstats
path: root/src/com/mbien/opencl/CLGLBuffer.java
diff options
context:
space:
mode:
authorMichael Bien <[email protected]>2010-01-29 14:36:19 +0100
committerMichael Bien <[email protected]>2010-01-29 14:36:19 +0100
commit2015fa5cd47b9be234f30e4b98d06b83486e4fb2 (patch)
treea03a73f6875e06ebdf8a910d939556ee139a9cb2 /src/com/mbien/opencl/CLGLBuffer.java
parentb0102cab5062eb8cb06329bff457d4dd5b9d0099 (diff)
splitted CLImageFormat into CLImageFormat and (generated) CLImageFormatImpl.
refactored CLProgram kernel creation code. updated tests.
Diffstat (limited to 'src/com/mbien/opencl/CLGLBuffer.java')
-rw-r--r--src/com/mbien/opencl/CLGLBuffer.java21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/com/mbien/opencl/CLGLBuffer.java b/src/com/mbien/opencl/CLGLBuffer.java
index 566f45ec..40298ad7 100644
--- a/src/com/mbien/opencl/CLGLBuffer.java
+++ b/src/com/mbien/opencl/CLGLBuffer.java
@@ -11,12 +11,18 @@ import static com.mbien.opencl.CLGLI.*;
*/
public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> {
- private CLGLBuffer(CLContext context, B directBuffer, long id) {
+ /**
+ * The OpenGL object handle.
+ */
+ public final int GLID;
+
+ private CLGLBuffer(CLContext context, B directBuffer, long id, int glObject) {
super(context, directBuffer, id);
+ this.GLID = glObject;
}
- static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, int flags, int glBuffer) {
+ static <B extends Buffer> CLGLBuffer<B> create(CLContext context, B directBuffer, int flags, int glObject) {
if(directBuffer != null && !directBuffer.isDirect())
throw new IllegalArgumentException("buffer is not a direct buffer");
@@ -29,14 +35,14 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> {
int[] result = new int[1];
CLGLI clgli = (CLGLI)cl;
- long id = clgli.clCreateFromGLBuffer(context.ID, flags, glBuffer, result, 0);
+ long id = clgli.clCreateFromGLBuffer(context.ID, flags, glObject, result, 0);
- return new CLGLBuffer<B>(context, directBuffer, id);
+ return new CLGLBuffer<B>(context, directBuffer, id, glObject);
}
@Override
public <T extends Buffer> CLGLBuffer<T> cloneWith(T directBuffer) {
- return new CLGLBuffer<T>(context, directBuffer, ID);
+ return new CLGLBuffer<T>(context, directBuffer, ID, GLID);
}
/**
@@ -59,6 +65,11 @@ public final class CLGLBuffer<B extends Buffer> extends CLBuffer<B> {
return array[0];
}
+ @Override
+ public String toString() {
+ return "CLMemory [id: " + ID+" glID: "+GLID+"]";
+ }
+
public enum GLObjectType {
GL_OBJECT_BUFFER(CL_GL_OBJECT_BUFFER),